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 Infragistics.Win.UltraWinGrid; using Infragistics.Win; using System.Collections; using CoreFS.CA06; using System.Diagnostics; namespace Core.LZMes.Client.QCM { public partial class QCM030507 : FrmBase { public QCM030507() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Judge": Judge(); break; case "Cancel_Judge": cancel_judge(); break; case "Exit": this.Close(); 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.dataSet3.Clear(); string heatno = this.textBox1.Text.Trim(); string prod_line = this.comboBox3.Text.ToString(); prod_line = "4001LG0"; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; ccp.MethodName = "GetStorageInfo"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), heatno, prod_line }; ccp.SourceDataTable = this.dataSet3.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 heatno = this.textBox1.Text.Trim(); string prod_line = this.comboBox3.Text.ToString(); if (prod_line == "一炼钢") { prod_line = "钢一区"; } else { prod_line = "钢二区"; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "GetXiuMoJiLv"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), heatno, 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 cancel_judge() { try { UltraGridRow ugr = this.ultraGrid3.ActiveRow; if (ugr == null) return; if (MessageBox.Show("是否确认撤销表面判定!", "提示", MessageBoxButtons.YesNo) == DialogResult.No) return; ArrayList list1 = new ArrayList(); list1.Add("4001LGX"); list1.Add(ugr.Cells["PROD_NAME"].Value.ToString()); list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString()); list1.Add(this.UserInfo.GetUserName());//操作人 CoreClientParam ccp = new CoreClientParam(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "cancelSurfaceJudge"; ccp.ServerParams = new object[] { list1 }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void Judge() { try { //UltraGridRow ugr = this.ultraGrid3.ActiveRow; CoreClientParam ccp = new CoreClientParam(); foreach (UltraGridRow ugrs in this.ultraGrid3.Rows) { if (ugrs.Cells["CHECK"].Text.ToString() == "True") { ArrayList list1 = new ArrayList(); list1.Add(ugrs.Cells["FACECHECKID"].Value.ToString()); list1.Add(ugrs.Cells["BILLETNO"].Value.ToString()); list1.Add(ugrs.Cells["STATUS"].Value.ToString()); list1.Add(ugrs.Cells["WEIGHT"].Value.ToString()); list1.Add(ugrs.Cells["THICK"].Value.ToString()); list1.Add(ugrs.Cells["WIDTH"].Value.ToString()); list1.Add(ugrs.Cells["LENGTH"].Value.ToString()); list1.Add(ugrs.Cells["PRODNAME"].Value.ToString()); list1.Add(ugrs.Cells["PROD_NAME"].Value.ToString()); list1.Add(ugrs.Cells["PROD_THK"].Value.ToString()); list1.Add(ugrs.Cells["PROD_WTH"].Value.ToString()); list1.Add(ugrs.Cells["STEELCODE"].Value.ToString()); list1.Add(ugrs.Cells["ORDERNO"].Value.ToString()); list1.Add(ugrs.Cells["HEATNO"].Value.ToString()); list1.Add(ugrs.Cells["PLANSTEEL"].Value.ToString()); list1.Add(this.comboBox1.Text.ToString()); string bmqx = this.comboBox1.Text.ToString(); string surfaceid = ugrs.Cells["FACECHECKID"].Value.ToString(); string username = this.UserInfo.GetUserName(); string userorder = this.UserInfo.GetUserOrderText(); string usergroup = this.UserInfo.GetUserGroupText(); string fixed_type_desc = this.comboBox2.Text.ToString();//修磨结果 if (fixed_type_desc == "") { MessageBox.Show("请输入修磨结果!"); return; } if (this.comboBox2.Text.ToString() == "全剥" && this.textBox2.Text.ToString() == "") { MessageBox.Show("请输入修改后厚度!"); return; } string fixed_thick = this.textBox2.Text.ToString(); string flag = "1"; /*if (ugrs.Cells["PRIMARY_FLAG"].Text.ToString().Contains("是")) { flag = "1"; } else { flag = "0"; }*/ ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "BMQX"; ccp.ServerParams = new object[] { surfaceid, flag, username, userorder, usergroup, fixed_type_desc, fixed_thick,bmqx,list1 }; ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } MessageBox.Show(ugrs.Cells["BILLETNO"].Value.ToString() + "修磨发送成功"); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void QCM0305_Load(object sender, EventArgs e) { //this.comboBox2.Visible = false; this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid3.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3); this.comboBox3.SelectedIndex = 0; this.ultraGrid1.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue; this.ultraGrid3.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue; /*ValueList vis_repair = new ValueList(); vis_repair.ValueListItems.Add("0", "待修复"); vis_repair.ValueListItems.Add("1", "已修复"); ValueList vprimary_flag = new ValueList(); vprimary_flag.ValueListItems.Add("1", "是"); vprimary_flag.ValueListItems.Add("0", "否");*/ ValueList vFLAW_DESC = new ValueList(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; ccp.MethodName = "findFlawData"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { vFLAW_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["ID_"].ToString(), ccp.SourceDataTable.Rows[i]["NAME_"].ToString()); } this.comboBox1.DataSource = vFLAW_DESC.ValueListItems; ValueList vflaw_pos_desc = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; ccp.MethodName = "findMemo"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { vflaw_pos_desc.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["ID_"].ToString(), ccp.SourceDataTable.Rows[i]["NAME_"].ToString()); } this.comboBox2.DataSource = vflaw_pos_desc.ValueListItems; /*ValueList VFLAW_SIZE_DESC = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findFlawSizeDesc"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { VFLAW_SIZE_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); }*/ /*ValueList vsflv = new ValueList(); 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; ValueList VFLAW_LV_DESC = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findFlawLvDesc"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { VFLAW_LV_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); } ValueList VFLAW_DIR_DESC = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findFlawDirDesc"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { VFLAW_DIR_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString()); } ValueList VFIXED_TYPE_DESC = new ValueList(); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "GetXmResult"; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) { VFIXED_TYPE_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["XMRESULT"].ToString(), ccp.SourceDataTable.Rows[i]["XMRESULT"].ToString()); } ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; ccp.MethodName = "findFlawDataLg"; ccp.ServerParams = new object[] { "LG2" }; ccp.SourceDataTable = this.dataSet6.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //ValueList VDEFECT_DESC = new ValueList(); //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) //{ // VDEFECT_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["DEFECT_CODE"].ToString(), ccp.SourceDataTable.Rows[i]["DEFECT_DESC"].ToString()); //} //this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].ValueList = VDEFECT_DESC; UltraCombo uc; this.ultraCombo1.DataSource = ccp.SourceDataTable; //uc.DisplayMember = ccp.SourceDataTable.Columns["DEFECT_NAME"].ToString(); //uc.ValueMember = ccp.SourceDataTable.Columns["DEFECT_CODE"].ToString();*/ //DoQuery(); } private void ultraGrid3_AfterRowActivate(object sender, EventArgs e) { } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { } private void checkBox1_CheckedChanged(object sender, EventArgs e) { foreach (UltraGridRow ugr in this.ultraGrid3.Rows) { 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.checkBox2.Visible = true; this.label11.Text = "判定时间"; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { //this.checkBox2.Visible = false; this.label11.Text = "生产时间"; } } private void DoExport() { try { 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); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }