| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111 |
- 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;
- namespace Core.LZMes.Client.UIB
- {
- public partial class UIB100220 : FrmBase
- {
- public UIB100220()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- try
- {
- switch (ToolbarKey.ToString())
- {
- case "Query":
- this.DoQuery();
- break;
- case "Send":
- this.DoSend();
- break;
- case "Export":
- this.DoExport();
- break;
- case "OnFile":
- this.DoOnFile();
- break;
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private string strLine = null;//产线
- private string strArea = null;//地点
- private string strSendTP = null;//是否已发送
- private string strWtbh = null;//委托编号
- private int Data1Table5Count = 0;//DataSet1.Table["Table5"]的列数
- public void DoQuery()
- {
- try
- {
- if (this.comboBox1.Text.Trim() == "" || this.comboBox2.Text.Trim() == "")
- {
- MessageBox.Show("请选择产线和实验地点", "提示");
- return;
- }
- OperateConditionRecode.WriteCondition("UIB100220_BOX1", this.comboBox1.Text);
- OperateConditionRecode.WriteCondition("UIB100220_BOX2", this.comboBox2.Text);
- OperateConditionRecode.WriteCondition("UIB100220_BOX3", this.comboBox3.Text);
-
- ArrayList al = new ArrayList();
- //产线
- if (this.comboBox1.Text == "热轧") { al.Add("UIB100220_01_01.SELECT"); strLine = "R"; }
- else if (this.comboBox1.Text == "连退") { al.Add("UIB100220_01_01.SELECT"); strLine = "L"; }
- else if (this.comboBox1.Text == "中板") { al.Add("UIB100220_01.SELECT"); strLine = "ZB"; }
- else if (this.comboBox1.Text == "厚板") { al.Add("UIB100220_01.SELECT"); strLine = "HB"; }
- else if (this.comboBox1.Text == "高棒") { al.Add("UIB100220_01.SELECT"); strLine = "GB"; }
- else if (this.comboBox1.Text == "高线") { al.Add("UIB100220_01.SELECT"); strLine = "GX"; }
- al.Add(strLine);
-
- //地点
- if (this.comboBox2.Text.Trim() == "力学") { strArea = "LX"; }
- else if (this.comboBox2.Text.Trim() == "金相") { strArea = "JX"; }
- else { MessageBox.Show("请区分力学与金相", "提示"); return; }
- al.Add(strArea);
- //是否已发送
- if (this.comboBox3.Text.Trim() == "未发送") { strSendTP = "0"; al.Add(strArea); al.Add(strSendTP); }
- else if (this.comboBox3.Text.Trim() == "已发送") { strSendTP = "1"; al.Add(strArea); al.Add(strSendTP); }
- else if (this.comboBox3.Text.Trim() == "全部") { strSendTP = ""; al.Add(""); al.Add(""); }
- else { MessageBox.Show("请选择发送状态"); return; }
- //委托时间
- al.Add(this.dateTimePicker1.Value.Date.ToString("yyyyMMdd")+"000000");
- al.Add(this.dateTimePicker2.Value.Date.ToString("yyyyMMdd") + "999999");
- 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.Cells["SEND_STAT"].Appearance.BackColor = Color.Blue;
- }
- if (ugr.Cells["WORK_STATS"].Text == "XX")//是否已完成,未完成则显示黄色
- {
- ugr.RowSelectorAppearance.BackColor = Color.Yellow;
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- public void DoSave()
- {
- }
- //发送
- public void DoSend()
- {
- try
- {
- string strSMPNO = null;
- string strSMPCUTLOC = null;
- string strSMPTNOTYPE = null;
- string strMat = 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 (strMat != null)
- {
- coilNum++;
- if (coilNum % SPLITNUM == 0) { splitStr = "\n"; }
- else {splitStr = ",";}
- }
- strMat = strMat + 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" + strMat, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- Hashtable ht = new Hashtable();
- ht.Add("i1", strSMPNO);
- ht.Add("i2", strSMPCUTLOC);
- ht.Add("i3", strSMPTNOTYPE);
- ht.Add("i4", strArea);
- 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_04.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() == "XX"){ MessageBox.Show("部分钢卷发送失败!", "提示");}
- else{MessageBox.Show("发送成功!", "提示");}
- this.DoQuery();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- public void DoExport()
- {
- try
- {
- string strMat = "";//物料号
- string strWtbh = "";//委托单号
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text == "True")
- {
- strMat = strMat + ugr.Cells["MATERIAL_NO"].Text;
- strWtbh = strWtbh + ugr.Cells["WEITO_NO"].Text;
- }
- }
- ArrayList al = new ArrayList();
- if (this.comboBoxExp.Text == "拉力原始记录")
- {
- this.dataSetExport.Tables["Table1"].Clear();
- al.Add("UIB100220_01.EXPORT.SELECT");
- al.Add(strMat);
- al.Add(strWtbh);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHYComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { al };
- ccp.SourceDataTable = this.dataSetExport.Tables["Table1"];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- JhyOpe jo = new JhyOpe();
- jo.Export(this.dataSetExport.Tables["Table1"], this.textBoxPath.Text, "热轧拉力试验原始记录表", "HostLaLi.xls");//拉力导出
- }
- else if (this.comboBoxExp.Text == "冲击原始记录")
- {
- //查询出所需要导出卷的信息
- this.dataSetExport.Tables["Table2"].Clear();
- al.Add("UIB100220_02.EXPORT.SELECT");
- al.Add(strMat);
- al.Add(strWtbh);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHYComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { al };
- ccp.SourceDataTable = this.dataSetExport.Tables["Table2"];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- JhyOpe jo = new JhyOpe();
- jo.Export(this.dataSetExport.Tables["Table2"], this.textBoxPath.Text, "热轧冲击试验原始记录表", "HostChongJi.xls");//拉力导出
- }
- MessageBox.Show("导出成功" , "提示");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- public void DoOnFile()
- {
- }
- private void UIB100220_Load(object sender, EventArgs e)
- {
- try
- {
- /**
- * 1、查询条件初始化
- * 2、过程编码初始化
- * 3、材质代码初始化,用于grid4中的绑定材质代码
- * 4、DataSet1.Table["Table5"]的列数
- * **/
-
- //查询条件初始化
- this.comboBox1.Text = OperateConditionRecode.ReadCondition("UIB100220_BOX1");
- this.comboBox2.Text = OperateConditionRecode.ReadCondition("UIB100220_BOX2");
- this.comboBox3.Text = OperateConditionRecode.ReadCondition("UIB100220_BOX3");
- this.textBoxPath.Text = OperateConditionRecode.ReadCondition("UIB100220_PATH");
- this.comboBoxExp.SelectedIndex = 0;
- //DataSet1.Table["Table5"]的列数
- Data1Table5Count = this.dataSet1.Tables["Table5"].Columns.Count;
- //过程编码和材质代码初始化
- ArrayList list = new ArrayList();
- ArrayList al = new ArrayList();
- al.Add("UIB100220_03.SELECT");
- list.Add(al);
- al.Add("");
- al = new ArrayList();
- al.Add("UIB100220_01.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["Table1"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["Table1"]);
- tab0.TableName = "Table1";
- this.dataSet2.Tables["Table1"].Merge(tab0);
- }
- if (aList[1] != null)
- {
- this.dataSet2.Tables["Table2"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["Table2"]);
- tab0.TableName = "Table2";
- this.dataSet2.Tables["Table2"].Merge(tab0);
- }
- }//end if
- }
- catch (Exception ex)
- {
- MessageBox.Show("系统缺少必要信息,请重新加载","提示");
- //System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- this.textBox1.Enabled = this.checkBox1.Checked;
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //对grid5动态行的处理
- public void grid5ColumnChange(string strQltyCD2, string strQltyCD3 , string strQltyCD)
- {
- // SETUP2:添加动态过程项目到table中
- for (int i = 0; i < this.dataSet2.Tables["Table3"].Rows.Count; i++)
- {
- this.dataSet1.Tables["Table5"].Columns.Add(this.dataSet2.Tables["Table3"].Rows[i]["QLTY_OPE_CFNM"].ToString());
- }
- // SETUP3:对grid5进行操作
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.UIB100220";
- ccp.MethodName = "doQltyCdQuery";
- ccp.ServerParams = new object[] { strQltyCD2, strQltyCD3, strWtbh, this.strArea, this.strSendTP == null ? "" : this.strSendTP, strQltyCD };
- ccp.SourceDataTable = this.dataSet1.Tables["Table5"];
- //this.ultraGrid5.Refresh();
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //设置列宽和不可编辑属性
- int index = Data1Table5Count + 1;
- for (int nextCol = Data1Table5Count; nextCol < this.ultraGrid5.DisplayLayout.Bands[0].Columns.Count; nextCol++)
- {
- this.ultraGrid5.DisplayLayout.Bands[0].Columns[nextCol].Width = 40;//设置列宽
- this.ultraGrid5.DisplayLayout.Bands[0].Columns[nextCol].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;//不可编辑
- }
- }
-
- private void ultraGrid6_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- /**
- *
- * 回车后,首先区分数据已变、未变的情况;未变时需要光标跳动,已变后需要处理数据问题以及光标跳动
- *
- * 针对已变逻辑如下:
- * SETUP1:保存数据,返回修约后的结果和是否合格的标识,回填到隐藏Table
- * SETUP2:从该项开始进行循环,有计算公式的,进行保存计算,回填到隐藏Table
- * SETUP3:通过隐藏的Table,回填到grid5和grid6
- *
- * SETUPA: 如果grid6未到行末,则grid6调到下一行;若grid6到达行末,对grid5换行,并执行查询;需要使得grid6首行的列处于可编辑状态
- * 注意 :DataSet1的Table6和DataSet2的Table4字段是相同的,DataSet2.Tables["Table4"]便是对grid6的隐藏Table
- * **/
- if (e.KeyCode != Keys.Enter) return;
- if (this.ultraGrid6.ActiveCell == null) return;
- if (this.ultraGrid6.ActiveCell.DataChanged == true)
- {
- //数据禁止修改,或数据不符合格式
- string strVal = this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Text.Trim() == "" ? "0" : this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Text.Trim();
- if (this.ultraGrid6.ActiveRow.Cells["EDIT_TP"].Text == "N" || JhyOpe.DcsDouble(strVal) == false)
- {
- MessageBox.Show("数据禁止修改或格式错误", "提示");
- //恢复数据
- this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Value = this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Value.ToString();
- this.ultraGrid6.UpdateData();
- return;
- }
- //数据处理问题
- Grid6KeyDown();
- }
- //光标跳动处理
- CursorMove();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //grid6的回车事件
- private void Grid6KeyDown()
- {
- ArrayList rsList = null;
- //SETUP1.OF 保存数据
- rsList = this.DoUpdate(this.ultraGrid5.ActiveRow.Cells["SMP_NO"].Text, this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text
- , this.ultraGrid5.ActiveRow.Cells["SMP_NO_TYPE"].Text, this.ultraGrid5.ActiveRow.Cells["QLTY_CD_2"].Text
- , this.ultraGrid6.ActiveRow.Cells["QLTY_OPE_CD"].Text, ""
- , this.ultraGrid6.ActiveRow.Cells["QLTY_DIS_LEN"].Text, this.ultraGrid6.ActiveRow.Cells["CRCT_REG"].Text.ToUpper()
- , "", this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Text);
- //SETUP1 OF 回填到隐藏的Table
- int rowTable4 = 0;
- for (int i = 0; i < this.dataSet2.Tables["Table4"].Rows.Count; i++)
- {
- if (this.dataSet2.Tables["Table4"].Rows[i]["QLTY_OPE_CD"].ToString() == this.ultraGrid6.ActiveRow.Cells["QLTY_OPE_CD"].Text)
- {
- this.setValHiddenTable(i, rsList);//回填数据到隐藏的Table
- rowTable4 = i;
- break;
- }
- }
- //SETUP2 OF 有计算公式的进行保存计算
- for (int i = rowTable4; i < this.dataSet2.Tables["Table4"].Rows.Count; i++)
- {
- string strCompVal = this.dataSet2.Tables["Table4"].Rows[i]["COMP_CAL"].ToString();//提取计算公式,如“a*b”
- if (strCompVal == "") continue;
- strCompVal = this.DoCompVal(strCompVal);//返回替换值后的计算公式,如 “12*13”
- rsList = this.DoUpdate(this.ultraGrid5.ActiveRow.Cells["SMP_NO"].Text, this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text
- , this.ultraGrid5.ActiveRow.Cells["SMP_NO_TYPE"].Text, this.ultraGrid5.ActiveRow.Cells["QLTY_CD_2"].Text
- , this.dataSet2.Tables["Table4"].Rows[i]["QLTY_OPE_CD"].ToString(), strCompVal
- , this.dataSet2.Tables["Table4"].Rows[i]["QLTY_DIS_LEN"].ToString(), this.dataSet2.Tables["Table4"].Rows[i]["CRCT_REG"].ToString().ToUpper()
- , "", this.dataSet2.Tables["Table4"].Rows[i]["QLTY_VAL"].ToString());
- //SETUP2 OF 回填到隐藏的Table
- this.setValHiddenTable(i, rsList);
- }
- //SETUP3 回填到grid5、grid6
- for (int i = 0; i < this.dataSet2.Tables["Table4"].Rows.Count; i++)
- {
- //SETUP3.通过隐藏的Table,回填到grid5
- //grid5的动态变化字段,与table的操作编码对应
- setValGrid5(this.dataSet2.Tables["Table4"].Rows[i]["QLTY_OPE_CFNM"].ToString() , this.dataSet2.Tables["Table4"].Rows[i]["QLTY_VAL"].ToString());
-
- if (this.dataSet2.Tables["Table4"].Rows[i]["QLTY_CD"].ToString() == this.ultraGrid5.ActiveRow.Cells["QLTY_CD"].Text )
- {
- //实绩值字段
- setValGrid5("QLTY_VAL", this.dataSet2.Tables["Table4"].Rows[i]["QLTY_VAL"].ToString());
- //判定结果字段
- setValGrid5("QLTY_DCS_RST", this.dataSet2.Tables["Table4"].Rows[i]["QLTY_DCS_RST"].ToString());
- }
- //SETUP3.通过隐藏的Table,回填到grid6
- setValGrid6(this.dataSet2.Tables["Table4"].Rows[i]["QLTY_OPE_CD"].ToString(), this.dataSet2.Tables["Table4"].Rows[i]["QLTY_VAL"].ToString());
- }
- this.ultraGrid5.UpdateData();
- this.ultraGrid6.UpdateData();
- this.dataSet2.Tables["Table4"].AcceptChanges();
- //不合格颜色提示
- string dcsRst = setColor("A" , this.ultraGrid5);
- if (dcsRst == "不合格")
- {
- MessageBox.Show("数据不合格" , "提示");
- }
- }
- //光标跳动处理
- private void CursorMove()
- {
- //换行,并编辑
- int grid6CurRow = this.ultraGrid6.ActiveRow.Index + 1;//下一行的序号
- for (int i = grid6CurRow; i < this.ultraGrid6.Rows.Count; i++)
- {
- //SETUPA OF 如果grid6未到行末,则grid6调到下一行
- if (i + 1 != this.ultraGrid6.Rows.Count)
- {
- if (this.ultraGrid6.Rows[i].Cells["EDIT_TP"].Text == "N")
- {
- i++;//执行i++后,可能到达了行末,所以后面需要重新判断是否到达行末
- }
- else
- {
- //this.ultraGrid6.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
- this.ultraGrid6.Rows[i].Activate();
- this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Activated = true;
- this.ultraGrid6.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- break;
- }
- }
- if (i + 1 == this.ultraGrid6.Rows.Count)// SETUPA OF 如果grid6到达行末,对grid5换行,并执行查询;需要使得grid6首行处于可编辑状态
- {
- this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
- //this.ultraGrid5_ClickCell(null, null);
- this.ultraGrid6.Rows[0].Activate();
- this.ultraGrid6.ActiveRow.Cells["QLTY_VAL"].Activated = true;
- this.ultraGrid6.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- this.ultraGrid6.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);//不明白为什么要写两次才可以进入回车编辑状态
- break;
- }
- }
- }
- private ArrayList DoUpdate(string smpNo, string smpCutLoc, string smpNoType, string qltyCd2
- ,string qltyOpeCd, string strCompVal, string qltyDisLen, string crctReg
- ,string flag, string qltyVal)
- {
- ArrayList al = null;
- try
- {
- Hashtable ht = null;
- ht = new Hashtable();
- ht.Add("i1", smpNo);
- ht.Add("i2", smpCutLoc);
- ht.Add("i3", smpNoType);
- ht.Add("i4", qltyCd2);
- ht.Add("i5", qltyOpeCd);
- ht.Add("i6", strCompVal);//计算公式
- ht.Add("i7", qltyDisLen);//保留位数
- ht.Add("i8", crctReg);//修约规则
- ht.Add("i9", flag);//特殊处理
- ht.Add("i10", qltyVal);
- 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_01.CALL", ht };
- CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- al = rccp.ReturnObject as ArrayList;
- if (al[0] == null) { al = new ArrayList(); }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- return al;
- }
- private string DoCompVal(string strCompVal)
- {
- try
- {
- for (int i = 0; i < this.dataSet2.Tables["Table4"].Rows.Count; i++)
- {
- strCompVal = strCompVal.Replace(this.dataSet2.Tables["Table4"].Rows[i]["QLTY_OPE_CD"].ToString()
- , this.dataSet2.Tables["Table4"].Rows[i]["QLTY_VAL"].ToString());
- //判断公式的字符串是否已经替换完成,未替换完成,则不进行任何操作,进入下一次循环
- Regex r = new Regex(@"[A-Z,a-z]");
- Match m = r.Match(strCompVal);
- if (m.Success) continue;
- strCompVal = strCompVal.Replace("√", "SQRT").Replace("=", "");//开根号处理
- break;
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- return strCompVal;
- }
- //回填实绩值、判定结果到隐藏的Table
- private void setValHiddenTable(int num , ArrayList al)
- {
- try
- {
- string[] str = al[0].ToString().Split(';');
- this.dataSet2.Tables["Table4"].Rows[num]["QLTY_VAL"] = str[0];//回填值
- this.dataSet2.Tables["Table4"].Rows[num]["QLTY_DCS_RST"] = str[1];//回填判定结果
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //回填实绩值、判定结果到grid5
- private void setValGrid5(string coluMnName , string val)
- {
- try
- {
- if (coluMnName != "")
- this.ultraGrid5.ActiveRow.Cells[coluMnName].Value = val;
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //回填实绩值、判定结果到grid6
- private void setValGrid6(string qltyOpeCd, string val)
- {
- try
- {
- for (int j = 0; j < this.dataSet1.Tables["Table6"].Rows.Count; j++)
- {
- if (this.dataSet1.Tables["Table6"].Rows[j]["QLTY_OPE_CD"].ToString() == qltyOpeCd)
- {
- this.dataSet1.Tables["Table6"].Rows[j]["QLTY_VAL"] = val;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //颜色提示,A为不合格颜色
- private string setColor(string flag , Infragistics.Win.UltraWinGrid.UltraGrid grid)
- {
- string dcsRst = "";//不合格为真,合格为假
- if (flag == "A")
- {
- foreach (UltraGridRow ugr in grid.Rows)
- {
- if (ugr.Cells["QLTY_DCS_RST"].Text == "不合格")
- {
- ugr.RowSelectorAppearance.BackColor = Color.Red;
- dcsRst = "不合格";
- //ugr.Appearance.ForeColor = Color.Red;
- }
- else
- {
- ugr.RowSelectorAppearance.BackColor = Color.White;
- }
- }
- }
- return dcsRst;
- }
- private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
- {
- try
- {
- if (this.ultraGrid1.ActiveRow == null) return;
- strWtbh = this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text;//委托编号,全局变量
- ArrayList al = new ArrayList();
- DataTable dt = new DataTable();
- //if (this.ultraTabControl1.SelectedTab.Text == "结果录入")
- if (this.ultraTabControl1.Tabs[3].Selected)
- {
- al.Add("UIB100220_02.SELECT");
- al.Add(this.strArea);
- al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text);
- this.dataSet1.Tables["Table3"].Clear();
- dt = this.dataSet1.Tables["Table3"];
- }
- else if (this.ultraTabControl1.SelectedTab.Text == "检验结果")
- {
- al.Add("UIB100220_06.SELECT");
- al.Add(this.strArea);//检测中心和理化楼区分
- al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text);
- if (this.ultraGrid1.ActiveCell.Column.Key == "MATERIAL_NO")
- {al.Add(this.ultraGrid1.ActiveCell.Value.ToString());}
- else
- {al.Add("");}
- this.dataSet1.Tables["Table2"].Clear();
- dt = this.dataSet1.Tables["Table2"];
- }
- else if (this.ultraTabControl1.SelectedTab.Text == "基本信息")
- {
- al.Add("UIB100220_08.SELECT");
- al.Add(this.strArea);
- al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text);
- this.dataSet1.Tables["Table7"].Clear();
- dt = this.dataSet1.Tables["Table7"];
-
- }
- else if (this.ultraTabControl1.SelectedTab.Text == "异常处理")
- {
- this.textWtbh.Text = this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text;
- this.textGyh.Text = this.ultraGrid1.ActiveRow.Cells["SMP_STEEL_NO"].Text;
- return;
- }
- else
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHYComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { al };
- ccp.SourceDataTable = dt;
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //不合格颜色提示
- if (this.ultraTabControl1.SelectedTab.Text == "检验结果")
- setColor("A", this.ultraGrid2);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void ultraGrid4_ClickCell(object sender, ClickCellEventArgs e)
- {
- if (this.ultraGrid4.ActiveRow == null) return;
- this.dataSet1.Tables["Table5"].Clear();
- this.dataSet1.Tables["Table6"].Clear();
- //清除添加的列
- for (int i = this.dataSet1.Tables["Table5"].Columns.Count; i > Data1Table5Count; i--)
- {
- this.dataSet1.Tables["Table5"].Columns.Remove(this.dataSet1.Tables["Table5"].Columns[i - 1]);
- }
- grid5ColumnChange(this.ultraGrid4.ActiveRow.Cells["QLTY_CD_2"].Text , this.ultraGrid4.ActiveRow.Cells["QLTY_CD_3"].Text ,this.ultraGrid4.ActiveRow.Cells["QLTY_CD"].Text );
- this.ultraTabControl1.Tabs[3].Text = this.ultraGrid4.Rows[0].Cells["QLTY_CD_CFNM"].Text;
- }
- private void ultraGrid7_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.textBoxRmkSB.Text = this.ultraGrid7.ActiveRow.Cells["RMK_1"].Text;//备注
- this.textBoxRmkBZ.Text = this.ultraGrid7.ActiveRow.Cells["RMK_2"].Text;//设备编号
- this.textBoxRmk3.Text = "检测备注";
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
-
- private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- foreach (UltraGridRow ugr in this.ultraGrid5.Rows)
- {
- if(ugr.Selected)
- {
- 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.comboBox6.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_02.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("修改成功" , "提示");
- //ugr.Cells["QLTY_CD_CFNM"].Value = al[0].ToString();
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //设备
- private void textBoxRmkSB_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- if (e.KeyCode != Keys.Enter) return;
- ArrayList al = new ArrayList();
- al.Add("UIB100220_01.UPDATE");
- al.Add(this.textBoxRmkSB.Text.Trim().ToString());
- al.Add(this.textBoxRmkSB.Text.Trim().ToString());
- al.Add(this.ultraGrid7.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid7.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- al.Add(this.ultraGrid7.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHYComSave";
- ccp.ServerParams = new object[] { al };
- ccp.MethodName = "doSimpleSave";
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- this.ultraGrid7.ActiveRow.Cells["RMK_2"].Value = this.textBoxRmkSB.Text.ToString();
- this.ultraGrid7.UpdateData();
- if (sender != null)
- this.textBoxRmkBZ.Focus();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //备注
- private void textBoxRmkBZ_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- if (e.KeyCode != Keys.Enter) return;
- this.ultraGrid7.ActiveRow.Cells["RMK_1"].Value = this.textBoxRmkBZ.Text.ToString();
- textBoxRmkSB_KeyDown(null, e);
- this.ultraGrid7.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
- this.textBoxRmkSB.Focus();
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //委托单号变更
- private void textWtbh_KeyDown(object sender, KeyEventArgs e)
- {
- try
- {
- ArrayList al = new ArrayList();
- al.Add("UIB100220_02.UPDATE");
- al.Add(this.textWtbh.Text.ToString());
- al.Add(this.ultraGrid1.ActiveRow.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)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void textGyh_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
- try
- {
- Hashtable ht = new Hashtable();
- ht.Add("i1", this.ultraGrid1.ActiveRow.Cells["COIL_NO"].Text);
- ht.Add("i2", this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
- ht.Add("i3", this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- ht.Add("i4", this.ultraGrid1.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- ht.Add("i5", this.textGyh.Text.Trim());
- ht.Add("o6", "");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHyComCallProc";
- ccp.MethodName = "doSimpleProc";
- ccp.ServerParams = new object[] { "UIB100203_03.CALL", ht };
- CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //计算结果返回
- ArrayList al = rccp.ReturnObject as ArrayList;
- if (al[0] == null) return;
- MessageBox.Show(al[0].ToString(), "提示");
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- //导出路径修改
- private void button1_Click(object sender, EventArgs e)
- {
- try
- {
-
- string path = null;
- if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
- {
- path = this.folderBrowserDialog1.SelectedPath;
- this.textBoxPath.Text = path;
- OperateConditionRecode.WriteCondition("UIB100220_PATH", this.textBoxPath.Text);
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- Boolean blChkci = false;
- private void label13_Click(object sender, EventArgs e)
- {
- blChkci = !blChkci;
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- ugr.Cells["CHK"].Value = blChkci;
- }
- this.ultraGrid1.UpdateData();
- }
- private void ultraTabControl1_MouseClick(object sender, MouseEventArgs e)
- {
- ultraGrid1_ClickCell(null ,null);
- }
- private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- /*
- * 由于SQL语句查询出来的动态的列,在界面上显示时并不是按照SQL语句中字段的先后顺序排列的。故:
- * SETUP1:查询出检验大类(如拉力)所需要的过程项目(Lo,So等),SQL的ID为UIB100220_03.SELECT
- * SETUP2:将查询出来的过程项目添加到grid5的数据源dataset1.Table5中
- * SETUP2-1:每次点击都需要添加过程项目,故而每次要先删除被添加的项目,否则第二次添加将会出错
- * SETUP2-2:删除dataset1.Table5中添加项,必须知道有多少列是固定的=>在界面初始化时获取固定列
- * SETUP3:对grid5进行操作,给动态列“设置列宽”和“设置可编辑属性”
- * **/
- if (this.ultraGrid3.ActiveRow == null) return;
- //int GRIDCOLS = this.ultraGrid3.DisplayLayout.Bands[0].Columns.Count;
- string strQltyCD2 = this.ultraGrid3.ActiveRow.Cells["QLTY_CD_2"].Text;//二级编码,如拉力,冲击
- string strQltyCD3 = this.ultraGrid3.ActiveRow.Cells["QLTY_CD_3"].Text;//三级编码,如屈服强度,伸长率
- this.dataSet1.Tables["Table4"].Clear();
- this.dataSet1.Tables["Table6"].Clear();
- this.dataSet1.Tables["Table5"].Clear();
- //清除添加的列
- for (int i = this.dataSet1.Tables["Table5"].Columns.Count; i > Data1Table5Count; i--)
- {
- this.dataSet1.Tables["Table5"].Columns.Remove(this.dataSet1.Tables["Table5"].Columns[i - 1]);
- }
- this.dataSet2.Tables["Table3"].Clear();
- this.dataSet2.Tables["Table4"].Clear();
- //SETUP1:初始化工作完成后,进行查询过程项目
- ArrayList list = new ArrayList();
- ArrayList al = new ArrayList();
- al.Add("UIB100220_03.SELECT");//查询大类(如拉力)所对应的操作编码,对应this.dataSet2.Tables["Table3"].Clear();
- al.Add(strQltyCD2);
- list.Add(al);
- al = new ArrayList();
- al.Add("UIB100220_07.SELECT");//查询具体项目名称和编码,对应this.dataSet1.Tables["Table4"].Clear();
- al.Add(strQltyCD2);
- al.Add(strQltyCD3);
- al.Add(strWtbh);
- 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["Table3"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["Table3"]);
- tab0.TableName = "Table3";
- this.dataSet2.Tables["Table3"].Merge(tab0);
- }
- if (aList[1] != null)
- {
- this.dataSet1.Tables["Table4"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet1.Tables["Table4"]);
- tab0.TableName = "Table4";
- this.dataSet1.Tables["Table4"].Merge(tab0);
- }
- }//end if
- this.ultraTabControl1.Tabs[3].Text = this.ultraGrid4.Rows[0].Cells["QLTY_CD_CFNM"].Text;
- grid5ColumnChange(strQltyCD2, strQltyCD3, "");//对grid5动态行的处理
- //不合格颜色提示
- setColor("A", this.ultraGrid5);
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- ///*
- ///录入数据的grid6的需求决定了grid5的查询
- ///
- ///*/
- if (this.ultraGrid5.ActiveRow == null) return;
- this.dataSet1.Tables["Table6"].Clear();
- this.dataSet2.Tables["Table4"].Clear();
- ArrayList list = new ArrayList();
- //grid6的显示,只显示相关过程项目
- ArrayList al = new ArrayList();
- al.Add("UIB100220_05.SELECT");
- al.Add(this.strLine);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["QLTY_CD_3"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["QLTY_CD_2"].Text);
- list.Add(al);
- //grid6的隐藏Table,获取所有大类(如拉力)中的过程项目,并放入this.dataSet2.Tables["Table4"]
- al = new ArrayList();
- al.Add("UIB100220_05.SELECT");
- al.Add(this.strLine);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- al.Add(this.ultraGrid5.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- al.Add("");
- al.Add(this.ultraGrid5.ActiveRow.Cells["QLTY_CD_2"].Text);
- 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.dataSet1.Tables["Table6"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet1.Tables["Table6"]);
- tab0.TableName = "Table6";
- this.dataSet1.Tables["Table6"].Merge(tab0);
- }
- if (aList[1] != null)
- {
- this.dataSet2.Tables["Table4"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["Table4"]);
- tab0.TableName = "Table4";
- this.dataSet2.Tables["Table4"].Merge(tab0);
- }
- }//if end
- foreach (UltraGridRow ugr in this.ultraGrid6.Rows)
- {
- if (ugr.Cells["QLTY_OPE_CD"].Text == "FX")//与试样方向绑定
- {
- ugr.Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor3;
- }
- else if (ugr.Cells["QLTY_OPE_CD"].Text == "CB")//与冷弯值绑定
- {
- ugr.Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor2;
- }
- else if (ugr.Cells["QLTY_OPE_CD"].Text == "MJGG")//与剪切面积绑定
- {
- ugr.Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor4;
- }
- }
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- }//Class end
- }//namespace end
|