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 Infragistics.Win; using System.Collections; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; namespace Core.LZMes.Client.QCM { public partial class QCM030303 : FrmBase { public QCM030303() { 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() { if (this.ultraTabControl1.Tabs[0].Selected) //待判信息 { DoQueryMe(); } if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { DoQueryRe(); } } //查询待判信息 private void DoQueryMe() { try { this.dataSet2.Clear(); string starttime =""; string endtime = ""; if (checkBox2.Checked) { starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd"); } string sbatchno = ""; string ebatchno = ""; if (checkBox3.Checked) { sbatchno = this.textBox1.Text.Trim(); if (textBox2.Text.ToString() == "") { ebatchno = this.textBox1.Text.Trim(); } else { ebatchno = this.textBox2.Text.Trim(); } } if (!checkBox2.Checked && !checkBox3.Checked) { MessageBox.Show("时间与轧批号必须选择其中一个条件!"); return; } string orderno = this.textBox3.Text.Trim();// 订单号 string psc = textBox4.Text.Trim(); //产品描述 string prodline = this.comboBox3.Text.ToString(); string isjudge = this.comboBox4.Text.ToString(); string steelname = this.textBox10.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "doQueryMaterialDetailsJ2"; ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc,"M" ,prodline,isjudge,steelname}; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } //查询判定记录 private void DoQueryRe() { try { this.dataSet5.Clear(); string starttime = ""; string endtime = ""; if (checkBox2.Checked) { starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd"); } string sbatchno = ""; string ebatchno = ""; if (checkBox3.Checked) { sbatchno = this.textBox1.Text.Trim(); if (textBox2.Text.ToString() == "") { ebatchno = this.textBox1.Text.Trim(); } else { ebatchno = this.textBox2.Text.Trim(); } } if (!checkBox2.Checked && !checkBox3.Checked) { MessageBox.Show("时间与轧批号必须选择其中一个条件!"); return; } string orderno = this.textBox3.Text.Trim();// 订单号 string psc = textBox4.Text.Trim(); //产品描述 string stellname = this.textBox10.Text.Trim(); string prodline = this.comboBox3.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "GetMeasureInfoJ"; ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc, prodline, stellname }; ccp.SourceDataTable = this.dataSet5.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void ultraGrid2_AfterRowActivate(object sender, EventArgs e) { try { UltraGridRow ugr = this.ultraGrid2.ActiveRow; if (ugr == null) return; this.dataSet3.Clear(); string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString(); string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "getToleranceJ"; ccp.ServerParams = new object[] { design_key, material_no }; ccp.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.dataSet4.Clear(); string sic_id = ugr.Cells["SIZEID"].Value.ToString(); if (sic_id != "") { ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "getQcmJudgeMeasureJ"; ccp.ServerParams = new object[] { sic_id }; ccp.SourceDataTable = this.dataSet4.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } if (design_key != "") { ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "GetMemo"; ccp.ServerParams = new object[] { design_key }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp.SourceDataTable.Rows.Count == 0) { this.textBox6.Text = ""; } else { this.textBox6.Text = ccp.SourceDataTable.Rows[0]["MEMO"].ToString(); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void QCM0303_Load(object sender, EventArgs e) { this.comboBox3.SelectedIndex = 0; ValueList VFLAW_SIZE_DESC = new ValueList(); VFLAW_SIZE_DESC.ValueListItems.Add("0", "传动侧"); VFLAW_SIZE_DESC.ValueListItems.Add("1", "中间"); VFLAW_SIZE_DESC.ValueListItems.Add("2", "操作侧"); //this.ultraGrid5.DisplayLayout.Bands[0].Columns["THICK_TYPE"].ValueList = VFLAW_SIZE_DESC; ValueList vsflv = new ValueList(); CoreClientParam ccp = new CoreClientParam(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findSfLv"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); } this.comboBox2.DataSource = vsflv.ValueListItems; this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7); this.comboBox3.SelectedIndex = 0; this.comboBox4.SelectedIndex = 0; DoQuery(); } private void ultraGrid4_AfterRowActivate(object sender, EventArgs e) { try { UltraGridRow ugr = this.ultraGrid4.ActiveRow; if (ugr == null) return; this.dataSet6.Clear(); string sic = ugr.Cells["SIC_ID"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "getToleranceInfoNew"; ccp.ServerParams = new object[] { sic }; ccp.SourceDataTable = this.dataSet6.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.dataSet7.Clear(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "getQcmJudgeMeasureJ"; ccp.ServerParams = new object[] { sic }; ccp.SourceDataTable = this.dataSet7.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void button1_Click(object sender, EventArgs e) { try { int count = 0; foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { count++; } } List lists = new List(); foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { if (count == 1) { ArrayList list1 = new ArrayList(); List list2 = new List(); List list3 = new List(); list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString()); list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString()); if (comboBox1.Text.ToString() == "") { list1.Add(""); list1.Add(""); } else { if (comboBox1.Text.ToString() == "合格") { list1.Add("1"); list1.Add("合格"); } else if (comboBox1.Text.ToString() == "不合格") { list1.Add("2"); list1.Add("不合格"); } else { list1.Add("0"); list1.Add("待判"); } } string is_zl = ""; if (comboBox2.Text.ToString() == "正品") { is_zl = "512601"; } else if (comboBox2.Text.ToString() == "次品") { is_zl = "512602"; } else if (comboBox2.Text.ToString() == "废品") { is_zl = "512603"; } else if (comboBox2.Text.ToString() == "协议品") { is_zl = "512604"; } else if (comboBox2.Text.ToString() == "订单外") { is_zl = "512605"; } list1.Add(textBox5.Text.Trim().ToString()); list1.Add(this.UserInfo.GetUserName()); list1.Add(this.UserInfo.GetUserOrderText()); list1.Add(this.UserInfo.GetUserGroupText()); list1.Add(is_zl);//质量等级代码 list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称 ArrayList list = new ArrayList(); list.Add(ugr.Cells["BIAS_CODE"].Text.ToString()); list.Add(ugr.Cells["VAL"].Text.ToString()); list.Add(ugr.Cells["BIAS_NAME"].Text.ToString()); list.Add(ugr.Cells["PLAN"].Text.ToString()); list.Add(ugr.Cells["VAL2"].Text.ToString()); list2.Add(list); list = new ArrayList(); list.Add(ugr.Cells["BIAS_CODE_2"].Text.ToString()); list.Add(ugr.Cells["VAL_2"].Text.ToString()); list.Add(ugr.Cells["BIAS_NAME_2"].Text.ToString()); list.Add(ugr.Cells["PLAN_2"].Text.ToString()); list.Add(ugr.Cells["VAL2_2"].Text.ToString()); list2.Add(list); ArrayList listc1 = new ArrayList(); listc1.Add("传动侧"); listc1.Add(ugr.Cells["THICK_VAL1"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL1"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL1"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL1"].Value.ToString()); list3.Add(listc1); listc1 = new ArrayList(); listc1.Add("中间"); listc1.Add(ugr.Cells["THICK_VAL2"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL2"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL2"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL2"].Value.ToString()); list3.Add(listc1); listc1 = new ArrayList(); listc1.Add("操作侧"); listc1.Add(ugr.Cells["THICK_VAL3"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL3"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL3"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL3"].Value.ToString()); list3.Add(listc1); if ((comboBox1.Text.ToString() == "合格" && comboBox2.Text.ToString() != "正品") || (comboBox1.Text.ToString() == "不合格" && comboBox2.Text.ToString() == "正品")) { MessageBox.Show("检验结果与质量等级不一致!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "judgeByHuman2"; ccp.ServerParams = new object[] { list1, list2, list3 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } lists.Add(ugr); } else { ArrayList list1 = new ArrayList(); List list3 = new List(); list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString()); list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString()); if (comboBox1.Text.ToString() == "") { MessageBox.Show("请输入登记结果!"); return; } else { if (comboBox1.Text.ToString() == "合格") { list1.Add("1"); list1.Add("合格"); } else if (comboBox1.Text.ToString() == "待判") { list1.Add("0"); list1.Add("待判"); } else { list1.Add("2"); list1.Add("不合格"); } } string is_zl = ""; if (comboBox2.Text.ToString() == "正品") { is_zl = "512601"; } else if (comboBox2.Text.ToString() == "次品") { is_zl = "512602"; } else if (comboBox2.Text.ToString() == "废品") { is_zl = "512603"; } else if (comboBox2.Text.ToString() == "协议品") { is_zl = "512604"; } else if (comboBox2.Text.ToString() == "订单外") { is_zl = "512605"; } list1.Add(textBox5.Text.Trim().ToString()); list1.Add(this.UserInfo.GetUserName()); list1.Add(this.UserInfo.GetUserOrderText()); list1.Add(this.UserInfo.GetUserGroupText()); list1.Add(is_zl);//质量等级代码 list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称 ArrayList listc1 = new ArrayList(); listc1.Add("传动侧"); listc1.Add(ugr.Cells["THICK_VAL1"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL1"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL1"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL1"].Value.ToString()); list3.Add(listc1); listc1 = new ArrayList(); listc1.Add("中间"); listc1.Add(ugr.Cells["THICK_VAL2"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL2"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL2"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL2"].Value.ToString()); list3.Add(listc1); listc1 = new ArrayList(); listc1.Add("操作侧"); listc1.Add(ugr.Cells["THICK_VAL3"].Text.ToString()); listc1.Add(ugr.Cells["H_VAL3"].Value.ToString()); listc1.Add(ugr.Cells["M_VAL3"].Value.ToString()); listc1.Add(ugr.Cells["R_VAL3"].Value.ToString()); list3.Add(listc1); if ((comboBox1.Text.ToString() == "合格" && comboBox2.Text.ToString() != "正品") || (comboBox1.Text.ToString() == "不合格" && comboBox2.Text.ToString() == "正品")) { MessageBox.Show("检验结果与质量等级不一致!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "judgeByHumanJ"; ccp.ServerParams = new object[] { list1,list3 }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } lists.Add(ugr); } } } for (int i = 0; i < lists.Count; i++) { lists[i].Delete(false); } MessageBox.Show("检验登记成功!"); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } //DoQuery(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList()) { if (checkBox1.Checked) { ugr.Cells["CHECK"].Value = "True"; } else { ugr.Cells["CHECK"].Value = "False"; } } } private void ultraTabControl1_Click(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.label11.Visible = false; this.comboBox4.Visible = false; this.label12.Text = "判定时间"; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.label11.Visible = true; this.comboBox4.Visible = true; this.label12.Text = "生产时间"; } } private void DoExport() { try { if (this.ultraGrid4.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { ultraGrid2.UpdateData(); } } }