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 System.Collections; using Infragistics.Win.UltraWinGrid; using Core.LZMes.Client.QCM.QCM03; using Infragistics.Win; using System.Diagnostics; namespace Core.LZMes.Client.QCM { public partial class QCM030728 : FrmBase { public QCM030728() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Exit": this.Close(); break; case "Unlock": this.Judge(); break; case "SteelInfo": this.steelinfo(); break; case "Export2": this.DoExport(); break; } } private void steelinfo() { if (MessageBox.Show(this, "是否对申请做审批不通过操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } List lists = new List(); foreach (UltraGridRow ugr in this.ultraGrid9.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { string apply_id = ugr.Cells["APPLY_ID"].Text.ToString(); string handle_memo = this.textBox1.Text.Trim().ToString();//审批处理备注 if (!string.IsNullOrEmpty(handle_memo)) { DoUpdate(apply_id, handle_memo); } string username = this.UserInfo.GetUserName(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl"; ccp.MethodName = "doApply"; ccp.ServerParams = new object[] { apply_id, username, "2" }; 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("申请处置成功!"); DoQuery(); } private void Judge() { if (MessageBox.Show(this, "是否对申请做审批通过操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { return; } List lists = new List(); foreach (UltraGridRow ugr in this.ultraGrid9.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { string apply_id = ugr.Cells["APPLY_ID"].Text.ToString(); string handle_memo = this.textBox1.Text.Trim().ToString();//审批处理备注 if (!string.IsNullOrEmpty(handle_memo)) { DoUpdate(apply_id, handle_memo); } string username = this.UserInfo.GetUserName(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl"; ccp.MethodName = "doApply"; ccp.ServerParams = new object[] { apply_id, username,"1" }; 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("申请处置成功!"); DoQuery(); } private void DoUpdate(String apply_id, String handle_memo) { try { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl"; ccp.MethodName = "updatememo"; ccp.ServerParams = new object[] { apply_id, handle_memo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错请联系管理人员", "警告"); } } 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 heatno = this.textBox4.Text.ToString(); string material_no = this.textBox5.Text.ToString(); string prod_name = this.comboBox2.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl"; ccp.MethodName = "getLgInformationS"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"),heatno,material_no,prod_name,"4" }; 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 heatno = this.textBox4.Text.ToString(); string material_no = this.textBox5.Text.ToString(); string prod_name = this.comboBox2.Text.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl"; ccp.MethodName = "getAbnormalRecordLgInfoS"; ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), heatno, material_no, prod_name, "4" }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void label1_Click(object sender, EventArgs e) { } private void panel4_Paint(object sender, PaintEventArgs e) { } private void panel2_Paint(object sender, PaintEventArgs e) { } private void DoQueryC() { try { UltraGridRow ugr = this.ultraGrid9.ActiveRow; if (ugr == null) return; this.dataSet4.Clear(); string design_key = ugr.Cells["design_key"].Value.ToString(); string smp_no = ugr.Cells["smp_no"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; ccp.MethodName = "GetChemeInfo"; ccp.ServerParams = new object[] { design_key, smp_no}; ccp.SourceDataTable = this.dataSet4.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { UltraGridRow ugr = e.Cell.Row; string lock_id = ugr.Cells["LOCK_ID"].Value.ToString(); if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F") { QCM030705 dlg = new QCM030705(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D") { QCM030704 dlg = new QCM030704(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C") { QCM030701 dlg = new QCM030701(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P") { QCM030702 dlg = new QCM030702(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S") { QCM030703 dlg = new QCM030703(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } } private void button1_Click(object sender, EventArgs e) { int count = 0; UltraGridRow ugr = this.ultraGrid9.ActiveRow; foreach (UltraGridRow ugr1 in this.ultraGrid9.Rows) { if (ugr1.Cells["CHECK"].Value.ToString() == "True") { ugr = ugr1; count++; continue; } } if (count == 0) { MessageBox.Show("请选择数据!"); return; } string prodline = "4001LGX"; string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString(); string prod_name = ugr.Cells["PROD_NAME"].Value.ToString(); string steelname = ""; QCM030710 dlg = new QCM030710(); dlg.prodline = prodline; dlg.material_no = material_no; dlg.prod_name = prod_name; dlg.steel = steelname; dlg.ob = this.ob; dlg.ShowDialog(); } 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 QCM030708_Load(object sender, EventArgs e) { this.comboBox2.SelectedIndex = 0; this.ultraGrid9.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons; this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3); //CoreClientParam ccp = new CoreClientParam(); //ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; //ccp.MethodName = "findXmMemo"; //ccp.ServerParams = new object[] { }; //ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //DataTable table1 = ccp.SourceDataTable; //ValueList valueList1 = GeneralValuelist(ref table1, "SM_CD", "SM_CFNM"); //this.checkBoxComboBox1.DataSource = valueList1.ValueListItems; //ccp = new CoreClientParam(); //ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl"; //ccp.MethodName = "findCcMemo"; //ccp.ServerParams = new object[] { }; //ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //DataTable table2 = ccp.SourceDataTable; //ValueList valueList2 = GeneralValuelist(ref table2, "SM_CD", "SM_CFNM"); //this.checkBoxComboBox2.DataSource = valueList2.ValueListItems; } private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { UltraGridRow ugr = e.Cell.Row; string lock_id = ugr.Cells["LOCK_ID"].Value.ToString(); if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F") { QCM030705 dlg = new QCM030705(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D") { QCM030704 dlg = new QCM030704(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C") { QCM030701 dlg = new QCM030701(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P") { QCM030702 dlg = new QCM030702(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S") { QCM030703 dlg = new QCM030703(); dlg.lock_id = lock_id; dlg.ob = this.ob; dlg.ShowDialog(); } } private void ultraTabControl1_Click(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.label4.Text = "审核时间"; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.label4.Text = "申请时间"; } } private void DoExport() { try { if (this.ultraGrid2.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #region 全选 private void checkBox2_CheckStateChanged(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[0].Selected) { foreach (UltraGridRow ugr in this.ultraGrid9.Rows.Where(p => p.IsFilteredOut == false).ToList()) { if (checkBox2.Checked) { ugr.Cells["check"].Value = "True"; } else { ugr.Cells["check"].Value = "False"; } } } } #endregion } }