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 System.Collections; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace Core.LZMes.Client.QCM { public partial class QCM0210 : FrmBase { public QCM0210() { InitializeComponent(); } private void QCM0210_Load(object sender, EventArgs e) { dateTimePicker2.Value = DateTime.Now.Date.AddDays(1); ValueList v1 = new ValueList(); v1.ValueListItems.Add("0", "未发送"); v1.ValueListItems.Add("1", "已引用"); v1.ValueListItems.Add("2", "已接收"); v1.ValueListItems.Add("3", "已完成"); v1.ValueListItems.Add("7", "确认接收样"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["STATUS"].ValueList = v1.Clone(); ValueList v2 = new ValueList(); v2.ValueListItems.Add("A", "成分"); v2.ValueListItems.Add("B", "材质"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["SMP_CATG"].ValueList = v2.Clone(); ValueList v3 = new ValueList(); v3.ValueListItems.Add("HB1", "厚板"); v3.ValueListItems.Add("ZB1", "中板"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["PLINE_CODE_LIMS"].ValueList = v3.Clone(); ValueList v4 = new ValueList(); v4.ValueListItems.Add("0", "无效"); v4.ValueListItems.Add("1", "有效"); this.ultraGrid3.DisplayLayout.Bands[0].Columns["YN_LOG"].ValueList = v4.Clone(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "BLIMS": this.DoBLIMS(); break; case "BJG": this.DoBJG(); break; case "InExport": break; } } #region 补发 private void DoBJG() { String spNoSel = ""; string fh1 = ""; int num1 = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["check"].Value.ToString().ToLower() == "true") { String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString(); if (String.IsNullOrEmpty(PRINT_SEQ)) { String BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString(); this.alert("轧批号:" + BATCH_NO + "还未生成编号不能使用补发按钮!"); return; } String specimeNoSel = ""; String ZHB_SPECIMEN_NO = ugr.Cells["ZHB_SPECIMEN_NO"].Value.ToString(); if (!String.IsNullOrEmpty(ZHB_SPECIMEN_NO)) { specimeNoSel = ZHB_SPECIMEN_NO; } else { specimeNoSel = ugr.Cells["SPECIMEN_NO"].Value.ToString(); } num1 = num1 + 1; if (num1 <= 1) { spNoSel = specimeNoSel; fh1 = ","; } else { spNoSel = spNoSel + fh1 + specimeNoSel; } } } Hashtable ht = new Hashtable(); ht.Add("USERID", this.UserInfo.GetUserID()); ht.Add("USERNAME", this.UserInfo.GetUserName()); ht.Add("BLG", '2'); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "GetDoBLIMS"; ccp.ServerParams = new object[] { spNoSel, ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("编号发送激光成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } private void DoBLIMS() { String spNoSel = ""; string fh1 = ""; int num1 = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["check"].Value.ToString().ToLower() == "true") { String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString(); if (String.IsNullOrEmpty(PRINT_SEQ)) { String BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString(); this.alert("轧批号:" + BATCH_NO + "还未生成编号不能使用补发按钮!"); return; } String specimeNoSel = ""; String ZHB_SPECIMEN_NO = ugr.Cells["ZHB_SPECIMEN_NO"].Value.ToString(); if (!String.IsNullOrEmpty(ZHB_SPECIMEN_NO)) { specimeNoSel = ZHB_SPECIMEN_NO; } else { specimeNoSel = ugr.Cells["SPECIMEN_NO"].Value.ToString(); } num1 = num1 + 1; if (num1 <= 1) { spNoSel = specimeNoSel; fh1 = ","; } else { spNoSel = spNoSel + fh1 + specimeNoSel; } } } Hashtable ht = new Hashtable(); ht.Add("USERID", this.UserInfo.GetUserID()); ht.Add("USERNAME", this.UserInfo.GetUserName()); ht.Add("BLG", '1'); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "GetDoBLIMS"; ccp.ServerParams = new object[] { spNoSel, ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("编号发送LIMS成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } #endregion #region 查询 private void DoQuery() { try { String SEND_TIME1 = this.dateTimePicker1.Value.ToString("yyyy-MM-dd"); String SEND_TIME2 = this.dateTimePicker2.Value.ToString("yyyy-MM-dd"); String sdtime = this.dateTimePicker4.Text.ToString(); String SAMPLE_DELIVERY_TIME = this.SAMPLE_DELIVERY_TIME2.Text.Trim();//查询 送样时间点 SAMPLE_DELIVERY_TIME = sdtime + " " + SAMPLE_DELIVERY_TIME;//送样时间点 String CERT_INST_CODE = ""; String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构 String SMP_CATG_CODE = ""; String SMP_CATG = this.cbx_smp_catg.Text.Trim();//类别 String BATCH_NO1 = this.BATCH_NO1.Text.Trim();//轧批号1 String BATCH_NO2 = this.BATCH_NO2.Text.Trim();//轧批号2 String PLINE_CODE = ""; String PLINE_NAME = this.PLINE_NAME.Text.Trim();//产线 if ("检测中心".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "5000"; } else if ("挪威船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC001"; } else if ("俄罗斯船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC002"; } else if ("法国船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC003"; } else if ("韩国船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC004"; } else if ("美国船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC005"; } else if ("日本船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC006"; } else if ("意大利船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC007"; } else if ("英国船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC009"; } else if ("中国船级社".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC010"; } else if ("客户认证".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC012"; } else if ("军方认证".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC013"; } else if ("美国船级社(非船板)".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC023"; } else if ("中国船级社(非船板)".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC024"; } else if ("劳盛工业(上海)".Equals(CERT_INST_NAME)) { CERT_INST_CODE = "IC026"; } if ("材质".Equals(SMP_CATG)) { SMP_CATG_CODE = "B"; } else if ("成分".Equals(SMP_CATG)) { SMP_CATG_CODE = "A"; } if ("厚板线".Equals(PLINE_NAME)) { PLINE_CODE = "HB1"; } else if ("中板线".Equals(PLINE_NAME)) { PLINE_CODE = "ZB1"; } if(this.checkBox4.Checked){ SEND_TIME1 = ""; SEND_TIME2 = ""; } else { SAMPLE_DELIVERY_TIME = ""; } if (this.checkBox1.Checked) { SEND_TIME1 = ""; SEND_TIME2 = ""; } else { BATCH_NO1 = ""; BATCH_NO2 = ""; } String YN = "N"; if (this.checkBox3.Checked) { YN = "1"; } Hashtable ht = new Hashtable(); ht.Add("SEND_TIME1", SEND_TIME1); ht.Add("SEND_TIME2", SEND_TIME2); ht.Add("SAMPLE_DELIVERY_TIME", SAMPLE_DELIVERY_TIME); ht.Add("CERT_INST_CODE", CERT_INST_CODE); ht.Add("SMP_CATG_CODE", SMP_CATG_CODE); ht.Add("BATCH_NO1", BATCH_NO1); ht.Add("BATCH_NO2", BATCH_NO2); ht.Add("PLINE_CODE", PLINE_CODE); ht.Add("YN", YN); CoreClientParam ccp = new CoreClientParam(); if (this.TabControl.SelectedIndex == 0) //检验委托 { this.dataSet2.Clear(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "getHZBNumber"; ccp.SourceDataTable = this.dataSet2.Tables[0]; ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); // ClsControlPack.RefreshAndAutoSize(ultraGrid1); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样") { ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red; } if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("一次模拟焊后")) { if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("一次模拟焊后") && (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "卷卷取样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "按母板取样")) { ugr.Cells["SMP_TYPE_NAME"].Value = "一次模拟焊后" + ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); } else { ugr.Cells["SMP_TYPE_NAME"].Value = "一次模拟焊后"; } } else if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("二次模拟焊后")) { if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("二次模拟焊后") && (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "卷卷取样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "按母板取样")) { ugr.Cells["SMP_TYPE_NAME"].Value = "二次模拟焊后" + ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); } else { ugr.Cells["SMP_TYPE_NAME"].Value = "二次模拟焊后"; } } else if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("三次模拟焊后")) { if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("三次模拟焊后") && (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "卷卷取样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "按母板取样")) { ugr.Cells["SMP_TYPE_NAME"].Value = "三次模拟焊后" + ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); } else { ugr.Cells["SMP_TYPE_NAME"].Value = "三次模拟焊后"; } } else if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("四次模拟焊后")) { if (ugr.Cells["SMP_LOCATION"].Value.ToString().Contains("四次模拟焊后") && (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "卷卷取样" || ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "按母板取样")) { ugr.Cells["SMP_TYPE_NAME"].Value = "四次模拟焊后" + ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); } else { ugr.Cells["SMP_TYPE_NAME"].Value = "四次模拟焊后"; } } if (ugr.Cells["SMP_CATG"].Value.ToString().Equals("A")) { ugr.Appearance.BackColor = Color.Aqua; } } } else { this.dataSet1.Clear(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "getHZBNumberQ"; ccp.SourceDataTable = this.dataSet1.Tables[0]; ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); // ClsControlPack.RefreshAndAutoSize(ultraGrid3); } this.checkBox2.Checked = false; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("查询异常!", "警告"); } } #endregion #region 生成按钮 private void button2_Click(object sender, EventArgs e) { this.DoUpdate(); } private void DoUpdate() { String spNoSel = ""; string fh1 = ""; int num1 = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["check"].Value.ToString().ToLower() == "true") { String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString(); String PRINT_SEQJ = ugr.Cells["PRINT_SEQJ"].Value.ToString(); if (!String.IsNullOrEmpty(PRINT_SEQ) || !String.IsNullOrEmpty(PRINT_SEQJ)) { String BATCH_NO = ugr.Cells["BATCH_NO"].Value.ToString(); this.alert("轧批号:" + BATCH_NO + "已生成编号不可重复生成!!!"); return; } String specimeNoSel = ""; String ZHB_SPECIMEN_NO = ugr.Cells["ZHB_SPECIMEN_NO"].Value.ToString(); if (!String.IsNullOrEmpty(ZHB_SPECIMEN_NO)) { specimeNoSel = ZHB_SPECIMEN_NO; } else { specimeNoSel = ugr.Cells["SPECIMEN_NO"].Value.ToString(); } num1 = num1 + 1; if (num1 <= 1) { spNoSel = specimeNoSel; fh1 = ","; } else { spNoSel = spNoSel + fh1 + specimeNoSel; } } } Hashtable ht = new Hashtable(); ht.Add("USERID", this.UserInfo.GetUserID()); ht.Add("USERNAME", this.UserInfo.GetUserName()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "GetGenerateSteel"; ccp.ServerParams = new object[] { spNoSel, ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("生成成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } #endregion #region 全选 private void checkBox2_CheckedChanged(object sender, EventArgs e) { foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList()) { if (checkBox2.Checked) { ugr.Cells["check"].Value = "True"; } else { ugr.Cells["check"].Value = "False"; } } } #endregion #region 勾选框事件 private void checkBox4_Click(object sender, EventArgs e) { if (this.checkBox4.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.dateTimePicker4.Enabled = true; this.SAMPLE_DELIVERY_TIME2.Enabled = true; } else { if (!this.checkBox1.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.dateTimePicker4.Enabled = false; this.SAMPLE_DELIVERY_TIME2.Enabled = false; } } private void checkBox1_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.BATCH_NO1.Enabled = true; this.BATCH_NO2.Enabled = true; } else { if (!this.checkBox4.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.BATCH_NO1.Enabled = false; this.BATCH_NO2.Enabled = false; } } #endregion #region 重置 private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e) { e.Row.Cells["reset"].Value = "重置"; } private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e) { ultraGrid3.UpdateData(); if (e.Cell.Column.Key == "reset") { try { UltraGridRow row = ultraGrid3.ActiveRow; if (row.Cells["YN_LOG"].Value.ToString().Equals("0")) { this.alert("请重置有效数据!"); return; } String CERT_INST_NAME = row.Cells["CERT_INST_NAME"].Value.ToString(); if (MessageBox.Show("确定要重置" + CERT_INST_NAME + "吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) { return; } String CERT_INST_CODE = row.Cells["CERT_INST_CODE"].Value.ToString(); String FH_LOG = row.Cells["FH_LOG"].Value.ToString(); String YYMM = row.Cells["YYMM"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); Hashtable ht = new Hashtable(); ht.Add("USERID", this.UserInfo.GetUserID()); ht.Add("USERNAME", this.UserInfo.GetUserName()); ht.Add("CERT_INST_CODE", CERT_INST_CODE); ht.Add("FH_LOG", FH_LOG); ht.Add("YYMM", YYMM); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "upShipInspec"; ccp.ServerParams = new object[] { ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("重置成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } } #endregion } }