QCM030803.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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 Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. namespace Core.LZMes.Client.QCM
  14. {
  15. public partial class QCM030803 : FrmBase
  16. {
  17. public QCM030803()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case"Query":
  26. this.DoQuery();
  27. break;
  28. case "Judge":
  29. this.Judge();
  30. break;
  31. case "Cancel":
  32. this.Cancel();
  33. break;
  34. case "Export":
  35. this.DoExport();
  36. break;
  37. }
  38. }
  39. private void Judge()
  40. {
  41. try
  42. {
  43. int count = 0;
  44. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  45. {
  46. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  47. {
  48. string heat_no = ugr.Cells["HEAT_NO"].Value.ToString();
  49. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  50. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  51. if (design_key.Equals(""))
  52. {
  53. if (MessageBox.Show(this, "此板坯无订单号,采用炼钢牌号判定,是否继续操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  54. {
  55. return;
  56. }
  57. }
  58. string grade_name = ugr.Cells["GRADE_NAME"].Value.ToString();
  59. string prod_name = ugr.Cells["PROD_NAME"].Text.ToString();
  60. string username = this.UserInfo.GetUserName();
  61. string assay_no = "";
  62. UltraGridRow ugrs = this.ultraGrid1.ActiveRow;
  63. if (heat_no.Equals(ugrs.Cells["HEAT_NO"].Value.ToString()))
  64. {
  65. List<string> list1 = new List<string>();
  66. foreach (UltraGridRow ugrt in this.ultraGrid2.Rows)
  67. {
  68. if (ugrt.Cells["CHECKBOX"].Text.ToString() == "True")
  69. {
  70. assay_no = ugrt.Cells["STD_TYPE"].Value.ToString();
  71. list1.Add(assay_no);
  72. }
  73. }
  74. if (list1.Count == 0)
  75. {
  76. CoreClientParam ccp = new CoreClientParam();
  77. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  78. ccp.MethodName = "LGRlChemJudgeBySystem";
  79. ccp.ServerParams = new object[] { heat_no, material_no, design_key, username, grade_name, prod_name, "4001LG0" };
  80. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  81. if (ccp.ReturnCode == 2 && count == 0)
  82. {
  83. MessageBox.Show(ccp.ReturnInfo);
  84. count++;
  85. }
  86. }
  87. else
  88. {
  89. CoreClientParam ccp = new CoreClientParam();
  90. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  91. ccp.MethodName = "LGRlChemJudgeByHuman";
  92. ccp.ServerParams = new object[] { heat_no, material_no, design_key, username, grade_name, list1, prod_name, "4001LG0" };
  93. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  94. if (ccp.ReturnCode == 2 && count == 0)
  95. {
  96. MessageBox.Show(ccp.ReturnInfo);
  97. count++;
  98. }
  99. }
  100. }
  101. else
  102. {
  103. CoreClientParam ccp = new CoreClientParam();
  104. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  105. ccp.MethodName = "LGRlChemJudgeBySystem";
  106. ccp.ServerParams = new object[] { heat_no, material_no, design_key, username, grade_name, prod_name, "4001LG0" };
  107. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  108. if (ccp.ReturnCode == 2 && count == 0)
  109. {
  110. MessageBox.Show(ccp.ReturnInfo);
  111. count++;
  112. }
  113. }
  114. }
  115. }
  116. if (count == 0)
  117. {
  118. MessageBox.Show("判定成功!");
  119. }
  120. //UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  121. //List<string> list1 = new List<string>();
  122. //if (ugr == null)
  123. // return;
  124. //string heat_no = ugr.Cells["HEAT_NO"].Value.ToString();
  125. //string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  126. //string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  127. //string grade_name = ugr.Cells["GRADE_NAME"].Value.ToString();
  128. //string prod_name = ugr.Cells["PROD_NAME"].Text.ToString();
  129. //string username = this.UserInfo.GetUserName();
  130. //string assay_no = "";
  131. //foreach (UltraGridRow ugrs in this.ultraGrid2.Rows)
  132. //{
  133. // if (ugrs.Cells["CHECKBOX"].Text.ToString() == "True")
  134. // {
  135. // assay_no = ugrs.Cells["STD_TYPE"].Value.ToString();
  136. // list1.Add(assay_no);
  137. // }
  138. //}
  139. //if (list1.Count == 0)
  140. //{
  141. // MessageBox.Show("请选择检验实绩!");
  142. // return;
  143. //}
  144. //CoreClientParam ccp = new CoreClientParam();
  145. //ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  146. //ccp.MethodName = "LGRlChemJudgeByHuman";
  147. //ccp.ServerParams = new object[] { heat_no, material_no, design_key, username, grade_name, list1, prod_name, "4001LG0" };
  148. //ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  149. //if (ccp.ReturnCode == -1)
  150. //{
  151. // return;
  152. //}
  153. //ugr.Delete(false);
  154. //MessageBox.Show("判定成功!");
  155. }
  156. catch(Exception EX)
  157. {
  158. MessageBox.Show(EX.ToString());
  159. }
  160. DoQuery();
  161. }
  162. private void Cancel()
  163. {
  164. try
  165. {
  166. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  167. if (ugr == null)
  168. return;
  169. string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
  170. string username = this.UserInfo.GetUserName();
  171. CoreClientParam ccp = new CoreClientParam();
  172. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  173. ccp.MethodName = "CancelLgRJudge";
  174. ccp.ServerParams = new object[] { MATERIAL_NO, username };
  175. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  176. if (ccp.ReturnCode != -1)
  177. {
  178. MessageBox.Show("取消判定成功!");
  179. }
  180. }
  181. catch (Exception ex)
  182. {
  183. System.Diagnostics.Debug.WriteLine(ex.ToString());
  184. MessageBox.Show("系统出错,请联系管理人员", "警告");
  185. }
  186. }
  187. private void DoQuery()
  188. {
  189. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  190. {
  191. DoQueryMe();
  192. }
  193. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  194. {
  195. DoQueryRe();
  196. }
  197. }
  198. //查询待判信息
  199. private void DoQueryMe()
  200. {
  201. try
  202. {
  203. this.dataSet5.Clear();
  204. string heatno = this.textBox1.Text.Trim();
  205. string prod_type = this.comboBox2.Text.ToString();
  206. CoreClientParam ccp = new CoreClientParam();
  207. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  208. ccp.MethodName = "getLgRejudgeInfo";
  209. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), heatno,"4001LG0",prod_type,"C"};
  210. ccp.SourceDataTable = this.dataSet5.Tables[0];
  211. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  212. }
  213. catch (Exception ex)
  214. {
  215. System.Diagnostics.Debug.WriteLine(ex.ToString());
  216. MessageBox.Show("系统出错,请联系管理人员", "警告");
  217. }
  218. }
  219. //查询判定记录
  220. private void DoQueryRe()
  221. {
  222. try
  223. {
  224. this.dataSet1.Clear();
  225. string heatno = textBox1.Text.Trim();
  226. string isvalid = "0";
  227. if (checkBox2.Checked)
  228. {
  229. isvalid = "1";
  230. }
  231. CoreClientParam ccp = new CoreClientParam();
  232. string prod_type = this.comboBox2.Text.ToString();
  233. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  234. ccp.MethodName = "getLgjudgeInfo";
  235. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyy-MM-dd"), this.dateTimePicker2.Value.ToString("yyyy-MM-dd"), heatno, "4001LG0", prod_type, "C" ,isvalid};
  236. ccp.SourceDataTable = this.dataSet1.Tables[0];
  237. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  238. }
  239. catch (Exception ex)
  240. {
  241. System.Diagnostics.Debug.WriteLine(ex.ToString());
  242. MessageBox.Show("系统出错,请联系管理人员", "警告");
  243. }
  244. }
  245. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  246. {
  247. try
  248. {
  249. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  250. if (ugr == null)
  251. return;
  252. this.dataSet4.Clear();
  253. string cic_id = ugr.Cells["CIC_ID"].Value.ToString();
  254. CoreClientParam ccp = new CoreClientParam();
  255. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  256. ccp.MethodName = "GetLgRChemeResult";
  257. ccp.ServerParams = new object[] { cic_id };
  258. ccp.SourceDataTable = this.dataSet4.Tables[0];
  259. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  260. //ccp = new CoreClientParam();
  261. //ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  262. //ccp.MethodName = "GetCheme";
  263. //ccp.ServerParams = new object[] { cic_id };
  264. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  265. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  266. //{
  267. // foreach (UltraGridRow ugr5 in this.ultraGrid5.Rows)
  268. // {
  269. // 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()))
  270. // {
  271. // ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Appearance.BackColor = Color.Red;
  272. // }
  273. // }
  274. //}
  275. UltraGridRow judge_row = null;
  276. foreach (UltraGridRow ugst in this.ultraGrid5.Rows)
  277. {
  278. if(ccp.ReturnInfo.Contains (ugst.Cells["STD_TYPE"].Text.ToString()))
  279. {
  280. ugst.Appearance.BackColor = Color.Green;
  281. }
  282. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  283. {
  284. judge_row = ugst;
  285. }
  286. if (judge_row != null)
  287. {
  288. foreach (UltraGridRow ugs in this.ultraGrid5.Rows)
  289. {
  290. 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() == "特殊要求(熔炼)"))
  291. {
  292. for (int i = 0; i < ugs.Cells.Count; i++)
  293. {
  294. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  295. {
  296. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  297. if (str_arr.Length == 1)
  298. {
  299. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  300. {
  301. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  302. {
  303. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  304. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  305. {
  306. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  307. }
  308. }
  309. }
  310. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  311. {
  312. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  313. {
  314. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  315. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  316. {
  317. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  318. }
  319. }
  320. }
  321. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  322. {
  323. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  324. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  325. {
  326. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  327. }
  328. }
  329. }
  330. else if (str_arr.Length == 2)
  331. {
  332. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  333. {
  334. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  335. {
  336. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  337. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  338. {
  339. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  340. }
  341. }
  342. }
  343. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  344. {
  345. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  346. {
  347. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  348. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  349. {
  350. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  351. }
  352. }
  353. }
  354. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  355. {
  356. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  357. {
  358. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  359. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  360. {
  361. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  362. }
  363. }
  364. }
  365. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  366. {
  367. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  368. {
  369. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  370. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  371. {
  372. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  373. }
  374. }
  375. }
  376. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  377. {
  378. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  379. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  380. {
  381. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  382. }
  383. }
  384. }
  385. }
  386. }
  387. }
  388. }
  389. }
  390. }
  391. }
  392. catch (Exception ex)
  393. {
  394. //System.Diagnostics.Debug.WriteLine(ex.ToString());
  395. //MessageBox.Show("系统出错,请联系管理人员", "警告");
  396. }
  397. }
  398. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  399. {
  400. try
  401. {
  402. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  403. if (ugr == null)
  404. return;
  405. this.dataSet3.Clear();
  406. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  407. if (design_key.Equals(""))
  408. {
  409. design_key = ugr.Cells["OLD_DESIGN_KEY"].Value.ToString();
  410. }
  411. string smp_no = ugr.Cells["HEAT_NO"].Value.ToString();
  412. string grade_name = ugr.Cells["GRADE_NAME"].Text.ToString();
  413. CoreClientParam ccp = new CoreClientParam();
  414. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  415. ccp.MethodName = "GetLgRChemeInfo";
  416. ccp.ServerParams = new object[] { design_key, smp_no,grade_name };
  417. ccp.SourceDataTable = this.dataSet3.Tables[0];
  418. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  419. UltraGridRow judge_row = null;
  420. int count1 = 0;
  421. List<string> s = new List<string>();
  422. foreach (UltraGridRow ugst in this.ultraGrid2.Rows)
  423. {
  424. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  425. {
  426. judge_row = ugst;
  427. }
  428. if (judge_row != null)
  429. {
  430. foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
  431. {
  432. 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() == "特殊要求(熔炼)"))
  433. {
  434. for (int i = 0; i < ugs.Cells.Count; i++)
  435. {
  436. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  437. {
  438. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  439. if (str_arr.Length == 1)
  440. {
  441. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  442. {
  443. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  444. {
  445. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  446. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  447. if(!s.Contains(judge_row.Cells[i].ToString()))
  448. {
  449. s.Add(judge_row.Cells[i].ToString());
  450. count1++;
  451. }
  452. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  453. {
  454. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  455. }
  456. }
  457. }
  458. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  459. {
  460. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  461. {
  462. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  463. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  464. if (!s.Contains(judge_row.Cells[i].ToString()))
  465. {
  466. s.Add(judge_row.Cells[i].ToString());
  467. count1++;
  468. }
  469. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  470. {
  471. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  472. }
  473. }
  474. }
  475. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  476. {
  477. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  478. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  479. if (!s.Contains(judge_row.Cells[i].ToString()))
  480. {
  481. s.Add(judge_row.Cells[i].ToString());
  482. count1++;
  483. }
  484. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  485. {
  486. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  487. }
  488. }
  489. }
  490. else if (str_arr.Length == 2)
  491. {
  492. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  493. {
  494. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  495. {
  496. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  497. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  498. if (!s.Contains(judge_row.Cells[i].ToString()))
  499. {
  500. s.Add(judge_row.Cells[i].ToString());
  501. count1++;
  502. }
  503. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  504. {
  505. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  506. }
  507. }
  508. }
  509. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  510. {
  511. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  512. {
  513. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  514. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  515. if (!s.Contains(judge_row.Cells[i].ToString()))
  516. {
  517. s.Add(judge_row.Cells[i].ToString());
  518. count1++;
  519. }
  520. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  521. {
  522. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  523. }
  524. }
  525. }
  526. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  527. {
  528. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  529. {
  530. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  531. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  532. if (!s.Contains(judge_row.Cells[i].ToString()))
  533. {
  534. s.Add(judge_row.Cells[i].ToString());
  535. count1++;
  536. }
  537. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  538. {
  539. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  540. }
  541. }
  542. }
  543. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  544. {
  545. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  546. {
  547. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  548. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  549. if (!s.Contains(judge_row.Cells[i].ToString()))
  550. {
  551. s.Add(judge_row.Cells[i].ToString());
  552. count1++;
  553. }
  554. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  555. {
  556. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  557. }
  558. }
  559. }
  560. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  561. {
  562. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  563. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  564. if (!s.Contains(judge_row.Cells[i].ToString()))
  565. {
  566. s.Add(judge_row.Cells[i].ToString());
  567. count1++;
  568. }
  569. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  570. {
  571. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  572. }
  573. }
  574. }
  575. }
  576. }
  577. }
  578. }
  579. }
  580. }
  581. if (count1 > 0)
  582. {
  583. this.label2.BackColor = Color.Red;
  584. this.label2.Text = "" + smp_no + "有" + count1 + "条元素成分不合格!";
  585. //MessageBox.Show("" + smp_no + "有" + count1 + "条元素成分不合格!");
  586. }
  587. else
  588. {
  589. this.label2.Text = "";
  590. }
  591. }
  592. catch (Exception ex)
  593. {
  594. System.Diagnostics.Debug.WriteLine(ex.ToString());
  595. MessageBox.Show("系统出错,请联系管理人员", "警告");
  596. }
  597. }
  598. private void QCM030803_Load(object sender, EventArgs e)
  599. {
  600. this.comboBox2.SelectedIndex = 0;
  601. this.checkBox2.Visible = false;
  602. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  603. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  604. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
  605. this.DoQuery();
  606. }
  607. private void ultraTabControl1_Click(object sender, EventArgs e)
  608. {
  609. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  610. {
  611. this.checkBox2.Visible = true;
  612. this.label6.Text = "判定时间";
  613. }
  614. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  615. {
  616. this.checkBox2.Visible = false;
  617. this.label6.Text = "生产时间";
  618. }
  619. }
  620. private void DoExport()
  621. {
  622. try
  623. {
  624. if (this.ultraGrid4.Rows.Count == 0)
  625. {
  626. MessageBox.Show("没有可以导出的数据", "提示");
  627. return;
  628. }
  629. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  630. {
  631. string fName = this.saveFileDialog1.FileName;
  632. this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
  633. Process.Start(fName);
  634. }
  635. }
  636. catch (Exception ex)
  637. {
  638. System.Diagnostics.Debug.WriteLine(ex.ToString());
  639. }
  640. }
  641. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  642. {
  643. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  644. {
  645. if (checkBox1.Checked)
  646. {
  647. ugr.Cells["CHECK"].Value = "True";
  648. }
  649. else
  650. {
  651. ugr.Cells["CHECK"].Value = "False";
  652. }
  653. }
  654. }
  655. private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
  656. {
  657. if (e.Cell.Column.Key.ToString() == "CHECKBOX")
  658. {
  659. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  660. {
  661. ugr.Cells["CHECKBOX"].Value = "False";
  662. }
  663. }
  664. }
  665. }
  666. }