QCM030602.cs 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322
  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 Infragistics.Win;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. using System.Text.RegularExpressions;
  14. using System.Collections;
  15. namespace Core.LZMes.Client.QCM
  16. {
  17. public partial class QCM030602 : FrmBase
  18. {
  19. public QCM030602()
  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 "Judge":
  31. this.Judge();
  32. break;
  33. case "Cancel":
  34. this.canceljudge();
  35. break;
  36. case "Exit":
  37. this.Close();
  38. break;
  39. case "Export":
  40. this.DoExport();
  41. break;
  42. case "Pass":
  43. this.pass();
  44. break;
  45. case "C":
  46. this.C();
  47. break;
  48. case "P":
  49. this.P();
  50. break;
  51. case "Lock":
  52. this.locked();
  53. break;
  54. }
  55. }
  56. private void locked()
  57. {
  58. try
  59. {
  60. foreach (UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  61. {
  62. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  63. string username = this.UserInfo.GetUserName();
  64. CoreClientParam ccp = new CoreClientParam();
  65. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  66. ccp.MethodName = "JudgeLocking";
  67. ccp.ServerParams = new object[] { material_no, username };
  68. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  69. }
  70. MessageBox.Show("异常材锁定成功!");
  71. }
  72. catch (Exception EX)
  73. {
  74. MessageBox.Show(EX.ToString());
  75. }
  76. }
  77. private void pass()
  78. {
  79. try
  80. {
  81. QCM030607 frm = new QCM030607();
  82. if (frm.ShowDialog() == DialogResult.OK)
  83. {
  84. string remark = frm._memo;
  85. List<UltraGridRow> lists = new List<UltraGridRow>();
  86. foreach (UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  87. {
  88. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  89. string username = this.UserInfo.GetUserName();
  90. CoreClientParam ccp = new CoreClientParam();
  91. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  92. ccp.MethodName = "ultimateJudgeAutoByHuman";
  93. ccp.ServerParams = new object[] { material_no, username, remark, "1" };
  94. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  95. if (ccp.ReturnCode == -1)
  96. {
  97. return;
  98. }
  99. lists.Add(ugr);
  100. }
  101. for (int i = 0; i < lists.Count; i++)
  102. {
  103. lists[i].Delete(false);
  104. }
  105. MessageBox.Show("判定成功!");
  106. }
  107. }
  108. catch (Exception EX)
  109. {
  110. MessageBox.Show(EX.ToString());
  111. }
  112. }
  113. private void C()
  114. {
  115. try
  116. {
  117. QCM030607 frm = new QCM030607();
  118. if (frm.ShowDialog() == DialogResult.OK)
  119. {
  120. string remark = frm._memo;
  121. List<UltraGridRow> lists = new List<UltraGridRow>();
  122. foreach (UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  123. {
  124. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  125. string username = this.UserInfo.GetUserName();
  126. CoreClientParam ccp = new CoreClientParam();
  127. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  128. ccp.MethodName = "ultimateJudgeAutoByHuman";
  129. ccp.ServerParams = new object[] { material_no, username, remark, "3" };
  130. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  131. if (ccp.ReturnCode == -1)
  132. {
  133. return;
  134. }
  135. lists.Add(ugr);
  136. }
  137. for (int i = 0; i < lists.Count; i++)
  138. {
  139. lists[i].Delete(false);
  140. }
  141. MessageBox.Show("判定成功!");
  142. }
  143. }
  144. catch (Exception EX)
  145. {
  146. MessageBox.Show(EX.ToString());
  147. }
  148. }
  149. private void P()
  150. {
  151. try
  152. {
  153. QCM030607 frm = new QCM030607();
  154. if (frm.ShowDialog() == DialogResult.OK)
  155. {
  156. string remark = frm._memo;
  157. List<UltraGridRow> lists = new List<UltraGridRow>();
  158. foreach (UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  159. {
  160. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  161. string username = this.UserInfo.GetUserName();
  162. CoreClientParam ccp = new CoreClientParam();
  163. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  164. ccp.MethodName = "ultimateJudgeAutoByHuman";
  165. ccp.ServerParams = new object[] { material_no, username, remark, "4" };
  166. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  167. if (ccp.ReturnCode == -1)
  168. {
  169. return;
  170. }
  171. lists.Add(ugr);
  172. }
  173. for (int i = 0; i < lists.Count; i++)
  174. {
  175. lists[i].Delete(false);
  176. }
  177. MessageBox.Show("判定成功!");
  178. }
  179. }
  180. catch (Exception EX)
  181. {
  182. MessageBox.Show(EX.ToString());
  183. }
  184. }
  185. private void Judge()
  186. {
  187. try
  188. {
  189. if (this.ultraGrid1.Selected.Rows.Count == 0)
  190. this.ultraGrid1.ActiveRow.Selected = true;
  191. List<UltraGridRow> lists = new List<UltraGridRow>();
  192. foreach (UltraGridRow ugr in this.ultraGrid1.Selected.Rows)
  193. {
  194. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  195. string username = this.UserInfo.GetUserName();
  196. CoreClientParam ccp = new CoreClientParam();
  197. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  198. ccp.MethodName = "ultimateJudgeAuto";
  199. ccp.ServerParams = new object[] { material_no, username,"" };
  200. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  201. if (ccp.ReturnCode == -1)
  202. {
  203. return;
  204. }
  205. lists.Add(ugr);
  206. }
  207. for (int i = 0; i < lists.Count; i++)
  208. {
  209. lists[i].Delete(false);
  210. }
  211. MessageBox.Show("判定成功!");
  212. }
  213. catch (Exception EX)
  214. {
  215. MessageBox.Show(EX.ToString());
  216. }
  217. }
  218. private void canceljudge()
  219. {
  220. try
  221. {
  222. QCM030607 frm = new QCM030607();
  223. if (frm.ShowDialog() == DialogResult.OK)
  224. {
  225. string remark = frm._memo;
  226. if (remark == "")
  227. {
  228. MessageBox.Show("请录入备注信息!");
  229. return;
  230. }
  231. if (this.ultraGrid2.Selected.Rows.Count == 0)
  232. this.ultraGrid2.ActiveRow.Selected = true;
  233. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  234. {
  235. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  236. {
  237. string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
  238. string username = this.UserInfo.GetUserName();
  239. string utm_id = ugr.Cells["UTM_ID"].Value.ToString();
  240. CoreClientParam ccp = new CoreClientParam();
  241. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  242. ccp.MethodName = "cancelUltimateJudge";
  243. ccp.ServerParams = new object[] { username, MATERIAL_NO, utm_id,remark };
  244. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  245. if (ccp.ReturnCode == -1)
  246. {
  247. return;
  248. }
  249. }
  250. }
  251. MessageBox.Show("取消判定成功!");
  252. }
  253. }
  254. catch (Exception EX)
  255. {
  256. MessageBox.Show(EX.ToString());
  257. }
  258. DoQuery();
  259. }
  260. private void DoQuery()
  261. {
  262. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  263. {
  264. DoQueryMe();
  265. }
  266. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  267. {
  268. DoQueryRe();
  269. }
  270. }
  271. //查询待判信息
  272. private void DoQueryMe()
  273. {
  274. try
  275. {
  276. this.dataSet1.Clear();
  277. string ebatchno = "";
  278. string bbatchno = textBox4.Text.Trim();
  279. if (textBox2.Text.ToString() == "")
  280. {
  281. ebatchno = this.textBox4.Text.Trim();
  282. }
  283. else
  284. {
  285. ebatchno = textBox2.Text.Trim();
  286. }
  287. string design_key = textBox1.Text.Trim();
  288. string psc = textBox3.Text.Trim();
  289. string prodline = comboBox3.Text.ToString();
  290. string cert_inst_name = this.comboBox1.Text.ToString();
  291. string heat_no = this.textBox5.Text.ToString();
  292. CoreClientParam ccp = new CoreClientParam();
  293. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  294. ccp.MethodName = "GetUnjudgeInfoX";
  295. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key, psc,prodline,cert_inst_name,heat_no };
  296. ccp.SourceDataTable = this.dataSet1.Tables[0];
  297. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  298. }
  299. catch (Exception ex)
  300. {
  301. System.Diagnostics.Debug.WriteLine(ex.ToString());
  302. MessageBox.Show("系统出错,请联系管理人员", "警告");
  303. }
  304. }
  305. //查询判定记录
  306. private void DoQueryRe()
  307. {
  308. try
  309. {
  310. this.dataSet2.Clear();
  311. string ebatchno = "";
  312. string bbatchno = textBox4.Text.Trim();
  313. if (textBox2.Text.ToString() == "")
  314. {
  315. ebatchno = this.textBox4.Text.Trim();
  316. }
  317. else
  318. {
  319. ebatchno = textBox2.Text.Trim();
  320. }
  321. string design_key = textBox1.Text.Trim();
  322. string psc = textBox3.Text.Trim();
  323. string prodline = comboBox3.Text.ToString();
  324. string cert_inst_name = this.comboBox1.Text.ToString();
  325. string heat_no = this.textBox5.Text.ToString();
  326. CoreClientParam ccp = new CoreClientParam();
  327. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  328. ccp.MethodName = "GetjudgeInfoX";
  329. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key, psc,prodline,cert_inst_name,heat_no };
  330. ccp.SourceDataTable = this.dataSet2.Tables[0];
  331. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  332. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  333. //{
  334. // foreach (UltraGridRow ugr18 in this.ultraGrid2.Rows)
  335. // {
  336. // if (ugr18.Cells["ISVALID"].Value.ToString() == "是 ")
  337. // {
  338. // ugr18.Cells["ISVALID"].Appearance.BackColor = Color.FromArgb(185, 235, 204);
  339. // ugr18.Cells["ISVALID"].Appearance.ForeColor = Color.Black;
  340. // }
  341. // else
  342. // {
  343. // ugr18.Cells["ISVALID"].Appearance.BackColor = Color.FromArgb(249, 198, 186);
  344. // ugr18.Cells["ISVALID"].Appearance.ForeColor = Color.Black;
  345. // }
  346. // }
  347. //}
  348. }
  349. catch (Exception ex)
  350. {
  351. System.Diagnostics.Debug.WriteLine(ex.ToString());
  352. MessageBox.Show("系统出错,请联系管理人员", "警告");
  353. }
  354. }
  355. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  356. {
  357. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  358. this.textBox6.Text = ugr.Cells["ORDER_REMARK"].Text.ToString();
  359. DoQueryC();//成分信息
  360. DoQueryR();
  361. DoQueryP();//材质信息
  362. DoQueryM();//公差信息
  363. DoQueryS();//表面信息
  364. //DoQueryD();//探伤信息
  365. }
  366. private void DoQueryM()
  367. {
  368. try
  369. {
  370. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  371. if (ugr == null)
  372. return;
  373. this.dataSet10.Clear();
  374. if (ugr.Cells["SIZEID"].Text.ToString() == "")
  375. {
  376. return;
  377. }
  378. string sic = ugr.Cells["SIZEID"].Text.ToString();
  379. CoreClientParam ccp = new CoreClientParam();
  380. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  381. ccp.MethodName = "getToleranceInfoNew";
  382. ccp.ServerParams = new object[] { sic };
  383. ccp.SourceDataTable = this.dataSet10.Tables[0];
  384. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  385. }
  386. catch (Exception ex)
  387. {
  388. System.Diagnostics.Debug.WriteLine(ex.ToString());
  389. MessageBox.Show("系统出错,请联系管理人员", "警告");
  390. }
  391. }
  392. private void DoQueryS()
  393. {
  394. try
  395. {
  396. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  397. if (ugr == null)
  398. return;
  399. this.dataSet7.Clear();
  400. if (ugr.Cells["SURFACEID"].Text.ToString() == "")
  401. {
  402. return;
  403. }
  404. string surface_id = ugr.Cells["SURFACEID"].Value.ToString();
  405. CoreClientParam ccp = new CoreClientParam();
  406. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  407. ccp.MethodName = "findNameByMN";
  408. ccp.ServerParams = new object[] { surface_id };
  409. ccp.SourceDataTable = this.dataSet7.Tables[0];
  410. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  411. }
  412. catch (Exception ex)
  413. {
  414. System.Diagnostics.Debug.WriteLine(ex.ToString());
  415. MessageBox.Show("系统出错,请联系管理人员", "警告");
  416. }
  417. }
  418. private void DoQueryD()
  419. {
  420. }
  421. public static bool IsNumberal(string input)
  422. {
  423. bool flag = true;
  424. int count = 0;
  425. int count1 = 0;
  426. if (input.Length == 0)
  427. {
  428. flag = false;
  429. }
  430. else
  431. {
  432. char[] x = input.ToCharArray();
  433. for (int i = 0; i < input.Length; i++)
  434. {
  435. if (!char.IsNumber(x[i]) && x[i] != '.' && x[i] != '-')
  436. {
  437. flag = false; break;
  438. }
  439. if (x[i] == '.')
  440. {
  441. count++;
  442. if (i == 0 || i == input.Length - 1) flag = false;
  443. }
  444. if (x[i] == '-')
  445. {
  446. count1++;
  447. if (i > 1) flag = false;
  448. }
  449. }
  450. if (count > 1 || count1 > 1) flag = false;
  451. }
  452. return flag;
  453. }
  454. private static bool ishz(string text)
  455. {
  456. if (Regex.IsMatch(text, @"[\u4e00-\u9fa5]"))
  457. {
  458. return true;
  459. }
  460. else
  461. {
  462. return false;
  463. }
  464. }
  465. private void DoQueryP()
  466. {
  467. try
  468. {
  469. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  470. if (ugr == null)
  471. return;
  472. this.dataSet11.Clear();
  473. if (ugr.Cells["PHYSID"].Text.ToString() == "")
  474. {
  475. return;
  476. }
  477. string pic_id = ugr.Cells["PHYSID"].Value.ToString();
  478. CoreClientParam ccp = new CoreClientParam();
  479. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  480. ccp.MethodName = "querryJudgeResult";
  481. ccp.ServerParams = new object[] { pic_id };
  482. ccp.SourceDataTable = this.dataSet11.Tables[1];
  483. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  484. ccp = new CoreClientParam();
  485. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  486. ccp.MethodName = "querryJudgetItem";
  487. ccp.ServerParams = new object[] { pic_id };
  488. ccp.SourceDataTable = this.dataSet11.Tables[0];
  489. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  490. this.ultraGrid4.Rows.ExpandAll(true);
  491. foreach (UltraGridRow ugr1 in this.ultraGrid4.Rows)
  492. {
  493. foreach (UltraGridRow ugrs in ugr1.ChildBands[0].Rows)
  494. {
  495. if (ugrs.Cells["defect_flag"].Value.ToString() == "是")
  496. {
  497. ugrs.Cells["defect_flag"].Appearance.ForeColor = Color.Red;
  498. }
  499. if (ugrs.Cells["isjudge"].Value.ToString() == "是")
  500. {
  501. if (ugrs.Cells["judge_basis"].Value.ToString() == "逐值判定")
  502. {
  503. if (ugrs.Cells["val1"].Text.ToString() == "")
  504. {
  505. ugrs.Cells["val1"].Appearance.BackColor = Color.Yellow;
  506. }
  507. }
  508. else if (ugrs.Cells["judge_basis"].Value.ToString() == "平均值")
  509. {
  510. if (ugrs.Cells["avg_val"].Text.ToString() == "")
  511. {
  512. ugrs.Cells["avg_val"].Appearance.BackColor = Color.Yellow;
  513. }
  514. }
  515. }
  516. if (ugrs.Cells["isjudge"].Value.ToString() == "是")
  517. {
  518. if (ugrs.Cells["judge_basis"].Value.ToString() == "逐值判定")
  519. {
  520. DataTable dt = new DataTable();
  521. if (IsNumberal(ugrs.Cells["val1"].Value.ToString()))
  522. {
  523. if (ishz(ugrs.Cells["jf_stdmin"].Value.ToString()) || ishz(ugrs.Cells["jf_stdmax"].Value.ToString()))
  524. {
  525. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  526. }
  527. else
  528. {
  529. if (ugrs.Cells["jf_stdmin"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["jf_stdmin"].Value.ToString(), ""))
  530. {
  531. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  532. }
  533. if (ugrs.Cells["jf_stdmax"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["jf_stdmax"].Value.ToString(), ""))
  534. {
  535. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  536. }
  537. }
  538. }
  539. else
  540. {
  541. if (ugrs.Cells["jf_stdmin"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && "=" + ugrs.Cells["val1"].Value.ToString() != ugrs.Cells["jf_stdmin"].Value.ToString())
  542. {
  543. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  544. }
  545. if (ugrs.Cells["jf_stdmax"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && "=" + ugrs.Cells["val1"].Value.ToString() != ugrs.Cells["jf_stdmax"].Value.ToString())
  546. {
  547. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  548. }
  549. }
  550. if (ugrs.Cells["jf_stdmin"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["jf_stdmin"].Value.ToString(), ""))
  551. {
  552. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  553. }
  554. if (ugrs.Cells["jf_stdmax"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["jf_stdmax"].Value.ToString(), ""))
  555. {
  556. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  557. }
  558. if (ugrs.Cells["jf_stdmin"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["jf_stdmin"].Value.ToString(), ""))
  559. {
  560. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  561. }
  562. if (ugrs.Cells["jf_stdmax"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["jf_stdmax"].Value.ToString(), ""))
  563. {
  564. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  565. }
  566. if (ugrs.Cells["nk_stdmin"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["nk_stdmin"].Value.ToString(), ""))
  567. {
  568. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  569. }
  570. if (ugrs.Cells["nk_stdmax"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["nk_stdmax"].Value.ToString(), ""))
  571. {
  572. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  573. }
  574. if (ugrs.Cells["nk_stdmin"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["nk_stdmin"].Value.ToString(), ""))
  575. {
  576. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  577. }
  578. if (ugrs.Cells["nk_stdmax"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["nk_stdmax"].Value.ToString(), ""))
  579. {
  580. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  581. }
  582. if (ugrs.Cells["nk_stdmin"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["nk_stdmin"].Value.ToString(), ""))
  583. {
  584. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  585. }
  586. if (ugrs.Cells["nk_stdmax"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["nk_stdmax"].Value.ToString(), ""))
  587. {
  588. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  589. }
  590. if (ugrs.Cells["kh_stdmin"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["kh_stdmin"].Value.ToString(), ""))
  591. {
  592. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  593. }
  594. if (ugrs.Cells["kh_stdmax"].Value.ToString() != "" && ugrs.Cells["val1"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val1"].Value.ToString() + ugrs.Cells["kh_stdmax"].Value.ToString(), ""))
  595. {
  596. ugrs.Cells["val1"].Appearance.ForeColor = Color.Red;
  597. }
  598. if (ugrs.Cells["kh_stdmin"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["kh_stdmin"].Value.ToString(), ""))
  599. {
  600. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  601. }
  602. if (ugrs.Cells["kh_stdmax"].Value.ToString() != "" && ugrs.Cells["val2"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val2"].Value.ToString() + ugrs.Cells["kh_stdmax"].Value.ToString(), ""))
  603. {
  604. ugrs.Cells["val2"].Appearance.ForeColor = Color.Red;
  605. }
  606. if (ugrs.Cells["kh_stdmin"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["kh_stdmin"].Value.ToString(), ""))
  607. {
  608. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  609. }
  610. if (ugrs.Cells["kh_stdmax"].Value.ToString() != "" && ugrs.Cells["val3"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["val3"].Value.ToString() + ugrs.Cells["kh_stdmax"].Value.ToString(), ""))
  611. {
  612. ugrs.Cells["val3"].Appearance.ForeColor = Color.Red;
  613. }
  614. }
  615. else if (ugrs.Cells["judge_basis"].Value.ToString() == "平均值")
  616. {
  617. DataTable dt = new DataTable();
  618. if (ugrs.Cells["jf_stdmin"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["jf_stdmin"].Value.ToString(), ""))
  619. {
  620. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  621. }
  622. if (ugrs.Cells["jf_stdmax"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["jf_stdmax"].Value.ToString(), ""))
  623. {
  624. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  625. }
  626. if (ugrs.Cells["kh_stdmin"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["kh_stdmin"].Value.ToString(), ""))
  627. {
  628. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  629. }
  630. if (ugrs.Cells["kh_stdmax"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["kh_stdmax"].Value.ToString(), ""))
  631. {
  632. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  633. }
  634. if (ugrs.Cells["nk_stdmin"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["nk_stdmin"].Value.ToString(), ""))
  635. {
  636. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  637. }
  638. if (ugrs.Cells["nk_stdmax"].Value.ToString() != "" && ugrs.Cells["avg_val"].Value.ToString() != "" && !(bool)dt.Compute(ugrs.Cells["avg_val"].Value.ToString() + ugrs.Cells["nk_stdmax"].Value.ToString(), ""))
  639. {
  640. ugrs.Cells["avg_val"].Appearance.ForeColor = Color.Red;
  641. }
  642. }
  643. }
  644. }
  645. }
  646. }
  647. catch (Exception ex)
  648. {
  649. System.Diagnostics.Debug.WriteLine(ex.ToString());
  650. MessageBox.Show("系统出错,请联系管理人员", "警告");
  651. }
  652. }
  653. private void DoQueryC()
  654. {
  655. try
  656. {
  657. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  658. if (ugr == null)
  659. return;
  660. this.dataSet3.Clear();
  661. if (ugr.Cells["CHEMID"].Text.ToString() == "")
  662. {
  663. return;
  664. }
  665. string cic_id = ugr.Cells["CHEMID"].Value.ToString();
  666. CoreClientParam ccp = new CoreClientParam();
  667. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  668. ccp.MethodName = "GetChemeResult";
  669. ccp.ServerParams = new object[] { cic_id };
  670. ccp.SourceDataTable = this.dataSet3.Tables[0];
  671. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  672. ccp = new CoreClientParam();
  673. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  674. ccp.MethodName = "GetCheme";
  675. ccp.ServerParams = new object[] { cic_id };
  676. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  677. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  678. {
  679. foreach (UltraGridRow ugr5 in this.ultraGrid8.Rows)
  680. {
  681. if (ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmin"].ToString()) && ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmax"].ToString()))
  682. {
  683. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  684. }
  685. }
  686. }
  687. }
  688. catch (Exception ex)
  689. {
  690. System.Diagnostics.Debug.WriteLine(ex.ToString());
  691. MessageBox.Show("系统出错,请联系管理人员", "警告");
  692. }
  693. }
  694. private void DoQueryR()
  695. {
  696. try
  697. {
  698. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  699. if (ugr == null)
  700. return;
  701. this.dataSet9.Clear();
  702. //电弧炉熔炼成分
  703. //if (ugr.Cells["HEAT_NO"].Text.ToString().StartsWith("E") && !"".Equals(ugr.Cells["R_CHEMRESULT_DESC"].Text.ToString()))
  704. //{
  705. // DoQueryRDHL();
  706. // return;
  707. //}
  708. if (ugr.Cells["R_CHEMID"].Text.ToString() == "")
  709. {
  710. return;
  711. }
  712. string cic_id = ugr.Cells["R_CHEMID"].Value.ToString();
  713. CoreClientParam ccp = new CoreClientParam();
  714. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  715. ccp.MethodName = "GetRChemeResult";
  716. ccp.ServerParams = new object[] { cic_id };
  717. ccp.SourceDataTable = this.dataSet9.Tables[0];
  718. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  719. ccp = new CoreClientParam();
  720. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  721. ccp.MethodName = "GetCheme";
  722. ccp.ServerParams = new object[] { cic_id };
  723. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  724. UltraGridRow judge_row = null;
  725. foreach (UltraGridRow ugst in this.ultraGrid10.Rows)
  726. {
  727. if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString()) && ugr.Cells["R_CHEMRESULT_DESC"].Text.ToString().Trim() != "")
  728. {
  729. ugst.Appearance.BackColor = Color.Green;
  730. }
  731. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  732. {
  733. judge_row = ugst;
  734. }
  735. if (judge_row != null)
  736. {
  737. foreach (UltraGridRow ugs in this.ultraGrid10.Rows)
  738. {
  739. if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)"))
  740. {
  741. for (int i = 0; i < ugs.Cells.Count; i++)
  742. {
  743. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  744. {
  745. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  746. if (str_arr.Length == 1)
  747. {
  748. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  749. {
  750. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  751. {
  752. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  753. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  754. }
  755. }
  756. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  757. {
  758. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  759. {
  760. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  761. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  762. }
  763. }
  764. }
  765. else if (str_arr.Length == 2)
  766. {
  767. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  768. {
  769. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  770. {
  771. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  772. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  773. }
  774. }
  775. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  776. {
  777. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  778. {
  779. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  780. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  781. }
  782. }
  783. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  784. {
  785. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  786. {
  787. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  788. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  789. }
  790. }
  791. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  792. {
  793. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  794. {
  795. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  796. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  797. }
  798. }
  799. }
  800. }
  801. }
  802. }
  803. }
  804. }
  805. }
  806. }
  807. catch (Exception ex)
  808. {
  809. System.Diagnostics.Debug.WriteLine(ex.ToString());
  810. MessageBox.Show("系统出错,请联系管理人员", "警告");
  811. }
  812. }
  813. private void DoQueryRDHL()
  814. {
  815. try
  816. {
  817. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  818. if (ugr == null)
  819. return;
  820. string DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString();
  821. string HEAT_NO = ugr.Cells["HEAT_NO"].Value.ToString();
  822. string STEEL_NAME = ugr.Cells["STEEL_NAME"].Value.ToString();
  823. if (string.IsNullOrEmpty(DESIGN_KEY) || string.IsNullOrEmpty(HEAT_NO))
  824. {
  825. return;
  826. }
  827. Hashtable ht = new Hashtable();
  828. ht.Add("DESIGN_KEY", DESIGN_KEY);
  829. ht.Add("HEAT_NO", HEAT_NO);
  830. ht.Add("STEEL_NAME", STEEL_NAME);
  831. CoreClientParam ccp = new CoreClientParam();
  832. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  833. ccp.MethodName = "GetRChemeResultDHL";
  834. ccp.ServerParams = new object[] { ht };
  835. ccp.SourceDataTable = this.dataSet9.Tables[0];
  836. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  837. UltraGridRow judge_row = null;
  838. foreach (UltraGridRow ugst in this.ultraGrid10.Rows)
  839. {
  840. if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString()) && ugr.Cells["R_CHEMRESULT_DESC"].Text.ToString().Trim() != "")
  841. {
  842. ugst.Appearance.BackColor = Color.Green;
  843. }
  844. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  845. {
  846. judge_row = ugst;
  847. }
  848. if (judge_row != null)
  849. {
  850. foreach (UltraGridRow ugs in this.ultraGrid10.Rows)
  851. {
  852. if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)"))
  853. {
  854. for (int i = 0; i < ugs.Cells.Count; i++)
  855. {
  856. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  857. {
  858. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  859. if (str_arr.Length == 1)
  860. {
  861. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  862. {
  863. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  864. {
  865. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  866. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  867. }
  868. }
  869. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  870. {
  871. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  872. {
  873. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  874. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  875. }
  876. }
  877. }
  878. else if (str_arr.Length == 2)
  879. {
  880. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  881. {
  882. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  883. {
  884. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  885. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  886. }
  887. }
  888. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  889. {
  890. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  891. {
  892. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  893. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  894. }
  895. }
  896. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  897. {
  898. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  899. {
  900. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  901. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  902. }
  903. }
  904. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  905. {
  906. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  907. {
  908. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  909. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  910. }
  911. }
  912. }
  913. }
  914. }
  915. }
  916. }
  917. }
  918. }
  919. }
  920. catch (Exception ex)
  921. {
  922. System.Diagnostics.Debug.WriteLine(ex.ToString());
  923. MessageBox.Show("系统出错,请联系管理人员", "警告");
  924. }
  925. }
  926. private void QCM030602_Load(object sender, EventArgs e)
  927. {
  928. ValueList vsflv = new ValueList();
  929. CoreClientParam ccp = new CoreClientParam();
  930. ccp = new CoreClientParam();
  931. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  932. ccp.MethodName = "findCretInstName";
  933. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  934. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  935. {
  936. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["CERT_INST_CODE"].ToString(), ccp.SourceDataTable.Rows[i]["CERT_INST_NAME"].ToString());
  937. }
  938. this.comboBox1.DataSource = vsflv.ValueListItems;
  939. this.comboBox3.SelectedIndex = 0;
  940. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  941. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  942. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  943. this.ultraGrid21.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  944. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  945. //DoQuery();
  946. }
  947. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  948. {
  949. DoQueryC1();//成分信息
  950. DoQueryR1();
  951. DoQueryP1();//材质信息
  952. DoQueryM1();//公差信息
  953. DoQueryS1();//表面信息
  954. }
  955. private void DoQueryM1()
  956. {
  957. try
  958. {
  959. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  960. if (ugr == null)
  961. return;
  962. this.dataSet15.Clear();
  963. if (ugr.Cells["SIC_ID"].Text.ToString() == "")
  964. {
  965. return;
  966. }
  967. string sic = ugr.Cells["SIC_ID"].Text.ToString();
  968. CoreClientParam ccp = new CoreClientParam();
  969. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  970. ccp.MethodName = "getToleranceInfoNew";
  971. ccp.ServerParams = new object[] { sic };
  972. ccp.SourceDataTable = this.dataSet15.Tables[0];
  973. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  974. }
  975. catch (Exception ex)
  976. {
  977. System.Diagnostics.Debug.WriteLine(ex.ToString());
  978. MessageBox.Show("系统出错,请联系管理人员", "警告");
  979. }
  980. }
  981. private void DoQueryS1()
  982. {
  983. try
  984. {
  985. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  986. if (ugr == null)
  987. return;
  988. this.dataSet17.Clear();
  989. if (ugr.Cells["SFU_ID"].Text.ToString() == "")
  990. {
  991. return;
  992. }
  993. string surface_id = ugr.Cells["SFU_ID"].Value.ToString();
  994. CoreClientParam ccp = new CoreClientParam();
  995. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  996. ccp.MethodName = "findNameByMN";
  997. ccp.ServerParams = new object[] { surface_id };
  998. ccp.SourceDataTable = this.dataSet17.Tables[0];
  999. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1000. }
  1001. catch (Exception ex)
  1002. {
  1003. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1004. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1005. }
  1006. }
  1007. private void DoQueryP1()
  1008. {
  1009. try
  1010. {
  1011. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  1012. if (ugr == null)
  1013. return;
  1014. this.dataSet14.Clear();
  1015. if (ugr.Cells["PIC_ID"].Text.ToString() == "")
  1016. {
  1017. return;
  1018. }
  1019. string pic_id = ugr.Cells["PIC_ID"].Value.ToString();
  1020. CoreClientParam ccp = new CoreClientParam();
  1021. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  1022. ccp.MethodName = "querryJudgeResult";
  1023. ccp.ServerParams = new object[] { pic_id };
  1024. ccp.SourceDataTable = this.dataSet14.Tables[1];
  1025. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1026. ccp = new CoreClientParam();
  1027. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  1028. ccp.MethodName = "querryJudgetItem";
  1029. ccp.ServerParams = new object[] { pic_id };
  1030. ccp.SourceDataTable = this.dataSet14.Tables[0];
  1031. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1032. this.ultraGrid21.Rows.ExpandAll(true);
  1033. }
  1034. catch (Exception ex)
  1035. {
  1036. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1037. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1038. }
  1039. }
  1040. private void DoQueryC1()
  1041. {
  1042. try
  1043. {
  1044. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  1045. if (ugr == null)
  1046. return;
  1047. this.dataSet13.Clear();
  1048. if (ugr.Cells["CIC_ID"].Text.ToString() == "")
  1049. {
  1050. return;
  1051. }
  1052. string cic_id = ugr.Cells["CIC_ID"].Value.ToString();
  1053. CoreClientParam ccp = new CoreClientParam();
  1054. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  1055. ccp.MethodName = "GetChemeResult";
  1056. ccp.ServerParams = new object[] { cic_id };
  1057. ccp.SourceDataTable = this.dataSet13.Tables[0];
  1058. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1059. ccp = new CoreClientParam();
  1060. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  1061. ccp.MethodName = "GetCheme";
  1062. ccp.ServerParams = new object[] { cic_id };
  1063. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1064. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  1065. {
  1066. foreach (UltraGridRow ugr5 in this.ultraGrid8.Rows)
  1067. {
  1068. if (ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmin"].ToString()) && ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmax"].ToString()))
  1069. {
  1070. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  1071. }
  1072. }
  1073. }
  1074. }
  1075. catch (Exception ex)
  1076. {
  1077. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1078. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1079. }
  1080. }
  1081. private void DoQueryR1()
  1082. {
  1083. try
  1084. {
  1085. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  1086. if (ugr == null)
  1087. return;
  1088. this.dataSet12.Clear();
  1089. //电弧炉熔炼成分
  1090. //if (ugr.Cells["HEAT_NO"].Text.ToString().StartsWith("E"))
  1091. //{
  1092. // DoQueryRDHL1();
  1093. // return;
  1094. //}
  1095. if (ugr.Cells["R_CIC_ID"].Text.ToString() == "")
  1096. {
  1097. return;
  1098. }
  1099. string cic_id = ugr.Cells["R_CIC_ID"].Value.ToString();
  1100. CoreClientParam ccp = new CoreClientParam();
  1101. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  1102. ccp.MethodName = "GetRChemeResult";
  1103. ccp.ServerParams = new object[] { cic_id };
  1104. ccp.SourceDataTable = this.dataSet12.Tables[0];
  1105. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1106. ccp = new CoreClientParam();
  1107. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  1108. ccp.MethodName = "GetCheme";
  1109. ccp.ServerParams = new object[] { cic_id };
  1110. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1111. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  1112. {
  1113. foreach (UltraGridRow ugr5 in this.ultraGrid10.Rows)
  1114. {
  1115. if (ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmin"].ToString()) && ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmax"].ToString()))
  1116. {
  1117. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  1118. }
  1119. }
  1120. }
  1121. }
  1122. catch (Exception ex)
  1123. {
  1124. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1125. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1126. }
  1127. }
  1128. private void DoQueryRDHL1()
  1129. {
  1130. try
  1131. {
  1132. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  1133. if (ugr == null)
  1134. return;
  1135. string DESIGN_KEY = ugr.Cells["DESIGN_KEY"].Value.ToString();
  1136. string HEAT_NO = ugr.Cells["HEAT_NO"].Value.ToString();
  1137. string STEEL_NAME = ugr.Cells["STEEL_NAME"].Value.ToString();
  1138. if (string.IsNullOrEmpty(DESIGN_KEY) || string.IsNullOrEmpty(HEAT_NO))
  1139. {
  1140. return;
  1141. }
  1142. Hashtable ht = new Hashtable();
  1143. ht.Add("DESIGN_KEY", DESIGN_KEY);
  1144. ht.Add("HEAT_NO", HEAT_NO);
  1145. ht.Add("STEEL_NAME", STEEL_NAME);
  1146. CoreClientParam ccp = new CoreClientParam();
  1147. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  1148. ccp.MethodName = "GetRChemeResultDHL";
  1149. ccp.ServerParams = new object[] { ht };
  1150. ccp.SourceDataTable = this.dataSet12.Tables[0];
  1151. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  1152. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  1153. {
  1154. foreach (UltraGridRow ugr5 in this.ultraGrid10.Rows)
  1155. {
  1156. if (ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmin"].ToString()) && ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmax"].ToString()))
  1157. {
  1158. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  1159. }
  1160. }
  1161. }
  1162. }
  1163. catch (Exception ex)
  1164. {
  1165. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1166. MessageBox.Show("系统出错,请联系管理人员", "警告");
  1167. }
  1168. }
  1169. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  1170. {
  1171. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  1172. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  1173. SetFilterUIType(this.ultraGrid10, this.checkBox1.Checked);
  1174. SetFilterUIType(this.ultraGrid8, this.checkBox1.Checked);
  1175. SetFilterUIType(this.ultraGrid4, this.checkBox1.Checked);
  1176. SetFilterUIType(this.ultraGrid5, this.checkBox1.Checked);
  1177. SetFilterUIType(this.ultraGrid6, this.checkBox1.Checked);
  1178. SetFilterUIType(this.ultraGrid20, this.checkBox1.Checked);
  1179. SetFilterUIType(this.ultraGrid7, this.checkBox1.Checked);
  1180. SetFilterUIType(this.ultraGrid11, this.checkBox1.Checked);
  1181. SetFilterUIType(this.ultraGrid12, this.checkBox1.Checked);
  1182. SetFilterUIType(this.ultraGrid13, this.checkBox1.Checked);
  1183. SetFilterUIType(this.ultraGrid14, this.checkBox1.Checked);
  1184. SetFilterUIType(this.ultraGrid15, this.checkBox1.Checked);
  1185. }
  1186. private void SetFilterUIType(UltraGrid grid, bool checkType)
  1187. {
  1188. if (checkType)
  1189. {
  1190. grid.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  1191. }
  1192. else
  1193. {
  1194. grid.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
  1195. grid.DisplayLayout.Override.FilterUIType = FilterUIType.Default;
  1196. }
  1197. }
  1198. private void ultraTabControl1_Click(object sender, EventArgs e)
  1199. {
  1200. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  1201. {
  1202. this.label6.Text = "判定时间";
  1203. }
  1204. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  1205. {
  1206. this.label6.Text = "生产时间";
  1207. }
  1208. }
  1209. private void DoExport()
  1210. {
  1211. try
  1212. {
  1213. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  1214. {
  1215. if (this.ultraGrid1.Rows.Count == 0)
  1216. {
  1217. MessageBox.Show("没有可以导出的数据", "提示");
  1218. return;
  1219. }
  1220. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  1221. {
  1222. string fName = this.saveFileDialog1.FileName;
  1223. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  1224. Process.Start(fName);
  1225. }
  1226. }
  1227. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  1228. {
  1229. if (this.ultraGrid2.Rows.Count == 0)
  1230. {
  1231. MessageBox.Show("没有可以导出的数据", "提示");
  1232. return;
  1233. }
  1234. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  1235. {
  1236. string fName = this.saveFileDialog1.FileName;
  1237. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  1238. Process.Start(fName);
  1239. }
  1240. }
  1241. }
  1242. catch (Exception ex)
  1243. {
  1244. System.Diagnostics.Debug.WriteLine(ex.ToString());
  1245. }
  1246. }
  1247. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  1248. {
  1249. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  1250. {
  1251. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  1252. {
  1253. if (checkBox2.Checked)
  1254. {
  1255. ugr.Selected = true;
  1256. }
  1257. else
  1258. {
  1259. ugr.Selected = false;
  1260. }
  1261. }
  1262. }
  1263. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  1264. {
  1265. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  1266. {
  1267. if (checkBox2.Checked)
  1268. {
  1269. ugr.Cells["CHECK"].Value = "True";
  1270. }
  1271. else
  1272. {
  1273. ugr.Cells["CHECK"].Value = "False";
  1274. }
  1275. }
  1276. }
  1277. }
  1278. }
  1279. }