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; namespace Core.LZMes.Client.UIN { public partial class UIN060220 : FrmBase { public UIN060220() { InitializeComponent(); } /// /// 初始化 /// #region "Init" #endregion /// /// 操作方法 查询 /// 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"))); string DelToDateTo = Convert.ToString(Common.FixDBManager.CheckNullStr(this.DelToDateTo.DateTime.ToString("yyyyMMdd"))); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ArrayList paramArray = new ArrayList(); paramArray.Add("UIN060220_REEL_NO.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()); //a为原料重量 b为成品重量 double a1 = 0; double b1 = 0; double a2 = 0; double b2 = 0; double a3 = 0; double b3 = 0; double a4 = 0; double b4 = 0; double a5 = 0; double b5 = 0; double a6 = 0; double b6 = 0; double a7 = 0; double b7 = 0; double a8 = 0; double b8 = 0; for (int a = 0; a < this.ultraGrid1.Rows.Count; a++) { /* * author: zmz * 原料重量 成品重量根据订单厚度汇总 * cc 订单厚度 * aa 原料重量 * bb 成品重量 */ double cc; double aa; double bb; if (this.ultraGrid1.Rows[a].Cells["INSTR_COIL_THK"].Text == "") cc = 0; else cc = double.Parse(this.ultraGrid1.Rows[a].Cells["INSTR_COIL_THK"].Value.ToString()); if (this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Text == "") aa = 0; else aa = double.Parse(this.ultraGrid1.Rows[a].Cells["ENT_COIL_WGT"].Value.ToString()); if (this.ultraGrid1.Rows[a].Cells["COIL_WGT"].Text == "") bb = 0; else bb = double.Parse(this.ultraGrid1.Rows[a].Cells["COIL_WGT"].Value.ToString()); if (cc < 0.3) { a1 = a1 + aa; b1 = b1 + bb; } else if (cc < 0.35) { a2 = a2 + aa; b2 = b2 + bb; } else if (cc < 0.4) { a3 = a3 + aa; b3 = b3 + bb; } else if (cc < 0.45) { a4 = a4 + aa; b4 = b4 + bb; } else if (cc < 0.5) { a5 = a5 + aa; b5 = b5 + bb; } else if (cc < 0.6) { a6 = a6 + aa; b6 = b6 + bb; } else if (cc < 1.0) { a7 = a7 + aa; b7 = b7 + bb; } else if (cc < 2.0) { a8 = a8 + aa; b8 = b8 + bb; } } this.textBox1.Text = (a1 / 1000).ToString(); this.textBox2.Text = (b1 / 1000).ToString(); this.textBox3.Text = (a2 / 1000).ToString(); this.textBox4.Text = (b2 / 1000).ToString(); this.textBox5.Text = (a3 / 1000).ToString(); this.textBox6.Text = (b3 / 1000).ToString(); this.textBox7.Text = (a4 / 1000).ToString(); this.textBox8.Text = (b4 / 1000).ToString(); this.textBox9.Text = (a5 / 1000).ToString(); this.textBox10.Text = (b5 / 1000).ToString(); this.textBox11.Text = (a6 / 1000).ToString(); this.textBox12.Text = (b6 / 1000).ToString(); this.textBox13.Text = (a7 / 1000).ToString(); this.textBox14.Text = (b7 / 1000).ToString(); this.textBox15.Text = (a8 / 1000).ToString(); this.textBox16.Text = (b8 / 1000).ToString(); for (int a = 0; a < this.ultraGrid1.Rows.Count; a++) { string zl = Convert.ToString(Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[a].Cells["COIL_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["COIL_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, 16) == c.Substring(0, 16)) { b = b + e; a = d; } else break; } double g = b / h * 100; this.ultraGrid1.Rows[a].Cells["CHENGCAILV"].Value = g.ToString("f2"); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } /// /// 操作方法 保存班次组信息 /// 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("UIN060220_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()); } } /// /// 事件方法: /// /// /// #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 } }