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 Infragistics.Win; using System.Drawing.Printing; using System.IO; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using ThoughtWorks.QRCode.Codec; using System.Diagnostics; namespace Core.LZMes.Client.QCM { public partial class QCM0201RZ : FrmBase { #region 初始化 //Boolean textboxHasText = false;//判断输入框是否有文本 private String v_line_no = "";//RZ1-热轧 ZB1-中板线 HB1-厚板线 LT1-连退 Image image2;//二维码 private String v_BATCH_NO = "";//轧批号 private String PRINT_SEQV = "";//打印序号 private int lennum = 0;//长度 public QCM0201RZ() { InitializeComponent(); } private void QCM0201RZ_Load(object sender, EventArgs e) { //获取自定义参数 if (!this.CustomInfo.Equals("")) { v_line_no = this.CustomInfo; } // this.ultraGrid1.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目"; // this.ultraGrid4.DisplayLayout.Bands[0].Columns["PHY_NAME_L_bj"].Header.Caption = "检验项目"; //dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1); dateTimePicker2.Value = DateTime.Now.Date.AddDays(1); ValueList v = new ValueList(); v.ValueListItems.Add("1", "是"); v.ValueListItems.Add("0", "否"); this.ultraGrid3.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone(); ValueList v1 = new ValueList(); v1.ValueListItems.Add("0", "订单"); v1.ValueListItems.Add("1", "人工"); this.ultraGrid3.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone(); this.ultraGrid6.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone(); v1 = new ValueList(); v1.ValueListItems.Add("0", "订单"); v1.ValueListItems.Add("1", "人工复制"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].ValueList = v1.Clone(); this.ultraGrid4.DisplayLayout.Bands[0].Columns["ITEM_FLAG"].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(); this.ultraGrid4.DisplayLayout.Bands[0].Columns["smp_catg"].ValueList = v2.Clone(); //ValueList v3 = new ValueList(); //v3.ValueListItems.Add("", ""); //v3.ValueListItems.Add("A", "金相"); //v3.ValueListItems.Add("B", "重量偏差"); //v3.ValueListItems.Add("C", "金相&重量偏差"); //this.ultraGrid1.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone(); //this.ultraGrid4.DisplayLayout.Bands[0].Columns["SEND_MEMO"].ValueList = v3.Clone(); if (!this.checkBox1.Checked) { this.textBox1.Enabled = false; this.BATCH_NO2.Enabled = false; } // this.DoQuery(); } #endregion #region 功能 public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Send": this.DoSend();//发送委托 break; case "SendRZ": this.DoSendRZ();//热轧 组批区间 人工抽样 break; case "Unsend": this.DoUnsend();//撤销委托 break; case "Add": this.AddBasePhy();//新增检验项 break; case "AddArtificial": this.AddArtificial();//新增人工委托 break; case "Update": this.DoUpdate();//修改取样材料号 break; case "AddWt": this.DoAddWt();//新增复制单条委托 break; case "DelWt": this.DoDelWt();//撤销复制单条委托 break; case "DoDelete": this.DoDelete();//删除委托 break; case "DoEject": this.DoEject();//卷板质量异常处理 break; case "UpBatchNo": this.DoUpBatchNo();//复样 修改轧批号 (一炉5个轧批 1 2 3 4 5 取1号轧批委托 夹杂不合格 复 2 3轧批) break; case "UpRefBatchNo": this.DoUpRefBatchNo();//初样 修改指定的按炉引用 (一炉5个轧批 1 2 3 4 5 系统默认为 1 但是现场实际取的是3 所以要人工修改) break; case "CleanUpMixRoll": this.CleanUpMixRoll();//清空库存组批区间 break; case "doPrint": this.doPrint();//打印 break; case "SendJG": this.DoSendJG();//补发激光 break; case "ForecastRZ": this.DoForecastRZ();//预测换样 break; case "InExport": this.InExcel();//导出 break; } } #region 打印 private void doPrint() { RowsCollection rowsCollection = this.ultraGrid1.Rows; if (this.ultraTabControl1.Tabs[0].Selected) //检验委托 { rowsCollection = this.ultraGrid1.Rows; } else if (this.ultraTabControl1.Tabs[1].Selected) { rowsCollection = this.ultraGrid4.Rows; } foreach (UltraGridRow ugr in rowsCollection) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String specimenNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();//取样编号 String materialNo = ugr.Cells["MATERIAL_NO"].Value.ToString();//子板号 String batchNO = ugr.Cells["BATCH_NO"].Value.ToString();//轧批号 String steelName = ugr.Cells["STEEL_NAME"].Value.ToString();//钢种 String thck = ugr.Cells["THICK"].Value.ToString();//规格 String phyNameLbj = ugr.Cells["PHY_NAME_L_bj"].Value.ToString();//项目 String STATUS = ugr.Cells["STATUS"].Value.ToString();//发送状态 String PRINT_SEQ = ugr.Cells["PRINT_SEQ"].Value.ToString();//打印序号 if (STATUS.Equals("未发送")) { this.alert("当前委托还未发送!请先发送委托"); return; } if (string.IsNullOrEmpty(specimenNo)) { this.alert("未找到相应委托数据!请核实!!!"); return; } if (string.IsNullOrEmpty(PRINT_SEQ)) { PRINT_SEQ = "1"; } v_BATCH_NO = materialNo;//轧批号 batchNO 换成子板号240126 PRINT_SEQV = PRINT_SEQ; //二维码内容 //" 子板:" + materialNo +"轧批:" + batchNO + " 钢种:" + steelName + " 规格:" + thck + " 项目:" + phyNameLbj+ " 序号:" + PRINT_SEQV String qrCodeContent = specimenNo; QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;//二维码编码格式 int num =qrCodeContent.Length; lennum = num; if (num<=90) { qrCodeEncoder.QRCodeScale = 5; qrCodeEncoder.QRCodeVersion = 2;//设置二维码的版本,默认7 } else{ qrCodeEncoder.QRCodeScale = 6;//二维码大小比例4 qrCodeEncoder.QRCodeVersion = 14;//设置二维码的版本,默认7 该值影响二维码最高数据容量 7大致对应40个汉字长度,内容超出择需提升该数值 } //设置错误校验级别,默认中等,二维码被遮挡住一部分实际上也是能扫出内容的,这个效验级别的意思就是 //当遮挡部分最大占整体多少时仍然可以被扫出来,M大概在20%左右,H为30%,级别越高相应的数据容量会缩小 qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M; System.Drawing.Image image = qrCodeEncoder.Encode(qrCodeContent, Encoding.UTF8);//生成二维码图片 第一个参数打印内容 image2 = image; string FilePath = @"C:\二维码"; if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath);//判断是否有相应文件夹 } PrintDocument printDocument = new PrintDocument(); printDocument.PrinterSettings.PrinterName = "Deli DL-888T";//打印机名 printDocument.PrintPage += new PrintPageEventHandler(pdt_PrintPage);//设置字体 try { if (!printDocument.PrinterSettings.IsValid) { MessageBox.Show("打印设置无效!", "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } printDocument.Print(); } catch (Exception ex) { MessageBox.Show("打印过程出现异常!\n" + ex.Message, "出错", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } finally { printDocument.Dispose(); } //增加打印标识 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "doPrintLog"; ccp.ServerParams = new object[] { specimenNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //保存二维码 //FilePath = @"C:\二维码\" + batchNO + "二维码.jpg"; //System.IO.FileStream fs = new System.IO.FileStream(FilePath, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None); //image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg); //fs.Close(); image.Dispose(); } } } void pdt_PrintPage(object sender, PrintPageEventArgs e) { // e.Graphics.TranslateTransform(135, 255); //e.Graphics.RotateTransform(90.0F); Graphics grfx = e.Graphics; //grfx.DrawString(v_BATCH_NO, new Font("宋体", 20), Brushes.Black, 125, 366);//打印内容、字体、颜色、X、Y //grfx.DrawImage(image2, 135, 255, 120, 110);//图片、X、Y、宽、高 grfx.DrawString(PRINT_SEQV, new Font("宋体", 15), Brushes.Black, 22, 70);//打印内容、字体、颜色、X、Y grfx.DrawString(v_BATCH_NO, new Font("宋体", 14), Brushes.Black, 68, 130);//打印内容、字体、颜色、X、Y grfx.DrawImage(image2, 70, 15, 120, 110);//图片、X、Y、宽、高 //if (lennum <= 90) //{ //} //else //{ // //grfx.DrawString(v_BATCH_NO, new Font("宋体", 16), Brushes.Black, 125, 370); // //grfx.DrawImage(image2, 120, 250, 140, 120); //} } #endregion #endregion #region 功能方法 #region 初样 修改取样轧批号按炉初样比如:夹杂 private void DoUpRefBatchNo() { try { CoreClientParam ccp = new CoreClientParam(); ArrayList smpNo = new ArrayList();//试样号 ArrayList specimenNo = new ArrayList();//取样编号 ArrayList batchNo = new ArrayList();//轧批号 ArrayList heatnNo = new ArrayList();//炉号 ArrayList materialNo = new ArrayList();//取样材料号 ArrayList send_memo = new ArrayList();//发送备注 ArrayList inspectionLot = new ArrayList();//检验号 ArrayList plineCode = new ArrayList(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if (!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("0") || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D")) { this.alert("修改初样取样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!"); return; } smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString()); specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString()); batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString()); heatnNo.Add(ugr.Cells["HEAT_NO"].Value.ToString()); materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString()); send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString()); inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString()); plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); } } ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "DoUpRefBatchNo"; ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, heatnNo, materialNo, send_memo, inspectionLot, plineCode }; 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 #region 复样 修改轧批号 private void DoUpBatchNo() { try { CoreClientParam ccp = new CoreClientParam(); ArrayList smpNo = new ArrayList();//试样号 ArrayList specimenNo = new ArrayList();//取样编号 ArrayList batchNo = new ArrayList();//轧批号 ArrayList materialNo = new ArrayList();//取样材料号 ArrayList send_memo = new ArrayList();//发送备注 ArrayList inspectionLot = new ArrayList();//检验号 ArrayList plineCode = new ArrayList(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if ((!ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("1") && !ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3")) || !ugr.Cells["FREQ_CODE"].Value.ToString().Equals("D")) { this.alert("修改复样轧批号按钮是用来修改按炉取样的轧批,请谨慎操作!"); return; } smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString()); specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString()); batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString()); materialNo.Add(ugr.Cells["MATERIAL_NO"].Value.ToString()); send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString()); inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString()); plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); } } ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "updateBatchNo"; ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode }; 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 #region 修改取样材料号 private void DoUpdate() { try { // String plineCode = this.CustomInfo; CoreClientParam ccp = new CoreClientParam(); ArrayList smpNo = new ArrayList();//试样号 ArrayList specimenNo = new ArrayList();//取样编号 ArrayList batchNo = new ArrayList();//轧批号 ArrayList materialNo = new ArrayList();//取样材料号 ArrayList send_memo = new ArrayList();//发送备注 ArrayList inspectionLot = new ArrayList();//检验号 ArrayList plineCode = new ArrayList(); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString()); specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString()); batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString()); materialNo.Add(ugr.Cells["OLD_SAMPL_NO"].Value.ToString());//勾选了那个钢卷号,就代表送的那个样 send_memo.Add(ugr.Cells["SEND_MEMO"].Value.ToString()); inspectionLot.Add(ugr.Cells["INSPECTION_LOT"].Value.ToString()); plineCode.Add(ugr.Cells["PLINE_CODE"].Value.ToString()); } } ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "updateMaterialNo"; ccp.ServerParams = new object[] { smpNo, specimenNo, batchNo, materialNo, send_memo, inspectionLot, plineCode }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错【修改取样材料号】,请联系管理人员", "警告"); } } #endregion #region 新增人工委托 private void AddArtificial() { try { UltraGridRow row = this.ultraGrid1.ActiveRow; //if (row == null) //{ // this.alert("检验委托为空!请选择检验委托数据!!!"); // return; //} //if (!String.IsNullOrEmpty(row.Cells["MIXROLL"].Text.ToString())) //{ // this.alert("组批区间不为空!!!"); // return; //} Hashtable ht = new Hashtable(); if(row != null){ ht.Add("BATCH_NO", row.Cells["BATCH_NO"].Text.ToString()); } QCM0205 frmRbp = new QCM0205(); frmRbp.StartPosition = FormStartPosition.CenterScreen; frmRbp.ob = this.ob; frmRbp.plineCode = "RZ1"; frmRbp.hashTable = ht; frmRbp.ShowDialog(); this.DoQuery(); } catch (Exception ex) { MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } #endregion #region 新增检验项 private void AddBasePhy() { try { UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { this.alert("检验委托为空!请选择检验委托数据!!!"); return; } if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质")) { this.alert("只有材质数据才可以新增检验项!!!"); return; } if (!row.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } QCM0204 frmRbp = new QCM0204(); frmRbp.StartPosition = FormStartPosition.CenterScreen; frmRbp.ob = this.ob; frmRbp.specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString(); frmRbp.smpNo = row.Cells["SMP_NO"].Value.ToString(); frmRbp.plineCode = "RZ1"; frmRbp.ShowDialog(); this.DoQueryPrg(row);//右下角 } catch (Exception ex) { MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } #endregion #region 新增复制单条委托 private void DoAddWt() { try { int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { num = num + 1; } if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } } if (num > 1) { this.alert("只能单条复制!为防止数据差错谢谢配合【谨慎复制】"); return; } UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { this.alert("检验委托为空!请选择检验委托数据!!!"); return; } String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号 String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号 String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号 String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号 String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型 if (MessageBox.Show("轧批号【" + batchNo + "】,确认复制当前委托一条?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; if (smpTypeName.Equals("初样")) { ccp.MethodName = "DoAddWtZy"; } else if (smpTypeName.Equals("复样")) { ccp.MethodName = "DoAddWtFy"; } ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, this.UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } catch (Exception ex) { MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } #endregion #region 撤销复制单条委托 private void DoDelWt() { try { int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { num = num + 1; } String status = ugr.Cells["STATUS"].Value.ToString(); if (!status.Equals("0") && !status.Equals("未发送") && !String.IsNullOrEmpty(status)) { this.alert("当前委托状态不为未发送"); return; } } if (num > 1) { this.alert("只能单条删除!为防止数据差错谢谢配合【谨慎删除】"); return; } UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { this.alert("检验委托为空!请选择检验委托数据!!!"); return; } String batchNo = row.Cells["BATCH_NO"].Value.ToString();//轧批号 String designKey = row.Cells["DESIGN_KEY"].Value.ToString();//订单号 String smpNo = row.Cells["SMP_NO"].Value.ToString();//试样号 String specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号 String smpTypeName = row.Cells["SMP_TYPE_NAME"].Value.ToString();//取样类型 String item_flag = row.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工) if (MessageBox.Show("轧批号【" + batchNo + "】,确认撤销当前委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } if (!item_flag.Equals("1")) { this.alert("只能撤销人工复制委托"); return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; if (smpTypeName.Equals("初样")) { ccp.MethodName = "DoDelWtZy"; } else if (smpTypeName.Equals("复样")) { ccp.MethodName = "DoDelWtFy"; } ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("撤销复制委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); } catch (Exception ex) { MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } #endregion #region 删除委托 private void DoDelete() { try { UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { this.alert("检验委托为空!请选择检验委托数据!!!"); return; } String batchNoViw = row.Cells["BATCH_NO"].Value.ToString();//轧批号 ArrayList batchNo = new ArrayList();//轧批号 ArrayList designKey = new ArrayList();//订单号 ArrayList smpNo = new ArrayList();//试样号 ArrayList specimenNo = new ArrayList();//取样编号 ArrayList smpTypeName = new ArrayList();//取样类型 foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } batchNo.Add(ugr.Cells["BATCH_NO"].Value.ToString());//轧批号 designKey.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());//订单号 smpNo.Add(ugr.Cells["SMP_NO"].Value.ToString());//试样号 specimenNo.Add(ugr.Cells["SPECIMEN_NO"].Value.ToString());//取样编号 smpTypeName.Add(ugr.Cells["SMP_TYPE_NAME"].Value.ToString());//取样类型 if (ugr.Cells["SMP_TYPE_CODE"].Value.ToString().Equals("3")) { this.alert("件件取样暂时不支持删除!!!"); return; } } } if (MessageBox.Show("确认删除轧批号【" + batchNoViw + "】委托?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "DoDelete"; ccp.ServerParams = new object[] { batchNo, designKey, smpNo, specimenNo, smpTypeName, this.UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("删除委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQuery(); } catch (Exception ex) { MessageBox.Show("操作过程出现异常!\n" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } #endregion #region 查询 private void DoQuery() { try { if (this.ultraTabControl1.Tabs[2].Selected) { DoQueryRZ();//异常取样卷界面 return; } String checkboxVal = ""; String STARTTIME = ""; String ENDTIME = ""; if (this.ultraTabControl1.Tabs[1].Selected) { STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd"); ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd"); } else { STARTTIME = this.dateTimePicker1.Value.ToString("yyyyMMdd"); ENDTIME = this.dateTimePicker2.Value.ToString("yyyyMMdd"); } String BATCH_NO = this.textBox1.Text.Trim(); String BATCH_NO2 = this.BATCH_NO2.Text.Trim(); String VALIDFLAG = "1"; String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构 String PLINE_NAME = ""; String PLINE_CODE = v_line_no; String STEEL_NAME = this.txt_steel_name.Text.Trim(); String SMP_CATG = this.cbx_smp_catg.Text.Trim(); String ROLL_MANA_NO = this.ROLL_MANA_NO.Text.Trim(); String heatNo = this.selheatNo.Text.Trim(); if (CERT_INST_NAME.Equals("全部")) { CERT_INST_NAME = ""; } if (SMP_CATG.Equals("全部")) { SMP_CATG = ""; } else if (SMP_CATG.Equals("成分")) { SMP_CATG = "A"; } else { SMP_CATG = "B"; } if (this.CustomInfo == "BC2") { PLINE_NAME = "棒二线"; } else if (this.CustomInfo == "GX") { PLINE_NAME = "高线"; } else if (this.CustomInfo == "GB") { PLINE_NAME = "高棒线"; } else if (this.CustomInfo == "RZ") { PLINE_NAME = "热轧"; } else if (this.CustomInfo == "LT") { PLINE_NAME = "连退"; } else if (this.CustomInfo == "HB") { PLINE_NAME = "厚板线"; } else if (this.CustomInfo == "ZB") { PLINE_NAME = "中板线"; } //轧批号 小框框 是否勾选 if (this.checkBox1.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { BATCH_NO = ""; BATCH_NO2 = ""; } if (!string.IsNullOrEmpty(BATCH_NO2)) { if (string.IsNullOrEmpty(BATCH_NO)) { this.alert("请输入轧批号!!!"); this.textBox1.Focus(); return; } } //炉号 小框框 是否勾选 if (this.checkBox2.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { heatNo = ""; } //轧辊单元 小框框 是否勾选 if (this.checkBox3.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { ROLL_MANA_NO = ""; } CoreClientParam ccp = new CoreClientParam(); if (this.ultraTabControl1.Tabs[0].Selected) //检验委托 { this.dataSet1.Clear(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleInfoRZ"; ccp.SourceDataTable = this.dataSet1.Tables[0]; } else if (this.ultraTabControl1.Tabs[1].Selected) { this.dataSet5.Clear(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleInfoRZ2"; ccp.SourceDataTable = this.dataSet5.Tables[0]; } Hashtable ht = new Hashtable(); ht.Add("BATCH_NO", BATCH_NO); ht.Add("BATCH_NO2", BATCH_NO2); ht.Add("STARTTIME", STARTTIME); ht.Add("ENDTIME", ENDTIME); ht.Add("VALIDFLAG", VALIDFLAG); ht.Add("CERT_INST_NAME", CERT_INST_NAME); ht.Add("PLINE_NAME", PLINE_NAME); ht.Add("PLINE_CODE", PLINE_CODE); ht.Add("checkboxVal", checkboxVal); ht.Add("HEAT_NO", heatNo); if (this.ultraTabControl1.Tabs[0].Selected) { ht.Add("STATUS", "0"); } if (this.ultraTabControl1.Tabs[1].Selected) { ht.Add("TAB_NAME", "1"); } ht.Add("STEEL_NAME", STEEL_NAME); ht.Add("SMP_CATG", SMP_CATG); ht.Add("ROLL_MANA_NO", ROLL_MANA_NO); ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (this.ultraTabControl1.Tabs[0].Selected) //检验委托 { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { switch (ugr.Cells["STATUS"].Text.ToString()) { case "0": ugr.Cells["STATUS"].Value = "未发送"; break; case "1": ugr.Cells["STATUS"].Value = "已引用"; break; case "2": ugr.Cells["STATUS"].Value = "已发送"; break; case "3": ugr.Cells["STATUS"].Value = "已完成"; break; case "4": ugr.Cells["STATUS"].Value = "检化验系统退回"; break; case "5": ugr.Cells["STATUS"].Value = "重判"; break; case "7": ugr.Cells["STATUS"].Value = "确认接收样"; break; } if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样") { ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red; } if (!ugr.Cells["OLD_SAMPL_NO"].Value.ToString().Equals(ugr.Cells["MATERIAL_NO"].Value.ToString())) { ugr.Cells["SAMPL_PICK_RY"].Value = null; } } int num = this.ultraGrid1.Rows.Count(); if (num <= 0) { this.dataSet3.Clear(); } foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows) { if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1")) { ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen;//钢卷号建议抽样卷 } } } else if (this.ultraTabControl1.Tabs[1].Selected) { foreach (UltraGridRow ugr in this.ultraGrid4.Rows) { switch (ugr.Cells["STATUS"].Text.ToString()) { case "0": ugr.Cells["STATUS"].Value = "未发送"; break; case "1": ugr.Cells["STATUS"].Value = "已引用"; break; case "2": ugr.Cells["STATUS"].Value = "已发送"; break; case "3": ugr.Cells["STATUS"].Value = "已完成"; break; case "4": ugr.Cells["STATUS"].Value = "检化验系统退回"; break; case "5": ugr.Cells["STATUS"].Value = "重判"; break; case "7": ugr.Cells["STATUS"].Value = "确认接收样"; break; } if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样") { ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red; } } int num = this.ultraGrid4.Rows.Count(); if (num <= 0) { this.dataSet6.Clear(); } } //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid4.Rows) //{ // if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1")) // { // ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen; // } //} } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } private void DoQueryRZ() { try { String checkboxVal = ""; String STARTTIME = ""; String ENDTIME = ""; STARTTIME = this.dateTimePicker1.Value.ToString("yyyyMMdd"); ENDTIME = this.dateTimePicker2.Value.ToString("yyyyMMdd"); String BATCH_NO = this.textBox1.Text.Trim(); String BATCH_NO2 = this.BATCH_NO2.Text.Trim(); String VALIDFLAG = "1"; String CERT_INST_NAME = this.textBox2.Text.Trim();//认证机构 String PLINE_NAME = "热轧"; String PLINE_CODE = v_line_no; String STEEL_NAME = this.txt_steel_name.Text.Trim(); String SMP_CATG = this.cbx_smp_catg.Text.Trim(); String ROLL_MANA_NO = this.ROLL_MANA_NO.Text.Trim(); String heatNo = this.selheatNo.Text.Trim(); if (CERT_INST_NAME.Equals("全部")) { CERT_INST_NAME = ""; } if (SMP_CATG.Equals("全部")) { SMP_CATG = ""; } else if (SMP_CATG.Equals("成分")) { SMP_CATG = "A"; } else { SMP_CATG = "B"; } //轧批号 小框框 是否勾选 if (this.checkBox1.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { BATCH_NO = ""; BATCH_NO2 = ""; } if (!string.IsNullOrEmpty(BATCH_NO2)) { if (string.IsNullOrEmpty(BATCH_NO)) { this.alert("请输入轧批号!!!"); this.textBox1.Focus(); return; } } //炉号 小框框 是否勾选 if (this.checkBox2.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { heatNo = ""; } //轧辊单元 小框框 是否勾选 if (this.checkBox3.Checked) { checkboxVal = "1"; STARTTIME = ""; ENDTIME = ""; } else { ROLL_MANA_NO = ""; } CoreClientParam ccp = new CoreClientParam(); this.dataSet8.Clear(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQCMRZYZ"; ccp.SourceDataTable = this.dataSet8.Tables[0]; Hashtable ht = new Hashtable(); ht.Add("BATCH_NO", BATCH_NO); ht.Add("BATCH_NO2", BATCH_NO2); ht.Add("STARTTIME", STARTTIME); ht.Add("ENDTIME", ENDTIME); ht.Add("VALIDFLAG", VALIDFLAG); ht.Add("CERT_INST_NAME", CERT_INST_NAME); ht.Add("PLINE_NAME", PLINE_NAME); ht.Add("PLINE_CODE", PLINE_CODE); ht.Add("checkboxVal", checkboxVal); ht.Add("HEAT_NO", heatNo); ht.Add("STEEL_NAME", STEEL_NAME); ht.Add("SMP_CATG", SMP_CATG); ht.Add("ROLL_MANA_NO", ROLL_MANA_NO); ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (this.ultraTabControl1.Tabs[2].Selected) { List lists = new List(); foreach (UltraGridRow ugr in this.ultraGrid2.Rows) { switch (ugr.Cells["STATUS"].Text.ToString()) { case "0": ugr.Cells["STATUS"].Value = "未发送"; break; case "1": ugr.Cells["STATUS"].Value = "已引用"; break; case "2": ugr.Cells["STATUS"].Value = "已发送"; break; case "3": ugr.Cells["STATUS"].Value = "已完成"; break; case "4": ugr.Cells["STATUS"].Value = "检化验系统退回"; break; case "5": ugr.Cells["STATUS"].Value = "重判"; break; case "7": ugr.Cells["STATUS"].Value = "确认接收样"; break; } if (ugr.Cells["SMP_TYPE_NAME"].Value.ToString() == "复样") { ugr.Cells["SMP_TYPE_NAME"].Appearance.ForeColor = Color.Red; } if (!ugr.Cells["OLD_SAMPL_NO"].Value.ToString().Equals(ugr.Cells["MATERIAL_NO"].Value.ToString())) { ugr.Cells["SAMPL_PICK_RY"].Value = null; } //if (ugr.Cells["MIXFLAG"].Value.ToString().Equals("1")) //{ // ugr.Cells["OLD_SAMPL_NO"].Appearance.BackColor = Color.LightGreen; //} if (!string.IsNullOrEmpty(ugr.Cells["JHQ_STATUS"].Value.ToString())) { int jhqnum=int.Parse(ugr.Cells["JHQ_STATUS"].Value.ToString()); if (12 < jhqnum) { if (jhqnum <= 72) { ugr.Appearance.BackColor = Color.Yellow; }else if (jhqnum > 240) { lists.Add(ugr); } } else if (jhqnum <= 12) { ugr.Appearance.BackColor = Color.Red; } } } for (int i = 0; i < lists.Count; i++) { lists[i].Delete(false); } int num = this.ultraGrid2.Rows.Count(); if (num <= 0) { this.dataSet8.Clear(); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 查找检验项目 private void DoQueryPrg(UltraGridRow ugr) { try { this.dataSet3.Clear(); String specimen_no = ugr.Cells["SPECIMEN_NO"].Value.ToString(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleItem"; ccp.ServerParams = new object[] { specimen_no }; ccp.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 查询订单信息 private void DoQueryOrder(UltraGridRow ugr) { try { this.dataSet2.Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleOrd"; ccp.ServerParams = new object[] { ugr.Cells["SMP_NO"].Text.ToString() }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows) //{ // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value; //} } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 发送检验委托 private void DoSend() { try { CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; String mixroll2 = "0"; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString())) { this.alert("委托不存在"); return; } if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } String mixroll = ugr.Cells["MIXROLL"].Value.ToString(); String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); String txt_DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString(); String txtDK = txt_DESIGN_KEY.Substring(0, 2); if (!String.IsNullOrEmpty(mixroll) && smpTypeName.Equals("初样") && !"39".Equals(txtDK) && !"49".Equals(txtDK) && !"59".Equals(txtDK)) { mixroll2 = "1"; this.alert("预测产品,请进行抽样操作!"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } DoUpdate();//先修改取样材料号 //if (mixroll2.Equals("1")) //{ // if (MessageBox.Show("组匹区间不为空!建议使用【预测抽样】按钮,而不是【发送检验委托】按钮,如继续执行【发送检验委托】按钮程序点击【是】,停止则点击【否】", "提示", // MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) // { // return; // } //} ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "SendLIMES"; ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), " " }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); int conut = this.ultraGrid1.Rows.Count(); if (conut <= 0) { this.dataSet2.Clear(); this.dataSet3.Clear(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 热轧 人工抽样 组批区间 private void DoSendRZ() { try { if (this.CustomInfo != "RZ") { this.alert("只能热轧产线可使用人工抽样按钮!"); return; } CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String mixroll = ugr.Cells["MIXROLL"].Value.ToString(); if (mixroll == null || mixroll.Equals("")) { this.alert("非预测品种,不允许预测抽样"); return; } if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } if(num>=2){ this.alert("请勾选一条钢卷号做为预测抽样,预测抽样不可勾选多条数据!!!"); return; } DoUpdate();//先修改取样材料号 String GroupBatch = "1";//组批标识 ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "SendLimesRZ"; ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), GroupBatch,"热轧" }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("人工抽样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); int conut = this.ultraGrid1.Rows.Count(); if (conut <= 0) { this.dataSet2.Clear(); this.dataSet3.Clear(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 撤销检验委托 private void DoUnsend() { try { if (MessageBox.Show("确认撤销发送?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } String zhyy = "MES撤回"; CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String rzEntrustNumber = ugr.Cells["RZ_ENTRUST_NUMBER"].Value.ToString(); //判断是否是热轧 预测抽样 if (!String.IsNullOrEmpty(rzEntrustNumber)) { this.alert("【预测抽样】的委托只能用【撤销抽样】按钮撤销!"); return; } String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString(); if (!String.IsNullOrEmpty(QRZ_SPECIMEN_NO)) { this.alert("轧批号:" + ugr.Cells["BATCH_NO"].Value.ToString() + "为人工选样不可撤销!"); return; } String status = ugr.Cells["STATUS"].Value.ToString(); if (status.Equals("0") || status.Equals("未发送") || String.IsNullOrEmpty(status)) { this.alert("当前委托未发送、不可撤销"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "CancelLIMES"; ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("撤销发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); int conut = this.ultraGrid1.Rows.Count(); if (conut <= 0) { this.dataSet2.Clear(); this.dataSet3.Clear(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 热轧 撤销人工抽样 private void DoUnsendRZ() { try { //if (!this.ultraTabControl1.SelectedTab.Text.Equals("委托记录")) //{ // this.alert("请在委托记录中勾选要撤销的人工抽样委托!"); // return; //} if (MessageBox.Show("确认撤销人工抽样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } UltraGridRow row = ultraGrid1.ActiveRow; String oldSamplNo = row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号 String rzOldSamplNo = row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号 if (!oldSamplNo.Equals(rzOldSamplNo) || String.IsNullOrEmpty(rzOldSamplNo)) { this.alert("请选择预测抽样的钢卷号撤销抽样!预测抽样钢卷号【" + rzOldSamplNo + "】"); return; } String zhyy = "MES撤回热轧预测抽样"; CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String status = ugr.Cells["STATUS"].Value.ToString(); String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString(); if (status.Equals("0") || status.Equals("未发送") || String.IsNullOrEmpty(status)) { this.alert("当前委托未发送、不可撤销"); return; } else if (!String.IsNullOrEmpty(QRZ_SPECIMEN_NO)) { this.alert("轧批号:" + ugr.Cells["BATCH_NO"].Value.ToString()+"为人工选样不可撤销!"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } if (num > 1) { this.alert("撤销预测抽样、只能一条预测抽样撤销"); return; } ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "CancelLIMESRZ"; ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserName(), zhyy }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("撤销人工抽样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); int conut = this.ultraGrid1.Rows.Count(); if (conut <= 0) { this.dataSet2.Clear(); this.dataSet3.Clear(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 卷板质量异常处理 private void DoEject() { QCM0307 frmRbp = new QCM0307(); frmRbp.StartPosition = FormStartPosition.CenterScreen; frmRbp.ob = this.ob; frmRbp.ShowDialog(); } #endregion #region 清空组批区间 private void CleanUpMixRoll() { int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String mixroll = ugr.Cells["MIXROLL"].Value.ToString(); String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); if (string.IsNullOrEmpty(mixroll)) { this.alert("当前轧批组批区间已为空!"); return; } if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString())) { this.alert("委托不存在!"); return; } if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } num = num + 1; } } if (num != 1) { this.alert("要勾选委托并且只能勾选一个委托的轧批号!"); return; } UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) { this.alert("检验委托为空!请选择检验委托数据!!!"); return; } if (!row.Cells["SMP_CATG"].Text.ToString().Equals("材质")) { this.alert("只有材质数据才可以清空!!!"); return; } String batchNo = row.Cells["BATCH_NO"].Text.ToString(); if (MessageBox.Show("确认清除当前轧批号【" + batchNo + "】组批区间?清空组批区间是按批清空", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } String MATERIAL_NO = row.Cells["MATERIAL_NO"].Value.ToString(); String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString(); String PLINE_CODE = row.Cells["PLINE_CODE"].Value.ToString(); String MIXROLL = row.Cells["MIXROLL"].Value.ToString(); String OLD_SAMPL_NO = row.Cells["OLD_SAMPL_NO"].Value.ToString(); Hashtable ht = new Hashtable(); ht.Add("OLD_SAMPL_NO", OLD_SAMPL_NO); ht.Add("MATERIAL_NO", MATERIAL_NO); ht.Add("BATCH_NO", BATCH_NO); ht.Add("MIXROLL", MIXROLL); ht.Add("PLINE_CODE", PLINE_CODE); ht.Add("USER_NAME", this.UserInfo.GetUserName().ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "DoCleanUpMixRoll"; ccp.ServerParams = new object[] { ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) { return; } MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); this.DoQuery(); } #endregion #region 补发激光 private void DoSendJG() { try { CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if (string.IsNullOrEmpty(ugr.Cells["PRINT_SEQ"].Value.ToString())) { String OLD_SAMPL_NO = ugr.Cells["OLD_SAMPL_NO"].Value.ToString(); this.alert("钢卷号:" + OLD_SAMPL_NO+"未发送,不能使用补发功能,请核实数据!"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } if (num==0) { this.alert("请勾选数据!!!"); return; } Hashtable ht = new Hashtable(); ht.Add("USER_ID", this.UserInfo.GetUserID()); ht.Add("USER_NAME", this.UserInfo.GetUserName()); ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "SendJG"; ccp.ServerParams = new object[] { SPECIMEN_NO, this.UserInfo.GetUserID(), this.UserInfo.GetUserName(), ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("补发激光委托成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #region 预测换样 private void DoForecastRZ() { try { int i = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { i++; } } if(i==0){ this.alert("未勾选数据!"); return; }else if (i>=2){ this.alert("您勾选了多条数据,请勾选一条数据,勾选当前轧辊单元组批区间的抽样钢卷号,红色字体那条!"); return; } UltraGridRow row = this.ultraGrid1.ActiveRow; String OLD_SAMPL_NO = row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号 String ROLL_MANA_NO = row.Cells["ROLL_MANA_NO"].Value.ToString();//轧辊单元 String MIXROLL = row.Cells["MIXROLL"].Value.ToString();//组批区间 String RZ_ENTRUST_NUMBER = row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号 String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString();//轧批号 String STATUS = row.Cells["STATUS"].Text.ToString();//状态 String SAMPL_PICK_RY = row.Cells["SAMPL_PICK_RY"].Value.ToString();//有无取样 String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString();//取样编号 if (OLD_SAMPL_NO.Equals(RZ_ENTRUST_NUMBER) && SAMPL_PICK_RY.Equals("R") && STATUS.Equals("已完成")) { if (MessageBox.Show("是否确认轧辊单元【" + ROLL_MANA_NO + "】组批区间【" + MIXROLL + "】轧批号【" + BATCH_NO + "】"+ "不合格,需从新在组距内钢卷重新挑卷预测抽样", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); Hashtable ht = new Hashtable(); ht.Add("BATCH_NO", BATCH_NO); ht.Add("SPECIMEN_NO", SPECIMEN_NO); ht.Add("USER_ID", this.UserInfo.GetUserID()); ht.Add("USER_NAME", this.UserInfo.GetUserName()); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "doForecastRZ"; ccp.ServerParams = new object[] { ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("操作成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); } else { this.alert("操作失败!请核实当前预测抽样数据!轧辊单元【" + ROLL_MANA_NO + "】组批区间【" + MIXROLL + "】"); return; } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion #endregion #region 其它事件 #region 查询下拉框 取样材料号 private void ultraGrid1_AfterCellActivate(object sender, EventArgs e) { this.dataSet4.Clear(); //String heatNo = this.ultraGrid1.ActiveRow.Cells["HEAT_NO"].Value.ToString(); //CoreClientParam ccp2 = new CoreClientParam(); //ccp2.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址 //ccp2.MethodName = "getBatchNo";//调用的方法 //ccp2.ServerParams = new object[] { heatNo }; //ccp2.SourceDataTable = this.dataSet4.Tables[0]; //this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); //ValueList VDEFECT_DESC2 = new ValueList(); //for (int i = 0; i < ccp2.SourceDataTable.Rows.Count; i++) //{ // VDEFECT_DESC2.ValueListItems.Add(ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString(), ccp2.SourceDataTable.Rows[i]["BATCH_NO"].ToString()); //} //this.ultraGrid1.DisplayLayout.Bands[0].Columns["BATCH_NO"].ValueList = VDEFECT_DESC2; String batchNo = this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString(); String plineCode = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString(); if (string.IsNullOrEmpty(batchNo)) { return; } if (string.IsNullOrEmpty(plineCode)) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";//调用java地址 ccp.MethodName = "getBilletId";//调用的方法 ccp.ServerParams = new object[] { batchNo, plineCode }; ccp.SourceDataTable = this.dataSet4.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]["MATERIAL_NO"].ToString(), ccp.SourceDataTable.Rows[i]["MATERIAL_NO"].ToString()); } this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIAL_NO"].ValueList = VDEFECT_DESC; } #endregion private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { int num = this.ultraGrid1.Rows.Count(); if (num >= 1) { Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim(); string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim(); if (String.IsNullOrEmpty(specimen_no) || String.IsNullOrEmpty(smp_no)) { this.dataSet3.Tables[0].Clear(); return; } this.dataSet3.Tables[0].Clear(); this.dataSet2.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleItemNew"; ccp.ServerParams = new object[] { specimen_no }; ccp.SourceDataTable = this.dataSet3.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //CoreClientParam ccp1 = new CoreClientParam(); //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; //ccp1.MethodName = "getQltySampleOrdNew"; //ccp1.ServerParams = new object[] { smp_no }; //ccp1.SourceDataTable = this.dataSet2.Tables[0]; //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal); //右下角ord表删除 //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows) //{ // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value; //} } else { this.dataSet2.Clear(); this.dataSet3.Clear(); } } #region 选择tab 显示相应按钮 private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e) { if (this.ultraTabControl1.SelectedTab.Index == 0) { this.ToolBarItemEnable(this, "Send", true); this.ToolBarItemEnable(this, "Add", true); this.ToolBarItemEnable(this, "AddArtificial", true); this.ToolBarItemEnable(this, "Unsend", true); this.ToolBarItemEnable(this, "AddWt", true); this.ToolBarItemEnable(this, "DelWt", true); this.ToolBarItemEnable(this, "DoDelete", true); this.ToolBarItemEnable(this, "SendJG", true); this.ToolBarItemEnable(this, "doPrint", true); this.ToolBarItemEnable(this, "ForecastRZ", true); this.button1.Enabled = true; this.button2.Enabled = true; this.button3.Enabled = true; this.button4.Enabled = true; this.button8.Enabled = true; } if (this.ultraTabControl1.SelectedTab.Index == 1) { this.ToolBarItemEnable(this, "Send", false); this.ToolBarItemEnable(this, "Add", false); this.ToolBarItemEnable(this, "AddArtificial", false); this.ToolBarItemEnable(this, "Unsend", false); this.ToolBarItemEnable(this, "AddWt", false); this.ToolBarItemEnable(this, "DelWt", false); this.ToolBarItemEnable(this, "DoDelete", false); this.ToolBarItemEnable(this, "SendJG", false); this.ToolBarItemEnable(this, "doPrint", true); this.ToolBarItemEnable(this, "ForecastRZ", false); this.button1.Enabled = true; this.button2.Enabled = true; this.button3.Enabled = true; this.button4.Enabled = true; this.button8.Enabled = true; } if (this.ultraTabControl1.SelectedTab.Index == 2) { this.ToolBarItemEnable(this, "Send", false); this.ToolBarItemEnable(this, "Add", false); this.ToolBarItemEnable(this, "AddArtificial", false); this.ToolBarItemEnable(this, "Unsend", false); this.ToolBarItemEnable(this, "AddWt", false); this.ToolBarItemEnable(this, "DelWt", false); this.ToolBarItemEnable(this, "DoDelete", false); this.ToolBarItemEnable(this, "SendJG", false); this.ToolBarItemEnable(this, "doPrint", false); this.ToolBarItemEnable(this, "ForecastRZ", false); this.button1.Enabled = false; this.button2.Enabled = false; this.button3.Enabled = false; this.button4.Enabled = false; this.button8.Enabled = false; } } #endregion private void ultraGrid4_AfterRowActivate(object sender, EventArgs e) { // this.DoQueryPrg(this.ultraGrid4.ActiveRow); // this.DoQueryOrder(this.ultraGrid4.ActiveRow); Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender; string specimen_no = uGrid.ActiveRow.Cells["SPECIMEN_NO"].Text.Trim(); //string smp_no = uGrid.ActiveRow.Cells["SMP_NO"].Text.Trim(); if (String.IsNullOrEmpty(specimen_no) ) { this.dataSet6.Tables[0].Clear(); return; } this.dataSet6.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleItemNew"; ccp.ServerParams = new object[] { specimen_no }; ccp.SourceDataTable = this.dataSet6.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //右下角ord订单 //CoreClientParam ccp1 = new CoreClientParam(); //ccp1.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; //ccp1.MethodName = "getQltySampleOrdNew"; //ccp1.ServerParams = new object[] { smp_no }; //ccp1.SourceDataTable = this.dataSet2.Tables[0]; //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal); //foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows) //{ // ugr2.Cells["Column1"].Value = ugr2.Cells["THICK"].Value + "*" + ugr2.Cells["WIDTH"].Value + "*" + ugr2.Cells["LENGTH"].Value; //} } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { ultraGrid1.UpdateData(); } private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e) { ultraGrid1.UpdateData(); } private void ultraGrid4_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e) { ultraGrid4.UpdateData(); } private void ultraGrid4_CellChange(object sender, CellEventArgs e) { ultraGrid4.UpdateData(); } #endregion #region 右下角 删除 名称 private void ultraGrid3_InitializeRow(object sender, InitializeRowEventArgs e) { e.Row.Cells["deletebol"].Value = "删除"; } #endregion #region 右下角 删除 private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e) { ultraGrid3.UpdateData(); if (e.Cell.Column.Key == "deletebol") { if (MessageBox.Show("确定要删除这一项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) { return; } try { CoreClientParam ccp = new CoreClientParam(); String seq = "";//检验项目流水号 String specimenNo = "";//取样编号 UltraGridRow row = ultraGrid3.ActiveRow; if (!row.Cells["ITEM_FLAG"].Value.ToString().Equals("1")) { MessageBox.Show("不能删除系统生成的项目,只能删除人工生成的项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } seq = row.Cells["SEQ"].Value.ToString(); specimenNo = row.Cells["SPECIMEN_NO"].Value.ToString(); ccp.ServerName = "QCM.JHY01.JHY0102.UpdateInfo"; ccp.MethodName = "deleteInfo"; ccp.ServerParams = new object[] { seq, specimenNo }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show(ccp.ReturnInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } this.DoQueryPrg(this.ultraGrid1.ActiveRow); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } } #endregion #region 轧批号框勾选触发 private void checkBox1_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.textBox1.Enabled = true; this.BATCH_NO2.Enabled = true; } else { if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.textBox1.Enabled = false; this.BATCH_NO2.Enabled = false; } } private void checkBox2_Click(object sender, EventArgs e) { if (this.checkBox2.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.selheatNo.Enabled = true; } else { if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.selheatNo.Enabled = false; } } private void checkBox3_Click(object sender, EventArgs e) { if (this.checkBox3.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.ROLL_MANA_NO.Enabled = true; } else { if (!this.checkBox1.Checked && !this.checkBox2.Checked && !this.checkBox3.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.ROLL_MANA_NO.Enabled = false; } } #endregion #region 表中的列 值改变触发 private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e) { Boolean bl = true; if (this.CustomInfo == "GX") { UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null || "".Equals(row)) { return; } String sendMemoValeu = row.Cells["SEND_MEMO"].Value.ToString(); if (sendMemoValeu.Equals("A") || sendMemoValeu.Equals("B") || sendMemoValeu.Equals("C")) { String BATCH_NO = row.Cells["BATCH_NO"].Value.ToString(); String SPECIMEN_NO = row.Cells["SPECIMEN_NO"].Value.ToString(); String phyname = row.Cells["PHY_NAME_L_bj"].Value.ToString(); String sendMemo = row.Cells["SEND_MEMO"].Text.ToString(); //金相 if (sendMemoValeu.Equals("A")) { if (phyname.Contains(sendMemo)) { bl = false; } if (bl) { this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】"); } } //重量偏差 if (sendMemoValeu.Equals("B")) { if (phyname.Contains("其他")) { bl = false; } if (bl) { this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】不包含:【" + sendMemo + "】"); } } //金相&重量偏差 if (sendMemoValeu.Equals("C")) { if (phyname.Contains("其他") && phyname.Contains("金相")) { bl = false; } if (bl) { this.alert("轧批号【" + BATCH_NO + "】取样编号【" + SPECIMEN_NO + "】需包含:【" + sendMemo + "】两个项目,请检查是否包含!!!"); } } } } } #endregion #region 抽样按钮 private void button1_Click(object sender, EventArgs e) { DoSendRZ(); } private void button2_Click(object sender, EventArgs e) { DoUnsendRZ(); } #endregion #region 发送检验委托按钮 private void button3_Click(object sender, EventArgs e) { this.DoSend();//发送委托 } private void button4_Click(object sender, EventArgs e) { this.DoUnsend();//撤销委托 } #endregion #region 人工委托按钮 private void button8_Click(object sender, EventArgs e) { this.AddArtificial();//新增人工委托 } #endregion #region ultraGrid1 初始化 变色 状态为2 3红色 private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { String statusl = e.Row.Cells["STATUS"].Value.ToString(); String OLD_SAMPL_NO = e.Row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号 String RZ_OLD_SAMPL_NO = e.Row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号 String MixRoll =e.Row.Cells["MIXROLL"].Value.ToString();//组批区间 String SteelName = e.Row.Cells["STEEL_NAME"].Value.ToString();//牌号 String Hold = OLD_SAMPL_NO.Substring(OLD_SAMPL_NO.Length - 2);//钢卷号后两位 String MATERIAL_NO = e.Row.Cells["MATERIAL_NO"].Value.ToString();//取样材料号 String smpTypeName = e.Row.Cells["SMP_TYPE_NAME"].Value.ToString();//初样 复样 String QRZ_SPECIMEN_NO = e.Row.Cells["QRZ_SPECIMEN_NO"].Value.ToString();//人工选样 String SPECIMEN_NO = e.Row.Cells["SPECIMEN_NO"].Value.ToString();//人工选样 String SAMPL_PICK_RY = e.Row.Cells["SAMPL_PICK_RY"].Value.ToString();//人工选样 String SEND_MEMO = e.Row.Cells["SEND_MEMO"].Value.ToString();//发送备注 //if ((e.Row.Cells["STATUS"].Value.ToString() != "0" && !String.IsNullOrEmpty(MixRoll)) && // !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) // && (SteelName.Equals("Q235B") || SteelName.Equals("Q355B")) // ) //{ // e.Row.Appearance.BackColor = Color.LightGreen; //} //正常委托 状态不等于0 组指区间为空 抽样钢卷号为空 if (e.Row.Cells["STATUS"].Value.ToString() != "0" && !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) && String.IsNullOrEmpty(MixRoll) && String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) ) { e.Row.Appearance.BackColor = Color.LightGreen;//浅绿 } if (e.Row.Cells["STATUS"].Value.ToString() != "0" && !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) && !smpTypeName.Equals("初样") ) { e.Row.Appearance.BackColor = Color.LightGreen;//浅绿 } //抽样委托 组指区间不为空 抽样钢卷号不为空 if (!String.IsNullOrEmpty(MixRoll) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO)) { e.Row.Appearance.BackColor = Color.LightGreen;//浅绿 } //1、置空变绿色 有委托 再发送 if(e.Row.Cells["STATUS"].Value.ToString() != "0" && !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) && RZ_OLD_SAMPL_NO.Equals(OLD_SAMPL_NO) && MATERIAL_NO.Equals(OLD_SAMPL_NO) && String.IsNullOrEmpty(MixRoll) ){ e.Row.Appearance.BackColor = Color.LightGreen;//浅绿 } //2、置空变绿色 无委托 再发送 if (e.Row.Cells["STATUS"].Value.ToString() != "0" && !e.Row.Cells["STATUS"].Value.ToString().Equals("未发送") && !String.IsNullOrEmpty(statusl) && !OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO) && OLD_SAMPL_NO.Equals(MATERIAL_NO) && String.IsNullOrEmpty(MixRoll) ) { e.Row.Appearance.BackColor = Color.LightGreen;//浅绿 } //组批区间置空 钢卷号后两位不等于10 组批区间为空 抽样钢卷号不为空 取样材料号不等于钢卷号 if (!Hold.Equals("10") && String.IsNullOrEmpty(MixRoll) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) && !MATERIAL_NO.Equals(OLD_SAMPL_NO)) { e.Row.Appearance.ForeColor = Color.Blue;//置空从新人工委托 蓝色 //除010其它子板清空组批区间变蓝 e.Row.Cells["STATUS"].Value = "请人工委托"; } //状态为完 抽样卷不为空 钢卷号和抽样钢卷号不一样 钢卷号等于 取样材料号 组批区间为空 if ((e.Row.Cells["STATUS"].Value.ToString().Equals("3") || e.Row.Cells["STATUS"].Value.ToString().Equals("已完成")) && !String.IsNullOrEmpty(statusl) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) && !OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO) && OLD_SAMPL_NO.Equals(MATERIAL_NO) && String.IsNullOrEmpty(MixRoll) ) { e.Row.Appearance.ForeColor = Color.Blue;//010清空组批区间变蓝 e.Row.Cells["STATUS"].Value = "请人工委托"; e.Row.Appearance.BackColor = Color.White;//白色 } if (!String.IsNullOrEmpty(statusl) && !"0".Equals(statusl) && !"未发送".Equals(statusl) && String.IsNullOrEmpty(MixRoll) && !String.IsNullOrEmpty(RZ_OLD_SAMPL_NO) && !"预测换样".Equals(SEND_MEMO)) { e.Row.Appearance.ForeColor = Color.Blue; e.Row.Cells["STATUS"].Value = "请人工委托"; e.Row.Appearance.BackColor = Color.White;//白色 } if (OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO)) { e.Row.Appearance.ForeColor = Color.Red;//抽样卷 红色 } if (QRZ_SPECIMEN_NO.Equals(SPECIMEN_NO) && "Y".Equals(SAMPL_PICK_RY)) { e.Row.Appearance.ForeColor = Color.DeepPink;//人工选样 } } private void ultraGrid4_InitializeRow(object sender, InitializeRowEventArgs e) { //String statusl = e.Row.Cells["STATUS"].Value.ToString(); //String OLD_SAMPL_NO = e.Row.Cells["OLD_SAMPL_NO"].Value.ToString();//钢卷号 //String RZ_OLD_SAMPL_NO = e.Row.Cells["RZ_ENTRUST_NUMBER"].Value.ToString();//抽样钢卷号 //if (OLD_SAMPL_NO.Equals(RZ_OLD_SAMPL_NO)) //{ // e.Row.Appearance.ForeColor = Color.Red; //} } #endregion #region 导出 private void InExcel() { 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()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } #endregion private void button10_Click(object sender, EventArgs e) { var dataSource = new List(); Double mySalary = 0; Double mySalary1 = 0; string SPECIMEN_NO = ""; string fh = ""; int num = 0; string Znum = "0"; string Fnum = "0"; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { if (string.IsNullOrEmpty(ugr.Cells["STATUS"].Value.ToString())) { this.alert("委托不存在"); return; } if (!ugr.Cells["STATUS"].Value.ToString().Equals("未发送")) { this.alert("请选择状态为未发送的委托!!!"); return; } String rollManaNo = ugr.Cells["ROLL_MANA_NO"].Value.ToString(); dataSource.Add(rollManaNo); String mixroll = ugr.Cells["MIXROLL"].Value.ToString(); String smpTypeName = ugr.Cells["SMP_TYPE_NAME"].Value.ToString(); String txt_DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString(); String txtDK = txt_DESIGN_KEY.Substring(0, 2); if (smpTypeName.Equals("初样")) { Znum = "1"; } else if (smpTypeName.Equals("复样")) { Fnum = "1"; } if (!String.IsNullOrEmpty(mixroll) && smpTypeName.Equals("初样") && !"39".Equals(txtDK) && !"49".Equals(txtDK) && !"59".Equals(txtDK)) { this.alert("预测产品,请进行抽样操作!"); return; } //拿取最大规格 String THICK = ugr.Cells["THICK"].Value.ToString(); mySalary = Double.Parse(THICK); if (mySalary > mySalary1) { mySalary1 = mySalary; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } if (num<=0) { this.alert("未勾选委托!"); return; } if (Znum.Equals("1") && Fnum.Equals("1")) { this.alert("不能同时勾选初样和复样!"); return; } var uniqueData = dataSource.Distinct(); int unum = 0; foreach (var item in uniqueData) { unum = unum + 1; } if (unum>=2) { this.alert("只能勾选同轧辊单元委托!"); return; } CoreClientParam ccpSel = new CoreClientParam(); ccpSel.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccpSel.MethodName = "getQltyRZHeatNo"; ccpSel.ServerParams = new object[] { SPECIMEN_NO }; ccpSel = this.ExecuteNonQuery(ccpSel, CoreInvokeType.Internal); if (ccpSel.ReturnCode == -1) { return; } QCM0211 frmRbp = new QCM0211(); frmRbp.StartPosition = FormStartPosition.CenterScreen; frmRbp.ob = this.ob; frmRbp.specimenNo = SPECIMEN_NO; frmRbp.thick = mySalary1.ToString(); frmRbp.plineCode = "RZ1"; frmRbp.ShowDialog(); this.DoQuery(); } private void button9_Click(object sender, EventArgs e) { try { if (MessageBox.Show("确认撤销人工选样?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } String zhyy = "MES撤回热轧选样"; CoreClientParam ccp = new CoreClientParam(); string SPECIMEN_NO = ""; string fh = ""; int num = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { String spno = ugr.Cells["SPECIMEN_NO"].Value.ToString(); String QRZ_SPECIMEN_NO = ugr.Cells["QRZ_SPECIMEN_NO"].Value.ToString(); if (String.IsNullOrEmpty(QRZ_SPECIMEN_NO) || !spno.Equals(QRZ_SPECIMEN_NO)) { this.alert("请勾选正确的人工选样的数据进行撤销选样!"); return; } specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString(); num = num + 1; if (num <= 1) { SPECIMEN_NO = specimeNo; fh = ","; } else { SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo; } } } Hashtable ht = new Hashtable(); ht.Add("ZHYY", zhyy); ht.Add("USERID", this.UserInfo.GetUserID().ToString()); ht.Add("USERNAME", this.UserInfo.GetUserName().ToString()); ccp.ServerName = "QCM.JHY01.JHY0102.Send2"; ccp.MethodName = "CancelLimesRZXY"; ccp.ServerParams = new object[] { SPECIMEN_NO, ht }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageBox.Show("撤销人工选样成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);//ccp.ReturnInfo "发送成功" ccp.ReturnInfo } this.DoQuery(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } } }