JHY02.cs 80 KB

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