de403d1f60667440e89144283002248ce303904b.svn-base 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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 QCM030804 : FrmBase
  16. {
  17. public QCM030804()
  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, "4001LGX" };
  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, "4001LGX" };
  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, "4001LGX" };
  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 username = this.UserInfo.GetUserName();
  129. //string prod_name = ugr.Cells["PROD_NAME"].Text.ToString();
  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, "4001LGX" };
  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. }
  161. private void Cancel()
  162. {
  163. try
  164. {
  165. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  166. if (ugr == null)
  167. return;
  168. string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
  169. string username = this.UserInfo.GetUserName();
  170. CoreClientParam ccp = new CoreClientParam();
  171. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  172. ccp.MethodName = "CancelLgRJudge";
  173. ccp.ServerParams = new object[] { MATERIAL_NO, username };
  174. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  175. if (ccp.ReturnCode != -1)
  176. {
  177. MessageBox.Show("取消判定成功!");
  178. }
  179. }
  180. catch (Exception ex)
  181. {
  182. System.Diagnostics.Debug.WriteLine(ex.ToString());
  183. MessageBox.Show("系统出错,请联系管理人员", "警告");
  184. }
  185. DoQuery();
  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,"4001LGX",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 prod_type = this.comboBox2.Text.ToString();
  227. string isvalid = "0";
  228. if (checkBox2.Checked)
  229. {
  230. isvalid = "1";
  231. }
  232. CoreClientParam ccp = new CoreClientParam();
  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, "4001LGX", 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. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  305. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  306. {
  307. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  308. }
  309. }
  310. }
  311. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  312. {
  313. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  314. {
  315. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  316. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  317. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  318. {
  319. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  320. }
  321. }
  322. }
  323. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  324. {
  325. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  326. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  327. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  328. {
  329. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  330. }
  331. }
  332. }
  333. else if (str_arr.Length == 2)
  334. {
  335. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  336. {
  337. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  338. {
  339. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  340. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  341. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  342. {
  343. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  344. }
  345. }
  346. }
  347. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  348. {
  349. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  350. {
  351. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  352. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  353. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  354. {
  355. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  356. }
  357. }
  358. }
  359. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  360. {
  361. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  362. {
  363. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  364. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  365. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  366. {
  367. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  368. }
  369. }
  370. }
  371. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  372. {
  373. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  374. {
  375. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  376. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  377. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  378. {
  379. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  380. }
  381. }
  382. }
  383. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  384. {
  385. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  386. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  387. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  388. {
  389. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  390. }
  391. }
  392. }
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. }
  400. catch (Exception ex)
  401. {
  402. //System.Diagnostics.Debug.WriteLine(ex.ToString());
  403. //MessageBox.Show("系统出错,请联系管理人员", "警告");
  404. }
  405. }
  406. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  407. {
  408. try
  409. {
  410. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  411. if (ugr == null)
  412. return;
  413. this.dataSet3.Clear();
  414. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  415. if(design_key.Equals("")){
  416. design_key = ugr.Cells["OLD_DESIGN_KEY"].Value.ToString();
  417. }
  418. string smp_no = ugr.Cells["HEAT_NO"].Value.ToString();
  419. string grade_name = ugr.Cells["GRADE_NAME"].Text.ToString();
  420. CoreClientParam ccp = new CoreClientParam();
  421. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  422. ccp.MethodName = "GetLgRChemeInfo";
  423. ccp.ServerParams = new object[] { design_key, smp_no,grade_name };
  424. ccp.SourceDataTable = this.dataSet3.Tables[0];
  425. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  426. UltraGridRow judge_row = null;
  427. int count1 = 0;
  428. List<string> s = new List<string>();
  429. foreach (UltraGridRow ugst in this.ultraGrid2.Rows)
  430. {
  431. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  432. {
  433. judge_row = ugst;
  434. }
  435. if (judge_row != null)
  436. {
  437. foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
  438. {
  439. 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() == "特殊要求(熔炼)"))
  440. {
  441. for (int i = 0; i < ugs.Cells.Count; i++)
  442. {
  443. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  444. {
  445. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  446. if (str_arr.Length == 1)
  447. {
  448. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  449. {
  450. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  451. {
  452. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  453. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  454. if (!s.Contains(judge_row.Cells[i].ToString()))
  455. {
  456. s.Add(judge_row.Cells[i].ToString());
  457. count1++;
  458. }
  459. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  460. {
  461. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  462. }
  463. }
  464. }
  465. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  466. {
  467. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  468. {
  469. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  470. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  471. if (!s.Contains(judge_row.Cells[i].ToString()))
  472. {
  473. s.Add(judge_row.Cells[i].ToString());
  474. count1++;
  475. }
  476. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  477. {
  478. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  479. }
  480. }
  481. }
  482. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  483. {
  484. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  485. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  486. if (!s.Contains(judge_row.Cells[i].ToString()))
  487. {
  488. s.Add(judge_row.Cells[i].ToString());
  489. count1++;
  490. }
  491. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  492. {
  493. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  494. }
  495. }
  496. }
  497. else if (str_arr.Length == 2)
  498. {
  499. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  500. {
  501. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  502. {
  503. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  504. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  505. if (!s.Contains(judge_row.Cells[i].ToString()))
  506. {
  507. s.Add(judge_row.Cells[i].ToString());
  508. count1++;
  509. }
  510. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  511. {
  512. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  513. }
  514. }
  515. }
  516. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  517. {
  518. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  519. {
  520. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  521. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  522. if (!s.Contains(judge_row.Cells[i].ToString()))
  523. {
  524. s.Add(judge_row.Cells[i].ToString());
  525. count1++;
  526. }
  527. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  528. {
  529. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  530. }
  531. }
  532. }
  533. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  534. {
  535. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  536. {
  537. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  538. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  539. if (!s.Contains(judge_row.Cells[i].ToString()))
  540. {
  541. s.Add(judge_row.Cells[i].ToString());
  542. count1++;
  543. }
  544. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  545. {
  546. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  547. }
  548. }
  549. }
  550. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  551. {
  552. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  553. {
  554. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  555. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  556. if (!s.Contains(judge_row.Cells[i].ToString()))
  557. {
  558. s.Add(judge_row.Cells[i].ToString());
  559. count1++;
  560. }
  561. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  562. {
  563. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  564. }
  565. }
  566. }
  567. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  568. {
  569. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  570. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  571. if (!s.Contains(judge_row.Cells[i].ToString()))
  572. {
  573. s.Add(judge_row.Cells[i].ToString());
  574. count1++;
  575. }
  576. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  577. {
  578. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  579. }
  580. }
  581. }
  582. }
  583. }
  584. }
  585. }
  586. }
  587. }
  588. if (count1 > 0)
  589. {
  590. this.label2.BackColor = Color.Red;
  591. this.label2.Text = "" + smp_no + "有" + count1 + "条元素成分不合格!";
  592. // MessageBox.Show("" + smp_no + "有" + count1 + "条元素成分不合格!");
  593. }
  594. else
  595. {
  596. this.label2.Text = "";
  597. }
  598. }
  599. catch (Exception ex)
  600. {
  601. System.Diagnostics.Debug.WriteLine(ex.ToString());
  602. MessageBox.Show("系统出错,请联系管理人员", "警告");
  603. }
  604. }
  605. private void QCM030803_Load(object sender, EventArgs e)
  606. {
  607. this.comboBox2.SelectedIndex = 0;
  608. this.checkBox2.Visible = false;
  609. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  610. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  611. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
  612. }
  613. private void ultraTabControl1_Click(object sender, EventArgs e)
  614. {
  615. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  616. {
  617. this.checkBox2.Visible = true;
  618. this.label6.Text = "判定时间";
  619. }
  620. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  621. {
  622. this.checkBox2.Visible = false;
  623. this.label6.Text = "生产时间";
  624. }
  625. }
  626. private void DoExport()
  627. {
  628. try
  629. {
  630. if (this.ultraGrid4.Rows.Count == 0)
  631. {
  632. MessageBox.Show("没有可以导出的数据", "提示");
  633. return;
  634. }
  635. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  636. {
  637. string fName = this.saveFileDialog1.FileName;
  638. this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
  639. Process.Start(fName);
  640. }
  641. }
  642. catch (Exception ex)
  643. {
  644. System.Diagnostics.Debug.WriteLine(ex.ToString());
  645. }
  646. }
  647. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  648. {
  649. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  650. {
  651. if (checkBox1.Checked)
  652. {
  653. ugr.Cells["CHECK"].Value = "True";
  654. }
  655. else
  656. {
  657. ugr.Cells["CHECK"].Value = "False";
  658. }
  659. }
  660. }
  661. private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
  662. {
  663. if (e.Cell.Column.Key.ToString() == "CHECKBOX")
  664. {
  665. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  666. {
  667. ugr.Cells["CHECKBOX"].Value = "False";
  668. }
  669. }
  670. }
  671. }
  672. }