| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712 |
- 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;
- using Infragistics.Win;
- namespace Core.LZMes.Client.UIB
- {
- public partial class JHY02 : FrmBase
- {
- public JHY02()
- {
- 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("JHY02_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();
- al.Add("JHY02.SMP_D_SELECT");
- strLine = "R";
- //产线
- if (this.checkBox5.Checked && !string.IsNullOrEmpty(comboBox1.Text) && comboBox1.Text != "全部")
- {
- al.Add(comboBox1.Text);
- }
- else
- {
- 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.checkBox4.Checked)
- {
- al.Add(this.textBox3.Text.Trim());
- }
- else
- {
- al.Add("");
- }
- this.dataSet1.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { "testDao", 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)
- {
- }
- }
- /// <summary>
- /// 发送检测值到质检服务
- /// </summary>
- public void DoSend()
- {
- try
- {
- int SPLITNUM = 3;
- string splitStr = null;
- int coilNum = 0;
- ArrayList specimen_noList = new ArrayList();
- ArrayList al = new ArrayList();
- string specimen_no = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text == "True")
- {
- specimen_noList.Add(ugr.Cells["SPECIMEN_NO"].Text);
- coilNum++;
- if (coilNum % SPLITNUM == 0)
- {
- splitStr = "\n";
- }
- else
- {
- if (string.IsNullOrEmpty(specimen_no))
- {
- splitStr = "";
- }
- else
- {
- splitStr = ",";
- }
- }
- specimen_no = specimen_no + splitStr + ugr.Cells["SPECIMEN_NO"].Text;
- }
- // this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Value = al[0].ToString();
- }
- if(specimen_noList.Count == 0) {
- return;
- }
- if (MessageBox.Show("确定发送以下取样编号:\n" + specimen_no, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.JHY02";
- ccp.MethodName = "doSendQltyValue";
- al.Add(specimen_noList);
- al.Add(this.UserInfo.GetUserName());
- ccp.ServerParams = new object[] { al };
- ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- if (!ccp.ReturnObject.ToString().Equals("200"))
- {
- MessageBox.Show(ccp.ReturnObject.ToString(), "警告");
- }
- else
- {
- MessageBox.Show("发送成功!", "提示");
- }
- this.DoQuery();
- }
- catch (Exception ex)
- {
- MessageBox.Show("系统异常,请联系技术中心", "警告");
- }
- }
- //归档
- 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;
- }
- int SPLITNUM = 3;
- string splitStr = null;
- int coilNum = 0;
- string strspecimen_no_export = "";
- string specimen_no = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- if (ugr.Cells["CHK"].Text == "True")
- {
- coilNum++;
- if (coilNum % SPLITNUM == 0)
- {
- splitStr = "\n";
- }
- else
- {
- if (string.IsNullOrEmpty(specimen_no))
- {
- splitStr = "";
- }
- else
- {
- splitStr = ",";
- }
- }
- strspecimen_no_export = strspecimen_no_export + ugr.Cells["SPECIMEN_NO"].Text;
- specimen_no = specimen_no + splitStr + ugr.Cells["SPECIMEN_NO"].Text;
- }
- }
- if (string.IsNullOrEmpty(strspecimen_no_export))
- {
- return;
- }
- if (MessageBox.Show("确定导出以下取样编号:\n" + specimen_no, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- 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();
- if (this.comboBox3.Text == "拉力原始记录(圆形)" || this.comboBox3.Text == "拉力原始记录(矩形)")
- {
-
- //查询出所需要导出卷的信息
- this.dataSet3.Tables["lldc"].Clear();
- al.Add("JHY02.EXPORT_PULL_SELECT");
- al.Add(strspecimen_no_export);
- al.Add(strspecimen_no_export);
- al.Add(strspecimen_no_export);
- if (this.comboBox3.Text == "拉力原始记录(圆形)")
- {
- al.Add("C");
- }
- else if (this.comboBox3.Text == "拉力原始记录(矩形)")
- {
- al.Add("S");
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { "testDao", al };
- ccp.SourceDataTable = this.dataSet3.Tables["lldc"];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //导出
- if (this.dataSet3.Tables["lldc"].Rows.Count == 0)
- {
- return;
- }
- string strfile = "";
- if (this.comboBox3.Text == "拉力原始记录(圆形)")
- {
- strfile = System.Windows.Forms.Application.StartupPath + "\\JHY02PullY.xls";//模板路径
- }
- else
- {
- strfile = System.Windows.Forms.Application.StartupPath + "\\JHY02PullJ.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]["gyh"].ToString();//钢印号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["grade_name"].ToString();//牌号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["batch_no"].ToString();//轧批号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["material_thk"].ToString();//规格
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["a01"].ToString();//a
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["b01"].ToString();//b
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["a02"].ToString();//a
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["b02"].ToString();//b
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["a03"].ToString();//a
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["b03"].ToString();//b
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FeL/FeH"].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;
- string path = null;
- if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
- {
- path = this.folderBrowserDialog1.SelectedPath;
- }
- else
- {
- return;
- }
- workbook.SaveCopyAs(path + "\\" + this.comboBox3.Text + DateTime.Now.ToString("yyyyMMddHHmmss") + ".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();
- //查询出所需要导出卷的信息
- this.dataSet3.Tables["cjdc"].Clear();
- al.Add("JHY02.EXPORT_CJ_SELECT");
- al.Add(strspecimen_no_export);
- al.Add(strspecimen_no_export);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { "testDao", al };
- ccp.SourceDataTable = this.dataSet3.Tables["cjdc"];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- //导出
- if (this.dataSet3.Tables["cjdc"].Rows.Count == 0)
- {
- return;
- }
- //导出
- string strfile = System.Windows.Forms.Application.StartupPath + "\\JHY02CJ.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]["gyh"].ToString();//钢印号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["grade_name"].ToString();//牌号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["batch_no"].ToString();//轧批号
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["material_thk"].ToString();//规格
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["item_name_d"].ToString();//试样温度
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["item_name_t"].ToString();//试验温度
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["J1"].ToString();//J1
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["J2"].ToString();//J2
- sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["J3"].ToString();//J3
- //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;
- string path = null;
- if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
- {
- path = this.folderBrowserDialog1.SelectedPath;
- }
- else
- {
- return;
- }
- workbook.SaveCopyAs(path + "\\" + this.comboBox3.Text + DateTime.Now.ToString("yyyyMMddHHmmss") + ".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, string column_name)
- {
- 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][column_name] = this.ultraGrid5.ActiveRow.Cells[column_name].Text;
- // this.dataSet3.Tables["yincang"].
- // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i][column_name].ToString());
- this.dataSet3.Tables["yincang"].AcceptChanges();
- // this.dataSet3.AcceptChanges();
- break;
- }
- }
- Hashtable ht = null;
- CoreClientParam ccp = null;
- string process_name = "JHY02_1.CALL";
- if (column_name == "QLTY_VAL1")
- {
- process_name = "JHY02_1.CALL";
- }
- else if (column_name == "QLTY_VAL2")
- {
- process_name = "JHY02_2.CALL";
- }
- else if (column_name == "QLTY_VAL3")
- {
- process_name = "JHY02_3.CALL";
- }
- ht = new Hashtable();
- ht.Add("i1", this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
- ht.Add("i2", this.ultraGrid3.ActiveRow.Cells["SPECIMEN_NO"].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", string.IsNullOrEmpty(this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid5.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- ht.Add("i7", "");//计算公式
- ht.Add("i8", this.ultraGrid5.ActiveRow.Cells["QLTY_DIS_LEN"].Text);//保留位数
- ht.Add("i9", this.ultraGrid5.ActiveRow.Cells["CRCT_REG"].Text.ToUpper());//修约规则
- ht.Add("i10", flag);//处理数据规则
- ht.Add("i11", this.ultraGrid5.ActiveRow.Cells[column_name].Text);
- ht.Add("i12", this.UserInfo.GetUserName());
- ht.Add("o13","");
- ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComCallProc";
- ccp.MethodName = "doSimpleProc";
- ccp.ServerParams = new object[] { "testDao", process_name, ht };
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
-
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("系统异常,请与技术中心联系" , "提示");
- }
- }
- //按公式进行计算
- //colNum为需要计算的行
- public void DoCompVal(int colNum, string column_name)
- {
- 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][column_name].ToString());//this.ultraGrid5.Rows[i].Cells[column_name].Text);
- }
- Regex r = new Regex(@"[A-Z,a-z]");
- Match m = r.Match(strCompVal);
- //判断公式的字符串是否已经替换完成,未替换完成,则不进行任何操作,直接返回
- if (m.Success) return;
- string process_name = "JHY02_1.CALL";
- if (column_name == "QLTY_VAL1")
- {
- process_name = "JHY02_1.CALL";
- }
- else if (column_name == "QLTY_VAL2")
- {
- process_name = "JHY02_2.CALL";
- }
- else if (column_name == "QLTY_VAL3")
- {
- process_name = "JHY02_3.CALL";
- }
- 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["SPECIMEN_NO"].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", string.IsNullOrEmpty(this.ultraGrid5.Rows[colNum].Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid5.Rows[colNum].Cells["SMP_CUT_LOC"].Text);
- ht.Add("i7", strCompVal);//计算公式
- ht.Add("i8", this.ultraGrid5.Rows[colNum].Cells["QLTY_DIS_LEN"].Text);//保留位数
- ht.Add("i9", this.ultraGrid5.Rows[colNum].Cells["CRCT_REG"].Text.ToUpper());//修约规则
- ht.Add("i10", "");//处理数据规则
- ht.Add("i11", "");
- ht.Add("i12", this.UserInfo.GetUserName());
- ht.Add("o13", "");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComCallProc";
- ccp.MethodName = "doSimpleProc";
- ccp.ServerParams = new object[] { "testDao", process_name, 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[column_name].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][column_name] = this.ultraGrid5.Rows[colNum].Cells[column_name].Text;//this.ultraGrid5.ActiveRow.Cells[column_name].Text;
- // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i][column_name].ToString());
- this.dataSet3.Tables["yincang"].AcceptChanges();
- break;
- }
- }
-
- }
- catch (Exception ex)
- {
- MessageBox.Show("计算异常");
- }
- }
- private void JHY02_Load(object sender, EventArgs e)
- {
- try
- {
- this.comboBox1.Text = "全部";//OperateConditionRecode.ReadCondition("UIB100203_1");
- this.comboBox6.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");
- comboBox1.Enabled = false;
- ultraDateTimeEditor3.DateTime = ultraDateTimeEditor3.DateTime = DateTime.Today;
- 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);
- }
- }
- ValueList vlist = new ValueList();
- vlist.ValueListItems.Add("A", "成分");
- vlist.ValueListItems.Add("B", "材质");
- SetGridValuelist(ref ultraGrid1, "SMP_CATG", ref vlist);
- vlist = new ValueList();
- vlist.ValueListItems.Add("0", "无效");
- vlist.ValueListItems.Add("1", "有效");
- SetGridValuelist(ref ultraGrid1, "VALIDFLAG", ref vlist);
- vlist = new ValueList();
- vlist.ValueListItems.Add("0", "未发送");
- vlist.ValueListItems.Add("1", "已发送");
- vlist.ValueListItems.Add("2", "已接收");
- vlist.ValueListItems.Add("3", "已完成");
- vlist.ValueListItems.Add("4", "检化验系统退回");
- SetGridValuelist(ref ultraGrid1, "STATUS", ref vlist);
- vlist = new ValueList();
- vlist.ValueListItems.Add("0", "正常组批");
- vlist.ValueListItems.Add("1", "改判组批");
- SetGridValuelist(ref ultraGrid1, "SOURCE", ref vlist);
- vlist = new ValueList();
- vlist.ValueListItems.Add("0", "未发送");
- vlist.ValueListItems.Add("1", "已发送");
- SetGridValuelist(ref ultraGrid1, "SEND_FLAG", ref vlist);
- //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;
- string smpno = this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text;
- ArrayList al = new ArrayList();
- if (this.ultraTabControl1.Tabs[0].Selected)//检验结果查询
- {
- al.Add("JHY02.QLTY_ITEM_VALUE_SELECT");
- al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
- //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.ComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { "testDao", al };
- ccp.SourceDataTable = this.dataSet1.Tables[1];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- SetColor("A" , this.ultraGrid2);//不合格颜色为红色
- }
- else if (this.ultraTabControl1.Tabs[1].Selected)//检验项目原始记录
- {
- al.Add("JHY02.SMP_D_ITEM_SELECT");
- al.Add(smpno);
- al.Add(smpno);
- this.dataSet2.Tables[0].Clear();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComQuery";
- ccp.MethodName = "doSimpleQuery";
- ccp.ServerParams = new object[] { "testDao", 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 = 26;//固定的有17列,包括隐藏列
- string seq = this.ultraGrid4.ActiveRow.Cells["SEQ"].Text;
- string smp_no = this.ultraGrid4.ActiveRow.Cells["SMP_NO"].Text;
- string specimen_no = this.ultraGrid4.ActiveRow.Cells["SPECIMEN_NO"].Text;
- //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.JHY02";
- ccp.MethodName = "doQltyCdQuery";
- ccp.ServerParams = new object[] { smp_no, specimen_no, seq, strQltyCD2, strQltyCD3};
- 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();//如拉力,冲击等二级编码
- for (int nextCol = GRID3COLS; nextCol < this.ultraGrid3.DisplayLayout.Bands[0].Columns.Count; nextCol++)//固定的有15列,包括隐藏的两列,从第12列开始排序
- {
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[nextCol].Width = 50;//设置列宽
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[nextCol].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;//不可编辑
- if (this.ultraGrid3.DisplayLayout.Bands[0].Columns[nextCol].Header.Caption == strColName)
- {
- this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].Header.VisiblePosition = index; //列排序
- 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;
- if (!string.IsNullOrEmpty(strQltyCD) && strQltyCD != "0")
- {
- comboBox6.Text = "一组";
- panel1.Hide();
- }
- else
- {
- panel1.Show();
- }
-
- 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("JHY02.QLTY_QCMVAL_IMPORT_SELECT");
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SPECIMEN_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- al.Add(string.IsNullOrEmpty(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- //al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_3"].Text);
- al.Add(this.strQltyCD2);
- al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_AFTER"].Text);
- ////设备号、备注等查询
- //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("JHY02.QLTY_QCMVAL_VALUE_SELECT");
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SPECIMEN_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- //al.Add(string.IsNullOrEmpty(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- //al.Add(this.strQltyCD2);
- //al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_AFTER"].Text);
- //隐藏的值和编码
- al = new ArrayList();
- list.Add(al);
- al.Add("JHY02.QLTY_QCMVAL_IMPORT_SELECT2");
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SPECIMEN_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- al.Add(string.IsNullOrEmpty(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- //al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_3"].Text);
- al.Add(this.strQltyCD2);
- al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_AFTER"].Text);
- //隐藏的值和编码
- al = new ArrayList();
- list.Add(al);
- al.Add("JHY02.QLTY_QCMVAL_VALUE_SELECT2");
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SPECIMEN_NO"].Text);
- al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
- //al.Add(string.IsNullOrEmpty(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text) ? "0" : this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
- //al.Add(this.strQltyCD2);
- //al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_AFTER"].Text);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIB.JHY.ComQuery";
- ccp.MethodName = "doContQluery";
- ccp.ServerParams = new object[] {"testDao", 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"]);
- if (tab0 == null || tab0.Rows == null || tab0.Rows.Count == 0)
- {
- if (aList[2] != null)
- {
- tab0 = Common.FixDBManager.ConvertToDataTable(aList[2] 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[1] != null)
- {
- this.dataSet3.Tables["yincang"].Clear();
- System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet3.Tables["yincang"]);
- if (tab0 == null || tab0.Rows == null || tab0.Rows.Count == 0)
- {
- if (aList[3] != null)
- {
- tab0 = Common.FixDBManager.ConvertToDataTable(aList[3] as System.Collections.ArrayList, this.dataSet2.Tables["yuanshi"]);
- }
- }
- 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.Column.Key == "QLTY_VAL1" || this.ultraGrid5.ActiveCell.Column.Key == "QLTY_VAL2" || this.ultraGrid5.ActiveCell.Column.Key == "QLTY_VAL3")
- {
- string column_name = this.ultraGrid5.ActiveCell.Column.Key;
- 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", column_name);
- //同步更新到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][column_name] = this.ultraGrid5.ActiveRow.Cells[column_name].Text;
- break;
- }
- }
- }
- else
- {
- this.DoUpdate("", column_name);//保存试验数据
- }
- //从当前行的下一行开始,计算所有具有计算公式的行
- int numCol = this.ultraGrid5.ActiveRow.Index;
- for (int i = numCol + 1; i < this.ultraGrid5.Rows.Count; i++)
- {
- this.DoCompVal(i, column_name);//按公式计算,当前行的下面第一行
- }
- }
- }
- //换行,并编辑
- 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[column_name].Activated = true;
- this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- //this.ultraGrid5.DisplayLayout.Bands[0].Columns[column_name].CellActivation = Activation.AllowEdit;
- //this.ultraGrid5.ActiveRow.Cells[column_name].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")//不允许编辑,有计算公式
- )
- {
- if (comboBox6.Text == "一组" || column_name == "QLTY_VAL3")
- {
- //*****************************************
- //////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
- if(ultraGrid4.ActiveRow.Index == ultraGrid4.Rows.Count -1) {
- MessageBox.Show("数据输入已完成!", "提示");
- } else {
- if (MessageBox.Show("当前检验项目数据输入已完成!\n是否跳转到下一检验项目?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
- {
- this.ultraGrid4.Rows[ultraGrid4.ActiveRow.Index + 1].Activate();
- ultraGrid4_MouseDown(null, null);//重新触发事件,调用查询方法
- if (ultraGrid3.Rows.Count != 0)
- {
- this.ultraGrid3.Rows[0].Activate();
- ultraGrid3_MouseDown(null, null);//重新触发事件,调用查询方法
- }
- }
- }
- }
- //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_VAL1"].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");
- }
- }
- else
- {
- if (column_name == "QLTY_VAL1")
- {
- this.ultraGrid5.Rows[0].Activate();
- this.ultraGrid5.ActiveRow.Cells["QLTY_VAL2"].Activated = true;
- this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- break;
- }
- else if (column_name == "QLTY_VAL2")
- {
- this.ultraGrid5.Rows[0].Activate();
- this.ultraGrid5.ActiveRow.Cells["QLTY_VAL3"].Activated = true;
- this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
- break;
- }
- }
- }
- }
- }
- }
- 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 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.comboBox1.Enabled = true;
- }
- else
- {
- this.comboBox1.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)
- {
- }
- }
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.checkBox4.Checked)
- {
- this.textBox3.Enabled = true;
- }
- else
- {
- this.textBox3.Enabled = false;
- }
- }
- catch (Exception ex)
- {
- }
- }
- private void comboBox6_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(comboBox6.Text) && comboBox6.Text == "三组")
- {
- ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL2"].Hidden = false;
- ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL3"].Hidden = false;
- }
- else
- {
- ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL2"].Hidden = true;
- ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL3"].Hidden = true;
- }
- }
- public static void SetGridValuelist(ref UltraGrid myGrid, string strColumn, ref ValueList vlist)
- {
- SetGridValuelist(ref myGrid, 0, strColumn, ref vlist);
- }
- /// <summary>
- /// 设置UltraGrid指定列的ValueList,指定Band
- /// </summary>
- /// <param name="myGrid"></param>
- /// <param name="BandIndex"></param>
- /// <param name="strColumn"></param>
- /// <param name="vlist"></param>
- public static void SetGridValuelist(ref UltraGrid myGrid, int BandIndex, string strColumn, ref ValueList vlist)
- {
- bool Contains = GridContainsColumn(myGrid, BandIndex, strColumn);
- try
- {
- if (Contains)
- {
- myGrid.DisplayLayout.Bands[BandIndex].Columns[strColumn].ValueList = vlist;
- //myGrid.DisplayLayout.Bands[BandIndex].Columns[strColumn].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDown;
- }
- }
- catch { }
- }
- public static bool GridContainsColumn(UltraGrid grid, string strColumn)
- {
- return GridContainsColumn(grid, 0, strColumn);
- }
- public static bool GridContainsColumn(UltraGridBand band, string strColumn)
- {
- for (int i = 0; i < band.Columns.Count; i++)
- {
- if (band.Columns[i].Key.Equals(strColumn))
- return true;
- }
- return false;
- }
- public static bool GridContainsColumn(UltraGrid grid, int BandIndex, string strColumn)
- {
- if (BandIndex <= grid.DisplayLayout.Bands.Count - 1)
- {
- for (int i = 0; i < grid.DisplayLayout.Bands[BandIndex].Columns.Count; i++)
- {
- if (grid.DisplayLayout.Bands[BandIndex].Columns[i].Key.Equals(strColumn))
- return true;
- }
- }
- return false;
- }
- }
- }
|