QCM0305.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  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 Infragistics.Win.UltraWinGrid;
  10. using Infragistics.Win;
  11. using System.Collections;
  12. using CoreFS.CA06;
  13. using System.Diagnostics;
  14. namespace Core.LZMes.Client.QCM
  15. {
  16. public partial class QCM0305 : FrmBase
  17. {
  18. public QCM0305()
  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. Operate();
  31. break;
  32. case "FB":
  33. fb();
  34. break;
  35. case "Cancel_FB":
  36. cancel_fb();
  37. break;
  38. case "Exit":
  39. this.Close();
  40. break;
  41. case "Export":
  42. this.DoExport();
  43. break;
  44. }
  45. }
  46. private void DoQuery()
  47. {
  48. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  49. {
  50. DoQueryMe();
  51. }
  52. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  53. {
  54. DoQueryRe();
  55. }
  56. }
  57. private void DoQueryMe()
  58. {
  59. //查询探伤待检信息(轧批号、计划号)
  60. try
  61. {
  62. this.dataSet3.Clear();
  63. dataSet6.Clear();
  64. string starttime = "";
  65. string endtime = "";
  66. if (checkBox2.Checked)
  67. {
  68. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  69. endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd");
  70. }
  71. string sbatchno = "";
  72. string ebatchno = "";
  73. if (checkBox3.Checked)
  74. {
  75. sbatchno = this.textBox2.Text.Trim();
  76. if (textBox1.Text.ToString() == "")
  77. {
  78. ebatchno = this.textBox2.Text.Trim();
  79. }
  80. else
  81. {
  82. ebatchno = this.textBox1.Text.Trim();
  83. }
  84. }
  85. if (!checkBox2.Checked && !checkBox3.Checked)
  86. {
  87. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  88. return;
  89. }
  90. string orderno = this.textBox4.Text.Trim();// 订单号
  91. string psc = textBox3.Text.Trim(); //产品描述
  92. string prodline = comboBox3.Text.ToString();
  93. string isjudge = this.comboBox4.Text.ToString();
  94. //string planno = this.textBox8.Text.Trim();
  95. //string stellname = this.textBox7.Text.Trim();
  96. CoreClientParam ccp = new CoreClientParam();
  97. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  98. ccp.MethodName = "doQueryMaterialDetailsJ";
  99. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc, "B", prodline, isjudge };
  100. ccp.SourceDataTable = this.dataSet3.Tables[0];
  101. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  102. ccp = new CoreClientParam();
  103. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  104. ccp.MethodName = "findFlawDataJ";
  105. ccp.ServerParams = new object[] { prodline };
  106. ccp.SourceDataTable = this.dataSet6.Tables[0];
  107. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  108. ultraCombo1.DataSource = ccp.SourceDataTable;
  109. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].EditorComponent = ultraCombo1;
  110. }
  111. catch (Exception ex)
  112. {
  113. System.Diagnostics.Debug.WriteLine(ex.ToString());
  114. MessageBox.Show("系统出错,请联系管理人员", "警告");
  115. }
  116. }
  117. private void DoQueryRe()
  118. {
  119. //查询判定记录
  120. try
  121. {
  122. this.dataSet2.Clear();
  123. string starttime = "";
  124. string endtime = "";
  125. if (checkBox2.Checked)
  126. {
  127. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  128. endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  129. }
  130. string sbatchno = "";
  131. string ebatchno = "";
  132. if (checkBox3.Checked)
  133. {
  134. sbatchno = this.textBox2.Text.Trim();
  135. if (textBox1.Text.ToString() == "")
  136. {
  137. ebatchno = this.textBox2.Text.Trim();
  138. }
  139. else
  140. {
  141. ebatchno = this.textBox1.Text.Trim();
  142. }
  143. }
  144. if (!checkBox2.Checked && !checkBox3.Checked)
  145. {
  146. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  147. return;
  148. }
  149. string orderno = textBox4.Text.Trim();
  150. string psc = textBox3.Text.Trim();
  151. string prodline = comboBox3.Text.ToString();
  152. string stellname = this.textBox7.Text.Trim();
  153. CoreClientParam ccp = new CoreClientParam();
  154. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  155. ccp.MethodName = "GetSurfaceInfoJ";
  156. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc, prodline, stellname };
  157. ccp.SourceDataTable = this.dataSet2.Tables[0];
  158. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  159. }
  160. catch (Exception ex)
  161. {
  162. System.Diagnostics.Debug.WriteLine(ex.ToString());
  163. MessageBox.Show("系统出错,请联系管理人员", "警告");
  164. }
  165. }
  166. private void Operate()
  167. {
  168. string material_no = "";
  169. try
  170. {
  171. UltraGridRow ugr = this.ultraGrid3.ActiveRow;
  172. if (ugr == null)
  173. return;
  174. CoreClientParam ccp = new CoreClientParam();
  175. foreach (UltraGridRow ugrs in this.ultraGrid4.Rows)
  176. {
  177. if (ugrs.Cells["CHECKBOX"].Text.ToString() == "True")
  178. {
  179. string surfaceid = ugrs.Cells["SURFACE_ID"].Value.ToString();
  180. string username = this.UserInfo.GetUserName();
  181. string userorder = this.UserInfo.GetUserOrderText();
  182. string usergroup = this.UserInfo.GetUserGroupText();
  183. string flag = "";
  184. if(ugrs.Cells["PRIMARY_FLAG"].Text.ToString().Contains("是")){
  185. flag = "1";
  186. }else{
  187. flag = "0";
  188. }
  189. ccp = new CoreClientParam();
  190. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  191. ccp.MethodName = "repairFlaw";
  192. ccp.ServerParams = new object[] { surfaceid, ugrs.Cells["FLAW_SEQ"].Value.ToString(), flag, username, userorder, usergroup };
  193. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  194. }
  195. }
  196. this.dataSet4.Clear();
  197. string surface_id = ugr.Cells["SURFACE_ID"].Value.ToString();
  198. ccp = new CoreClientParam();
  199. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  200. ccp.MethodName = "findNameByMN";
  201. ccp.ServerParams = new object[] { surface_id };
  202. ccp.SourceDataTable = this.dataSet4.Tables[0];
  203. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  204. }
  205. catch (Exception ex)
  206. {
  207. System.Diagnostics.Debug.WriteLine(ex.ToString());
  208. MessageBox.Show("系统出错,请联系管理人员", "警告");
  209. }
  210. }
  211. private void fb()
  212. {
  213. try
  214. {
  215. List<UltraGridRow> lists = new List<UltraGridRow>();
  216. foreach (UltraGridRow ugr in ultraGrid3.Rows)
  217. {
  218. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  219. {
  220. CoreClientParam ccp = new CoreClientParam();
  221. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  222. ccp.MethodName = "coiljudge_status_call_commit";
  223. ccp.ServerParams = new object[] { ugr.Cells["PLINE_CODE"].Value.ToString()
  224. , ugr.Cells["MATERIAL_NO"].Value.ToString()
  225. , ""
  226. , ""
  227. , ""
  228. , ""
  229. , ""
  230. , "Y"
  231. , txt_fb_reason.Text};
  232. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  233. if (ccp.ReturnCode == -1)
  234. {
  235. return;
  236. }
  237. lists.Add(ugr);
  238. }
  239. }
  240. for (int i = 0; i < lists.Count; i++)
  241. {
  242. lists[i].Delete(false);
  243. }
  244. //DoQuery();
  245. MessageBox.Show("封闭成功!");
  246. }
  247. catch (Exception ex)
  248. {
  249. System.Diagnostics.Debug.WriteLine(ex.ToString());
  250. MessageBox.Show("系统出错,请联系管理人员", "警告");
  251. }
  252. }
  253. private void cancel_fb()
  254. {
  255. try
  256. {
  257. List<UltraGridRow> lists = new List<UltraGridRow>();
  258. foreach (UltraGridRow ugr in ultraGrid3.Rows)
  259. {
  260. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  261. {
  262. CoreClientParam ccp = new CoreClientParam();
  263. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  264. ccp.MethodName = "coiljudge_status_call_commit";
  265. ccp.ServerParams = new object[] { ugr.Cells["PLINE_CODE"].Value.ToString()
  266. , ugr.Cells["MATERIAL_NO"].Value.ToString()
  267. , ""
  268. , ""
  269. , ""
  270. , ""
  271. , ""
  272. , "N"
  273. , txt_fb_reason.Text};
  274. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  275. if (ccp.ReturnCode == -1)
  276. {
  277. return;
  278. }
  279. lists.Add(ugr);
  280. }
  281. }
  282. for (int i = 0; i < lists.Count; i++)
  283. {
  284. lists[i].Delete(false);
  285. }
  286. //DoQuery();
  287. MessageBox.Show("解除封闭成功!");
  288. }
  289. catch (Exception ex)
  290. {
  291. System.Diagnostics.Debug.WriteLine(ex.ToString());
  292. MessageBox.Show("系统出错,请联系管理人员", "警告");
  293. }
  294. }
  295. private void label9_Click(object sender, EventArgs e)
  296. {
  297. try
  298. {
  299. List<UltraGridRow> lists = new List<UltraGridRow>();
  300. foreach (UltraGridRow ugr in ultraGrid3.Rows)
  301. {
  302. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  303. {
  304. ArrayList list1 = new ArrayList();
  305. List<ArrayList> list2 = new List<ArrayList>();
  306. if (comboBox1.Text.Trim() == "")
  307. {
  308. MessageBox.Show("请输入检验结果!");
  309. return;
  310. }
  311. if (comboBox2.Text.Trim() == "")
  312. {
  313. MessageBox.Show("请输入质量等级!");
  314. return;
  315. }
  316. string is_pass = "";
  317. string is_zl = "";
  318. if (comboBox1.Text.ToString() == "合格")
  319. {
  320. is_pass = "1";
  321. }
  322. else if (comboBox1.Text.ToString() == "不合格")
  323. {
  324. is_pass = "2";
  325. }
  326. else
  327. {
  328. is_pass = "0";
  329. }
  330. if (comboBox2.Text.ToString() == "正品")
  331. {
  332. is_zl = "512601";
  333. }
  334. else if (comboBox2.Text.ToString() == "次品")
  335. {
  336. is_zl = "512602";
  337. }
  338. else if (comboBox2.Text.ToString() == "废品")
  339. {
  340. is_zl = "512603";
  341. }
  342. else if (comboBox2.Text.ToString() == "协议品")
  343. {
  344. is_zl = "512604";
  345. }
  346. else if (comboBox2.Text.ToString() == "订单外")
  347. {
  348. is_zl = "512605";
  349. }
  350. else if (comboBox2.Text.ToString() == "待处理")
  351. {
  352. is_zl = "512606";
  353. }
  354. list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  355. list1.Add(is_pass);//检验结果代码
  356. list1.Add(comboBox1.Text.Trim().ToString());//检验结果
  357. list1.Add(is_zl);//质量等级代码
  358. list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称
  359. list1.Add(textBox5.Text.ToString().Trim());
  360. list1.Add(this.UserInfo.GetUserName());//操作人
  361. list1.Add(this.UserInfo.GetUserOrderText());//班次
  362. list1.Add(this.UserInfo.GetUserGroupText());//班组
  363. int count = 0;
  364. int i = 0;
  365. foreach (UltraGridRow ugrs in this.ultraGrid4.Rows)
  366. {
  367. if (ugrs.Cells["CHECKBOX"].Text.ToString() == "True")
  368. {
  369. int j = 2;
  370. ArrayList list = new ArrayList();
  371. if (ugrs.Cells["QUEXIAN_TP"].Value.ToString() == null || ugrs.Cells["QUEXIAN_TP"].Value.ToString() == "")
  372. {
  373. MessageBox.Show("请选择缺陷来源次!", "提示");
  374. return;
  375. }
  376. if (ugrs.Cells["PRIMARY_FLAG"].Value.ToString() == "1")
  377. i++;
  378. list.Add(ugrs.Cells["PRIMARY_FLAG"].Value.ToString());
  379. if (ugrs.Cells["PRIMARY_FLAG"].Value.ToString() == "1")
  380. {
  381. list.Add("1");
  382. j = j - 1;
  383. }
  384. else
  385. {
  386. list.Add(j);
  387. }
  388. if (ugrs.Cells["FLAW_DESC"].Text.ToString() == "")
  389. {
  390. list.Add(ugrs.Cells["FLAW_DESC"].Text.ToString());
  391. }
  392. else
  393. {
  394. list.Add(ugrs.Cells["FLAW_DESC"].Value.ToString());
  395. }
  396. list.Add(ugrs.Cells["FLAW_DESC"].Text.ToString());
  397. if (ugrs.Cells["FLAW_DESC"].Text.ToString() == "")
  398. {
  399. MessageBox.Show("已选择的请录入缺陷信息!");
  400. return;
  401. }
  402. if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "上表面")
  403. {
  404. list.Add("U");
  405. }
  406. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "下表面")
  407. {
  408. list.Add("D");
  409. }
  410. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "边部")
  411. {
  412. list.Add("E");
  413. }
  414. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "钢卷侧面")
  415. {
  416. list.Add("A");
  417. }
  418. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "上下表面都有,且不对称")
  419. {
  420. list.Add("N");
  421. }
  422. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "上下表面都有,且对称")
  423. {
  424. list.Add("S");
  425. }
  426. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "上凸下凹")
  427. {
  428. list.Add("T");
  429. }
  430. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "上凹下凸")
  431. {
  432. list.Add("B");
  433. }
  434. else if (ugrs.Cells["FLAW_AREA"].Text.ToString() == "已跟踪去重卷切除")
  435. {
  436. list.Add("C");
  437. }
  438. else
  439. {
  440. list.Add("");
  441. }
  442. //list.Add(ugrs.Cells["FLAW_TYPE_DESC"].Value.ToString());
  443. //list.Add(ugrs.Cells["FLAW_TYPE_DESC"].Text.ToString());
  444. if (ugrs.Cells["FLAW_POS_DESC"].Text.ToString() == "")
  445. {
  446. list.Add(ugrs.Cells["FLAW_POS_DESC"].Text.ToString());
  447. }
  448. else
  449. {
  450. list.Add(ugrs.Cells["FLAW_POS_DESC"].Value.ToString());
  451. }
  452. list.Add(ugrs.Cells["FLAW_POS_DESC"].Text.ToString());
  453. if (ugrs.Cells["FLAW_DIR_DESC"].Text.ToString() == "")
  454. {
  455. list.Add(ugrs.Cells["FLAW_DIR_DESC"].Text.ToString());
  456. }
  457. else
  458. {
  459. list.Add(ugrs.Cells["FLAW_DIR_DESC"].Value.ToString());
  460. }
  461. list.Add(ugrs.Cells["FLAW_DIR_DESC"].Text.ToString());
  462. if (ugrs.Cells["FLAW_SIZE_DESC"].Text.ToString() == "")
  463. {
  464. list.Add(ugrs.Cells["FLAW_SIZE_DESC"].Text.ToString());
  465. }
  466. else
  467. {
  468. list.Add(ugrs.Cells["FLAW_SIZE_DESC"].Value.ToString());
  469. }
  470. list.Add(ugrs.Cells["FLAW_SIZE_DESC"].Text.ToString());
  471. if (ugrs.Cells["FLAW_LV_DESC"].Text.ToString() == "")
  472. {
  473. list.Add(ugrs.Cells["FLAW_LV_DESC"].Text.ToString());
  474. }
  475. else
  476. {
  477. list.Add(ugrs.Cells["FLAW_LV_DESC"].Value.ToString());
  478. }
  479. list.Add(ugrs.Cells["FLAW_LV_DESC"].Text.ToString());
  480. //if (!IsNumberal(ugrs.Cells["FLAW_QUANTITY"].Text))
  481. //{
  482. // MessageBox.Show("数量请输入数字!");
  483. // return;
  484. //}
  485. list.Add(ugrs.Cells["FLAW_QUANTITY"].Text.ToString());
  486. list.Add(ugrs.Cells["MEMO"].Text.ToString());
  487. if (ugrs.Cells["IS_REPAIR"].Text.ToString() == "")
  488. {
  489. list.Add("0");
  490. }
  491. else
  492. {
  493. list.Add(ugrs.Cells["IS_REPAIR"].Value.ToString());
  494. }
  495. list.Add(ugrs.Cells["QUEXIAN_TP"].Value.ToString());
  496. count++;
  497. j++;
  498. list2.Add(list);
  499. }
  500. }
  501. if (count == 0 && comboBox1.Text.ToString() == "不合格")
  502. {
  503. MessageBox.Show("请录入缺陷信息并选择!");
  504. return;
  505. }
  506. if (i == 0 && comboBox1.Text.ToString() == "不合格")
  507. {
  508. MessageBox.Show("请录入主要缺陷!");
  509. return;
  510. }
  511. if (i > 1)
  512. {
  513. MessageBox.Show("请不要录入多条主要缺陷!");
  514. return;
  515. }
  516. if ((comboBox1.Text.ToString() == "合格" && comboBox2.Text.ToString() != "正品") || (comboBox1.Text.ToString() == "不合格" && comboBox2.Text.ToString() == "正品"))
  517. {
  518. MessageBox.Show("检验结果与质量等级不一致!");
  519. return;
  520. }
  521. CoreClientParam ccp = new CoreClientParam();
  522. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  523. ccp.MethodName = "doAddFlawJ";
  524. ccp.ServerParams = new object[] { list2, list1 };
  525. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  526. if (ccp.ReturnCode == -1)
  527. {
  528. return;
  529. }
  530. lists.Add(ugr);
  531. }
  532. }
  533. for (int i = 0; i < lists.Count; i++)
  534. {
  535. lists[i].Delete(false);
  536. }
  537. //DoQuery();
  538. MessageBox.Show("登记成功!");
  539. }catch(Exception ex)
  540. {
  541. System.Diagnostics.Debug.WriteLine(ex.ToString());
  542. MessageBox.Show("系统出错,请联系管理人员", "警告");
  543. }
  544. }
  545. public static bool IsNumberal(string input)
  546. {
  547. bool flag = true;
  548. int count = 0;
  549. int count1 = 0;
  550. if (input.Length == 0)
  551. {
  552. flag = false;
  553. }
  554. else
  555. {
  556. char[] x = input.ToCharArray();
  557. for (int i = 0; i < input.Length; i++)
  558. {
  559. if (!char.IsNumber(x[i]) && x[i] != '.' && x[i] != '-')
  560. {
  561. flag = false; break;
  562. }
  563. if (x[i] == '.')
  564. {
  565. count++;
  566. if (i == 0 || i == input.Length - 1) flag = false;
  567. }
  568. if (x[i] == '-')
  569. {
  570. count1++;
  571. if (i > 1) flag = false;
  572. }
  573. }
  574. if (count > 1 || count1 > 1) flag = false;
  575. }
  576. return flag;
  577. }
  578. private void QCM0305_Load(object sender, EventArgs e)
  579. {
  580. this.comboBox3.SelectedIndex = 0;
  581. this.comboBox4.SelectedIndex = 0;
  582. string prodline = comboBox3.Text.ToString();
  583. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  584. this.ultraGrid3.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  585. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  586. this.ultraGrid1.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue;
  587. this.ultraGrid3.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue;
  588. this.ultraGrid4.DisplayLayout.Bands[0].Header.Appearance.BackColor = Color.LightBlue;
  589. ValueList vis_repair = new ValueList();
  590. vis_repair.ValueListItems.Add("0", "待修复");
  591. vis_repair.ValueListItems.Add("1", "已修复");
  592. this.ultraGrid4.DisplayLayout.Bands[0].Columns["IS_REPAIR"].ValueList = vis_repair;
  593. ValueList vprimary_flag = new ValueList();
  594. vprimary_flag.ValueListItems.Add("1", "是");
  595. vprimary_flag.ValueListItems.Add("0", "否");
  596. this.ultraGrid4.DisplayLayout.Bands[0].Columns["PRIMARY_FLAG"].ValueList = vprimary_flag;
  597. ValueList vFLAW_DESC = new ValueList();
  598. CoreClientParam ccp = new CoreClientParam();
  599. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  600. ccp.MethodName = "findJFlawArea";
  601. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  602. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  603. {
  604. vFLAW_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  605. }
  606. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_AREA"].ValueList = vFLAW_DESC;
  607. ValueList vflaw_pos_desc = new ValueList();
  608. ccp = new CoreClientParam();
  609. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  610. ccp.MethodName = "findJFlawPosDesc";
  611. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  612. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  613. {
  614. vflaw_pos_desc.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  615. }
  616. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_POS_DESC"].ValueList = vflaw_pos_desc;
  617. ValueList vsflv = new ValueList();
  618. ccp = new CoreClientParam();
  619. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  620. ccp.MethodName = "findSfLv";
  621. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  622. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  623. {
  624. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  625. }
  626. this.comboBox2.DataSource = vsflv.ValueListItems;
  627. ValueList VFLAW_SIZE_DESC = new ValueList();
  628. ccp = new CoreClientParam();
  629. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  630. ccp.MethodName = "findJFlawSizeDesc";
  631. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  632. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  633. {
  634. VFLAW_SIZE_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  635. }
  636. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_SIZE_DESC"].ValueList = VFLAW_SIZE_DESC;
  637. ValueList VFLAW_LV_DESC = new ValueList();
  638. ccp = new CoreClientParam();
  639. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  640. ccp.MethodName = "findJFlawLvDesc";
  641. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  642. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  643. {
  644. VFLAW_LV_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  645. }
  646. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_LV_DESC"].ValueList = VFLAW_LV_DESC;
  647. ValueList VFLAW_DIR_DESC = new ValueList();
  648. ccp = new CoreClientParam();
  649. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  650. ccp.MethodName = "findJFlawDirDesc";
  651. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  652. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  653. {
  654. VFLAW_DIR_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  655. }
  656. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DIR_DESC"].ValueList = VFLAW_DIR_DESC;
  657. //ccp = new CoreClientParam();
  658. //ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  659. //ccp.MethodName = "findFlawDataJ";
  660. //ccp.ServerParams = new object[] {prodline };
  661. //ccp.SourceDataTable = this.dataSet6.Tables[0];
  662. //this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  663. ////ValueList VDEFECT_DESC = new ValueList();
  664. ////for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  665. ////{
  666. //// VDEFECT_DESC.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["DEFECT_CODE"].ToString(), ccp.SourceDataTable.Rows[i]["DEFECT_DESC"].ToString());
  667. ////}
  668. ////this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].ValueList = VDEFECT_DESC;
  669. ////this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].EditorComponent = VDEFECT_DESC;
  670. //UltraCombo uc;
  671. //uc = new UltraCombo();
  672. //uc.BindingContext = this.BindingContext;
  673. //uc.DataSource = ccp.SourceDataTable;
  674. //this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].ValueList = new BindableValueList(ccp.SourceDataTable, "", "DEFECT_NAME", "DEFECT_CODE", this.ultraGrid4);
  675. DoQuery();
  676. }
  677. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  678. {
  679. try
  680. {
  681. UltraGridRow ugr = this.ultraGrid3.ActiveRow;
  682. this.dataSet4.Clear();
  683. string surface_id = ugr.Cells["SURFACE_ID"].Value.ToString();
  684. if (surface_id != "")
  685. {
  686. CoreClientParam ccp = new CoreClientParam();
  687. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  688. ccp.MethodName = "findNameByMN";
  689. ccp.ServerParams = new object[] { surface_id };
  690. ccp.SourceDataTable = this.dataSet4.Tables[0];
  691. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  692. }
  693. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  694. if (design_key != "")
  695. {
  696. CoreClientParam ccp = new CoreClientParam();
  697. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  698. ccp.MethodName = "GetMemo";
  699. ccp.ServerParams = new object[] { design_key };
  700. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  701. if (ccp.SourceDataTable.Rows.Count == 0)
  702. {
  703. this.textBox6.Text = "";
  704. }
  705. else
  706. {
  707. this.textBox6.Text = ccp.SourceDataTable.Rows[0]["MEMO"].ToString();
  708. }
  709. }
  710. this.ultraGrid4.DisplayLayout.Bands[0].Columns["FLAW_DESC"].EditorComponent = ultraCombo1;
  711. foreach (UltraGridRow ugrs in this.ultraGrid4.Rows)
  712. {
  713. if (ugrs.Cells["IS_REPAIR"].Text.ToString().Contains("已修复"))
  714. {
  715. ugrs.Appearance.BackColor = Color.Pink;
  716. }
  717. }
  718. }
  719. catch (Exception ex)
  720. {
  721. System.Diagnostics.Debug.WriteLine(ex.ToString());
  722. MessageBox.Show("系统出错,请联系管理人员", "警告");
  723. }
  724. }
  725. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  726. {
  727. try
  728. {
  729. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  730. if (ugr == null)
  731. return;
  732. this.dataSet5.Clear();
  733. string surface_id = ugr.Cells["SURFACE_ID"].Value.ToString();
  734. CoreClientParam ccp = new CoreClientParam();
  735. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  736. ccp.MethodName = "findNameByMN";
  737. ccp.ServerParams = new object[] { surface_id };
  738. ccp.SourceDataTable = this.dataSet5.Tables[0];
  739. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  740. foreach (UltraGridRow ugrs in this.ultraGrid5.Rows)
  741. {
  742. if (ugrs.Cells["IS_REPAIR"].Text.ToString().Contains("已修复"))
  743. {
  744. ugrs.Appearance.BackColor = Color.Pink;
  745. }
  746. }
  747. }
  748. catch (Exception ex)
  749. {
  750. System.Diagnostics.Debug.WriteLine(ex.ToString());
  751. MessageBox.Show("系统出错,请联系管理人员", "警告");
  752. }
  753. }
  754. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  755. {
  756. foreach (UltraGridRow ugr in this.ultraGrid3.Rows.Where(p => p.IsFilteredOut == false).ToList())
  757. {
  758. if (checkBox1.Checked)
  759. {
  760. ugr.Cells["CHECK"].Value = "True";
  761. }
  762. else
  763. {
  764. ugr.Cells["CHECK"].Value = "False";
  765. }
  766. }
  767. }
  768. private void ultraTabControl1_Click(object sender, EventArgs e)
  769. {
  770. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  771. {
  772. this.label11.Visible = false;
  773. this.comboBox4.Visible = false;
  774. this.label12.Text = "判定时间";
  775. }
  776. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  777. {
  778. this.label11.Visible = true;
  779. this.comboBox4.Visible = true;
  780. this.label12.Text = "生产时间";
  781. }
  782. }
  783. private void DoExport()
  784. {
  785. try
  786. {
  787. if (this.ultraGrid1.Rows.Count == 0)
  788. {
  789. MessageBox.Show("没有可以导出的数据", "提示");
  790. return;
  791. }
  792. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  793. {
  794. string fName = this.saveFileDialog1.FileName;
  795. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  796. Process.Start(fName);
  797. }
  798. }
  799. catch (Exception ex)
  800. {
  801. System.Diagnostics.Debug.WriteLine(ex.ToString());
  802. }
  803. }
  804. }
  805. }