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 QCM030613 : FrmBase { public QCM030613() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Judge": this.Judge(); break; case "Exit": this.Close(); break; case "Export": this.DoExport(); break; } } private void Judge() { try { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return; string material_no = ugr.Cells["OLD_SAMPL_NO"].Value.ToString(); string steel_name = ugr.Cells["SPEC_STL_GRD"].Value.ToString(); string thick = ugr.Cells["COIL_THK"].Value.ToString(); string width = ugr.Cells["COIL_WTH"].Value.ToString(); string orderno = textBox3.Text.Trim().ToString(); string gp_steel_name = txt_gp_tradeno.Text.Trim().ToString(); string old_orderno = ugr.Cells["ORG_ORD_NO"].Value.ToString() + ugr.Cells["ORG_ORD_SEQ"].Value.ToString(); string weight = ugr.Cells["ACT_WGT"].Value.ToString(); string prod_line = ugr.Cells["PROD_LINE"].Value.ToString(); string username = this.UserInfo.GetUserName(); string gp_type = comboBox1.Text.ToString(); if (gp_type.Equals("")) { MessageBox.Show("请选择改判类型!"); return; } if (MessageBox.Show(this, "是否确认按【" + gp_type + "】改判!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "CoilGp"; ccp.ServerParams = new object[] { material_no,steel_name,thick,width,orderno,old_orderno,weight,prod_line, username,gp_steel_name,gp_type}; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } MessageBox.Show("改判成功!"); this.textBox3.Text=""; this.txt_gp_tradeno.Text =""; } 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) //判定记录 { DoQueryRe(); } } //查询待判信息 private void DoQueryMe() { try { this.dataSet1.Clear(); string coil_no = textBox4.Text.Trim(); string prod_line = comboBox3.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "GetGpCoilInfo"; ccp.ServerParams = new object[] { coil_no,prod_line }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } //查询判定记录 private void DoQueryRe() { try { this.dataSet2.Clear(); string starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); string endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd"); string prod_line = comboBox3.Text.ToString(); string coil_no = textBox4.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl"; ccp.MethodName = "GetGpHistory"; ccp.ServerParams = new object[] { coil_no,starttime,endtime,prod_line }; 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) { ValueList vsflv = new ValueList(); CoreClientParam ccp = new CoreClientParam(); this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid18.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.label1.Visible = false; this.label2.Visible = false; this.dateTimePicker1.Visible = false; this.dateTimePicker2.Visible = false; //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 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 button1_Click(object sender, EventArgs e) { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) return; string material_no = ugr.Cells["OLD_SAMPL_NO"].Text.ToString(); string steel_code = ugr.Cells["SPEC_STL_GRD"].Text.ToString(); string thick = ugr.Cells["COIL_THK"].Text.ToString(); string PSC = ugr.Cells["PSC"].Text.ToString(); string WIDTH = ugr.Cells["COIL_WTH"].Text.ToString(); string PRODLINE = ugr.Cells["PROD_LINE"].Text.ToString(); QCM030709 dlg = new QCM030709(); dlg.MATERIAL_NO = material_no; dlg.STD_CODE = ""; dlg.STEELCODE = steel_code; dlg.DELIVERY_STATE_CODE = ""; dlg.HEIGHT = thick; dlg.PSC = PSC; dlg.WIDTH = WIDTH; dlg.LENGTH = ""; dlg.PROD_LINE = PRODLINE; dlg.ob = this.ob; dlg.ShowDialog(); this.textBox3.Text = dlg.orderno; this.txt_gp_tradeno.Text = dlg.gp_tradeno; } private void ultraTabControl1_Click(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.label1.Visible = true; this.label2.Visible = true; this.dateTimePicker1.Visible = true; this.dateTimePicker2.Visible = true; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.label1.Visible = false; this.label2.Visible = false; this.dateTimePicker1.Visible = false; this.dateTimePicker2.Visible = false; } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { this.textBox3.Text = ""; this.txt_gp_tradeno.Text = ""; } } }