29d7170d5df2424c86966307bb0854c43fbfe2b7.svn-base 22 KB

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