ac12fd26726293f9bdc9cce630ed57e5a0202c7e.svn-base 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  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.UltraWinGrid;
  11. using System.Diagnostics;
  12. using System.Collections;
  13. using Core.LZMes.Client.QCM;
  14. namespace Core.LZMes.Client.QCM
  15. {
  16. public partial class QCM030603 : FrmBase
  17. {
  18. public QCM030603()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. this.DoQuery();
  28. break;
  29. case "Judge":
  30. this.Judge();
  31. break;
  32. case "Cancel":
  33. this.canceljudge();
  34. break;
  35. case "Ex_warehouse":
  36. this.Ex_warehouse();
  37. break;
  38. case "Cancel_Ex_warehouse":
  39. this.Cancel_Ex_warehouse();
  40. break;
  41. case "Exit":
  42. this.Close();
  43. break;
  44. case "Export":
  45. this.DoExport();
  46. break;
  47. }
  48. }
  49. private void Ex_warehouse()
  50. {
  51. ArrayList material_no = new ArrayList();
  52. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  53. {
  54. if (ugr.Cells["checked"].Text.ToString() == "True")
  55. {
  56. //if (ugr.Cells["ISFX"].Text.ToString() == "是")
  57. //{
  58. // MessageBox.Show("物料号" + ugr.Cells["MATERIAL_NO"].Value.ToString() + "已经出库!");
  59. // return;
  60. //}
  61. material_no.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  62. }
  63. }
  64. string username = this.UserInfo.GetUserName();
  65. CoreClientParam ccp = new CoreClientParam();
  66. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  67. ccp.MethodName = "ex_warehouse";
  68. ccp.ServerParams = new object[] { username, material_no, "4001LG0", "J" };
  69. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  70. if (ccp.ReturnCode == -1)
  71. {
  72. MessageBox.Show("出库放行失败!");
  73. return;
  74. }
  75. MessageBox.Show("出库放行成功!");
  76. DoQuery();
  77. }
  78. private void Cancel_Ex_warehouse()
  79. {
  80. ArrayList material_no = new ArrayList();
  81. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  82. {
  83. if (ugr.Cells["checked"].Text.ToString() == "True")
  84. {
  85. if (ugr.Cells["ISFX"].Text.ToString() != "是")
  86. {
  87. MessageBox.Show("物料号" + ugr.Cells["MATERIAL_NO"].Value.ToString() + "未出库!");
  88. return;
  89. }
  90. material_no.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  91. }
  92. }
  93. string username = this.UserInfo.GetUserName();
  94. CoreClientParam ccp = new CoreClientParam();
  95. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  96. ccp.MethodName = "cancel_ex_warehouse";
  97. ccp.ServerParams = new object[] { username, material_no, "4001LG0", "J" };
  98. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  99. if (ccp.ReturnCode == -1)
  100. {
  101. MessageBox.Show("撤销出库放行失败!");
  102. return;
  103. }
  104. MessageBox.Show("撤销出库放行成功!");
  105. DoQuery();
  106. }
  107. private void Judge()
  108. {
  109. try
  110. {
  111. ArrayList material_no = new ArrayList();
  112. string username = this.UserInfo.GetUserName();
  113. ArrayList prod_name = new ArrayList();
  114. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  115. {
  116. if (ugr.Cells["checked"].Text.ToString() == "True")
  117. {
  118. material_no.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  119. prod_name.Add(ugr.Cells["PROD_NAME"].Value.ToString());
  120. }
  121. }
  122. CoreClientParam ccp = new CoreClientParam();
  123. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  124. ccp.MethodName = "LgultimateJudgeAuto";
  125. ccp.ServerParams = new object[] { material_no, username, "4001LG0", prod_name };
  126. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  127. if (ccp.ReturnCode == -1)
  128. {
  129. return;
  130. }
  131. MessageBox.Show("综合判定成功!");
  132. DoQuery();
  133. }
  134. catch (Exception EX)
  135. {
  136. MessageBox.Show(EX.ToString());
  137. }
  138. }
  139. private void canceljudge()
  140. {
  141. try
  142. {
  143. ArrayList material_no = new ArrayList();
  144. string username = this.UserInfo.GetUserName();
  145. string again_judge_type = "";
  146. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  147. {
  148. if (ugr.Cells["checked"].Text.ToString() == "True")
  149. {
  150. material_no.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  151. }
  152. }
  153. if (material_no.Count == 0)
  154. {
  155. MessageBox.Show("请在判定记录中选择需要撤销判定的产品!");
  156. return;
  157. }
  158. QCM030605 frm = new QCM030605();
  159. if (frm.ShowDialog() == DialogResult.OK)
  160. {
  161. again_judge_type = frm.Results;
  162. CoreClientParam ccp = new CoreClientParam();
  163. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  164. ccp.MethodName = "cancelLgUltimateJudge";
  165. ccp.ServerParams = new object[] { username, material_no, again_judge_type };
  166. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  167. DoQuery();
  168. }
  169. }
  170. catch (Exception EX)
  171. {
  172. MessageBox.Show(EX.ToString());
  173. }
  174. }
  175. private void DoQuery()
  176. {
  177. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  178. {
  179. DoQueryMe();
  180. }
  181. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  182. {
  183. DoQueryRe();
  184. }
  185. }
  186. //查询待判信息
  187. private void DoQueryMe()
  188. {
  189. try
  190. {
  191. this.dataSet1.Clear();
  192. string bbatchno = textBox1.Text.Trim();
  193. string prod_name = this.comboBox2.Text.ToString();
  194. CoreClientParam ccp = new CoreClientParam();
  195. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  196. ccp.MethodName = "getLgZRejudgeInfo";
  197. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), bbatchno, "4001LG0", prod_name, "J" };
  198. ccp.SourceDataTable = this.dataSet1.Tables[0];
  199. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  200. }
  201. catch (Exception ex)
  202. {
  203. System.Diagnostics.Debug.WriteLine(ex.ToString());
  204. MessageBox.Show("系统出错,请联系管理人员", "警告");
  205. }
  206. }
  207. //查询判定记录
  208. private void DoQueryRe()
  209. {
  210. try
  211. {
  212. this.dataSet14.Clear();
  213. string bbatchno = textBox1.Text.Trim();
  214. //string prod_name = this.comboBox2.Text.ToString();
  215. //string isvalid = "0";
  216. //if (checkBox1.Checked)
  217. //{
  218. // isvalid = "1";
  219. //}
  220. CoreClientParam ccp = new CoreClientParam();
  221. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  222. ccp.MethodName = "GetHeatProcessInfo";
  223. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), bbatchno, "4001LG0"};
  224. ccp.SourceDataTable = this.dataSet14.Tables[0];
  225. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  226. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  227. //{
  228. // foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  229. // {
  230. // if (ugr2.Cells["UTM_RESULT_DESC"].Value.ToString() == "合格")
  231. // {
  232. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.BackColor = Color.FromArgb(185, 235, 204);
  233. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.ForeColor = Color.Black;
  234. // }
  235. // else
  236. // {
  237. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.BackColor = Color.FromArgb(249, 198, 186);
  238. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.ForeColor = Color.Black;
  239. // }
  240. // }
  241. //}
  242. }
  243. catch (Exception ex)
  244. {
  245. System.Diagnostics.Debug.WriteLine(ex.ToString());
  246. MessageBox.Show("系统出错,请联系管理人员", "警告");
  247. }
  248. }
  249. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  250. {
  251. DoQueryR();
  252. DoQueryS();//表面信息
  253. }
  254. private void DoQueryS()
  255. {
  256. try
  257. {
  258. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  259. if (ugr == null)
  260. return;
  261. this.dataSet7.Clear();
  262. if (ugr.Cells["SURFACEID"].Text.ToString() == "")
  263. {
  264. return;
  265. }
  266. string surface_id = ugr.Cells["SURFACEID"].Value.ToString();
  267. CoreClientParam ccp = new CoreClientParam();
  268. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  269. ccp.MethodName = "findNameByMN";
  270. ccp.ServerParams = new object[] { surface_id };
  271. ccp.SourceDataTable = this.dataSet7.Tables[0];
  272. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  273. }
  274. catch (Exception ex)
  275. {
  276. System.Diagnostics.Debug.WriteLine(ex.ToString());
  277. MessageBox.Show("系统出错,请联系管理人员", "警告");
  278. }
  279. }
  280. private void DoQueryR()
  281. {
  282. try
  283. {
  284. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  285. if (ugr == null)
  286. return;
  287. this.dataSet9.Clear();
  288. if (ugr.Cells["R_CHEMID"].Text.ToString() == "")
  289. {
  290. return;
  291. }
  292. string cic_id = ugr.Cells["R_CHEMID"].Value.ToString();
  293. CoreClientParam ccp = new CoreClientParam();
  294. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  295. ccp.MethodName = "GetLgRChemeResult";
  296. ccp.ServerParams = new object[] { cic_id };
  297. ccp.SourceDataTable = this.dataSet9.Tables[0];
  298. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  299. //ccp = new CoreClientParam();
  300. //ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  301. //ccp.MethodName = "GetCheme";
  302. //ccp.ServerParams = new object[] { cic_id };
  303. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  304. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  305. //{
  306. // foreach (UltraGridRow ugr5 in this.ultraGrid10.Rows)
  307. // {
  308. // 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()))
  309. // {
  310. // ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Appearance.BackColor = Color.Red;
  311. // }
  312. // }
  313. //}
  314. UltraGridRow judge_row = null;
  315. foreach (UltraGridRow ugst in this.ultraGrid10.Rows)
  316. {
  317. if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString()) && ugr.Cells["R_CHEMRESULT_DESC"].Text.ToString().Trim() != "")
  318. {
  319. ugst.Appearance.BackColor = Color.Green;
  320. }
  321. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  322. {
  323. judge_row = ugst;
  324. }
  325. if (judge_row != null)
  326. {
  327. foreach (UltraGridRow ugs in this.ultraGrid10.Rows)
  328. {
  329. if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "放行标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)"))
  330. {
  331. for (int i = 0; i < ugs.Cells.Count; i++)
  332. {
  333. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  334. {
  335. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  336. if (str_arr.Length == 1)
  337. {
  338. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  339. {
  340. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  341. {
  342. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  343. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  344. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  345. {
  346. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  347. }
  348. }
  349. }
  350. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  351. {
  352. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  353. {
  354. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  355. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  356. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  357. {
  358. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  359. }
  360. }
  361. }
  362. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  363. {
  364. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  365. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  366. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  367. {
  368. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  369. }
  370. }
  371. }
  372. else if (str_arr.Length == 2)
  373. {
  374. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  375. {
  376. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  377. {
  378. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  379. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  380. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  381. {
  382. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  383. }
  384. }
  385. }
  386. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  387. {
  388. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  389. {
  390. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  391. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  392. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  393. {
  394. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  395. }
  396. }
  397. }
  398. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  399. {
  400. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  401. {
  402. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  403. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  404. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  405. {
  406. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  407. }
  408. }
  409. }
  410. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  411. {
  412. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  413. {
  414. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  415. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  416. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  417. {
  418. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  419. }
  420. }
  421. }
  422. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  423. {
  424. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  425. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  426. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  427. {
  428. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  429. }
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. }
  439. catch (Exception ex)
  440. {
  441. System.Diagnostics.Debug.WriteLine(ex.ToString());
  442. MessageBox.Show("系统出错,请联系管理人员", "警告");
  443. }
  444. }
  445. private void QCM030603_Load(object sender, EventArgs e)
  446. {
  447. this.comboBox2.SelectedIndex = 0;
  448. this.checkBox1.Checked = true;
  449. this.checkBox1.Visible = false;
  450. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  451. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  452. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
  453. this.DoQuery();
  454. }
  455. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  456. {
  457. DoQueryR1();
  458. DoQueryS1();//表面信息
  459. }
  460. private void DoQueryS1()
  461. {
  462. try
  463. {
  464. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  465. if (ugr == null)
  466. return;
  467. this.dataSet12.Clear();
  468. if (ugr.Cells["SFU_ID"].Text.ToString() == "")
  469. {
  470. return;
  471. }
  472. string surface_id = ugr.Cells["SFU_ID"].Value.ToString();
  473. CoreClientParam ccp = new CoreClientParam();
  474. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  475. ccp.MethodName = "findNameByMN";
  476. ccp.ServerParams = new object[] { surface_id };
  477. ccp.SourceDataTable = this.dataSet12.Tables[0];
  478. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  479. }
  480. catch (Exception ex)
  481. {
  482. System.Diagnostics.Debug.WriteLine(ex.ToString());
  483. MessageBox.Show("系统出错,请联系管理人员", "警告");
  484. }
  485. }
  486. private void DoQueryR1()
  487. {
  488. try
  489. {
  490. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  491. if (ugr == null)
  492. return;
  493. this.dataSet13.Clear();
  494. if (ugr.Cells["R_CIC_ID"].Text.ToString() == "")
  495. {
  496. return;
  497. }
  498. string cic_id = ugr.Cells["R_CIC_ID"].Value.ToString();
  499. CoreClientParam ccp = new CoreClientParam();
  500. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  501. ccp.MethodName = "GetLgRChemeResult";
  502. ccp.ServerParams = new object[] { cic_id };
  503. ccp.SourceDataTable = this.dataSet13.Tables[0];
  504. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  505. //ccp = new CoreClientParam();
  506. //ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  507. //ccp.MethodName = "GetCheme";
  508. //ccp.ServerParams = new object[] { cic_id };
  509. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  510. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  511. //{
  512. // foreach (UltraGridRow ugr5 in this.ultraGrid10.Rows)
  513. // {
  514. // 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()))
  515. // {
  516. // ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Appearance.BackColor = Color.Red;
  517. // }
  518. // }
  519. //}
  520. UltraGridRow judge_row = null;
  521. foreach (UltraGridRow ugst in this.ultraGrid4.Rows)
  522. {
  523. if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString()))
  524. {
  525. ugst.Appearance.BackColor = Color.Green;
  526. }
  527. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  528. {
  529. judge_row = ugst;
  530. }
  531. if (judge_row != null)
  532. {
  533. foreach (UltraGridRow ugs in this.ultraGrid4.Rows)
  534. {
  535. if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (ugs.Cells["STD_TYPE"].Text.ToString() == "放行标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)"))
  536. {
  537. for (int i = 0; i < ugs.Cells.Count; i++)
  538. {
  539. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  540. {
  541. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  542. if (str_arr.Length == 1)
  543. {
  544. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  545. {
  546. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  547. {
  548. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  549. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  550. {
  551. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  552. }
  553. }
  554. }
  555. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  556. {
  557. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  558. {
  559. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  560. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  561. {
  562. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  563. }
  564. }
  565. }
  566. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  567. {
  568. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  569. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  570. {
  571. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  572. }
  573. }
  574. }
  575. else if (str_arr.Length == 2)
  576. {
  577. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  578. {
  579. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  580. {
  581. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  582. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  583. {
  584. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  585. }
  586. }
  587. }
  588. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  589. {
  590. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  591. {
  592. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  593. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  594. {
  595. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  596. }
  597. }
  598. }
  599. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  600. {
  601. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  602. {
  603. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  604. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  605. {
  606. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  607. }
  608. }
  609. }
  610. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  611. {
  612. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  613. {
  614. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  615. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  616. {
  617. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  618. }
  619. }
  620. }
  621. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  622. {
  623. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  624. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  625. {
  626. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  627. }
  628. }
  629. }
  630. }
  631. }
  632. }
  633. }
  634. }
  635. }
  636. }
  637. catch (Exception ex)
  638. {
  639. System.Diagnostics.Debug.WriteLine(ex.ToString());
  640. MessageBox.Show("系统出错,请联系管理人员", "警告");
  641. }
  642. }
  643. private void ultraTabControl1_Click(object sender, EventArgs e)
  644. {
  645. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  646. {
  647. this.label4.Text = "判定时间";
  648. this.checkBox1.Visible = true;
  649. this.dateTimePicker1.Value = System.DateTime.Now;
  650. }
  651. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  652. {
  653. this.label4.Text = "生产时间";
  654. this.checkBox1.Visible = false;
  655. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
  656. }
  657. }
  658. private void DoExport()
  659. {
  660. try
  661. {
  662. //if (this.ultraGrid2.Rows.Count == 0)
  663. //{
  664. // MessageBox.Show("没有可以导出的数据", "提示");
  665. // return;
  666. //}
  667. this.dataSet2.Clear();
  668. string prod_name = this.comboBox2.Text.ToString();
  669. string isvalid = "0";
  670. if (checkBox1.Checked)
  671. {
  672. isvalid = "1";
  673. }
  674. CoreClientParam ccp = new CoreClientParam();
  675. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  676. ccp.MethodName = "getLgZjudgeInfo";
  677. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), "", "4001LG0", prod_name, "J", isvalid };
  678. ccp.SourceDataTable = this.dataSet2.Tables[0];
  679. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  680. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  681. {
  682. string fName = this.saveFileDialog1.FileName;
  683. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  684. Process.Start(fName);
  685. }
  686. }
  687. catch (Exception ex)
  688. {
  689. System.Diagnostics.Debug.WriteLine(ex.ToString());
  690. }
  691. }
  692. private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
  693. {
  694. try
  695. {
  696. UltraGridRow ugr = this.ultraGrid5.ActiveRow;
  697. this.dataSet2.Clear();
  698. string bbatchno = ugr.Cells["HEAT_NO"].Value.ToString();
  699. string prod_name = ugr.Cells["PLATE_TYPE"].Value.ToString();
  700. string isvalid = "0";
  701. if (checkBox1.Checked)
  702. {
  703. isvalid = "1";
  704. }
  705. CoreClientParam ccp = new CoreClientParam();
  706. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  707. ccp.MethodName = "getLgZjudgeInfo";
  708. ccp.ServerParams = new object[] { "", "", bbatchno, "4001LG0", prod_name, "J", isvalid };
  709. ccp.SourceDataTable = this.dataSet2.Tables[0];
  710. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  711. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  712. //{
  713. // foreach (UltraGridRow ugr2 in this.ultraGrid2.Rows)
  714. // {
  715. // if (ugr2.Cells["UTM_RESULT_DESC"].Value.ToString() == "合格")
  716. // {
  717. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.BackColor = Color.FromArgb(185, 235, 204);
  718. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.ForeColor = Color.Black;
  719. // }
  720. // else
  721. // {
  722. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.BackColor = Color.FromArgb(249, 198, 186);
  723. // ugr2.Cells["UTM_RESULT_DESC"].Appearance.ForeColor = Color.Black;
  724. // }
  725. // }
  726. //}
  727. }
  728. catch (Exception ex)
  729. {
  730. System.Diagnostics.Debug.WriteLine(ex.ToString());
  731. MessageBox.Show("系统出错,请联系管理人员", "警告");
  732. }
  733. }
  734. }
  735. }