6e4e431b523848eadf36807320ec27d908b9d852.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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 QCM030724 : FrmBase
  19. {
  20. private string judge_type = "";//用于区分1检测中心和2轧钢厂
  21. public QCM030724()
  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.textBox1.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.textBox1.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 = "getInformationJS";
  185. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "0", prodline, lock_type_desc };
  186. }
  187. else
  188. {
  189. ccp.MethodName = "getInformation2JS";
  190. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "0", 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 = "getAbnormalRecordInfoJS";
  225. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "0", prodline,lock_type_desc };
  226. }
  227. else
  228. {
  229. ccp.MethodName = "getAbnormalRecordInfo2JS";
  230. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), sbatchno, ebatchno, orderno, psc, "0", prodline, judge_type, lock_type_desc };
  231. }
  232. ccp.SourceDataTable = this.dataSet2.Tables[0];
  233. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  234. }
  235. catch (Exception ex)
  236. {
  237. System.Diagnostics.Debug.WriteLine(ex.ToString());
  238. MessageBox.Show("系统出错,请联系管理人员", "警告");
  239. }
  240. }
  241. private void label1_Click(object sender, EventArgs e)
  242. {
  243. }
  244. private void panel4_Paint(object sender, PaintEventArgs e)
  245. {
  246. }
  247. private void panel2_Paint(object sender, PaintEventArgs e)
  248. {
  249. }
  250. private void DoQueryC()
  251. {
  252. try
  253. {
  254. UltraGridRow ugr = this.ultraGrid9.ActiveRow;
  255. if (ugr == null)
  256. return;
  257. this.dataSet4.Clear();
  258. string design_key = ugr.Cells["design_key"].Value.ToString();
  259. string smp_no = ugr.Cells["smp_no"].Value.ToString();
  260. CoreClientParam ccp = new CoreClientParam();
  261. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  262. ccp.MethodName = "GetChemeInfo";
  263. ccp.ServerParams = new object[] { design_key, smp_no};
  264. ccp.SourceDataTable = this.dataSet4.Tables[0];
  265. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  266. }
  267. catch (Exception ex)
  268. {
  269. System.Diagnostics.Debug.WriteLine(ex.ToString());
  270. MessageBox.Show("系统出错,请联系管理人员", "警告");
  271. }
  272. }
  273. private void ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  274. {
  275. UltraGridRow ugr = e.Cell.Row;
  276. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  277. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  278. {
  279. QCM030705 dlg = new QCM030705();
  280. dlg.lock_id = lock_id;
  281. dlg.ob = this.ob;
  282. dlg.ShowDialog();
  283. }
  284. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  285. {
  286. QCM030704 dlg = new QCM030704();
  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() == "C")
  292. {
  293. QCM030701 dlg = new QCM030701();
  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() == "P")
  299. {
  300. QCM030702 dlg = new QCM030702();
  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() == "S")
  306. {
  307. QCM030716 dlg = new QCM030716();
  308. dlg.lock_id = lock_id;
  309. dlg.ob = this.ob;
  310. dlg.ShowDialog();
  311. }
  312. }
  313. private void button1_Click(object sender, EventArgs e)
  314. {
  315. }
  316. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  317. {
  318. if (cbEdt == null || vlist == null)
  319. return false;
  320. cbEdt.Items.Clear();
  321. if (bNull)
  322. cbEdt.Items.Add(null, "");
  323. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  324. {
  325. try
  326. {
  327. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  328. }
  329. catch { }
  330. }
  331. return true;
  332. }
  333. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  334. {
  335. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  336. return null;
  337. ArrayList alist = new ArrayList();
  338. ValueList vlist = new ValueList();
  339. for (int i = 0; i < table.Rows.Count; i++)
  340. {
  341. try
  342. {
  343. if (!alist.Contains(table.Rows[i][strKey]))
  344. {
  345. alist.Add(table.Rows[i][strKey]);
  346. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  347. }
  348. }
  349. catch { }
  350. }
  351. return vlist;
  352. }
  353. private void QCM0307_Load(object sender, EventArgs e)
  354. {
  355. this.comboBox3.SelectedIndex = 0;
  356. this.ultraGrid9.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  357. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  358. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  359. judge_type = String.IsNullOrEmpty(this.CustomInfo) ? "" : this.CustomInfo;
  360. CoreClientParam ccp = new CoreClientParam();
  361. ccp.ServerName = "QCM.QCM01.QCM0106.QueryDefect";
  362. ccp.MethodName = "QueryMemo";
  363. ccp.ServerParams = new object[] { "JB1" };
  364. ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  365. DataTable table2 = ccp.SourceDataTable;
  366. ValueList valueList2 = GeneralValuelist(ref table2, "MEMO_CODE", "MEMO");
  367. }
  368. private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  369. {
  370. UltraGridRow ugr = e.Cell.Row;
  371. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  372. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  373. {
  374. QCM030705 dlg = new QCM030705();
  375. dlg.lock_id = lock_id;
  376. dlg.ob = this.ob;
  377. dlg.ShowDialog();
  378. }
  379. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  380. {
  381. QCM030704 dlg = new QCM030704();
  382. dlg.lock_id = lock_id;
  383. dlg.ob = this.ob;
  384. dlg.ShowDialog();
  385. }
  386. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C")
  387. {
  388. QCM030701 dlg = new QCM030701();
  389. dlg.lock_id = lock_id;
  390. dlg.ob = this.ob;
  391. dlg.ShowDialog();
  392. }
  393. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P")
  394. {
  395. QCM030702 dlg = new QCM030702();
  396. dlg.lock_id = lock_id;
  397. dlg.ob = this.ob;
  398. dlg.ShowDialog();
  399. }
  400. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S")
  401. {
  402. QCM030703 dlg = new QCM030703();
  403. dlg.lock_id = lock_id;
  404. dlg.ob = this.ob;
  405. dlg.ShowDialog();
  406. }
  407. }
  408. private void ultraTabControl1_Click(object sender, EventArgs e)
  409. {
  410. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  411. {
  412. this.label9.Text = "处置时间";
  413. }
  414. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  415. {
  416. this.label9.Text = "封锁时间";
  417. }
  418. }
  419. private void DoExport()
  420. {
  421. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  422. {
  423. try
  424. {
  425. if (this.ultraGrid9.Rows.Count == 0)
  426. {
  427. MessageBox.Show("没有可以导出的数据", "提示");
  428. return;
  429. }
  430. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  431. {
  432. string fName = this.saveFileDialog1.FileName;
  433. this.ultraGridExcelExporter1.Export(this.ultraGrid9, fName);
  434. Process.Start(fName);
  435. }
  436. }
  437. catch (Exception ex)
  438. {
  439. System.Diagnostics.Debug.WriteLine(ex.ToString());
  440. }
  441. }
  442. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  443. {
  444. try
  445. {
  446. if (this.ultraGrid2.Rows.Count == 0)
  447. {
  448. MessageBox.Show("没有可以导出的数据", "提示");
  449. return;
  450. }
  451. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  452. {
  453. string fName = this.saveFileDialog1.FileName;
  454. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  455. Process.Start(fName);
  456. }
  457. }
  458. catch (Exception ex)
  459. {
  460. System.Diagnostics.Debug.WriteLine(ex.ToString());
  461. }
  462. }
  463. }
  464. private void label11_Click(object sender, EventArgs e)
  465. {
  466. //获取勾选的批次
  467. ultraGrid9.UpdateData();
  468. DataRow[] rows = dataTable1.Copy().Select("CHECK = 'True'");
  469. if (this.ultraGrid9.Rows.Count == 0 || rows.Length == 0)
  470. {
  471. return;
  472. }
  473. DataRow[] rows2 = rows.CopyToDataTable().Select("BATCH_NO = '" + rows[0]["BATCH_NO"].ToString() + "'");
  474. if (rows2.Length != rows.Length)
  475. {
  476. MessageBox.Show("选择了多个批次信息!");
  477. return;
  478. }
  479. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  480. {
  481. if (ugr.Cells["BATCH_NO"].Text.ToString() == rows[0]["BATCH_NO"].ToString())
  482. {
  483. ugr.Cells["CHECK"].Value = "True";
  484. }
  485. }
  486. }
  487. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  488. {
  489. foreach (UltraGridRow ugr in this.ultraGrid9.Rows.Where(p => p.IsFilteredOut == false).ToList())
  490. {
  491. if (checkBox2.Checked)
  492. {
  493. ugr.Cells["CHECK"].Value = "True";
  494. }
  495. else
  496. {
  497. ugr.Cells["CHECK"].Value = "False";
  498. }
  499. }
  500. }
  501. }
  502. }