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; namespace Core.LZMes.Client.QCM { public partial class QCM0201 : FrmBase { #region 初始化 //Boolean textboxHasText = false;//判断输入框是否有文本 private String v_line_no = "";//RZ1-热轧 ZB1-中板线 HB1-厚板线 LT1-连退 public QCM0201() { InitializeComponent(); } private void QCM0201_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 "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; } } #endregion #region 功能方法 #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["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 = "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 { QCM0205 frmRbp = new QCM0205(); frmRbp.StartPosition = FormStartPosition.CenterScreen; frmRbp.ob = this.ob; 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; } 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 = "GB"; 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 (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; } } 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, 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(); } 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") { 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; } String item_flag = ugr.Cells["ITEM_FLAG"].Value.ToString();//项目来源(0-订单,1-人工) if (item_flag.Equals("1")) { this.alert("取样编号:" + ugr.Cells["SPECIMEN_NO"].Value.ToString()+"为【人工复制】委托,请选择[撤销复制委托]按钮!谢谢!"); 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 { String checkboxVal = ""; String STARTTIME = this.dateTimePicker1.Value.ToString("yyyy-MM-dd"); String ENDTIME = this.dateTimePicker2.Value.ToString("yyyy-MM-dd"); 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 = this.PLINE_NAME.Text.Trim(); 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 heatNo = this.selheatNo.Text.Trim(); if (PLINE_NAME.Equals("全部")) { PLINE_NAME = ""; } 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; } } CoreClientParam ccp = new CoreClientParam(); this.dataSet1.Clear(); ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample"; ccp.MethodName = "getQltySampleInfo"; ccp.SourceDataTable = this.dataSet1.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); if (this.ultraTabControl1.Tabs[0].Selected) { ht.Add("STATUS", "0"); } if (this.ultraTabControl1.SelectedTab.Text.Equals("委托记录")) { ht.Add("TAB_NAME", "1"); } ht.Add("STEEL_NAME", STEEL_NAME); ht.Add("SMP_CATG", SMP_CATG); ht.Add("HEAT_NO", heatNo); ccp.ServerParams = new object[] { ht }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); 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; } } int num = this.ultraGrid1.Rows.Count(); if (num <= 0) { this.dataSet2.Clear(); this.dataSet3.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 { DoUpdate();//先修改取样材料号 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") { 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 = "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 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.ultraGrid4.Rows) { string specimeNo = ""; if (ugr.Cells["CHK"].Value.ToString().ToLower() == "true") { 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 #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; this.dataSet4.Clear(); String batchNo = this.ultraGrid1.ActiveRow.Cells["BATCH_NO"].Value.ToString(); String plineCode = this.ultraGrid1.ActiveRow.Cells["PLINE_CODE"].Value.ToString(); 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) { // this.DoQueryPrg(this.ultraGrid1.ActiveRow);//右下角 // this.DoQueryOrder(this.ultraGrid1.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(); 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); //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", false); this.ToolBarItemEnable(this, "AddWt", true); this.ToolBarItemEnable(this, "DelWt", true); this.ToolBarItemEnable(this, "DoDelete", true); this.DoQuery(); } else 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", true); this.ToolBarItemEnable(this, "AddWt", false); this.ToolBarItemEnable(this, "DelWt", false); this.ToolBarItemEnable(this, "DoDelete", false); this.DoQuery(); } } #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(); 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); //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; this.selheatNo.Enabled = true; } else { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; this.textBox1.Enabled = false; this.BATCH_NO2.Enabled = false; this.selheatNo.Enabled = false; } } #endregion #region 表中的列 值改变触发 private void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e) { Boolean bl = true; if (this.CustomInfo == "GX" || this.CustomInfo == "BC2" || this.CustomInfo == "GB") { 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 轧批号 //textbox获得焦点 //private void textBox1_Enter(object sender, EventArgs e) //{ // if (textboxHasText == false) { // this.textBox1.Text = ""; // this.BATCH_NO2.Text = ""; // } // this.textBox1.ForeColor = Color.Black; // this.BATCH_NO2.ForeColor = Color.Black; //} //textbox获得焦点 //private void textBox1_Leave(object sender, EventArgs e) //{ // if (textBox1.Text == "") // { // textBox1.Text = "输入轧批号后四位"; // textBox1.ForeColor = Color.LightGray; // this.BATCH_NO2.Text = "输入轧批号后四位"; // this.BATCH_NO2.ForeColor = Color.LightGray; // textboxHasText = false; // } // else // textboxHasText = true; //} #endregion } }