| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.LZMes.Client.UIN
- {
- public partial class UIN060410 : FrmBase
- {
- public UIN060410()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 初始化
- /// </summary>
- #region "Init"
- #endregion
- /// <summary>
- /// 操作方法 查询
- /// </summary>
- private void DoQuery()
- {
- try
- {
- this.dataSet1.Tables[0].Clear();
- string calNO = Convert.ToString(Common.FixDBManager.CheckNullStr(this.textOrdNO.Text));
- string DelToDateFrom = Convert.ToString(Common.FixDBManager.CheckNullStr(this.DelToDateFrom.DateTime.ToString("yyyyMMdd"))) + textBox1.Text.Substring(0,2);
- string DelToDateTo = Convert.ToString(Common.FixDBManager.CheckNullStr(this.DelToDateTo.DateTime.ToString("yyyyMMdd")))+textBox2.Text.Substring(0,2);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBQuery";
- ccp.MethodName = "doSimpleQuery";
- ArrayList paramArray = new ArrayList();
- paramArray.Add("UIN060410_01.Select");
- paramArray.Add(DelToDateFrom);
- paramArray.Add(DelToDateTo);
- paramArray.Add(calNO);
- ccp.ServerParams = new object[] { paramArray };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- System.Diagnostics.Debug.WriteLine(this.dataSet1.Tables[0].ToString());
-
- for (int a = 0; a < this.ultraGrid1.Rows.Count; a++)
- {
- string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ACT_WGT"].Text.ToString()));
- if (zl == "") zl = "0";
- // double b = double.Parse(this.ultraGrid1.Rows[a].Cells["COIL_WGT"].Text.ToString());
- double b = double.Parse(zl);
- string c = this.ultraGrid1.Rows[a].Cells["OLD_SAMPL_NO"].Text.ToString();
- double h = double.Parse(this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Value.ToString());
- for (int d = a + 1; d <= this.ultraGrid1.Rows.Count - 1; d++)
- {
- string zl2 = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[d].Cells["ACT_WGT"].Text.ToString()));
- if (zl2 == "") zl2 = "0";
- // double e = double.Parse(this.ultraGrid1.Rows[d].Cells["COIL_WGT"].Text.ToString());
- double e = double.Parse(zl2);
- string f = this.ultraGrid1.Rows[d].Cells["OLD_SAMPL_NO"].Text.ToString();
- if (f.Substring(0, 12) == c.Substring(0, 12))
- {
- b = b + e;
- a = d;
- }
- else break;
- }
- double g = b / h * 100;
- this.ultraGrid1.Rows[a].Cells["CHENGCAILV"].Value = g.ToString("f2");
- }
- double sumwgt=0;
- double sumwgt1 = 0;
- int count1=0;
- for (int a = 0; a < this.ultraGrid1.Rows.Count; a++)
- {
- string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ACT_WGT"].Text.ToString()));
- string bp = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Text.ToString()));
- if (zl == "") zl = "0";
- double b = double.Parse(zl);
- sumwgt += b;
- if (bp == "") bp = "0";
- double z = double.Parse(bp);
- sumwgt1 += z;
- count1++;
- }
- this.textBox10.Text = count1.ToString();
- this.textBox12.Text = sumwgt.ToString();
- double ccl = sumwgt / sumwgt1;
- this.textBox3.Text = Math.Round(ccl * 100, 2).ToString();
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- /// <summary>
- /// 操作方法 保存班次组信息
- /// </summary>
- private void DoSave()
- {
- try
- {
- string strQueryFlag = "Y";
- this.ultraGrid1.UpdateData();
- DataRow[] selectedRows = dataSet1.Tables[0].Select("CHK ='True'");
- for (int i = 0; i < selectedRows.Length; i++)
- {
- string regid = this.UserInfo.GetUserID();
- string regshift = this.UserInfo.GetUserOrder();
- string reggroup = this.UserInfo.GetUserGroup();
- string coilno = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["OLD_SAMPL_NO"]));
- string cutEdgeYN = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["CUT_EDGE_YN"]));
- string millDtime = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["MILL_DTIME"]));
- string isHead = Convert.ToString(Common.FixDBManager.CheckNullStr(selectedRows[i]["ISHEAD"]));
- if (millDtime.Length != 14)//长度
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期长度" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- if (Convert.ToInt16(millDtime.Substring(4, 2)) > 12) //月
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期【月】" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- if (Convert.ToInt16(millDtime.Substring(6, 2)) > 31) //日
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期【日】" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- if (Convert.ToInt16(millDtime.Substring(8, 2)) > 24) //小时
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期【时】" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- if (Convert.ToInt16(millDtime.Substring(10, 2)) > 59)//分
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期【分】" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- if (Convert.ToInt16(millDtime.Substring(12, 2)) > 59)//秒
- {
- strQueryFlag = "N";
- MessageBox.Show("警告,钢卷" + coilno + "录入的日期【秒】" + millDtime + "错误,禁止保存", "提示");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.COM.ComDBSave";
- ccp.MethodName = "doXmlSave";
- ArrayList paramArray = new ArrayList();
- paramArray.Add("UIN060410_shift.Update");
- paramArray.Add(regid);
- paramArray.Add(regshift);
- paramArray.Add(reggroup);
- paramArray.Add(cutEdgeYN);
- paramArray.Add(isHead);
- paramArray.Add(millDtime);
- paramArray.Add(coilno);
- ccp.ServerParams = new object[] { paramArray };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- if (strQueryFlag == "Y")
- {
- this.DoQuery();
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void DoExport()
- {
- try
- {
- if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
- {
- string fileName = this.saveFileDialog1.FileName;
- ultraGridExcelExporter1.Export(ultraGrid1, fileName);
- //System.Diagnostics.Process.Start(fileName);
- }
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- /// <summary>
- /// 事件方法:
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- #region "EVENT 事件"
- private void UIN060120_Load(object sender, EventArgs e)
- {
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Save":
- //this.DoSave();
- break;
- case "Export":
- this.DoExport();
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- private void ComboCalNO_ValueChanged(object sender, EventArgs e)
- {
- this.DoQuery();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- ugr.Cells["CHK"].Value = this.checkBox1.Checked;
- ugr.Update();
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- private void ultraGrid1_AfterRowFilterChanged(object sender, Infragistics.Win.UltraWinGrid.AfterRowFilterChangedEventArgs e)
- {
- double c=0;
- double bp = 0;
-
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
- {
- string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["ACT_WGT"].Text.ToString()));//ENT_COIL_WGT
- string bpzl = Convert.ToString(Common.FixDBManager.CheckNullStr(ugr.Cells["ENT_COIL_WGT"].Text.ToString()));//ENT_COIL_WGT
- if (zl == "") zl = "0";
- double b = double.Parse(zl);
- c = c + b;
- if (bpzl == "") bpzl = "0";
- double bpp = double.Parse(bpzl);
- bp = bp + bpp;
- }
- double ccl = c / bp;
- this.textBox3.Text = Math.Round(ccl*100, 2).ToString();
- }
-
-
- }
- }
|