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 System.Diagnostics; using Infragistics.Win.UltraWinEditors; using Infragistics.Win; namespace Core.LZMes.Client.QCM { public partial class QCM0309 : FrmBase { private string judge_type = "";//用于区分1检测中心和2轧钢厂 public QCM0309() { 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.cancel_fb(); break; case "Export": this.DoExport(); break; case "CancelFy": CancelFy(); break; } } private void CancelFy() { } 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 starttime = ""; string endtime = ""; string ebatchno = ""; string sbatchno = BatchNo.Text.Trim(); if (BatchNo.Text.ToString() == "") { starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd"); } if (BatchNo1.Text.ToString() == "") { ebatchno = this.BatchNo.Text.Trim(); } else { ebatchno = BatchNo1.Text.Trim(); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "doQueryMaterialDetailsRZFB"; ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); /*CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "doQueryMaterialDetailsRZFB"; ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno }; 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 = ""; string endtime = ""; string ebatchno = ""; string sbatchno = BatchNo.Text.Trim(); if (BatchNo.Text.ToString() == "") { starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd"); endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd"); } if (BatchNo1.Text.ToString() == "") { ebatchno = this.BatchNo.Text.Trim(); } else { ebatchno = BatchNo1.Text.Trim(); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "doQueryMaterialDetailsRZFBJL"; ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno }; 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_fb() { try { List lists = new List(); foreach (UltraGridRow ugr in ultraGrid9.Rows) { if (ugr.Cells["CHECK"].Text.ToString() == "True") { if (ugr.Cells["DLIV_DIRNO"].Value.ToString() != "") { MessageBox.Show(ugr.Cells["MATERIAL_NO"].Value.ToString() + "卷已有货运指示号,不可进行解除封闭操作!"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp.MethodName = "coiljudge_status_call_commit"; ccp.ServerParams = new object[] { "RZ1" , ugr.Cells["MATERIAL_NO"].Value.ToString() , "" , "" , "" , "" , "" , "N" ,"",""}; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } string remark = "取消封闭"; CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl"; ccp1.MethodName = "RZ_Record1"; ccp1.ServerParams = new object[] { ugr.Cells["MATERIAL_NO"].Value.ToString(), this.UserInfo.GetUserName().ToString(), remark,"" }; ccp1 = this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal); if (ccp1.ReturnCode == -1) { return; } lists.Add(ugr); } } for (int i = 0; i < lists.Count; i++) { lists[i].Delete(false); } //DoQuery(); MessageBox.Show("解除封闭成功!"); } 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() { } private void ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { } private void button1_Click(object sender, EventArgs e) { } 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 QCM0309_Load(object sender, EventArgs e) { } private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { } private void ultraTabControl1_Click(object sender, EventArgs e) { if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { this.label9.Text = "操作封闭时间"; } if (this.ultraTabControl1.Tabs[0].Selected) //判定记录 { this.label9.Text = "封锁时间"; } } private void DoExport() { if (this.ultraTabControl1.Tabs[0].Selected) //待判信息 { try { if (this.ultraGrid9.Rows.Count == 0) { MessageBox.Show("没有可以导出的数据", "提示"); return; } if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fName = this.saveFileDialog1.FileName; this.ultraGridExcelExporter1.Export(this.ultraGrid9, fName); Process.Start(fName); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } if (this.ultraTabControl1.Tabs[1].Selected) //判定记录 { 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()); } } } private void label11_Click(object sender, EventArgs e) { } private void checkBox2_CheckedChanged(object sender, EventArgs e) { 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"; } } } } }