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 System.Collections; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.UIB { public partial class UIB030220 : FrmBase { public UIB030220() { InitializeComponent(); } 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; } } string strLine = null; public void DoQuery() { ArrayList al = new ArrayList(); //if(this.ultraTabControl1.Name) //MessageBox.Show(this.ultraTabControl1.Tabs.c); DataTable dt = null; if (this.ultraTabControl1.Tabs[0].Selected)//判定结果查询 { if (this.comboBox1.Text == "热轧") { al.Add("UIB030220_HOST_01.SELECT"); return; //未用到直接返回20151128 } else if (this.comboBox1.Text == "酸轧") { al.Add("UIB030220_SUAN_01.SELECT"); } else if(this.comboBox1.Text == "连退") { al.Add("UIB030220_LIAN_01.SELECT"); } this.dataSet1.Tables["coil"].Clear(); dt = this.dataSet1.Tables["coil"]; } else if (this.ultraTabControl1.Tabs[1].Selected)//判定历史记录查询 { if (this.comboBox1.Text == "酸轧") { al.Add("UIB030220_SUAN_HISDCS.SELECT");//判定历史记录 } else if (this.comboBox1.Text == "连退") { al.Add("UIB030220_LIAN_HISDCS.SELECT"); } this.dataSet1.Tables["HIS"].Clear(); dt = this.dataSet1.Tables["HIS"]; } else//带判钢卷查询 { if (this.comboBox1.Text == "酸轧") { al.Add("UIB030220_SUAN_02.SELECT");//待判卷 } else if (this.comboBox1.Text == "连退") { al.Add("UIB030220_LIAN_02.SELECT");//待判卷 } this.dataSet1.Tables["DaiPan"].Clear(); dt = this.dataSet1.Tables["DaiPan"]; } if (this.ultraTabControl1.Tabs[0].Selected || this.ultraTabControl1.Tabs[1].Selected) { OperateConditionRecode.WriteCondition("UIB030220_STLGRD", this.specStlGrd.Text); OperateConditionRecode.WriteCondition("UIB030220_COILS", this.coilStat.Text); OperateConditionRecode.WriteCondition("UIB030220_COILE", this.coilEnd.Text); OperateConditionRecode.WriteCondition("UIB030220_ORD", this.ordText.Text); al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss")); al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd" + "999999")); al.Add(this.coilStat.Text.Trim()); al.Add(this.coilEnd.Text.Trim() == "" ? this.coilStat.Text.Trim() : this.coilEnd.Text.Trim()); al.Add(this.ordText.Text.Trim() == "" ? "1" : this.ordText.Text.Trim()); al.Add(this.ordText.Text.Trim() == "" ? "1" : this.ordText.Text.Trim()); al.Add(this.specStlGrd.Text.Trim()); } //this.dataSet1.Tables["coil"].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable =dt ;//this.dataSet1.Tables["coil"]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); strLine = this.comboBox1.Text; if (this.ultraTabControl1.Tabs[0].Selected) { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["TOT_DEC_GRD"].Text == "2") { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } } } } public void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; if (this.ultraTabControl1.Tabs[0].Selected) { this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName); } else if (this.ultraTabControl1.Tabs[1].Selected) { this.ultraGridExcelExporter1.Export(this.ultraGrid5, fName); } else { this.ultraGridExcelExporter1.Export(this.ultraGrid6, fName); } System.Diagnostics.Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } public void DoSave()//取消综合判定 { try { if (!this.ultraTabControl1.Tabs[0].Selected) { return; } if (MessageBox.Show("确认取消判定?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList al = new ArrayList(); CoreClientParam ccp = new CoreClientParam(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (Convert.ToBoolean(ugr.Cells["CHK"].Text)) { Hashtable ht = new Hashtable(); ht.Add("i1", ugr.Cells["COIL_NO"].Text); ht.Add("i2", this.UserInfo.GetUserID()); ht.Add("o3", ""); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; if (strLine == "酸轧") { ccp.ServerParams = new object[] { "UIB030220_SUAN_01.CALL", ht }; } else if (strLine == "连退") { ccp.ServerParams = new object[] { "UIB030220_LIAN_01.CALL", ht }; } else { MessageBox.Show("错误操作!" , "警告"); return; } this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void UIB030220_Load(object sender, EventArgs e) { this.comboBox1.SelectedIndex = 1; this.specStlGrd.Text=OperateConditionRecode.ReadCondition("UIB030220_STLGRD"); this.coilStat.Text = OperateConditionRecode.ReadCondition("UIB030220_COILS"); this.coilEnd.Text = OperateConditionRecode.ReadCondition("UIB030220_COILE"); this.ordText.Text = OperateConditionRecode.ReadCondition("UIB030220_ORD"); } private void button1_Click(object sender, EventArgs e) { UIB010301 frm = new UIB010301(); frm.ob = this.ob; frm.OrderNO = "312009032101"; frm.OrderSEQ = "002"; frm.ShowDialog(); } private void ultraGrid1_AfterCellActivate(object sender, EventArgs e) { try { if (this.ultraGrid1.ActiveCell.Column.Key == "ORD_NO")//链接到品质设计结果查询 { UIB010301 frm = new UIB010301(); frm.ob = this.ob; frm.OrderNO = this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text; frm.OrderSEQ = this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text; frm.ShowDialog(); } else if (this.ultraGrid1.ActiveCell.Column.Key == "COIL_NO")//查询钢卷详细信息 { ArrayList list = new ArrayList(); //成分 ArrayList al = new ArrayList(); list.Add(al); al.Add("UIB030220_CHEM.SELECT"); al.Add(this.ultraGrid1.ActiveRow.Cells["SLAB_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["SLAB_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); //材质 al = new ArrayList(); list.Add(al); al.Add("UIB030220_QLTY.SELECT"); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text); //其它 al = new ArrayList(); list.Add(al); al.Add("UIB030220_OTHERS.SELECT"); al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_THK"].Text);//厚度 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_WTH"].Text);//宽度 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_INDIA"].Text);//内径 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ACT_WGT"].Text);//重量 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["EXTSHAPE_QUALITY"].Text);//外观 al.Add(this.ultraGrid1.ActiveRow.Cells["CR_DK1"].Text);//缺陷 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["PACKAGE_LEVEL"].Text);//包装 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["PROC_DEC_RST"].Text);//切边 al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["ORD_SEQ"].Text); //this.dataSet1.Tables[1].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doContinuousQluery"; ccp.ServerParams = new object[] { list }; CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (ccpList.ReturnInfo.Length == 0) { ArrayList aList = ccpList.ReturnObject as ArrayList; if (aList[0] != null) { this.dataSet1.Tables["ingr"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet1.Tables["ingr"]); tab0.TableName = "ingr"; this.dataSet1.Tables["ingr"].Merge(tab0); } if (aList[1] != null) { this.dataSet1.Tables["qlty"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet1.Tables["qlty"]); tab0.TableName = "qlty"; this.dataSet1.Tables["qlty"].Merge(tab0); } if (aList[2] != null) { this.dataSet1.Tables["other"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[2] as System.Collections.ArrayList, this.dataSet1.Tables["other"]); tab0.TableName = "other"; this.dataSet1.Tables["other"].Merge(tab0); } } }//end else if //成分判断 foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { double min = Convert.ToDouble(ugr.Cells["CHEM_MIN"].Text == "" ? "0" : ugr.Cells["CHEM_MIN"].Text); double max = Convert.ToDouble(ugr.Cells["CHEM_MAX"].Text == "" ? "9999" : ugr.Cells["CHEM_MAX"].Text); double value = Convert.ToDouble(ugr.Cells["CHEM_VAL"].Text == "" ? "-1" : ugr.Cells["CHEM_VAL"].Text); if (value < min || value > max) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } if (value == -1)//缺少实际值 { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } } //材质判断 foreach (UltraGridRow ugr in this.ultraGrid3.Rows) { double min = Convert.ToDouble(ugr.Cells["QLTY_MIN"].Text == "" ? "0" : ugr.Cells["QLTY_MIN"].Text); double max = Convert.ToDouble(ugr.Cells["QLTY_MAX"].Text == "" ? "9999" : ugr.Cells["QLTY_MAX"].Text); double value = Convert.ToDouble(ugr.Cells["QLTY_VAL_WK"].Text == "" ? "-1" : ugr.Cells["QLTY_VAL_WK"].Text); if (value < min || value > max) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } if (value == -1)//缺少实际值 { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } } //其它判断 foreach (UltraGridRow ugr in this.ultraGrid4.Rows) { string name = ugr.Cells["T_NAME"].Text.Trim(); if ("外观" == name) { //不相等显示红色 string waiguan = ugr.Cells["T_MIN"].Text; if (waiguan != null && waiguan != "" && !waiguan.Equals("0") && String.Compare(waiguan, ugr.Cells["T_VALUE"].Text) > 0) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } continue; } else if ("内径" == name) { //不相等显示红色 string india = ugr.Cells["T_MIN"].Text; if (india != null && india != "" && !india.Equals("0") && !india.Equals(ugr.Cells["T_VALUE"].Text)) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } continue; } else if ("包装" == name) { if ("不包装".Equals(ugr.Cells["T_MIN"].Text) && "XX".Equals(ugr.Cells["T_VALUE"].Text)) { } else { //不相等显示红色 if (!ugr.Cells["T_MIN"].Text.Equals(ugr.Cells["T_VALUE"].Text)) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } } continue; } else if ("切边" == name) { if ("Y".Equals(ugr.Cells["T_MIN"].Text) && "2".Equals(ugr.Cells["T_VALUE"].Text)) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } continue; } double min = Convert.ToDouble(ugr.Cells["T_MIN"].Text == "" ? "0" : ugr.Cells["T_MIN"].Text); double max = Convert.ToDouble(ugr.Cells["T_MAX"].Text == "" ? "99999" : ugr.Cells["T_MAX"].Text); double value = Convert.ToDouble(ugr.Cells["T_VALUE"].Text == "" ? "-1" : ugr.Cells["T_VALUE"].Text); if (value < min || value > max) { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } if (value == -1)//缺少实际值 { ugr.Appearance.ForeColor = Color.Red;//字体显示红色 } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }