using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Infragistics.Win; using System.Windows.Forms; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; using System.Text.RegularExpressions; using Infragistics.Win.UltraWinEditors; using System.Collections; namespace Core.LZMes.Client.QCM { public partial class QCM030612 : FrmBase { public QCM030612() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Judge": this.Judge(); break; case "Cancel": this.canceljudge(); break; case "Exit": this.Close(); break; case "Export": this.DoExport(); break; } } private void Judge() { try { List lists = new List(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { if (ultraComboEditor2.Text == "" || ultraComboEditor1.Text == "" || ultraComboEditor3.Text == "") { MessageBox.Show("请输入表面结果或者选择好缺陷!"); return; } string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString(); string sflv_code = this.ultraComboEditor1.Value.ToString(); string sflv_name = this.ultraComboEditor1.Text.ToString(); string qx_ly = this.ultraComboEditor2.Value.ToString(); string qx_ly_name = this.ultraComboEditor2.Text.ToString(); string qx = this.ultraComboEditor3.Value.ToString(); string qx_name = this.ultraComboEditor3.Text.ToString(); string username = this.UserInfo.GetUserName(); string wrk_ord = this.UserInfo.GetUserOrderText(); string wrk_grp = this.UserInfo.GetUserGroupText(); string memo = this.textBox3.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "ultimateJudgeAutoJF"; ccp.ServerParams = new object[] { material_no, username, sflv_code, sflv_name, qx_ly, qx_ly_name, qx, qx_name, wrk_ord, wrk_grp,memo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } lists.Add(ugr); } } if (lists.Count == 0) { MessageBox.Show("请选择数据!"); return; } for (int i = 0; i < lists.Count; i++) { lists[i].Delete(false); } MessageBox.Show("判定成功!"); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void canceljudge() { //try //{ // QCM030607 frm = new QCM030607(); // if (frm.ShowDialog() == DialogResult.OK) // { // string remark = frm._memo; // if (remark == "") // { // MessageBox.Show("请录入备注信息!"); // return; // } // if (this.ultraGrid18.Selected.Rows.Count == 0) // this.ultraGrid18.ActiveRow.Selected = true; // foreach (UltraGridRow ugr in this.ultraGrid18.Rows) // { // if (ugr.Cells["CHECK"].Text.ToString() == "True") // { // string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString(); // string utm_id = ugr.Cells["UTM_ID"].Value.ToString(); // string username = this.UserInfo.GetUserName(); // CoreClientParam ccp = new CoreClientParam(); // ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; // ccp.MethodName = "cancelUltimateJudge"; // ccp.ServerParams = new object[] { username, MATERIAL_NO, utm_id,remark }; // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); // if (ccp.ReturnCode == -1) // { // return; // } // } // } // MessageBox.Show("取消判定成功!"); // } //} //catch (Exception EX) //{ // MessageBox.Show(EX.ToString()); //} //DoQuery(); } private void DoQuery() { if (this.ultraTabControl1.Tabs[0].Selected) //待判信息 { DoQueryMe(); } if (this.ultraTabControl1.Tabs[1].Selected) //表面判定信息 { DoQueryRe1(); } if (this.ultraTabControl1.Tabs[2].Selected) //判定记录 { DoQueryRe(); } } //查询待判信息 private void DoQueryMe() { try { if (comboBox4.SelectedIndex == 1) { MessageBox.Show("请选择入库时间!"); return; } this.dataSet1.Clear(); string ebatchno = ""; string bbatchno = textBox4.Text.Trim(); if (textBox2.Text.ToString() == "") { ebatchno = this.textBox4.Text.Trim(); } else { ebatchno = textBox2.Text.Trim(); } string starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); string endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd"); string design_key = textBox1.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "GetUnjudgeInfoJF"; ccp.ServerParams = new object[] { starttime, endtime, bbatchno, ebatchno, design_key }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } //查询判定记录 private void DoQueryRe1() { try { if (comboBox4.SelectedIndex != 1) { MessageBox.Show("请选择判定时间!"); return; } this.dataSet18.Clear(); string ebatchno = ""; string bbatchno = textBox4.Text.Trim(); if (textBox2.Text.ToString() == "") { ebatchno = this.textBox4.Text.Trim(); } else { ebatchno = textBox2.Text.Trim(); } string design_key = textBox1.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "GetSurfaceInfoK"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key ,"400JB1"}; ccp.SourceDataTable = this.dataSet18.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } //查询判定记录 private void DoQueryRe() { try { if (comboBox4.SelectedIndex != 1) { MessageBox.Show("请选择判定时间!"); return; } this.dataSet2.Clear(); string ebatchno = ""; string bbatchno = textBox4.Text.Trim(); if (textBox2.Text.ToString() == "") { ebatchno = this.textBox4.Text.Trim(); } else { ebatchno = textBox2.Text.Trim(); } string design_key = textBox1.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "GetjudgeInfoJF"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void QCM030601_Load(object sender, EventArgs e) { this.comboBox4.SelectedIndex = 0; ValueList vsflv = new ValueList(); CoreClientParam ccp = new CoreClientParam(); this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid18.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7); ValueList vsflv2 = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findSfLvBj"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { vsflv2.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); } this.ultraComboEditor1.ValueList = vsflv2; //DoQuery(); } public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull) { if (cbEdt == null || vlist == null) return false; cbEdt.Items.Clear(); if (bNull) cbEdt.Items.Add(null, ""); for (int i = 0; i < vlist.ValueListItems.Count; i++) { try { cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText); } catch { } } return true; } public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText) { if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText)) return null; ArrayList alist = new ArrayList(); ValueList vlist = new ValueList(); for (int i = 0; i < table.Rows.Count; i++) { try { if (!alist.Contains(table.Rows[i][strKey])) { alist.Add(table.Rows[i][strKey]); vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText])); } } catch { } } return vlist; } private void checkBox1_CheckedChanged(object sender, EventArgs e) { SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid16, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid7, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid11, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid12, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid13, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid14, this.checkBox1.Checked); SetFilterUIType(this.ultraGrid15, this.checkBox1.Checked); } private void SetFilterUIType(UltraGrid grid, bool checkType) { if (checkType) { grid.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; } else { grid.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters(); grid.DisplayLayout.Override.FilterUIType = FilterUIType.Default; } } private void ultraTabControl1_Click(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.comboBox4.SelectedIndex = 1; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.comboBox4.SelectedIndex = 0; } } private void DoExport() { try { if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { if (this.ultraGrid1.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName); Process.Start(fName); } } if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { if (this.ultraGrid18.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid18, fName); Process.Start(fName); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[0].Selected) //待判信息 { foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList()) { if (checkBox2.Checked) { ugr.Selected = true; } else { ugr.Selected = false; } } } if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { foreach (UltraGridRow ugr in this.ultraGrid18.Rows.Where(p => p.IsFilteredOut == false).ToList()) { if (checkBox2.Checked) { ugr.Cells["CHECK"].Value = "True"; } else { ugr.Cells["CHECK"].Value = "False"; } } } } private void ultraComboEditor2_ValueChanged(object sender, EventArgs e) { string lb; if (this.ultraComboEditor2.Text.ToString() == "钢质次(A)") { lb = "钢质"; } else if (this.ultraComboEditor2.Text.ToString() == "热轧次(B)") { lb = "轧质"; } else { return; } ArrayList alt = new ArrayList(); alt.Add("UIB030110_021N1.SELECT"); alt.Add(lb); //alt.Add("UIB030110_022.SELECT"); ValueList vsflv3 = new ValueList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.COMMUNAL.ComDBQueryQCM"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { alt }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { vsflv3.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); } this.ultraComboEditor3.ValueList = vsflv3; } private void ultraTabControl1_Click_1(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.comboBox4.SelectedIndex = 1; } if (this.ultraTabControl1.Tabs[2].Selected) //判定记录 { this.comboBox4.SelectedIndex = 1; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.comboBox4.SelectedIndex = 0; } } } }