QCM030726.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562
  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 Core.LZMes.Client.QCM.QCM03;
  13. using System.Diagnostics;
  14. using Infragistics.Win.UltraWinEditors;
  15. using Infragistics.Win;
  16. namespace Core.LZMes.Client.QCM
  17. {
  18. public partial class QCM030726 : FrmBase
  19. {
  20. private string judge_type = "";//用于区分1检测中心和2轧钢厂
  21. public QCM030726()
  22. {
  23. InitializeComponent();
  24. }
  25. public override void ToolBar_Click(object sender, string ToolbarKey)
  26. {
  27. switch (ToolbarKey)
  28. {
  29. case "Query":
  30. this.DoQuery();
  31. break;
  32. case "Exit":
  33. this.Close();
  34. break;
  35. case "Unlock":
  36. this.Judge();
  37. break;
  38. case "Export":
  39. this.DoExport();
  40. break;
  41. case "CancelFy":
  42. CancelFy();
  43. break;
  44. }
  45. }
  46. private void CancelFy()
  47. {
  48. if (MessageBox.Show(this, "是否审批不通过?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  49. {
  50. return;
  51. }
  52. List<UltraGridRow> lists = new List<UltraGridRow>();
  53. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  54. {
  55. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  56. {
  57. ArrayList al = new ArrayList();
  58. string apply_id = ugr.Cells["APPLY_ID"].Value.ToString();
  59. string handle_memo = this.textBox2.Text.Trim().ToString();//审批处理备注
  60. if (!string.IsNullOrEmpty(handle_memo))
  61. {
  62. DoUpdate(apply_id, handle_memo);
  63. }
  64. string username = this.UserInfo.GetUserName();
  65. CoreClientParam ccp = new CoreClientParam();
  66. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  67. ccp.MethodName = "ApplyBack";
  68. ccp.ServerParams = new object[] { username,apply_id };
  69. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  70. if (ccp.ReturnCode == -1)
  71. {
  72. return;
  73. }
  74. lists.Add(ugr);
  75. }
  76. }
  77. for (int i = 0; i < lists.Count; i++)
  78. {
  79. lists[i].Delete(false);
  80. }
  81. MessageBox.Show("操作成功!");
  82. }
  83. private void DoUpdate(String apply_id, String handle_memo)
  84. {
  85. try
  86. {
  87. CoreClientParam ccp = new CoreClientParam();
  88. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  89. ccp.MethodName = "updatememo";
  90. ccp.ServerParams = new object[] { apply_id, handle_memo };
  91. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  92. }
  93. catch (Exception ex)
  94. {
  95. System.Diagnostics.Debug.WriteLine(ex.ToString());
  96. MessageBox.Show("系统出错请联系管理人员", "警告");
  97. }
  98. }
  99. private void Judge()
  100. {
  101. if (this.ultraGrid9.Selected.Rows.Count == 0)
  102. this.ultraGrid9.ActiveRow.Selected = true;
  103. List<UltraGridRow> lists = new List<UltraGridRow>();
  104. if (MessageBox.Show(this, "是否对申请做审批通过操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  105. {
  106. return;
  107. }
  108. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  109. {
  110. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  111. {
  112. ArrayList al = new ArrayList();
  113. string material = ugr.Cells["MATERIAL_NO"].Value.ToString();
  114. string lock_seq = ugr.Cells["LOCK_SEQ"].Value.ToString();
  115. string lock_type_code = ugr.Cells["LOCK_TYPE_CODE"].Value.ToString();
  116. string prodline = ugr.Cells["PLINE_CODE"].Value.ToString();
  117. string unlock_type_code = "0";
  118. string username = this.UserInfo.GetUserName();
  119. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  120. string apply_id = ugr.Cells["APPLY_ID"].Value.ToString();
  121. string handle_memo = this.textBox2.Text.ToString();//审批处理备注
  122. al.Add(material);
  123. al.Add(lock_seq);
  124. al.Add(lock_type_code);
  125. al.Add(unlock_type_code);
  126. al.Add(username);
  127. al.Add(lock_id);
  128. al.Add(prodline);
  129. al.Add(apply_id);
  130. al.Add(handle_memo);
  131. CoreClientParam ccp = new CoreClientParam();
  132. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  133. ccp.MethodName = "doApplyFx";
  134. ccp.ServerParams = new object[] { al };
  135. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  136. if (ccp.ReturnCode == -1)
  137. {
  138. return;
  139. }
  140. lists.Add(ugr);
  141. }
  142. }
  143. for (int i = 0; i < lists.Count; i++)
  144. {
  145. lists[i].Delete(false);
  146. }
  147. MessageBox.Show("异常处置成功!");
  148. }
  149. private void DoQuery()
  150. {
  151. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  152. {
  153. DoQueryMe();
  154. }
  155. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  156. {
  157. DoQueryRe();
  158. }
  159. }
  160. private void DoQueryMe()
  161. {
  162. try
  163. {
  164. this.dataSet1.Clear();
  165. this.dataSet8.Clear();
  166. string ebatchno = "";
  167. string sbatchno = BatchNo.Text.Trim();
  168. if (BatchNo1.Text.ToString() == "")
  169. {
  170. ebatchno = this.BatchNo.Text.Trim();
  171. }
  172. else
  173. {
  174. ebatchno = BatchNo1.Text.Trim();
  175. }
  176. string orderno = this.OrderNo.Text.Trim();
  177. string psc = this.PscDesc.Text.Trim();
  178. string prodline = this.comboBox3.Text.ToString();
  179. string lock_type_desc = this.comboBox2.Text.ToString();
  180. CoreClientParam ccp = new CoreClientParam();
  181. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  182. if (String.IsNullOrEmpty(judge_type))
  183. {
  184. ccp.MethodName = "getInformationS";
  185. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "2", prodline, lock_type_desc };
  186. }
  187. else
  188. {
  189. ccp.MethodName = "getInformation2S";
  190. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "2", prodline, judge_type, lock_type_desc };
  191. }
  192. ccp.SourceDataTable = this.dataSet1.Tables[0];
  193. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  194. }
  195. catch (Exception ex)
  196. {
  197. System.Diagnostics.Debug.WriteLine(ex.ToString());
  198. MessageBox.Show("系统出错,请联系管理人员", "警告");
  199. }
  200. }
  201. private void DoQueryRe()
  202. {
  203. try
  204. {
  205. this.dataSet2.Clear();
  206. string ebatchno = "";
  207. string sbatchno = BatchNo.Text.Trim();
  208. if (BatchNo1.Text.ToString() == "")
  209. {
  210. ebatchno = this.BatchNo.Text.Trim();
  211. }
  212. else
  213. {
  214. ebatchno = BatchNo1.Text.Trim();
  215. }
  216. string orderno = this.OrderNo.Text.Trim();
  217. string psc = this.PscDesc.Text.Trim();
  218. string prodline = this.comboBox3.Text.ToString();
  219. string lock_type_desc = this.comboBox2.Text.ToString();
  220. CoreClientParam ccp = new CoreClientParam();
  221. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  222. if (String.IsNullOrEmpty(judge_type))
  223. {
  224. ccp.MethodName = "getAbnormalRecordInfoS";
  225. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "2", prodline,lock_type_desc };
  226. }
  227. else
  228. {
  229. ccp.MethodName = "getAbnormalRecordInfo2S";
  230. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "2", prodline, judge_type, lock_type_desc };
  231. }
  232. ccp.SourceDataTable = this.dataSet2.Tables[0];
  233. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  234. foreach (UltraGridRow ugrs in this.ultraGrid2.Rows)
  235. {
  236. if (ugrs.Cells["UNLOCK_TYPE_DESC"].Text.ToString().Contains("复样"))
  237. {
  238. ugrs.Appearance.BackColor = Color.Pink;
  239. }
  240. }
  241. }
  242. catch (Exception ex)
  243. {
  244. System.Diagnostics.Debug.WriteLine(ex.ToString());
  245. MessageBox.Show("系统出错,请联系管理人员", "警告");
  246. }
  247. }
  248. private void label1_Click(object sender, EventArgs e)
  249. {
  250. }
  251. private void panel4_Paint(object sender, PaintEventArgs e)
  252. {
  253. }
  254. private void panel2_Paint(object sender, PaintEventArgs e)
  255. {
  256. }
  257. private void DoQueryC()
  258. {
  259. try
  260. {
  261. UltraGridRow ugr = this.ultraGrid9.ActiveRow;
  262. if (ugr == null)
  263. return;
  264. this.dataSet4.Clear();
  265. string design_key = ugr.Cells["design_key"].Value.ToString();
  266. string smp_no = ugr.Cells["smp_no"].Value.ToString();
  267. CoreClientParam ccp = new CoreClientParam();
  268. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  269. ccp.MethodName = "GetChemeInfo";
  270. ccp.ServerParams = new object[] { design_key, smp_no};
  271. ccp.SourceDataTable = this.dataSet4.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 ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  281. {
  282. UltraGridRow ugr = e.Cell.Row;
  283. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  284. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  285. {
  286. QCM030705 dlg = new QCM030705();
  287. dlg.lock_id = lock_id;
  288. dlg.ob = this.ob;
  289. dlg.ShowDialog();
  290. }
  291. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  292. {
  293. QCM030704 dlg = new QCM030704();
  294. dlg.lock_id = lock_id;
  295. dlg.ob = this.ob;
  296. dlg.ShowDialog();
  297. }
  298. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C")
  299. {
  300. QCM030701 dlg = new QCM030701();
  301. dlg.lock_id = lock_id;
  302. dlg.ob = this.ob;
  303. dlg.ShowDialog();
  304. }
  305. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P")
  306. {
  307. QCM030702 dlg = new QCM030702();
  308. dlg.lock_id = lock_id;
  309. dlg.ob = this.ob;
  310. dlg.ShowDialog();
  311. }
  312. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S")
  313. {
  314. QCM030716 dlg = new QCM030716();
  315. dlg.lock_id = lock_id;
  316. dlg.ob = this.ob;
  317. dlg.ShowDialog();
  318. }
  319. }
  320. private void button1_Click(object sender, EventArgs e)
  321. {
  322. UltraGridRow ugr = this.ultraGrid9.ActiveRow;
  323. if (ugr == null)
  324. return;
  325. string material_no = ugr.Cells["MATERIAL_NO"].Text.ToString();
  326. string std_code = ugr.Cells["STD_CODE"].Text.ToString();
  327. string steel_code = ugr.Cells["STEEL_CODE"].Text.ToString();
  328. string delivery_state_code = ugr.Cells["DELIVERY_STATE_DESC"].Text.ToString();
  329. string thick = ugr.Cells["THICK"].Text.ToString();
  330. string PSC = ugr.Cells["PSC"].Text.ToString();
  331. string WIDTH = ugr.Cells["WIDTH"].Text.ToString();
  332. string LENGTH = ugr.Cells["LENGTH"].Text.ToString();
  333. string PRODLINE = ugr.Cells["PLINE_CODE"].Text.ToString();
  334. QCM030709 dlg = new QCM030709();
  335. dlg.MATERIAL_NO = material_no;
  336. dlg.STD_CODE = std_code;
  337. dlg.STEELCODE = steel_code;
  338. dlg.DELIVERY_STATE_CODE = delivery_state_code;
  339. dlg.HEIGHT = thick;
  340. dlg.PSC = PSC;
  341. dlg.WIDTH = WIDTH;
  342. dlg.LENGTH = LENGTH;
  343. dlg.PROD_LINE = PRODLINE;
  344. dlg.ob = this.ob;
  345. dlg.ShowDialog();
  346. }
  347. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  348. {
  349. if (cbEdt == null || vlist == null)
  350. return false;
  351. cbEdt.Items.Clear();
  352. if (bNull)
  353. cbEdt.Items.Add(null, "");
  354. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  355. {
  356. try
  357. {
  358. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  359. }
  360. catch { }
  361. }
  362. return true;
  363. }
  364. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  365. {
  366. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  367. return null;
  368. ArrayList alist = new ArrayList();
  369. ValueList vlist = new ValueList();
  370. for (int i = 0; i < table.Rows.Count; i++)
  371. {
  372. try
  373. {
  374. if (!alist.Contains(table.Rows[i][strKey]))
  375. {
  376. alist.Add(table.Rows[i][strKey]);
  377. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  378. }
  379. }
  380. catch { }
  381. }
  382. return vlist;
  383. }
  384. private void QCM0307_Load(object sender, EventArgs e)
  385. {
  386. this.comboBox3.SelectedIndex = 0;
  387. this.ultraGrid9.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  388. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  389. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  390. judge_type = String.IsNullOrEmpty(this.CustomInfo) ? "" : this.CustomInfo;
  391. CoreClientParam ccp = new CoreClientParam();
  392. ccp.ServerName = "QCM.QCM01.QCM0106.QueryDefect";
  393. ccp.MethodName = "QueryMemo";
  394. ccp.ServerParams = new object[] { "JB1" };
  395. ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  396. DataTable table2 = ccp.SourceDataTable;
  397. ValueList valueList2 = GeneralValuelist(ref table2, "MEMO_CODE", "MEMO");
  398. }
  399. private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  400. {
  401. UltraGridRow ugr = e.Cell.Row;
  402. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  403. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  404. {
  405. QCM030705 dlg = new QCM030705();
  406. dlg.lock_id = lock_id;
  407. dlg.ob = this.ob;
  408. dlg.ShowDialog();
  409. }
  410. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  411. {
  412. QCM030704 dlg = new QCM030704();
  413. dlg.lock_id = lock_id;
  414. dlg.ob = this.ob;
  415. dlg.ShowDialog();
  416. }
  417. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C")
  418. {
  419. QCM030701 dlg = new QCM030701();
  420. dlg.lock_id = lock_id;
  421. dlg.ob = this.ob;
  422. dlg.ShowDialog();
  423. }
  424. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P")
  425. {
  426. QCM030702 dlg = new QCM030702();
  427. dlg.lock_id = lock_id;
  428. dlg.ob = this.ob;
  429. dlg.ShowDialog();
  430. }
  431. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S")
  432. {
  433. QCM030703 dlg = new QCM030703();
  434. dlg.lock_id = lock_id;
  435. dlg.ob = this.ob;
  436. dlg.ShowDialog();
  437. }
  438. }
  439. private void ultraTabControl1_Click(object sender, EventArgs e)
  440. {
  441. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  442. {
  443. this.label9.Text = "处置时间";
  444. }
  445. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  446. {
  447. this.label9.Text = "封锁时间";
  448. }
  449. }
  450. private void DoExport()
  451. {
  452. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  453. {
  454. try
  455. {
  456. if (this.ultraGrid9.Rows.Count == 0)
  457. {
  458. MessageBox.Show("没有可以导出的数据", "提示");
  459. return;
  460. }
  461. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  462. {
  463. string fName = this.saveFileDialog1.FileName;
  464. this.ultraGridExcelExporter1.Export(this.ultraGrid9, fName);
  465. Process.Start(fName);
  466. }
  467. }
  468. catch (Exception ex)
  469. {
  470. System.Diagnostics.Debug.WriteLine(ex.ToString());
  471. }
  472. }
  473. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  474. {
  475. try
  476. {
  477. if (this.ultraGrid2.Rows.Count == 0)
  478. {
  479. MessageBox.Show("没有可以导出的数据", "提示");
  480. return;
  481. }
  482. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  483. {
  484. string fName = this.saveFileDialog1.FileName;
  485. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  486. Process.Start(fName);
  487. }
  488. }
  489. catch (Exception ex)
  490. {
  491. System.Diagnostics.Debug.WriteLine(ex.ToString());
  492. }
  493. }
  494. }
  495. private void label11_Click(object sender, EventArgs e)
  496. {
  497. //获取勾选的批次
  498. ultraGrid9.UpdateData();
  499. DataRow[] rows = dataTable1.Copy().Select("CHECK = 'True'");
  500. if (this.ultraGrid9.Rows.Count == 0 || rows.Length == 0)
  501. {
  502. return;
  503. }
  504. DataRow[] rows2 = rows.CopyToDataTable().Select("BATCH_NO = '" + rows[0]["BATCH_NO"].ToString() + "'");
  505. if (rows2.Length != rows.Length)
  506. {
  507. MessageBox.Show("选择了多个批次信息!");
  508. return;
  509. }
  510. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  511. {
  512. if (ugr.Cells["BATCH_NO"].Text.ToString() == rows[0]["BATCH_NO"].ToString())
  513. {
  514. ugr.Cells["CHECK"].Value = "True";
  515. }
  516. }
  517. }
  518. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  519. {
  520. foreach (UltraGridRow ugr in this.ultraGrid9.Rows.Where(p => p.IsFilteredOut == false).ToList())
  521. {
  522. if (checkBox2.Checked)
  523. {
  524. ugr.Cells["CHECK"].Value = "True";
  525. }
  526. else
  527. {
  528. ugr.Cells["CHECK"].Value = "False";
  529. }
  530. }
  531. }
  532. }
  533. }