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; using Infragistics.Win; using System.Diagnostics; namespace Core.LZMes.Client.UIK { public partial class UIK050090 : FrmBase { public UIK050090() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": this.DoExport(); break; } } private void DoQuery() { try { string starttiem = ""; string endtime = ""; bool flag = true; string coilNo = this.textBox2.Text.ToString().Trim(); //if (coilNo != "") //{ // try // { // if (coilNo.Length != 13) // { // MessageBox.Show("钢卷输入有误!"); // return; // } // } // catch (Exception ex) // { // MessageBox.Show("钢卷输入有误!"); // return; // } //} string ordNo = this.textBox1.Text.ToString().Trim(); string seqNo = this.textBox3.Text.ToString().Trim(); if (this.ultraCheckEditor1.Checked == false) { starttiem = this.ultraCalendarSTRATTIME.DateTime.ToString("yyyyMMdd"); endtime = this.ultraCalendarENDTIME.DateTime.ToString("yyyyMMdd"); this.dataSet3.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIK.UIK05.UIK050080"; ccp.MethodName = "Query_Coil_State"; ccp.ServerParams = new object[] { starttiem, endtime, flag, coilNo, ordNo, seqNo }; ccp.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drs1 = dataSet3.Tables[0].Rows; if (drs1.Count <= 0) { MessageBox.Show("该时间内没有入库待机钢卷"); return; } } else { starttiem = ""; endtime = ""; flag = false; this.dataSet3.Tables[0].Clear(); CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "UIK.UIK05.UIK050080"; ccp2.MethodName = "Query_Coil_State"; ccp2.ServerParams = new object[] { starttiem, endtime, flag, coilNo, ordNo, seqNo }; ccp2.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); DataRowCollection drs2 = dataSet3.Tables[0].Rows; if (drs2.Count <= 0) { MessageBox.Show("该时间内没有入库待机钢卷"); return; } } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void DoExport() { try { if (this.ultraGrid3.Rows.Count == 0) { MessageBox.Show("没有可以导出入库钢卷数据", "提示"); return; } if (this.saveFileDialog2.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog2.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid3, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ultraGrid3_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { try { Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; int index = uGrid.ActiveRow.Index; string coilno = uGrid.ActiveRow.Cells["OLD_SAMPL_NO"].Text.Trim(); string ordno = uGrid.ActiveRow.Cells["OLD_ORD_NO"].Text.Trim(); string ordseq = uGrid.ActiveRow.Cells["OLD_ORD_SEQ"].Text.Trim(); CoreClientParam ccp = new CoreClientParam(); CoreClientParam ccp2 = new CoreClientParam(); if (ordno == "" && coilno == "") { MessageBox.Show("钢卷信息不完整,无法查询!"); return; } else { this.dataSet1.Tables[0].Clear(); this.dataSet2.Tables[0].Clear(); ccp.ServerName = "UIK.UIK05.UIK050090"; ccp.MethodName = "DoQueryCaiZhi"; ccp.ServerParams = new object[] { coilno }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); DataRowCollection drc1 = this.dataSet1.Tables[0].Rows; if (drc1.Count <= 0) { MessageBox.Show("无该钢卷的材质实绩信息"); } else { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { //不合格材质项目显示红色 string QVAL = ugr.Cells["QLTY_VAL_WK"].Text; string QMIN = ugr.Cells["QLTY_MIN"].Text; string QMAX = ugr.Cells["QLTY_MAX"].Text; if (QVAL != null && QVAL != "") { if (QMIN != null && QMIN != "" && double.Parse(QVAL) < double.Parse(QMIN)) { ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red; } if (QMAX != null && QMAX != "" && double.Parse(QVAL) > double.Parse(QMAX)) { ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red; } } else if ((QMAX != null && QMAX != "") || (QMIN != null && QMIN != "")) { ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red; } } } ccp2.ServerName = "UIK.UIK05.UIK050090"; ccp2.MethodName = "DoQueryChengFen"; ccp2.ServerParams = new object[] { coilno, ordno, ordseq }; ccp2.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); DataRowCollection drc2 = this.dataSet2.Tables[0].Rows; if (drc2.Count <= 0) { MessageBox.Show("无该钢卷的成分实绩信息"); } else { foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { //不合格元素显示红色 string CVAL = ugr.Cells["CHEM_VAL"].Text; string CMIN = ugr.Cells["CHEM_MIN"].Text; string CMAX = ugr.Cells["CHEM_MAX"].Text; if (CVAL != null && CVAL != "") { if (CMIN != null && CMIN != "" && double.Parse(CVAL) < double.Parse(CMIN)) { ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red; } if (CMAX != null && CMAX != "" && double.Parse(CVAL) > double.Parse(CMAX)) { ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red; } } else if ((CMAX != null && CMAX != "") || (CMIN != null && CMIN != "")) { ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red; } } } return; } } catch (Exception ex) { MessageBox.Show("系统信息错误!"); return; } } private void UIK050090_Load(object sender, EventArgs e) { this.ultraCheckEditor1.Checked = false; } private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e) { if (this.ultraCheckEditor1.Checked == true) { this.ultraCalendarSTRATTIME.Enabled = false; this.ultraCalendarENDTIME.Enabled = false; } if (this.ultraCheckEditor1.Checked == false) { this.ultraCalendarENDTIME.Enabled = true; this.ultraCalendarSTRATTIME.Enabled = true; } } } }