23ee5103843a4a638dee44f7dae42cb017ed5011.svn-base 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using System.Text.RegularExpressions;//正则表达式所在空间
  12. using Infragistics.Win.UltraWinGrid;
  13. using Microsoft.Office.Interop.Excel;
  14. namespace Core.LZMes.Client.UIB
  15. {
  16. public partial class UIB100203 : FrmBase
  17. {
  18. public UIB100203()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. this.DoQuery();
  28. break;
  29. case "Send":
  30. this.DoSend();
  31. break;
  32. case "Export":
  33. this.DoExport();
  34. break;
  35. case "OnFile":
  36. this.DoOnFile();
  37. break;
  38. }
  39. }
  40. string strLine = null;//产线
  41. string strArr = null;//地点
  42. string strWtbh = null;//委托编号
  43. string strQltyCD = null;//材质代码
  44. string strQltyCD2 = null;//二级编码,如拉力,冲击等
  45. string strQltyCD3 = null;//三级编码,如伸长率,屈服强度,抗拉强度等
  46. string strSendTP = null;//是否已发送
  47. int grid3ActiveRow = 0;//保存grid3(a,b,So等横向现实的grid)的当前活动行
  48. string strSmpNo = null;
  49. string strSmpCutLoc = null;
  50. string strSmpNoType = null;
  51. public void DoQuery()
  52. {
  53. try
  54. {
  55. if (this.comboBox1.Text.Trim() == "" || this.comboBox4.Text.Trim() == "")
  56. {
  57. MessageBox.Show("请选择产线和实验地点","提示");
  58. return;
  59. }
  60. OperateConditionRecode.WriteCondition("UIB100203_1", this.comboBox1.Text);
  61. OperateConditionRecode.WriteCondition("UIB100203_2", this.comboBox2.Text);
  62. OperateConditionRecode.WriteCondition("UIB100203_4", this.comboBox4.Text);
  63. this.dataSet1.Clear();
  64. ArrayList al = new ArrayList();
  65. //产线
  66. if (this.comboBox1.Text == "热轧")
  67. {
  68. al.Add("UIB100203_HOST_01.SELECT");
  69. strLine = "R";
  70. }
  71. else if (this.comboBox1.Text == "中厚板")
  72. {
  73. al.Add("UIB100203_HOST_01.SELECT");
  74. strLine = "Z";
  75. }
  76. else if (this.comboBox1.Text == "优特钢")
  77. {
  78. al.Add("UIB100203_HOST_01.SELECT");
  79. strLine = "Y";
  80. }
  81. else
  82. {
  83. al.Add("UIB100203_LIAN_01.SELECT");
  84. strLine = "L";
  85. }/*else if (this.comboBox1.Text == "连退")
  86. {
  87. al.Add("UIB100203_LIAN_01.SELECT");
  88. strLine = "L";
  89. } */
  90. al.Add(strLine);
  91. //地点
  92. if (this.comboBox4.Text.Trim() == "力学")
  93. {
  94. strArr = "LX";
  95. }
  96. else if (this.comboBox4.Text.Trim() == "金相")
  97. {
  98. strArr = "JX";
  99. }
  100. else
  101. {
  102. MessageBox.Show("请区分力学与金相" , "提示");
  103. return;
  104. }
  105. al.Add(strArr);
  106. //是否已发送
  107. if (this.comboBox2.Text == "未发送")
  108. {
  109. strSendTP = "0";
  110. al.Add(strArr);
  111. al.Add(strSendTP);
  112. }
  113. else if (this.comboBox2.Text == "已发送")
  114. {
  115. strSendTP = "1";
  116. al.Add(strArr);
  117. al.Add(strSendTP);
  118. }
  119. else if (this.comboBox2.Text == "全部")
  120. {
  121. al.Add("");
  122. al.Add("");
  123. }
  124. else
  125. {
  126. MessageBox.Show("请选择发送状态", "提示");
  127. return;
  128. }
  129. //入库时间
  130. if (this.checkBox5.Checked)
  131. {
  132. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "000000");
  133. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") + "999999");
  134. }
  135. else
  136. {
  137. al.Add("");
  138. al.Add("");
  139. }
  140. //委托时间
  141. if (this.checkBox2.Checked)
  142. {
  143. al.Add(this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") + "000000");
  144. al.Add(this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd") + "999999");
  145. }
  146. else
  147. {
  148. al.Add("");
  149. al.Add("");
  150. }
  151. //钢卷号
  152. if (this.checkBox1.Checked)
  153. {
  154. al.Add(this.textBox1.Text.Trim());
  155. al.Add(this.textBox2.Text.Trim() == "" ? this.textBox1.Text.Trim() : this.textBox2.Text.Trim());
  156. }
  157. else
  158. {
  159. al.Add("");
  160. al.Add("");
  161. }
  162. this.dataSet1.Tables[0].Clear();
  163. CoreClientParam ccp = new CoreClientParam();
  164. ccp.ServerName = "UIB.JHY.JHYComQuery";
  165. ccp.MethodName = "doSimpleQuery";
  166. ccp.ServerParams = new object[] { al };
  167. ccp.SourceDataTable = this.dataSet1.Tables[0];
  168. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  169. //发送、完成状态颜色显示,发送状态优先
  170. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  171. {
  172. if (ugr.Cells["SEND_STAT"].Text.Substring(0, 1) == "0")//是否已发送,未发送则蓝色
  173. {
  174. //ugr.RowSelectorAppearance.BackColor = Color.Blue;
  175. ugr.Cells["SEND_STAT"].Appearance.BackColor = Color.Blue;
  176. }
  177. if (ugr.Cells["WORK_STATS"].Text == "XX")//是否已完成,未完成则显示黄色
  178. {
  179. ugr.RowSelectorAppearance.BackColor = Color.Yellow;
  180. }
  181. }
  182. }
  183. catch (Exception ex)
  184. {
  185. }
  186. }
  187. //发送数据到三期或冷轧
  188. public void DoSend()
  189. {
  190. try
  191. {
  192. string strSMPNO = null;
  193. string strSMPCUTLOC = null;
  194. string strSMPTNOTYPE = null;
  195. string strCoilNo = null;
  196. int SPLITNUM = 3;
  197. string splitStr = null;
  198. int coilNum = 0;
  199. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  200. {
  201. if (ugr.Cells["CHK"].Text == "True")
  202. {
  203. strSMPNO = strSMPNO + ugr.Cells["SMP_NO"].Text;
  204. strSMPCUTLOC = strSMPCUTLOC + ugr.Cells["SMP_CUT_LOC"].Text;
  205. strSMPTNOTYPE = strSMPTNOTYPE + ugr.Cells["SMP_NO_TYPE"].Text;
  206. if (strCoilNo != null)
  207. {
  208. coilNum++;
  209. if (coilNum % SPLITNUM == 0)
  210. {
  211. splitStr = "\n";
  212. }
  213. else
  214. {
  215. splitStr = ",";
  216. }
  217. }
  218. strCoilNo = strCoilNo + splitStr + ugr.Cells["COIL_NO"].Text;
  219. }
  220. // this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Value = al[0].ToString();
  221. }
  222. if (strSMPNO == null) return;
  223. if (MessageBox.Show("确定发送以下钢卷:\n" + strCoilNo, "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  224. return;
  225. Hashtable ht = new Hashtable();
  226. ht.Add("i1" , strSMPNO);
  227. ht.Add("i2" , strSMPCUTLOC);
  228. ht.Add("i3" , strSMPTNOTYPE);
  229. ht.Add("i4" , strArr);
  230. ht.Add("i5" , this.UserInfo.GetUserName());
  231. ht.Add("o6" , "");
  232. CoreClientParam ccp = new CoreClientParam();
  233. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  234. ccp.MethodName = "doSimpleProc";
  235. ccp.ServerParams = new object[] { "UIB100203_COMM_02.CALL", ht };
  236. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  237. //计算结果返回
  238. ArrayList al = rccp.ReturnObject as ArrayList;
  239. if (al[0] == null) { MessageBox.Show("发送异常!"); return; }
  240. if (al[0].ToString() == "YY")
  241. {
  242. MessageBox.Show("发送成功!", "提示");
  243. }
  244. else if (al[0].ToString() == "XX")
  245. {
  246. MessageBox.Show("部分钢卷发送失败!", "提示");
  247. }
  248. else
  249. {
  250. MessageBox.Show("部分钢卷发送失败:" + al[0].ToString(), "提示");
  251. }
  252. this.DoQuery();
  253. }
  254. catch (Exception ex)
  255. {
  256. }
  257. }
  258. //归档
  259. public void DoOnFile()
  260. {
  261. try
  262. {
  263. if (MessageBox.Show("确定对【" + this.comboBox1.Text.ToString(), "】数据进行归档?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  264. return;
  265. Hashtable ht = new Hashtable();
  266. ht.Add("i1", this.comboBox1.Text.ToString());
  267. ht.Add("i2", this.UserInfo.GetUserName());
  268. ht.Add("o3", "");
  269. CoreClientParam ccp = new CoreClientParam();
  270. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  271. ccp.MethodName = "doSimpleProc";
  272. ccp.ServerParams = new object[] { "UIB100203_COMM_05.CALL", ht };
  273. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  274. ArrayList al = rccp.ReturnObject as ArrayList;
  275. if (al[0] == null) return;
  276. if (al[0].ToString() == "XX")
  277. {
  278. MessageBox.Show("数据归档失败!" , "提示");
  279. return;
  280. }
  281. MessageBox.Show("数据归档成功!" , "提示");
  282. }
  283. catch (Exception ex)
  284. {
  285. }
  286. }
  287. //导出
  288. public void DoExport()
  289. {
  290. if (this.comboBox3.Text == "")
  291. {
  292. MessageBox.Show("请选择导出类别" , "提示");
  293. return;
  294. }
  295. if (this.textBox5.Text.Trim() == "")
  296. {
  297. MessageBox.Show("请选择导出路径" , "提示");
  298. return;
  299. }
  300. string strCoil = null;
  301. string strWtbh = null;
  302. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  303. {
  304. if (ugr.Cells["CHK"].Text == "True")
  305. {
  306. strCoil = strCoil + ugr.Cells["COIL_NO"].Text;
  307. strWtbh = strWtbh + ugr.Cells["WEITO_NO"].Text;
  308. }
  309. //ugr.Update();
  310. }
  311. if (strCoil == null)
  312. {
  313. MessageBox.Show("没有选择需要导出的钢卷", "提示");
  314. return;
  315. }
  316. ApplicationClass ExcelApp = null;
  317. Microsoft.Office.Interop.Excel.Application excel = null;
  318. Microsoft.Office.Interop.Excel.Workbooks workbooks = null;
  319. Microsoft.Office.Interop.Excel._Workbook workbook = null;
  320. Microsoft.Office.Interop.Excel.Sheets sheets = null;
  321. Microsoft.Office.Interop.Excel.Worksheet sheet = null;
  322. try
  323. {
  324. ArrayList al = new ArrayList();
  325. string filename = null;
  326. if (this.comboBox3.Text == "拉力原始记录")
  327. {
  328. //查询出所需要导出卷的信息
  329. this.dataSet3.Tables["lldc"].Clear();
  330. al.Add("UIB100203_COMM_08.SELECT");
  331. al.Add(strCoil);
  332. al.Add(strWtbh);
  333. CoreClientParam ccp = new CoreClientParam();
  334. ccp.ServerName = "UIB.JHY.JHYComQuery";
  335. ccp.MethodName = "doSimpleQuery";
  336. ccp.ServerParams = new object[] { al };
  337. ccp.SourceDataTable = this.dataSet3.Tables["lldc"];
  338. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  339. //导出
  340. string strfile = System.Windows.Forms.Application.StartupPath + "\\HostLaLi.xls";//模板路径
  341. ExcelApp = new ApplicationClass();
  342. excel = new Microsoft.Office.Interop.Excel.Application();
  343. workbooks = excel.Workbooks;
  344. workbook = workbooks.Add(strfile);
  345. sheets = workbook.Sheets;
  346. sheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets[1];
  347. int startRow = 5;//模板数据填充从第五行开始
  348. Range range = null;
  349. int i = 0;
  350. int j = 1;
  351. for (i = 0; i < this.dataSet3.Tables["lldc"].Rows.Count; i++)
  352. {
  353. j = 1;
  354. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_STEEL_NO"].ToString();//钢印号
  355. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["SPEC_STL_GRD"].ToString();//牌号
  356. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_NO"].ToString();//钢卷
  357. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["COIL_THK"].ToString();//规格
  358. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LA"].ToString();//a
  359. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LB"].ToString();//b
  360. j++;
  361. j++;
  362. j++;
  363. j++;
  364. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FE"].ToString();//Fe
  365. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FM"].ToString();//Fm
  366. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LO"].ToString();//Lo
  367. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LU"].ToString();//Lu
  368. // sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["ZJ"].ToString();//直径
  369. // sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["CB"].ToString();//冷弯
  370. }
  371. //Range ra = sheet.get_Range(sheet.Cells[5, 1], sheet.Cells[5, 1]);
  372. //ra.Select();
  373. range = sheet.get_Range(sheet.Cells[startRow, 1], sheet.Cells[startRow+(i-1), j-1+3]);//(Range)sheet.Rows[6, 1];
  374. range.Borders.LineStyle = 1;
  375. range.NumberFormatLocal = "@";//设置单元格格式为文本
  376. range.RowHeight = 22.5;
  377. //range.HorizontalAlignment = XlHAlign.xlHAlignLeft;//字体左靠
  378. // range.RowHeight = 24;
  379. // System.DateTime dt = System.DateTime.Now;
  380. // string TimeNow = string.Format("{0:yyyyMMddHHmmssffff}", dt);
  381. workbook.Saved = true;
  382. workbook.SaveCopyAs(this.textBox5.Text + "\\热轧拉力试验原始记录表" + ".xls");
  383. excel.DisplayAlerts = false;
  384. excel.AlertBeforeOverwriting = false;
  385. workbooks.Close();
  386. workbook = null;
  387. excel.Quit();
  388. excel = null;
  389. ExcelApp.Quit();
  390. ExcelApp = null;
  391. }
  392. else if (this.comboBox3.Text == "冲击原始记录")
  393. {
  394. //查询出所需要导出卷的信息
  395. this.dataSet3.Tables["cjdc"].Clear();
  396. //产线
  397. if (this.comboBox1.Text == "热轧")
  398. {
  399. al.Add("UIB100203_COMM_091.SELECT");
  400. }
  401. else
  402. {
  403. al.Add("UIB100203_COMM_092.SELECT");
  404. }
  405. // al.Add("UIB100203_COMM_091.SELECT");
  406. al.Add(strCoil);
  407. al.Add(strWtbh);
  408. CoreClientParam ccp = new CoreClientParam();
  409. ccp.ServerName = "UIB.JHY.JHYComQuery";
  410. ccp.MethodName = "doSimpleQuery";
  411. ccp.ServerParams = new object[] { al };
  412. ccp.SourceDataTable = this.dataSet3.Tables["cjdc"];
  413. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  414. //导出
  415. string strfile = System.Windows.Forms.Application.StartupPath + "\\HostChongJi.xls";//模板路径
  416. ExcelApp = new ApplicationClass();
  417. excel = new Microsoft.Office.Interop.Excel.Application();
  418. workbooks = excel.Workbooks;
  419. workbook = workbooks.Add(strfile);
  420. sheets = workbook.Sheets;
  421. sheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets[1];
  422. int startRow = 5;//模板数据填充从第五行开始
  423. Range range = null;
  424. int i = 0;
  425. int j = 1;
  426. for (i = 0; i < this.dataSet3.Tables["cjdc"].Rows.Count; i++)
  427. {
  428. j = 1;
  429. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_STEEL_NO"].ToString();//钢印号
  430. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["SPEC_STL_GRD"].ToString();//牌号
  431. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_NO"].ToString();//钢卷
  432. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["COIL_THK"].ToString();//规格
  433. //j++;//试样宽度
  434. //j++;//试样方向
  435. //j++;//温度
  436. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_SIZ"].ToString();//A1
  437. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_DIR"].ToString();//A2
  438. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["QLTY_TEM"].ToString();//A3
  439. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A1"].ToString();//A1
  440. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A2"].ToString();//A2
  441. sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["cjdc"].Rows[i]["A3"].ToString();//A3
  442. //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["FM"].ToString();//Fm
  443. //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LO"].ToString();//Lo
  444. //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["LU"].ToString();//Lu
  445. //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["ZJ"].ToString();//直径
  446. //sheet.Cells[startRow + i, j++] = this.dataSet3.Tables["lldc"].Rows[i]["CB"].ToString();//冷弯
  447. }
  448. //设置样式
  449. range = sheet.get_Range(sheet.Cells[startRow, 1], sheet.Cells[startRow + (i - 1), j - 1 + 1]);//(Range)sheet.Rows[6, 1];
  450. range.Borders.LineStyle = 1;
  451. range.NumberFormatLocal = "@";//设置单元格格式为文本
  452. range.RowHeight = 22.5;
  453. workbook.Saved = true;
  454. workbook.SaveCopyAs(this.textBox5.Text + "\\热轧冲击试验原始记录表" + ".xls");
  455. excel.DisplayAlerts = false;
  456. excel.AlertBeforeOverwriting = false;
  457. workbooks.Close();
  458. workbook = null;
  459. excel.Quit();
  460. excel = null;
  461. ExcelApp.Quit();
  462. ExcelApp = null;
  463. }
  464. else
  465. return;
  466. MessageBox.Show("导出成功!" , "提示");
  467. }
  468. catch (Exception ex)
  469. {
  470. MessageBox.Show("导出失败!"+ex.ToString() , "提示");
  471. }
  472. finally
  473. {
  474. try
  475. {
  476. if (workbooks != null)
  477. workbooks.Close();
  478. if (excel != null)
  479. excel.Quit();
  480. if (ExcelApp != null)
  481. ExcelApp.Quit();
  482. }
  483. catch (Exception ex)
  484. {
  485. MessageBox.Show("error");
  486. }
  487. GC.Collect();
  488. }
  489. }
  490. //设置颜色
  491. //若为A,判断值是否合格
  492. public void SetColor(string flag , Infragistics.Win.UltraWinGrid.UltraGrid grid)
  493. {
  494. try
  495. {
  496. if (flag == "A")
  497. {
  498. Decimal minValue = 0;
  499. Decimal maxValue = 0;
  500. Decimal qltyValue = 0;
  501. foreach (UltraGridRow ugr in grid.Rows)
  502. {
  503. if (ugr.Cells["QLTY_VAL"].Text.Trim() == "")
  504. {
  505. ugr.RowSelectorAppearance.BackColor = Color.Yellow;
  506. continue;
  507. }
  508. else if (ugr.Cells["QLTY_VAL"].Text.Trim() == "不合格")
  509. {
  510. ugr.RowSelectorAppearance.BackColor = Color.Red;
  511. continue;
  512. }
  513. else if (ugr.Cells["QLTY_VAL"].Text.Trim() == "合格")
  514. {
  515. continue;
  516. }
  517. minValue = Convert.ToDecimal(ugr.Cells["QLTY_MIN"].Text == "" ? 0 : Convert.ToDecimal(ugr.Cells["QLTY_MIN"].Text));
  518. maxValue = Convert.ToDecimal(ugr.Cells["QLTY_MAX"].Text == "" ? 9999 : Convert.ToDecimal(ugr.Cells["QLTY_MAX"].Text));
  519. qltyValue = Convert.ToDecimal(ugr.Cells["QLTY_VAL"].Text.Trim());
  520. if (qltyValue < minValue || qltyValue > maxValue)
  521. {
  522. ugr.RowSelectorAppearance.BackColor = Color.Red;
  523. }
  524. }
  525. }
  526. }
  527. catch (Exception ex)
  528. {
  529. }
  530. }
  531. //无计算公式,直接输入数据
  532. public void DoUpdate(string flag)
  533. {
  534. try
  535. {
  536. if (this.ultraGrid5.ActiveCell == null) return;
  537. if (this.ultraGrid5.ActiveCell.DataChanged == true)
  538. {
  539. //同步更新到dataset3的对应的单元中
  540. for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++)
  541. {
  542. if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString())
  543. {
  544. this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text;
  545. // this.dataSet3.Tables["yincang"].
  546. // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString());
  547. this.dataSet3.Tables["yincang"].AcceptChanges();
  548. // this.dataSet3.AcceptChanges();
  549. break;
  550. }
  551. }
  552. Hashtable ht = null;
  553. CoreClientParam ccp = null;
  554. ht = new Hashtable();
  555. ht.Add("i1", this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  556. ht.Add("i2", this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  557. ht.Add("i3", this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  558. ht.Add("i4", this.strQltyCD2);
  559. ht.Add("i5", this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text);
  560. ht.Add("i6", "");//计算公式
  561. ht.Add("i7", this.ultraGrid5.ActiveRow.Cells["QLTY_DIS_LEN"].Text);//保留位数
  562. ht.Add("i8", this.ultraGrid5.ActiveRow.Cells["CRCT_REG"].Text.ToUpper());//修约规则
  563. ht.Add("i9", flag);//处理数据规则
  564. ht.Add("i10", this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text);
  565. ht.Add("i11", this.UserInfo.GetUserName());
  566. ht.Add("o12","");
  567. ccp = new CoreClientParam();
  568. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  569. ccp.MethodName = "doSimpleProc";
  570. ccp.ServerParams = new object[] { "UIB100203_COMM_01.CALL", ht };
  571. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  572. }
  573. }
  574. catch (Exception ex)
  575. {
  576. MessageBox.Show("系统异常,请与技术中心联系" , "提示");
  577. }
  578. }
  579. //按公式进行计算
  580. //colNum为需要计算的行
  581. public void DoCompVal(int colNum)
  582. {
  583. try
  584. {
  585. //判断该行是否存在,不存在则返回
  586. if (colNum >= this.ultraGrid5.Rows.Count) return;
  587. string strCompVal = this.ultraGrid5.Rows[colNum].Cells["COMP_CAL"].Text;//计算公式
  588. if (strCompVal == "") return;
  589. //若伸长率定标,则禁止计算
  590. if (this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text == "Lo" && this.ultraGrid5.Rows[colNum].Cells["EDIT_TP"].Text == "X")
  591. {
  592. return;
  593. }
  594. for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++)
  595. {
  596. strCompVal = strCompVal.Replace(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString()//this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text
  597. , this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString());//this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].Text);
  598. }
  599. Regex r = new Regex(@"[A-Z,a-z]");
  600. Match m = r.Match(strCompVal);
  601. //判断公式的字符串是否已经替换完成,未替换完成,则不进行任何操作,直接返回
  602. if(m.Success)return;
  603. strCompVal = strCompVal.Replace("√", "SQRT").Replace("=","");//开根号处理
  604. Hashtable ht = new Hashtable();
  605. ht.Add("i1", this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  606. ht.Add("i2", this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  607. ht.Add("i3", this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  608. ht.Add("i4", this.strQltyCD2);
  609. ht.Add("i5", this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text);
  610. ht.Add("i6", strCompVal);//计算公式
  611. ht.Add("i7", this.ultraGrid5.Rows[colNum].Cells["QLTY_DIS_LEN"].Text);//保留位数
  612. ht.Add("i8", this.ultraGrid5.Rows[colNum].Cells["CRCT_REG"].Text.ToUpper());//修约规则
  613. ht.Add("i9", "");//处理数据规则
  614. ht.Add("i10", "");
  615. ht.Add("i11",this.UserInfo.GetUserName());
  616. ht.Add("o12", "");
  617. CoreClientParam ccp = new CoreClientParam();
  618. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  619. ccp.MethodName = "doSimpleProc";
  620. ccp.ServerParams = new object[] { "UIB100203_COMM_01.CALL", ht };
  621. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  622. //计算结果返回
  623. ArrayList al = rccp.ReturnObject as ArrayList;
  624. if (al[0] == null) return;
  625. if (al[0].ToString() == "XX") return;
  626. this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Value = al[0].ToString();
  627. // this.ultraGrid3.ActiveRow.Cells[this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text].Value = al[0].ToString();
  628. this.ultraGrid5.UpdateData();
  629. this.ultraGrid3.UpdateData();
  630. //同步更新到dataset3的对应的单元中
  631. for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++)
  632. {
  633. // if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString())
  634. if (this.ultraGrid5.Rows[colNum].Cells["QLTY_OPE_CD"].Text == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString())
  635. //DefaultView
  636. {
  637. this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.Rows[colNum].Cells["QLTY_VAL"].Text;//this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text;
  638. // MessageBox.Show(this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"].ToString());
  639. this.dataSet3.Tables["yincang"].AcceptChanges();
  640. break;
  641. }
  642. }
  643. }
  644. catch (Exception ex)
  645. {
  646. MessageBox.Show("计算异常");
  647. }
  648. }
  649. private void UIB100203_Load(object sender, EventArgs e)
  650. {
  651. try
  652. {
  653. this.comboBox1.Text = OperateConditionRecode.ReadCondition("UIB100203_1");
  654. this.comboBox2.Text = OperateConditionRecode.ReadCondition("UIB100203_2");
  655. this.comboBox4.Text = OperateConditionRecode.ReadCondition("UIB100203_4");
  656. this.textBox5.Text = OperateConditionRecode.ReadCondition("UIB100203_PATH");
  657. this.comboBox3.SelectedIndex = 0;//导出
  658. //this.comboBox2.SelectedIndex = 2;
  659. ArrayList list = new ArrayList();
  660. //列名排序查询
  661. // this.dataSet2.Tables[2].Clear();
  662. ArrayList al = new ArrayList();
  663. al.Add("UIB100203_01.INITSELECT");//页面初始化调用,用于编码的排序
  664. list.Add(al);
  665. al = new ArrayList();
  666. al.Add("UIB100203_02.INITSELECT");//材质代码与材质名称
  667. list.Add(al);
  668. CoreClientParam ccp = new CoreClientParam();
  669. ccp.ServerName = "UIB.JHY.JHYComQuery";
  670. ccp.MethodName = "doContQluery";
  671. ccp.ServerParams = new object[] { list };
  672. CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  673. if (ccpList.ReturnInfo.Length == 0)
  674. {
  675. ArrayList aList = ccpList.ReturnObject as ArrayList;
  676. if (aList[0] != null)
  677. {
  678. this.dataSet2.Tables["paixu"].Clear();
  679. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["paixu"]);
  680. tab0.TableName = "paixu";
  681. this.dataSet2.Tables["paixu"].Merge(tab0);
  682. }
  683. if (aList[1] != null)
  684. {
  685. this.dataSet2.Tables["qltycd"].Clear();
  686. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["qltycd"]);
  687. tab0.TableName = "qltycd";
  688. this.dataSet2.Tables["qltycd"].Merge(tab0);
  689. }
  690. }
  691. //CoreClientParam ccp1 = new CoreClientParam();
  692. //ccp1.ServerName = "UIB.JHY.JHYComQuery";
  693. //ccp1.MethodName = "doSimpleQuery";
  694. //ccp1.ServerParams = new object[] { al };
  695. //ccp1.SourceDataTable = this.dataSet2.Tables[2];
  696. //this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal);
  697. }
  698. catch (Exception ex)
  699. {
  700. }
  701. }
  702. int grid1CurNum = 0;
  703. //点击上面的grid
  704. private void ultraGrid1_MouseDown(object sender, MouseEventArgs e)
  705. {
  706. try
  707. {
  708. if(this.ultraGrid1.ActiveRow == null)
  709. return;
  710. // if (this.ultraGrid1.ActiveCell.Column.Key == "CHK")
  711. // return;
  712. grid1CurNum = this.ultraGrid1.ActiveRow.Index;
  713. strWtbh = this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text;
  714. string smpno = this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text;
  715. ArrayList al = new ArrayList();
  716. if (this.ultraTabControl1.Tabs[0].Selected)//检验结果查询
  717. {
  718. if (this.ultraGrid1.ActiveCell.Column.Key == "COIL_NO"
  719. || this.ultraGrid1.ActiveCell.Column.Key == "CHK")
  720. {
  721. al.Add("UIB100203_COMM_01_1.SELECT");
  722. al.Add(this.strArr);//检测中心和理化楼区分
  723. al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_NO"].Text);
  724. //al.Add(this.strArr);//力学或者金相
  725. //al.Add(this.strSendTP);//是否已发送
  726. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
  727. }
  728. else
  729. {
  730. if (smpno.Substring(0, 1) == "X" || smpno.Substring(0, 1) == "Y")
  731. {
  732. al.Add("UIB100203_COMMZHB_01.SELECT");
  733. }
  734. else
  735. {
  736. al.Add("UIB100203_COMM_01.SELECT");
  737. }
  738. al.Add(this.strArr);//检测中心和理化楼区分
  739. al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text);
  740. // al.Add(this.strArr);//力学或者金相
  741. // al.Add(this.strSendTP);//是否已发送
  742. }
  743. this.dataSet1.Tables[1].Clear();
  744. CoreClientParam ccp = new CoreClientParam();
  745. ccp.ServerName = "UIB.JHY.JHYComQuery";
  746. ccp.MethodName = "doSimpleQuery";
  747. ccp.ServerParams = new object[] { al };
  748. ccp.SourceDataTable = this.dataSet1.Tables[1];
  749. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  750. SetColor("A" , this.ultraGrid2);//不合格颜色为红色
  751. }
  752. else if (this.ultraTabControl1.Tabs[1].Selected)//检验项目原始记录
  753. {
  754. if (smpno.Substring(0, 1) == "X" || smpno.Substring(0, 1) == "Y")
  755. {
  756. al.Add("UIB100203_COMMZHB_02.SELECT");
  757. }
  758. else
  759. {
  760. al.Add("UIB100203_COMM_02.SELECT");
  761. }
  762. al.Add(this.strArr);//检测中心和理化楼区分
  763. al.Add(this.ultraGrid1.ActiveRow.Cells["WEITO_NO"].Text);
  764. //al.Add(this.strArr);//力学或者金相
  765. //al.Add(this.strSendTP);//是否已发送
  766. this.dataSet2.Tables[0].Clear();
  767. CoreClientParam ccp = new CoreClientParam();
  768. ccp.ServerName = "UIB.JHY.JHYComQuery";
  769. ccp.MethodName = "doSimpleQuery";
  770. ccp.ServerParams = new object[] { al };
  771. ccp.SourceDataTable = this.dataSet2.Tables[0];
  772. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  773. if (this.ultraGrid4.Rows.Count> 0 && this.ultraGrid3.Rows.Count == 0)
  774. {
  775. this.ultraGrid4.Rows[0].Activate();
  776. ultraGrid4_MouseDown(null, null);
  777. }
  778. }
  779. else if (this.ultraTabControl1.Tabs[2].Selected)//异常处理
  780. {
  781. this.strSmpNo = this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text;
  782. this.strSmpCutLoc = this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text;
  783. this.strSmpNoType = this.ultraGrid1.ActiveRow.Cells["SMP_NO_TYPE"].Text;
  784. //清除项目值
  785. al.Add("UIB100203_COMM_10.SELECT");
  786. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);
  787. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  788. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  789. al.Add(this.strArr);
  790. this.dataSet3.Tables["Table1"].Clear();
  791. CoreClientParam ccp = new CoreClientParam();
  792. ccp.ServerName = "UIB.JHY.JHYComQuery";
  793. ccp.MethodName = "doSimpleQuery";
  794. ccp.ServerParams = new object[] { al };
  795. ccp.SourceDataTable = this.dataSet3.Tables["Table1"];
  796. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  797. }
  798. }
  799. catch (Exception ex)
  800. {
  801. }
  802. }
  803. //鼠标点击检验项目名称触发事件
  804. private void ultraGrid4_MouseDown(object sender, MouseEventArgs e)
  805. {
  806. try
  807. {
  808. if (this.ultraGrid4.ActiveRow == null)
  809. return;
  810. this.dataSet2.Tables[1].Clear();
  811. this.dataSet2.Tables["yuanshi"].Clear();
  812. int GRID3COLS = 15;//固定的有15列,包括隐藏列
  813. //strQltyCD = this.ultraGrid4.ActiveRow.Cells["QLTY_CD"].Text;//三期编码
  814. strQltyCD2 = this.ultraGrid4.ActiveRow.Cells["QLTY_CD_2"].Text;//二级编码,如拉力,冲击
  815. strQltyCD3 = this.ultraGrid4.ActiveRow.Cells["QLTY_CD_3"].Text;//三级编码,如屈服强度,伸长率
  816. //清除datatable中查询时增加的列,即显示钢卷号等信息的grid的动态列
  817. if (this.dataSet2.Tables[1].Columns.Count > GRID3COLS)
  818. {
  819. for (int i = this.dataSet2.Tables[1].Columns.Count; i > GRID3COLS; i--)
  820. this.dataSet2.Tables[1].Columns.Remove(this.dataSet2.Tables[1].Columns[i - 1]);
  821. }
  822. CoreClientParam ccp = new CoreClientParam();
  823. ccp.ServerName = "UIB.JHY.UIB100203";
  824. ccp.MethodName = "doQltyCdQuery";
  825. ccp.ServerParams = new object[] { strQltyCD2, strQltyCD3, strWtbh ,this.strArr , this.strSendTP==null?"":this.strSendTP };
  826. ccp.SourceDataTable = this.dataSet2.Tables["jilu"];
  827. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  828. //this.ultraGrid3.DisplayLayout.Bands[0].co
  829. //int ix = 0;
  830. //foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ultraGrid3.DisplayLayout.Bands[0].Columns)
  831. //{
  832. // col.RowLayoutColumnInfo.OriginX = ix * 2;
  833. // col.RowLayoutColumnInfo.OriginY = 0;
  834. // ix++;
  835. //}
  836. //列排序
  837. int index = GRID3COLS + 1;
  838. for (int i = 0; i < this.dataSet2.Tables[2].Rows.Count; i++)
  839. {
  840. string strColName = this.dataSet2.Tables[2].Rows[i]["QLTY_OPE_CFNM"].ToString();//a , b, So等
  841. string strColSeq = this.dataSet2.Tables[2].Rows[i]["QLTY_DIS_SEQ"].ToString();//1,2,3等
  842. string strColCD2 = this.dataSet2.Tables[2].Rows[i]["QLTY_CD_2"].ToString();//如拉力,冲击等二级编码
  843. if (strColSeq == "" || strColCD2 != this.strQltyCD2)//若无序号或者无在检验项目中所需要的检验编码(QLTY_OPE_CD),则不进行下面的循环,无意义
  844. {
  845. continue;
  846. }
  847. for (int nextCol = GRID3COLS; nextCol < this.ultraGrid3.DisplayLayout.Bands[0].Columns.Count; nextCol++)//固定的有15列,包括隐藏的两列,从第12列开始排序
  848. {
  849. if (this.ultraGrid3.DisplayLayout.Bands[0].Columns[nextCol].Header.Caption == strColName)
  850. {
  851. this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].Header.VisiblePosition = index; //列排序
  852. this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].Width = 40;//设置列宽
  853. this.ultraGrid3.DisplayLayout.Bands[0].Columns[strColName].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;//不可编辑
  854. index++;
  855. break;
  856. }
  857. }
  858. }
  859. SetColor("A" , this.ultraGrid3);//设置颜色
  860. }
  861. catch (Exception ex)
  862. {
  863. MessageBox.Show("系统异常,请联系技术中心","警告");
  864. }
  865. }
  866. //横行记录a,b,So的grid,在进行鼠标点击时的操作
  867. //******************************注意*********************************
  868. //grid3若新增字段,可能出现查询后字段显示异常的情况。。。。。。。。。。。。。。。注意处理
  869. //若grid3增加了字段,并要移动字段位置,请通过Band and Column Settings -- >Column Arrangement Overview Use Groups and Levels中的字段移动来改变,否则可能出现某些字段无法显示的异常情况。
  870. private void ultraGrid3_MouseDown(object sender, MouseEventArgs e)
  871. {
  872. try
  873. {
  874. if (this.ultraGrid3.ActiveRow == null)
  875. return;
  876. if (sender != null) grid3ActiveRow = this.ultraGrid3.ActiveRow.Index;
  877. this.strQltyCD = this.ultraGrid3.ActiveRow.Cells["QLTY_CD"].Text;
  878. this.strQltyCD2 = this.ultraGrid3.ActiveRow.Cells["QLTY_CD_2"].Text;
  879. this.dataSet2.Tables["yuanshi"].Clear();
  880. this.dataSet2.Tables["shebei"].Clear();
  881. ArrayList list = new ArrayList();
  882. //a,b等值查询
  883. ArrayList al = new ArrayList();
  884. list.Add(al);
  885. al.Add("UIB100203_COMM_05.SELECT");
  886. al.Add(this.strLine);
  887. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  888. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  889. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  890. al.Add(this.ultraGrid3.ActiveRow.Cells["QLTY_CD_3"].Text);
  891. al.Add(this.strQltyCD2);
  892. //设备号、备注等查询
  893. al = new ArrayList();
  894. list.Add(al);
  895. al.Add("UIB100203_COMM_06.SELECT");
  896. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  897. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  898. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  899. al.Add(strQltyCD);
  900. //隐藏的值和编码
  901. al = new ArrayList();
  902. list.Add(al);
  903. al.Add("UIB100203_COMM_07.SELECT");
  904. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  905. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  906. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  907. al.Add(this.strQltyCD2);
  908. CoreClientParam ccp = new CoreClientParam();
  909. ccp.ServerName = "UIB.JHY.JHYComQuery";
  910. ccp.MethodName = "doContQluery";
  911. ccp.ServerParams = new object[] { list };
  912. CoreClientParam ccpList = this.ExecuteQuery(ccp, CoreInvokeType.Internal);
  913. if (ccpList.ReturnInfo.Length == 0)
  914. {
  915. ArrayList aList = ccpList.ReturnObject as ArrayList;
  916. if (aList[0] != null)
  917. {
  918. this.dataSet2.Tables["yuanshi"].Clear();
  919. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[0] as System.Collections.ArrayList, this.dataSet2.Tables["yuanshi"]);
  920. tab0.TableName = "yuanshi";
  921. this.dataSet2.Tables["yuanshi"].Merge(tab0);
  922. }
  923. if (aList[1] != null)
  924. {
  925. this.dataSet2.Tables["shebei"].Clear();
  926. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[1] as System.Collections.ArrayList, this.dataSet2.Tables["shebei"]);
  927. tab0.TableName = "shebei";
  928. this.dataSet2.Tables["shebei"].Merge(tab0);
  929. }
  930. if (aList[2] != null)
  931. {
  932. this.dataSet3.Tables["yincang"].Clear();
  933. System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(aList[2] as System.Collections.ArrayList, this.dataSet3.Tables["yincang"]);
  934. tab0.TableName = "yincang";
  935. this.dataSet3.Tables["yincang"].Merge(tab0);
  936. }
  937. }
  938. this.textBoxEqumtID.Text = this.dataSet2.Tables["shebei"].Rows[0]["EQUMT_ID"].ToString();//设备号
  939. this.textBoxSmpRmk.Text = this.dataSet2.Tables["shebei"].Rows[0]["SMP_RMK"].ToString();//名称
  940. //记录上一次的CHK,以及下拉绑定
  941. for (int i = 0; i < this.ultraGrid5.Rows.Count; i++)
  942. {
  943. //if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "Lo")
  944. //{
  945. // string strChk = OperateConditionRecode.ReadCondition("UIB100203_CHKLO");
  946. // if(strChk == "False")
  947. // {
  948. // this.ultraGrid5.Rows[i].Cells["CHK"].Value = "True";
  949. // }
  950. // else
  951. // {
  952. // this.ultraGrid5.Rows[i].Cells["CHK"].Value = "False";
  953. // }
  954. // //break;
  955. //}
  956. if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "FX")//与试样方向绑定
  957. {
  958. this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor1;
  959. }
  960. else if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "MJGG")//与剪切面积绑定
  961. {
  962. this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor2;
  963. }
  964. else if (this.ultraGrid5.Rows[i].Cells["QLTY_OPE_CD"].Text == "CB")//与冷弯绑定
  965. {
  966. this.ultraGrid5.Rows[i].Cells["QLTY_VAL"].EditorComponent = this.ultraComboEditor3;
  967. }
  968. }
  969. }
  970. catch (Exception ex)
  971. {
  972. }
  973. }
  974. // int activteRowIndex = 0;//活动行
  975. private void ultraGrid5_KeyDown(object sender, KeyEventArgs e)
  976. {
  977. try
  978. {
  979. if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
  980. if (this.ultraGrid5.ActiveCell == null) return;
  981. if (this.ultraGrid5.ActiveCell.DataChanged == true)//数据被修改时
  982. {
  983. if ((this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "N"
  984. || this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "X" )
  985. && this.ultraGrid5.ActiveRow.Cells["CHK"].Text != "True"
  986. )//若无计算公式,或者没有被选中的,禁止编辑
  987. {
  988. MessageBox.Show("非可修改数据项,数据修改无效!", "提示");
  989. return;
  990. }
  991. else
  992. {
  993. //********************************************************
  994. if (this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text == "Lo" && this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "Y")
  995. {
  996. this.DoUpdate("Lo");
  997. //同步更新到dataset3的对应的单元中
  998. for (int i = 0; i < this.dataSet3.Tables["yincang"].Rows.Count; i++)
  999. {
  1000. if ("Lo" == this.dataSet3.Tables["yincang"].Rows[i]["QLTY_OPE_CD"].ToString())
  1001. {
  1002. this.dataSet3.Tables["yincang"].Rows[i]["QLTY_VAL"] = this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Text;
  1003. break;
  1004. }
  1005. }
  1006. }
  1007. else
  1008. {
  1009. this.DoUpdate("");//保存试验数据
  1010. }
  1011. //从当前行的下一行开始,计算所有具有计算公式的行
  1012. int numCol = this.ultraGrid5.ActiveRow.Index;
  1013. for (int i = numCol+1; i < this.ultraGrid5.Rows.Count; i++)
  1014. {
  1015. this.DoCompVal(i);//按公式计算,当前行的下面第一行
  1016. }
  1017. }
  1018. }
  1019. //换行,并编辑
  1020. int curRow = this.ultraGrid5.ActiveRow.Index;//当前行的行序号
  1021. for (int i = curRow; i <= (this.ultraGrid5.Rows.Count-1) ; i++)
  1022. {
  1023. ////==========================未到行末==========================
  1024. if (i<(this.ultraGrid5.Rows.Count-1))
  1025. {
  1026. if ((this.ultraGrid5.Rows[i + 1].Cells["EDIT_TP"].Text != "N" && this.ultraGrid5.Rows[i + 1].Cells["EDIT_TP"].Text != "X")//若下一行允许编辑
  1027. || (/*curRow < (this.ultraGrid5.Rows.Count - 1) && */this.ultraGrid5.Rows[i + 1].Cells["CHK"].Text == "True")//允许编辑
  1028. )
  1029. {
  1030. this.ultraGrid5.Rows[i+1].Activate();
  1031. this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activated = true;
  1032. this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  1033. //this.ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL"].CellActivation = Activation.AllowEdit;
  1034. //this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Column.CellActivation = Activation.AllowEdit;
  1035. break;
  1036. }
  1037. }
  1038. ////==========================到达行末==========================
  1039. else if ( (i == this.ultraGrid5.Rows.Count - 1)
  1040. || (this.ultraGrid5.Rows[i].Cells["EDIT_TP"].Text == "N" && this.ultraGrid5.Rows[i].Cells["CHK"].Text != "True")//不允许编辑,有计算公式
  1041. )
  1042. {
  1043. //*****************************************
  1044. //////this.DoUpdate();//保存试验数据
  1045. //判断数据格式是否合格,为double类型
  1046. if (JhyOpe.DcsDouble(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text))
  1047. {
  1048. //数据录入不合格提示
  1049. Decimal minValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MIN"].Text == "" ? 0 : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MIN"].Text);
  1050. Decimal maxValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MAX"].Text == "" ? 999 : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_MAX"].Text); ;
  1051. Decimal qltyValue = this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text == "" ? minValue : Convert.ToDecimal(this.ultraGrid3.Rows[grid3ActiveRow].Cells["QLTY_VAL"].Text);
  1052. if (qltyValue < minValue || qltyValue > maxValue)
  1053. {
  1054. this.ultraGrid3.Rows[grid3ActiveRow].RowSelectorAppearance.BackColor = Color.Red;
  1055. this.ultraGrid3.Rows[grid3ActiveRow].Appearance.ForeColor = Color.Red;// add by mgp 2014/3/3
  1056. MessageBox.Show("第" + (grid3ActiveRow+1) + "行不合格!", "提示");
  1057. }
  1058. }
  1059. //add by mgp 2014/3/3 注销下行代码
  1060. ultraGrid4_MouseDown(null , null);//鼠标点击项目名称触发的事件
  1061. grid3ActiveRow = grid3ActiveRow + 1;
  1062. if (grid3ActiveRow < this.ultraGrid3.Rows.Count)
  1063. {
  1064. this.ultraGrid3.Rows[grid3ActiveRow].Activate();
  1065. ultraGrid3_MouseDown(null, null);//重新触发事件,调用查询方法
  1066. }
  1067. else
  1068. {
  1069. grid3ActiveRow = 0;//到行末后,重新归0
  1070. MessageBox.Show("数据输入已完成" , "提示");
  1071. }
  1072. //this.ultraGrid5.Rows[0].Activate();
  1073. //this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activate();
  1074. //this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  1075. //break;
  1076. //this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.FirstRowInBand);
  1077. if (this.ultraGrid5.Rows.Count != 0)//grid3跳转到下一行循环时,可能存在查出无数据的情况
  1078. {
  1079. this.ultraGrid5.Rows[0].Activate();
  1080. this.ultraGrid5.ActiveRow.Cells["QLTY_VAL"].Activate();
  1081. this.ultraGrid5.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  1082. //this.ultraGrid5.DisplayLayout.Bands[0].Columns["QLTY_VAL"].CellActivation = Activation.AllowEdit;
  1083. break;
  1084. }
  1085. else
  1086. {
  1087. //MessageBox.Show("XXX");
  1088. }
  1089. }
  1090. }
  1091. }
  1092. catch (Exception ex)
  1093. {
  1094. MessageBox.Show("数据录入异常,可能存在数据格式错误,请检查!" , "提示");
  1095. }
  1096. }
  1097. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  1098. {
  1099. try
  1100. {
  1101. if (this.checkBox1.Checked)
  1102. {
  1103. this.textBox1.Enabled = true;
  1104. this.textBox2.Enabled = true;
  1105. }
  1106. else
  1107. {
  1108. this.textBox1.Enabled = false;
  1109. this.textBox2.Enabled = false;
  1110. }
  1111. }
  1112. catch (Exception ex)
  1113. {
  1114. }
  1115. }
  1116. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  1117. {
  1118. if (this.checkBox2.Checked)
  1119. {
  1120. this.ultraDateTimeEditor3.Enabled = true;
  1121. this.ultraDateTimeEditor4.Enabled = true;
  1122. }
  1123. else
  1124. {
  1125. this.ultraDateTimeEditor3.Enabled = false;
  1126. this.ultraDateTimeEditor4.Enabled = false;
  1127. }
  1128. }
  1129. private void textBoxEqumtID_KeyDown(object sender, KeyEventArgs e)
  1130. {
  1131. try
  1132. {
  1133. if (e.KeyCode != Keys.Enter) return;
  1134. if (this.ultraGrid3.ActiveRow == null) return;
  1135. ArrayList al = new ArrayList();
  1136. al.Add("UIB100203_COMM_01.UPDATE");
  1137. al.Add(this.textBoxEqumtID.Text.Trim());
  1138. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  1139. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  1140. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  1141. al.Add(this.strQltyCD2);
  1142. al.Add(this.strQltyCD);
  1143. CoreClientParam ccp = new CoreClientParam();
  1144. ccp.ServerName = "UIB.JHY.JHYComSave";
  1145. ccp.ServerParams = new object[] { al };
  1146. ccp.MethodName = "doSimpleSave";
  1147. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1148. // this.textBoxSmpRmk.Focus();
  1149. this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  1150. }
  1151. catch (Exception ex)
  1152. {
  1153. }
  1154. }
  1155. private void textBoxSmpRmk_KeyDown(object sender, KeyEventArgs e)
  1156. {
  1157. try
  1158. {
  1159. if (e.KeyCode != Keys.Enter) return;
  1160. if (this.ultraGrid3.ActiveRow == null) return;
  1161. ArrayList al = new ArrayList();
  1162. al.Add("UIB100203_COMM_02.UPDATE");
  1163. al.Add(this.textBoxSmpRmk.Text.Trim());
  1164. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO"].Text);
  1165. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_CUT_LOC"].Text);
  1166. al.Add(this.ultraGrid3.ActiveRow.Cells["SMP_NO_TYPE"].Text);
  1167. al.Add(this.strQltyCD2);
  1168. al.Add(this.strQltyCD);
  1169. CoreClientParam ccp = new CoreClientParam();
  1170. ccp.ServerName = "UIB.JHY.JHYComSave";
  1171. ccp.ServerParams = new object[] { al };
  1172. ccp.MethodName = "doSimpleSave";
  1173. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1174. //this.textBoxEqumtID.Focus();
  1175. this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  1176. }
  1177. catch (Exception ex)
  1178. {
  1179. }
  1180. }
  1181. private void ultraGrid5_MouseDown(object sender, MouseEventArgs e)
  1182. {
  1183. //try
  1184. //{
  1185. // if (this.ultraGrid5.ActiveRow == null) return;
  1186. // //只有Lo允许被选中,进行编辑
  1187. // if (this.ultraGrid5.ActiveCell.Column.Key == "CHK" )
  1188. // {
  1189. // if (this.ultraGrid5.ActiveRow.Cells["EDIT_TP"].Text == "N")
  1190. // {
  1191. // this.ultraGrid5.ActiveRow.Cells["CHK"].Value = "True";
  1192. // this.ultraGrid5.UpdateData();
  1193. // }
  1194. // else if(this.ultraGrid5.ActiveRow.Cells["QLTY_OPE_CD"].Text =="Lo" )
  1195. // {
  1196. // OperateConditionRecode.WriteCondition("UIB100203_CHKLO", this.ultraGrid5.ActiveRow.Cells["CHK"].Text);
  1197. // }
  1198. // }
  1199. //}
  1200. //catch (Exception ex)
  1201. //{
  1202. //}
  1203. }
  1204. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  1205. {
  1206. try
  1207. {
  1208. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  1209. {
  1210. ugr.Cells["CHK"].Value = this.checkBox4.Checked;
  1211. //ugr.Update();
  1212. }
  1213. this.ultraGrid1.UpdateData();
  1214. }
  1215. catch (Exception ex)
  1216. {
  1217. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1218. }
  1219. }
  1220. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  1221. {
  1222. try
  1223. {
  1224. foreach (UltraGridRow ugr in this.ultraGrid3.Rows)
  1225. {
  1226. ugr.Cells["CHK"].Value = this.checkBox3.Checked;
  1227. ugr.Update();
  1228. }
  1229. this.ultraGrid1.UpdateData();
  1230. }
  1231. catch (Exception ex)
  1232. {
  1233. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1234. }
  1235. }
  1236. //Rt0.2,ReL变更
  1237. private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
  1238. {
  1239. try
  1240. {
  1241. // if (this.ultraGrid3.ActiveRow == null) return;
  1242. if (MessageBox.Show("确定进行变更?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  1243. return;
  1244. foreach (UltraGridRow ugr in this.ultraGrid3.Rows)
  1245. {
  1246. if (ugr.Cells["CHK"].Text == "True")
  1247. {
  1248. Hashtable ht = new Hashtable();
  1249. ht.Add("i1", ugr.Cells["SMP_NO"].Text);
  1250. ht.Add("i2", ugr.Cells["SMP_CUT_LOC"].Text);
  1251. ht.Add("i3", ugr.Cells["SMP_NO_TYPE"].Text);
  1252. ht.Add("i4", ugr.Cells["QLTY_CD"].Text);
  1253. ht.Add("i5", this.comboBox5.Text.Trim());
  1254. ht.Add("i6", this.UserInfo.GetUserName());
  1255. ht.Add("o7", "");
  1256. CoreClientParam ccp = new CoreClientParam();
  1257. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  1258. ccp.MethodName = "doSimpleProc";
  1259. ccp.ServerParams = new object[] { "UIB100203_COMM_03.CALL", ht };
  1260. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1261. ArrayList al = rccp.ReturnObject as ArrayList;
  1262. if (al[0] == null) return;
  1263. if (al[0].ToString() == "XX") return;
  1264. ugr.Cells["QLTY_CD_CFNM"].Value = al[0].ToString();
  1265. }
  1266. }
  1267. // if (al[0] == null) { MessageBox.Show("操作失败,请检查数据格式!", "提示"); } return;
  1268. // if (al[0].ToString() == "XX") { MessageBox.Show("操作失败,请检查数据格式!", "提示"); } return;
  1269. // this.ultraGrid5.ActiveRow.Cells["QLTY_CD_CFNM"].Value = al[0].ToString();
  1270. // this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  1271. // this.ultraGrid2.ActiveRow.Cells["QLTY_VAL_WK"].Activate();
  1272. // this.ultraGrid3.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  1273. }
  1274. catch (Exception ex)
  1275. {
  1276. }
  1277. }
  1278. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  1279. {
  1280. if (this.checkBox5.Checked)
  1281. {
  1282. this.ultraDateTimeEditor1.Enabled = true;
  1283. this.ultraDateTimeEditor2.Enabled = true;
  1284. }
  1285. else
  1286. {
  1287. this.ultraDateTimeEditor1.Enabled = false;
  1288. this.ultraDateTimeEditor2.Enabled = false;
  1289. }
  1290. }
  1291. private void textBox6_KeyDown(object sender, KeyEventArgs e)
  1292. {
  1293. try
  1294. {
  1295. if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
  1296. if (this.textBox6.Text.ToString().Substring(0, 1) != "L" & this.textBox6.Text.ToString().Substring(0, 1) != "R"
  1297. & this.textBox6.Text.ToString().Length != 12)
  1298. {
  1299. MessageBox.Show("非法委托编号,请修改。(热轧-R,连退-L)" , "提示");
  1300. return;
  1301. }
  1302. // if (this.textBox3.Text.ToString().Substring(0, 1) != this.textBox6.Text.ToString().Substring(0, 1))
  1303. if (this.ultraGrid1.Rows[grid1CurNum].Cells["WEITO_NO"].Text.ToString().Substring(0, 1) != this.textBox6.Text.ToString().Substring(0, 1))
  1304. {
  1305. MessageBox.Show("非法修改,请检查!", "提示");
  1306. return;
  1307. }
  1308. ArrayList al = new ArrayList();
  1309. al.Add("UIB100203_COMM_03.UPDATE");
  1310. al.Add(this.textBox6.Text.ToString());
  1311. al.Add(this.ultraGrid1.Rows[grid1CurNum].Cells["WEITO_NO"].Text);
  1312. CoreClientParam ccp = new CoreClientParam();
  1313. ccp.ServerName = "UIB.JHY.JHYComSave";
  1314. ccp.ServerParams = new object[] { al };
  1315. ccp.MethodName = "doSimpleSave";
  1316. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1317. }
  1318. catch (Exception ex)
  1319. {
  1320. }
  1321. }
  1322. private void button1_Click(object sender, EventArgs e)
  1323. {
  1324. try
  1325. {
  1326. string path = null;
  1327. if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  1328. {
  1329. path = this.folderBrowserDialog1.SelectedPath;
  1330. this.textBox5.Text = path;
  1331. OperateConditionRecode.WriteCondition("UIB100203_PATH", this.textBox5.Text);
  1332. }
  1333. }
  1334. catch (Exception ex)
  1335. {
  1336. }
  1337. }
  1338. //钢印号修改
  1339. private void textBox4_KeyDown(object sender, KeyEventArgs e)
  1340. {
  1341. if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
  1342. try
  1343. {
  1344. Hashtable ht = new Hashtable();
  1345. ht.Add("i1", this.ultraGrid1.Rows[grid1CurNum].Cells["COIL_NO"].Text);
  1346. ht.Add("i2", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_NO"].Text);
  1347. ht.Add("i3", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_CUT_LOC"].Text);
  1348. ht.Add("i4", this.ultraGrid1.Rows[grid1CurNum].Cells["SMP_NO_TYPE"].Text);
  1349. ht.Add("i5", this.textBox4.Text.Trim());
  1350. ht.Add("o6" ,"" );
  1351. CoreClientParam ccp = new CoreClientParam();
  1352. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  1353. ccp.MethodName = "doSimpleProc";
  1354. ccp.ServerParams = new object[] { "UIB100203_COMM_04.CALL", ht };
  1355. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1356. //计算结果返回
  1357. ArrayList al = rccp.ReturnObject as ArrayList;
  1358. if (al[0] == null) return;
  1359. //if (al[0].ToString() == "XX") return;
  1360. MessageBox.Show(al[0].ToString() , "提示");
  1361. }
  1362. catch (Exception ex)
  1363. {
  1364. }
  1365. }
  1366. private void button2_Click(object sender, EventArgs e)
  1367. {
  1368. try
  1369. {
  1370. if (MessageBox.Show("确定清除?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  1371. return;
  1372. ArrayList al = new ArrayList();
  1373. al.Add("UIB100203_COMM_04.UPDATE");
  1374. al.Add(this.strSmpNo);
  1375. al.Add(this.strSmpCutLoc);
  1376. al.Add(this.strSmpNoType);
  1377. al.Add(this.ultraComboEditor4.Value.ToString());
  1378. al.Add(this.ultraComboEditor4.Value.ToString());
  1379. CoreClientParam ccp = new CoreClientParam();
  1380. ccp.ServerName = "UIB.JHY.JHYComSave";
  1381. ccp.ServerParams = new object[] { al };
  1382. ccp.MethodName = "doSimpleSave";
  1383. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1384. }
  1385. catch (Exception ex)
  1386. {
  1387. }
  1388. }
  1389. }
  1390. }