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 System.Text.RegularExpressions;//正则表达式所在空间 using Infragistics.Win.UltraWinGrid; using Microsoft.Office.Interop.Excel; namespace Core.LZMes.Client.UIB { public partial class UIB100203 : FrmBase { public UIB100203() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Send": this.DoSend(); break; case "Export": this.DoExport(); break; case "OnFile": this.DoOnFile(); break; } } string strLine = null;//产线 string strArr = null;//地点 string strWtbh = null;//委托编号 string strQltyCD = null;//材质代码 string strQltyCD2 = null;//二级编码,如拉力,冲击等 string strQltyCD3 = null;//三级编码,如伸长率,屈服强度,抗拉强度等 string strSendTP = null;//是否已发送 int grid3ActiveRow = 0;//保存grid3(a,b,So等横向现实的grid)的当前活动行 string strSmpNo = null; string strSmpCutLoc = null; string strSmpNoType = null; public void DoQuery() { try { if (this.comboBox1.Text.Trim() == "" || this.comboBox4.Text.Trim() == "") { MessageBox.Show("请选择产线和实验地点","提示"); return; } OperateConditionRecode.WriteCondition("UIB100203_1", this.comboBox1.Text); OperateConditionRecode.WriteCondition("UIB100203_2", this.comboBox2.Text); OperateConditionRecode.WriteCondition("UIB100203_4", this.comboBox4.Text); this.dataSet1.Clear(); ArrayList al = new ArrayList(); //产线 if (this.comboBox1.Text == "热轧") { al.Add("UIB100203_HOST_01.SELECT"); strLine = "R"; } else if (this.comboBox1.Text == "中厚板") { al.Add("UIB100203_HOST_01.SELECT"); strLine = "Z"; } else if (this.comboBox1.Text == "优特钢") { al.Add("UIB100203_HOST_01.SELECT"); strLine = "Y"; } else { al.Add("UIB100203_LIAN_01.SELECT"); strLine = "L"; }/*else if (this.comboBox1.Text == "连退") { al.Add("UIB100203_LIAN_01.SELECT"); strLine = "L"; } */ al.Add(strLine); //地点 if (this.comboBox4.Text.Trim() == "力学") { strArr = "LX"; } else if (this.comboBox4.Text.Trim() == "金相") { strArr = "JX"; } else { MessageBox.Show("请区分力学与金相" , "提示"); return; } al.Add(strArr); //是否已发送 if (this.comboBox2.Text == "未发送") { strSendTP = "0"; al.Add(strArr); al.Add(strSendTP); } else if (this.comboBox2.Text == "已发送") { strSendTP = "1"; al.Add(strArr); al.Add(strSendTP); } else if (this.comboBox2.Text == "全部") { al.Add(""); al.Add(""); } else { MessageBox.Show("请选择发送状态", "提示"); return; } //入库时间 if (this.checkBox5.Checked) { al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000"); al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999"); } else { al.Add(""); al.Add(""); } //委托时间 if (this.checkBox2.Checked) { al.Add(this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") + "000000"); al.Add(this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") + "999999"); } else { al.Add(""); al.Add(""); } //钢卷号 if (this.checkBox1.Checked) { al.Add(this.textBox1.Text.Trim()); al.Add(this.textBox2.Text.Trim() == "" ? this.textBox1.Text.Trim() : this.textBox2.Text.Trim()); } else { al.Add(""); al.Add(""); } this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //发送、完成状态颜色显示,发送状态优先 foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["SEND_STAT"].Text.Substring(0, 1) == "0")//是否已发送,未发送则蓝色 { //ugr.RowSelectorAppearance.BackColor = Color.Blue; ugr.Cells["SEND_STAT"].Appearance.BackColor = Color.Blue; } if (ugr.Cells["WORK_STATS"].Text == "XX")//是否已完成,未完成则显示黄色 { ugr.RowSelectorAppearance.BackColor = Color.Yellow; } } } catch (Exception ex) { } } //发送数据到三期或冷轧 public void DoSend() { try { string strSMPNO = null; string strSMPCUTLOC = null; string strSMPTNOTYPE = null; string strCoilNo = null; int SPLITNUM = 3; string splitStr = null; int coilNum = 0; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { strSMPNO = strSMPNO + ugr.Cells["SMP_NO"].Text; strSMPCUTLOC = strSMPCUTLOC + ugr.Cells["SMP_CUT_LOC"].Text; strSMPTNOTYPE = strSMPTNOTYPE + ugr.Cells["SMP_NO_TYPE"].Text; if (strCoilNo != null) { coilNum++; if (coilNum % SPLITNUM == 0) { splitStr = "\n"; } else { splitStr = ","; } } strCoilNo = strCoilNo + splitStr + ugr.Cells["COIL_NO"].Text; } // this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Value = al[0].ToString(); } if (strSMPNO == null) return; if (MessageBox.Show("确定发送以下钢卷:\n" + strCoilNo, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; Hashtable ht = new Hashtable(); ht.Add("i1" , strSMPNO); ht.Add("i2" , strSMPCUTLOC); ht.Add("i3" , strSMPTNOTYPE); ht.Add("i4" , strArr); ht.Add("i5" , this.UserInfo.GetUserName()); ht.Add("o6" , ""); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_02.CALL", ht }; CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //计算结果返回 ArrayList al = rccp.ReturnObject as ArrayList; if (al[0] == null) { MessageBox.Show("发送异常!"); return; } if (al[0].ToString() == "YY") { MessageBox.Show("发送成功!", "提示"); } else if (al[0].ToString() == "XX") { MessageBox.Show("部分钢卷发送失败!", "提示"); } else { MessageBox.Show("部分钢卷发送失败:" + al[0].ToString(), "提示"); } this.DoQuery(); } catch (Exception ex) { } } //归档 public void DoOnFile() { try { if (MessageBox.Show("确定对【" + this.comboBox1.Text.ToString(), "】数据进行归档?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; Hashtable ht = new Hashtable(); ht.Add("i1", this.comboBox1.Text.ToString()); ht.Add("i2", this.UserInfo.GetUserName()); ht.Add("o3", ""); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_05.CALL", ht }; CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); ArrayList al = rccp.ReturnObject as ArrayList; if (al[0] == null) return; if (al[0].ToString() == "XX") { MessageBox.Show("数据归档失败!" , "提示"); return; } MessageBox.Show("数据归档成功!" , "提示"); } catch (Exception ex) { } } //导出 public void DoExport() { if (this.comboBox3.Text == "") { MessageBox.Show("请选择导出类别" , "提示"); return; } if (this.textBox5.Text.Trim() == "") { MessageBox.Show("请选择导出路径" , "提示"); return; } string strCoil = null; string strWtbh = null; foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { if (ugr.Cells["CHK"].Text == "True") { strCoil = strCoil + ugr.Cells["COIL_NO"].Text; strWtbh = strWtbh + ugr.Cells["WEITO_NO"].Text; } //ugr.Update(); } if (strCoil == null) { MessageBox.Show("没有选择需要导出的钢卷", "提示"); return; } ApplicationClass ExcelApp = null; Microsoft.Office.Interop.Excel.Application excel = null; Microsoft.Office.Interop.Excel.Workbooks workbooks = null; Microsoft.Office.Interop.Excel._Workbook workbook = null; Microsoft.Office.Interop.Excel.Sheets sheets = null; Microsoft.Office.Interop.Excel.Worksheet sheet = null; try { ArrayList al = new ArrayList(); string filename = null; if (this.comboBox3.Text == "拉力原始记录") { //查询出所需要导出卷的信息 this.dataSet3.Tables["lldc"].Clear(); al.Add("UIB100203_COMM_08.SELECT"); al.Add(strCoil); al.Add(strWtbh); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet3.Tables["lldc"]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //导出 string strfile = System.Windows.Forms.Application.StartupPath + "\\HostLaLi.xls";//模板路径 ExcelApp = new ApplicationClass(); excel = new Microsoft.Office.Interop.Excel.Application(); workbooks = excel.Workbooks; workbook = workbooks.Add(strfile); sheets = workbook.Sheets; sheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets[1]; int startRow = 5;//模板数据填充从第五行开始 Range range = null; int i = 0; int j = 1; for (i = 0; i < this.dataSet3.Tables["lldc"].Rows.Count; i++) { j = 1; sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_STEEL_NO"].ToString();//钢印号 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["SPEC_STL_GRD"].ToString();//牌号 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_NO"].ToString();//钢卷 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_THK"].ToString();//规格 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LA"].ToString();//a sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LB"].ToString();//b j++; j++; j++; j++; sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FE"].ToString();//Fe sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FM"].ToString();//Fm sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LO"].ToString();//Lo sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LU"].ToString();//Lu // sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["ZJ"].ToString();//直径 // sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["CB"].ToString();//冷弯 } //Range ra = sheet.get_Range(sheet.Cells[5, 1], sheet.Cells[5, 1]); //ra.Select(); range = sheet.get_Range(sheet.Cells[startRow, 1], sheet.Cells[startRow+(i-1), j-1+3]);//(Range)sheet.Rows[6, 1]; range.Borders.LineStyle = 1; range.NumberFormatLocal = "@";//设置单元格格式为文本 range.RowHeight = 22.5; //range.HorizontalAlignment = XlHAlign.xlHAlignLeft;//字体左靠 // range.RowHeight = 24; // System.DateTime dt = System.DateTime.Now; // string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt); workbook.Saved = true; workbook.SaveCopyAs(this.textBox5.Text + "\\热轧拉力试验原始记录表" + ".xls"); excel.DisplayAlerts = false; excel.AlertBeforeOverwriting = false; workbooks.Close(); workbook = null; excel.Quit(); excel = null; ExcelApp.Quit(); ExcelApp = null; } else if (this.comboBox3.Text == "冲击原始记录") { //查询出所需要导出卷的信息 this.dataSet3.Tables["cjdc"].Clear(); //产线 if (this.comboBox1.Text == "热轧") { al.Add("UIB100203_COMM_091.SELECT"); } else { al.Add("UIB100203_COMM_092.SELECT"); } // al.Add("UIB100203_COMM_091.SELECT"); al.Add(strCoil); al.Add(strWtbh); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet3.Tables["cjdc"]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //导出 string strfile = System.Windows.Forms.Application.StartupPath + "\\HostChongJi.xls";//模板路径 ExcelApp = new ApplicationClass(); excel = new Microsoft.Office.Interop.Excel.Application(); workbooks = excel.Workbooks; workbook = workbooks.Add(strfile); sheets = workbook.Sheets; sheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets[1]; int startRow = 5;//模板数据填充从第五行开始 Range range = null; int i = 0; int j = 1; for (i = 0; i < this.dataSet3.Tables["cjdc"].Rows.Count; i++) { j = 1; sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_STEEL_NO"].ToString();//钢印号 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["SPEC_STL_GRD"].ToString();//牌号 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_NO"].ToString();//钢卷 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_THK"].ToString();//规格 //j++;//试样宽度 //j++;//试样方向 //j++;//温度 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_SIZ"].ToString();//A1 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_DIR"].ToString();//A2 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_TEM"].ToString();//A3 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A1"].ToString();//A1 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A2"].ToString();//A2 sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A3"].ToString();//A3 //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FM"].ToString();//Fm //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LO"].ToString();//Lo //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LU"].ToString();//Lu //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["ZJ"].ToString();//直径 //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["CB"].ToString();//冷弯 } //设置样式 range = sheet.get_Range(sheet.Cells[startRow, 1], sheet.Cells[startRow + (i - 1), j - 1 + 1]);//(Range)sheet.Rows[6, 1]; range.Borders.LineStyle = 1; range.NumberFormatLocal = "@";//设置单元格格式为文本 range.RowHeight = 22.5; workbook.Saved = true; workbook.SaveCopyAs(this.textBox5.Text + "\\热轧冲击试验原始记录表" + ".xls"); excel.DisplayAlerts = false; excel.AlertBeforeOverwriting = false; workbooks.Close(); workbook = null; excel.Quit(); excel = null; ExcelApp.Quit(); ExcelApp = null; } else return; MessageBox.Show("导出成功!" , "提示"); } catch (Exception ex) { MessageBox.Show("导出失败!"+ex.ToString() , "提示"); } finally { try { if (workbooks != null) workbooks.Close(); if (excel != null) excel.Quit(); if (ExcelApp != null) ExcelApp.Quit(); } catch (Exception ex) { MessageBox.Show("error"); } GC.Collect(); } } //设置颜色 //若为A,判断值是否合格 public void SetColor(string flag , Infragistics.Win.UltraWinGrid.UltraGrid grid) { try { if (flag == "A") { Decimal minValue = 0; Decimal maxValue = 0; Decimal qltyValue = 0; foreach (UltraGridRow ugr in grid.Rows) { if (ugr.Cells["QLTY_VAL"].Text.Trim() == "") { ugr.RowSelectorAppearance.BackColor = Color.Yellow; continue; } else if (ugr.Cells["QLTY_VAL"].Text.Trim() == "不合格") { ugr.RowSelectorAppearance.BackColor = Color.Red; continue; } else if (ugr.Cells["QLTY_VAL"].Text.Trim() == "合格") { continue; } minValue = Convert.ToDecimal(ugr.Cells["QLTY_MIN"].Text == "" ? 0 : Convert.ToDecimal(ugr.Cells["QLTY_MIN"].Text)); maxValue = Convert.ToDecimal(ugr.Cells["QLTY_MAX"].Text == "" ? 9999 : Convert.ToDecimal(ugr.Cells["QLTY_MAX"].Text)); qltyValue = Convert.ToDecimal(ugr.Cells["QLTY_VAL"].Text.Trim()); if (qltyValue < minValue || qltyValue > maxValue) { ugr.RowSelectorAppearance.BackColor = Color.Red; } } } } catch (Exception ex) { } } //无计算公式,直接输入数据 public void DoUpdate(string flag) { try { if (this.ultraGrid5.ActiveCell == null) return; if (this.ultraGrid5.ActiveCell.DataChanged == true) { //同步更新到dataset3的对应的单元中 for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++) { if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()) { this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text; // this.dataSet3.Tables["yincang"]. // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString()); this.dataSet3.Tables["yincang"].AcceptChanges(); // this.dataSet3.AcceptChanges(); break; } } Hashtable ht = null; CoreClientParam ccp = null; ht = new Hashtable(); ht.Add("i1", this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); ht.Add("i2", this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); ht.Add("i3", this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); ht.Add("i4", this.strQltyCD2); ht.Add("i5", this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text); ht.Add("i6", "");//计算公式 ht.Add("i7", this.ultraGrid5.ActiveRow.Cells["QLTY_DIS_LEN"].Text);//保留位数 ht.Add("i8", this.ultraGrid5.ActiveRow.Cells["CRCT_REG"].Text.ToUpper());//修约规则 ht.Add("i9", flag);//处理数据规则 ht.Add("i10", this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text); ht.Add("i11", this.UserInfo.GetUserName()); ht.Add("o12",""); ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_01.CALL", ht }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } } catch (Exception ex) { MessageBox.Show("系统异常,请与技术中心联系" , "提示"); } } //按公式进行计算 //colNum为需要计算的行 public void DoCompVal(int colNum) { try { //判断该行是否存在,不存在则返回 if (colNum >= this.ultraGrid5.Rows.Count) return; string strCompVal = this.ultraGrid5.Rows[colNum].Cells["COMP_CAL"].Text;//计算公式 if (strCompVal == "") return; //若伸长率定标,则禁止计算 if (this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text == "Lo" && this.ultraGrid5.Rows[colNum].Cells["EDIT_TP"].Text == "X") { return; } for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++) { strCompVal = strCompVal.Replace(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()//this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text , this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString());//this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].Text); } Regex r = new Regex(@"[A-Z,a-z]"); Match m = r.Match(strCompVal); //判断公式的字符串是否已经替换完成,未替换完成,则不进行任何操作,直接返回 if(m.Success)return; strCompVal = strCompVal.Replace("√", "SQRT").Replace("=","");//开根号处理 Hashtable ht = new Hashtable(); ht.Add("i1", this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); ht.Add("i2", this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); ht.Add("i3", this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); ht.Add("i4", this.strQltyCD2); ht.Add("i5", this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text); ht.Add("i6", strCompVal);//计算公式 ht.Add("i7", this.ultraGrid5.Rows[colNum].Cells["QLTY_DIS_LEN"].Text);//保留位数 ht.Add("i8", this.ultraGrid5.Rows[colNum].Cells["CRCT_REG"].Text.ToUpper());//修约规则 ht.Add("i9", "");//处理数据规则 ht.Add("i10", ""); ht.Add("i11",this.UserInfo.GetUserName()); ht.Add("o12", ""); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_01.CALL", ht }; CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //计算结果返回 ArrayList al = rccp.ReturnObject as ArrayList; if (al[0] == null) return; if (al[0].ToString() == "XX") return; this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Value = al[0].ToString(); // this.ultraGrid3.ActiveRow.Cells[this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text].Value = al[0].ToString(); this.ultraGrid5.UpdateData(); this.ultraGrid3.UpdateData(); //同步更新到dataset3的对应的单元中 for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++) { // if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()) if (this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()) //DefaultView { this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Text;//this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text; // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString()); this.dataSet3.Tables["yincang"].AcceptChanges(); break; } } } catch (Exception ex) { MessageBox.Show("计算异常"); } } private void UIB100203_Load(object sender, EventArgs e) { try { this.comboBox1.Text = OperateConditionRecode.ReadCondition("UIB100203_1"); this.comboBox2.Text = OperateConditionRecode.ReadCondition("UIB100203_2"); this.comboBox4.Text = OperateConditionRecode.ReadCondition("UIB100203_4"); this.textBox5.Text = OperateConditionRecode.ReadCondition("UIB100203_PATH"); this.comboBox3.SelectedIndex = 0;//导出 //this.comboBox2.SelectedIndex = 2; ArrayList list = new ArrayList(); //列名排序查询 // this.dataSet2.Tables[2].Clear(); ArrayList al = new ArrayList(); al.Add("UIB100203_01.INITSELECT");//页面初始化调用,用于编码的排序 list.Add(al); al = new ArrayList(); al.Add("UIB100203_02.INITSELECT");//材质代码与材质名称 list.Add(al); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doContQluery"; ccp.ServerParams = new object[] { list }; CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (ccpList.ReturnInfo.Length == 0) { ArrayList aList = ccpList.ReturnObject as ArrayList; if (aList[0] != null) { this.dataSet2.Tables["paixu"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["paixu"]); tab0.TableName = "paixu"; this.dataSet2.Tables["paixu"].Merge(tab0); } if (aList[1] != null) { this.dataSet2.Tables["qltycd"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["qltycd"]); tab0.TableName = "qltycd"; this.dataSet2.Tables["qltycd"].Merge(tab0); } } //CoreClientParam ccp1 = new CoreClientParam(); //ccp1.ServerName = "UIB.JHY.JHYComQuery"; //ccp1.MethodName = "doSimpleQuery"; //ccp1.ServerParams = new object[] { al }; //ccp1.SourceDataTable = this.dataSet2.Tables[2]; //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal); } catch (Exception ex) { } } int grid1CurNum = 0; //点击上面的grid private void ultraGrid1_MouseDown(object sender, MouseEventArgs e) { try { if(this.ultraGrid1.ActiveRow == null) return; // if (this.ultraGrid1.ActiveCell.Column.Key == "CHK") // return; grid1CurNum = this.ultraGrid1.ActiveRow.Index; strWtbh = this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text; string smpno = this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text; ArrayList al = new ArrayList(); if (this.ultraTabControl1.Tabs[0].Selected)//检验结果查询 { if (this.ultraGrid1.ActiveCell.Column.Key == "COIL_NO" || this.ultraGrid1.ActiveCell.Column.Key == "CHK") { al.Add("UIB100203_COMM_01_1.SELECT"); al.Add(this.strArr);//检测中心和理化楼区分 al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_NO"].Text); //al.Add(this.strArr);//力学或者金相 //al.Add(this.strSendTP);//是否已发送 al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text); } else { if (smpno.Substring(0, 1) == "X" || smpno.Substring(0, 1) == "Y") { al.Add("UIB100203_COMMZHB_01.SELECT"); } else { al.Add("UIB100203_COMM_01.SELECT"); } al.Add(this.strArr);//检测中心和理化楼区分 al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text); // al.Add(this.strArr);//力学或者金相 // al.Add(this.strSendTP);//是否已发送 } this.dataSet1.Tables[1].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet1.Tables[1]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); SetColor("A" , this.ultraGrid2);//不合格颜色为红色 } else if (this.ultraTabControl1.Tabs[1].Selected)//检验项目原始记录 { if (smpno.Substring(0, 1) == "X" || smpno.Substring(0, 1) == "Y") { al.Add("UIB100203_COMMZHB_02.SELECT"); } else { al.Add("UIB100203_COMM_02.SELECT"); } al.Add(this.strArr);//检测中心和理化楼区分 al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text); //al.Add(this.strArr);//力学或者金相 //al.Add(this.strSendTP);//是否已发送 this.dataSet2.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (this.ultraGrid4.Rows.Count> 0 && this.ultraGrid3.Rows.Count == 0) { this.ultraGrid4.Rows[0].Activate(); ultraGrid4_MouseDown(null, null); } } else if (this.ultraTabControl1.Tabs[2].Selected)//异常处理 { this.strSmpNo = this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text; this.strSmpCutLoc = this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text; this.strSmpNoType = this.ultraGrid1.ActiveRow.Cells["SMP_NO_TYPE"].Text; //清除项目值 al.Add("UIB100203_COMM_10.SELECT"); al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(this.strArr); this.dataSet3.Tables["Table1"].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; ccp.SourceDataTable = this.dataSet3.Tables["Table1"]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } } catch (Exception ex) { } } //鼠标点击检验项目名称触发事件 private void ultraGrid4_MouseDown(object sender, MouseEventArgs e) { try { if (this.ultraGrid4.ActiveRow == null) return; this.dataSet2.Tables[1].Clear(); this.dataSet2.Tables["yuanshi"].Clear(); int GRID3COLS = 15;//固定的有15列,包括隐藏列 //strQltyCD = this.ultraGrid4.ActiveRow.Cells["QLTY_CD"].Text;//三期编码 strQltyCD2 = this.ultraGrid4.ActiveRow.Cells["QLTY_CD_2"].Text;//二级编码,如拉力,冲击 strQltyCD3 = this.ultraGrid4.ActiveRow.Cells["QLTY_CD_3"].Text;//三级编码,如屈服强度,伸长率 //清除datatable中查询时增加的列,即显示钢卷号等信息的grid的动态列 if (this.dataSet2.Tables[1].Columns.Count > GRID3COLS) { for (int i = this.dataSet2.Tables[1].Columns.Count; i > GRID3COLS; i--) this.dataSet2.Tables[1].Columns.Remove(this.dataSet2.Tables[1].Columns[i - 1]); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.UIB100203"; ccp.MethodName = "doQltyCdQuery"; ccp.ServerParams = new object[] { strQltyCD2, strQltyCD3, strWtbh ,this.strArr , this.strSendTP==null?"":this.strSendTP }; ccp.SourceDataTable = this.dataSet2.Tables["jilu"]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //this.ultraGrid3.DisplayLayout.Bands[0].co //int ix = 0; //foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ultraGrid3.DisplayLayout.Bands[0].Columns) //{ // col.RowLayoutColumnInfo.OriginX = ix * 2; // col.RowLayoutColumnInfo.OriginY = 0; // ix++; //} //列排序 int index = GRID3COLS + 1; for (int i = 0; i < this.dataSet2.Tables[2].Rows.Count; i++) { string strColName = this.dataSet2.Tables[2].Rows[i]["QLTY_OPE_CFNM"].ToString();//a , b, So等 string strColSeq = this.dataSet2.Tables[2].Rows[i]["QLTY_DIS_SEQ"].ToString();//1,2,3等 string strColCD2 = this.dataSet2.Tables[2].Rows[i]["QLTY_CD_2"].ToString();//如拉力,冲击等二级编码 if (strColSeq == "" || strColCD2 != this.strQltyCD2)//若无序号或者无在检验项目中所需要的检验编码(QLTY_OPE_CD),则不进行下面的循环,无意义 { continue; } for (int nextCol = GRID3COLS; nextCol < this.ultraGrid3.DisplayLayout.Bands[0].Columns.Count; nextCol++)//固定的有15列,包括隐藏的两列,从第12列开始排序 { if (this.ultraGrid3.DisplayLayout.Bands[0].Columns[nextCol].Header.Caption == strColName) { this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].Header.VisiblePosition = index; //列排序 this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].Width = 40;//设置列宽 this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;//不可编辑 index++; break; } } } SetColor("A" , this.ultraGrid3);//设置颜色 } catch (Exception ex) { MessageBox.Show("系统异常,请联系技术中心","警告"); } } //横行记录a,b,So的grid,在进行鼠标点击时的操作 //******************************注意********************************* //grid3若新增字段,可能出现查询后字段显示异常的情况。。。。。。。。。。。。。。。注意处理 //若grid3增加了字段,并要移动字段位置,请通过Band and Column Settings -- >Column Arrangement Overview Use Groups and Levels中的字段移动来改变,否则可能出现某些字段无法显示的异常情况。 private void ultraGrid3_MouseDown(object sender, MouseEventArgs e) { try { if (this.ultraGrid3.ActiveRow == null) return; if (sender != null) grid3ActiveRow = this.ultraGrid3.ActiveRow.Index; this.strQltyCD = this.ultraGrid3.ActiveRow.Cells["QLTY_CD"].Text; this.strQltyCD2 = this.ultraGrid3.ActiveRow.Cells["QLTY_CD_2"].Text; this.dataSet2.Tables["yuanshi"].Clear(); this.dataSet2.Tables["shebei"].Clear(); ArrayList list = new ArrayList(); //a,b等值查询 ArrayList al = new ArrayList(); list.Add(al); al.Add("UIB100203_COMM_05.SELECT"); al.Add(this.strLine); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_3"].Text); al.Add(this.strQltyCD2); //设备号、备注等查询 al = new ArrayList(); list.Add(al); al.Add("UIB100203_COMM_06.SELECT"); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(strQltyCD); //隐藏的值和编码 al = new ArrayList(); list.Add(al); al.Add("UIB100203_COMM_07.SELECT"); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(this.strQltyCD2); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComQuery"; ccp.MethodName = "doContQluery"; ccp.ServerParams = new object[] { list }; CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (ccpList.ReturnInfo.Length == 0) { ArrayList aList = ccpList.ReturnObject as ArrayList; if (aList[0] != null) { this.dataSet2.Tables["yuanshi"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["yuanshi"]); tab0.TableName = "yuanshi"; this.dataSet2.Tables["yuanshi"].Merge(tab0); } if (aList[1] != null) { this.dataSet2.Tables["shebei"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["shebei"]); tab0.TableName = "shebei"; this.dataSet2.Tables["shebei"].Merge(tab0); } if (aList[2] != null) { this.dataSet3.Tables["yincang"].Clear(); System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[2] as System.Collections.ArrayList, this.dataSet3.Tables["yincang"]); tab0.TableName = "yincang"; this.dataSet3.Tables["yincang"].Merge(tab0); } } this.textBoxEqumtID.Text = this.dataSet2.Tables["shebei"].Rows[0]["EQUMT_ID"].ToString();//设备号 this.textBoxSmpRmk.Text = this.dataSet2.Tables["shebei"].Rows[0]["SMP_RMK"].ToString();//名称 //记录上一次的CHK,以及下拉绑定 for (int i = 0; i < this.ultraGrid5.Rows.Count; i++) { //if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "Lo") //{ // string strChk = OperateConditionRecode.ReadCondition("UIB100203_CHKLO"); // if(strChk == "False") // { // this.ultraGrid5.Rows[i].Cells["CHK"].Value = "True"; // } // else // { // this.ultraGrid5.Rows[i].Cells["CHK"].Value = "False"; // } // //break; //} if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "FX")//与试样方向绑定 { this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor1; } else if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "MJGG")//与剪切面积绑定 { this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor2; } else if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "CB")//与冷弯绑定 { this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor3; } } } catch (Exception ex) { } } // int activteRowIndex = 0;//活动行 private void ultraGrid5_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据 if (this.ultraGrid5.ActiveCell == null) return; if (this.ultraGrid5.ActiveCell.DataChanged == true)//数据被修改时 { if ((this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "N" || this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "X" ) && this.ultraGrid5.ActiveRow.Cells["CHK"].Text != "True" )//若无计算公式,或者没有被选中的,禁止编辑 { MessageBox.Show("非可修改数据项,数据修改无效!", "提示"); return; } else { //******************************************************** if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == "Lo" && this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "Y") { this.DoUpdate("Lo"); //同步更新到dataset3的对应的单元中 for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++) { if ("Lo" == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()) { this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text; break; } } } else { this.DoUpdate("");//保存试验数据 } //从当前行的下一行开始,计算所有具有计算公式的行 int numCol = this.ultraGrid5.ActiveRow.Index; for (int i = numCol+1; i < this.ultraGrid5.Rows.Count; i++) { this.DoCompVal(i);//按公式计算,当前行的下面第一行 } } } //换行,并编辑 int curRow = this.ultraGrid5.ActiveRow.Index;//当前行的行序号 for (int i = curRow; i <= (this.ultraGrid5.Rows.Count-1) ; i++) { ////==========================未到行末========================== if (i<(this.ultraGrid5.Rows.Count-1)) { if ((this.ultraGrid5.Rows[i + 1].Cells["EDIT_TP"].Text != "N" && this.ultraGrid5.Rows[i + 1].Cells["EDIT_TP"].Text != "X")//若下一行允许编辑 || (/*curRow < (this.ultraGrid5.Rows.Count - 1) && */this.ultraGrid5.Rows[i + 1].Cells["CHK"].Text == "True")//允许编辑 ) { this.ultraGrid5.Rows[i+1].Activate(); this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activated = true; this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode); //this.ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL"].CellActivation = Activation.AllowEdit; //this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Column.CellActivation = Activation.AllowEdit; break; } } ////==========================到达行末========================== else if ( (i == this.ultraGrid5.Rows.Count - 1) || (this.ultraGrid5.Rows[i].Cells["EDIT_TP"].Text == "N" && this.ultraGrid5.Rows[i].Cells["CHK"].Text != "True")//不允许编辑,有计算公式 ) { //***************************************** //////this.DoUpdate();//保存试验数据 //判断数据格式是否合格,为double类型 if (JhyOpe.DcsDouble(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text)) { //数据录入不合格提示 Decimal minValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MIN"].Text == "" ? 0 : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MIN"].Text); Decimal maxValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MAX"].Text == "" ? 999 : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MAX"].Text); ; Decimal qltyValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text == "" ? minValue : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text); if (qltyValue < minValue || qltyValue > maxValue) { this.ultraGrid3.Rows[grid3ActiveRow].RowSelectorAppearance.BackColor = Color.Red; this.ultraGrid3.Rows[grid3ActiveRow].Appearance.ForeColor = Color.Red;// add by mgp 2014/3/3 MessageBox.Show("第" + (grid3ActiveRow+1) + "行不合格!", "提示"); } } //add by mgp 2014/3/3 注销下行代码 ultraGrid4_MouseDown(null , null);//鼠标点击项目名称触发的事件 grid3ActiveRow = grid3ActiveRow + 1; if (grid3ActiveRow < this.ultraGrid3.Rows.Count) { this.ultraGrid3.Rows[grid3ActiveRow].Activate(); ultraGrid3_MouseDown(null, null);//重新触发事件,调用查询方法 } else { grid3ActiveRow = 0;//到行末后,重新归0 MessageBox.Show("数据输入已完成" , "提示"); } //this.ultraGrid5.Rows[0].Activate(); //this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activate(); //this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode); //break; //this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.FirstRowInBand); if (this.ultraGrid5.Rows.Count != 0)//grid3跳转到下一行循环时,可能存在查出无数据的情况 { this.ultraGrid5.Rows[0].Activate(); this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activate(); this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode); //this.ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL"].CellActivation = Activation.AllowEdit; break; } else { //MessageBox.Show("XXX"); } } } } catch (Exception ex) { MessageBox.Show("数据录入异常,可能存在数据格式错误,请检查!" , "提示"); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { try { if (this.checkBox1.Checked) { this.textBox1.Enabled = true; this.textBox2.Enabled = true; } else { this.textBox1.Enabled = false; this.textBox2.Enabled = false; } } catch (Exception ex) { } } private void checkBox2_CheckedChanged(object sender, EventArgs e) { if (this.checkBox2.Checked) { this.ultraDateTimeEditor3.Enabled = true; this.ultraDateTimeEditor4.Enabled = true; } else { this.ultraDateTimeEditor3.Enabled = false; this.ultraDateTimeEditor4.Enabled = false; } } private void textBoxEqumtID_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode != Keys.Enter) return; if (this.ultraGrid3.ActiveRow == null) return; ArrayList al = new ArrayList(); al.Add("UIB100203_COMM_01.UPDATE"); al.Add(this.textBoxEqumtID.Text.Trim()); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(this.strQltyCD2); al.Add(this.strQltyCD); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.ServerParams = new object[] { al }; ccp.MethodName = "doSimpleSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); // this.textBoxSmpRmk.Focus(); this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow); } catch (Exception ex) { } } private void textBoxSmpRmk_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode != Keys.Enter) return; if (this.ultraGrid3.ActiveRow == null) return; ArrayList al = new ArrayList(); al.Add("UIB100203_COMM_02.UPDATE"); al.Add(this.textBoxSmpRmk.Text.Trim()); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text); al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text); al.Add(this.strQltyCD2); al.Add(this.strQltyCD); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.ServerParams = new object[] { al }; ccp.MethodName = "doSimpleSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //this.textBoxEqumtID.Focus(); this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow); } catch (Exception ex) { } } private void ultraGrid5_MouseDown(object sender, MouseEventArgs e) { //try //{ // if (this.ultraGrid5.ActiveRow == null) return; // //只有Lo允许被选中,进行编辑 // if (this.ultraGrid5.ActiveCell.Column.Key == "CHK" ) // { // if (this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "N") // { // this.ultraGrid5.ActiveRow.Cells["CHK"].Value = "True"; // this.ultraGrid5.UpdateData(); // } // else if(this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text =="Lo" ) // { // OperateConditionRecode.WriteCondition("UIB100203_CHKLO", this.ultraGrid5.ActiveRow.Cells["CHK"].Text); // } // } //} //catch (Exception ex) //{ //} } private void checkBox4_CheckedChanged(object sender, EventArgs e) { try { foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { ugr.Cells["CHK"].Value = this.checkBox4.Checked; //ugr.Update(); } this.ultraGrid1.UpdateData(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void checkBox3_CheckedChanged(object sender, EventArgs e) { try { foreach (UltraGridRow ugr in this.ultraGrid3.Rows) { ugr.Cells["CHK"].Value = this.checkBox3.Checked; ugr.Update(); } this.ultraGrid1.UpdateData(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } //Rt0.2,ReL变更 private void comboBox5_SelectedIndexChanged(object sender, EventArgs e) { try { // if (this.ultraGrid3.ActiveRow == null) return; if (MessageBox.Show("确定进行变更?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; foreach (UltraGridRow ugr in this.ultraGrid3.Rows) { if (ugr.Cells["CHK"].Text == "True") { Hashtable ht = new Hashtable(); ht.Add("i1", ugr.Cells["SMP_NO"].Text); ht.Add("i2", ugr.Cells["SMP_CUT_LOC"].Text); ht.Add("i3", ugr.Cells["SMP_NO_TYPE"].Text); ht.Add("i4", ugr.Cells["QLTY_CD"].Text); ht.Add("i5", this.comboBox5.Text.Trim()); ht.Add("i6", this.UserInfo.GetUserName()); ht.Add("o7", ""); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_03.CALL", ht }; CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); ArrayList al = rccp.ReturnObject as ArrayList; if (al[0] == null) return; if (al[0].ToString() == "XX") return; ugr.Cells["QLTY_CD_CFNM"].Value = al[0].ToString(); } } // if (al[0] == null) { MessageBox.Show("操作失败,请检查数据格式!", "提示"); } return; // if (al[0].ToString() == "XX") { MessageBox.Show("操作失败,请检查数据格式!", "提示"); } return; // this.ultraGrid5.ActiveRow.Cells["QLTY_CD_CFNM"].Value = al[0].ToString(); // this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow); // this.ultraGrid2.ActiveRow.Cells["QLTY_VAL_WK"].Activate(); // this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode); } catch (Exception ex) { } } private void checkBox5_CheckedChanged(object sender, EventArgs e) { if (this.checkBox5.Checked) { this.ultraDateTimeEditor1.Enabled = true; this.ultraDateTimeEditor2.Enabled = true; } else { this.ultraDateTimeEditor1.Enabled = false; this.ultraDateTimeEditor2.Enabled = false; } } private void textBox6_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据 if (this.textBox6.Text.ToString().Substring(0, 1) != "L" & this.textBox6.Text.ToString().Substring(0, 1) != "R" & this.textBox6.Text.ToString().Length != 12) { MessageBox.Show("非法委托编号,请修改。(热轧-R,连退-L)" , "提示"); return; } // if (this.textBox3.Text.ToString().Substring(0, 1) != this.textBox6.Text.ToString().Substring(0, 1)) if (this.ultraGrid1.Rows[grid1CurNum].Cells["WEITO_NO"].Text.ToString().Substring(0, 1) != this.textBox6.Text.ToString().Substring(0, 1)) { MessageBox.Show("非法修改,请检查!", "提示"); return; } ArrayList al = new ArrayList(); al.Add("UIB100203_COMM_03.UPDATE"); al.Add(this.textBox6.Text.ToString()); al.Add(this.ultraGrid1.Rows[grid1CurNum].Cells["WEITO_NO"].Text); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.ServerParams = new object[] { al }; ccp.MethodName = "doSimpleSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } catch (Exception ex) { } } private void button1_Click(object sender, EventArgs e) { try { string path = null; if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK) { path = this.folderBrowserDialog1.SelectedPath; this.textBox5.Text = path; OperateConditionRecode.WriteCondition("UIB100203_PATH", this.textBox5.Text); } } catch (Exception ex) { } } //钢印号修改 private void textBox4_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据 try { Hashtable ht = new Hashtable(); ht.Add("i1", this.ultraGrid1.Rows[grid1CurNum].Cells["COIL_NO"].Text); ht.Add("i2", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_NO"].Text); ht.Add("i3", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_CUT_LOC"].Text); ht.Add("i4", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_NO_TYPE"].Text); ht.Add("i5", this.textBox4.Text.Trim()); ht.Add("o6" ,"" ); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHyComCallProc"; ccp.MethodName = "doSimpleProc"; ccp.ServerParams = new object[] { "UIB100203_COMM_04.CALL", ht }; CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); //计算结果返回 ArrayList al = rccp.ReturnObject as ArrayList; if (al[0] == null) return; //if (al[0].ToString() == "XX") return; MessageBox.Show(al[0].ToString() , "提示"); } catch (Exception ex) { } } private void button2_Click(object sender, EventArgs e) { try { if (MessageBox.Show("确定清除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ArrayList al = new ArrayList(); al.Add("UIB100203_COMM_04.UPDATE"); al.Add(this.strSmpNo); al.Add(this.strSmpCutLoc); al.Add(this.strSmpNoType); al.Add(this.ultraComboEditor4.Value.ToString()); al.Add(this.ultraComboEditor4.Value.ToString()); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.JHY.JHYComSave"; ccp.ServerParams = new object[] { al }; ccp.MethodName = "doSimpleSave"; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } catch (Exception ex) { } } } }