QCM030728.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  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 Infragistics.Win;
  14. using System.Diagnostics;
  15. namespace Core.LZMes.Client.QCM
  16. {
  17. public partial class QCM030728 : FrmBase
  18. {
  19. public QCM030728()
  20. {
  21. InitializeComponent();
  22. }
  23. public override void ToolBar_Click(object sender, string ToolbarKey)
  24. {
  25. switch (ToolbarKey)
  26. {
  27. case "Query":
  28. this.DoQuery();
  29. break;
  30. case "Exit":
  31. this.Close();
  32. break;
  33. case "Unlock":
  34. this.Judge();
  35. break;
  36. case "SteelInfo":
  37. this.steelinfo();
  38. break;
  39. case "Export2":
  40. this.DoExport();
  41. break;
  42. }
  43. }
  44. private void steelinfo()
  45. {
  46. if (MessageBox.Show(this, "是否对申请做审批不通过操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  47. {
  48. return;
  49. }
  50. List<UltraGridRow> lists = new List<UltraGridRow>();
  51. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  52. {
  53. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  54. {
  55. string apply_id = ugr.Cells["APPLY_ID"].Text.ToString();
  56. string handle_memo = this.textBox1.Text.Trim().ToString();//审批处理备注
  57. if (!string.IsNullOrEmpty(handle_memo))
  58. {
  59. DoUpdate(apply_id, handle_memo);
  60. }
  61. string username = this.UserInfo.GetUserName();
  62. CoreClientParam ccp = new CoreClientParam();
  63. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  64. ccp.MethodName = "doApply";
  65. ccp.ServerParams = new object[] { apply_id, username, "2" };
  66. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  67. if (ccp.ReturnCode == -1)
  68. {
  69. return;
  70. }
  71. lists.Add(ugr);
  72. }
  73. }
  74. for (int i = 0; i < lists.Count; i++)
  75. {
  76. lists[i].Delete(false);
  77. }
  78. MessageBox.Show("申请处置成功!");
  79. DoQuery();
  80. }
  81. private void Judge()
  82. {
  83. if (MessageBox.Show(this, "是否对申请做审批通过操作?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
  84. {
  85. return;
  86. }
  87. List<UltraGridRow> lists = new List<UltraGridRow>();
  88. foreach (UltraGridRow ugr in this.ultraGrid9.Rows)
  89. {
  90. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  91. {
  92. string apply_id = ugr.Cells["APPLY_ID"].Text.ToString();
  93. string handle_memo = this.textBox1.Text.Trim().ToString();//审批处理备注
  94. if (!string.IsNullOrEmpty(handle_memo))
  95. {
  96. DoUpdate(apply_id, handle_memo);
  97. }
  98. string username = this.UserInfo.GetUserName();
  99. CoreClientParam ccp = new CoreClientParam();
  100. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  101. ccp.MethodName = "doApply";
  102. ccp.ServerParams = new object[] { apply_id, username,"1" };
  103. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  104. if (ccp.ReturnCode == -1)
  105. {
  106. return;
  107. }
  108. lists.Add(ugr);
  109. }
  110. }
  111. for (int i = 0; i < lists.Count; i++)
  112. {
  113. lists[i].Delete(false);
  114. }
  115. MessageBox.Show("申请处置成功!");
  116. DoQuery();
  117. }
  118. private void DoUpdate(String apply_id, String handle_memo)
  119. {
  120. try
  121. {
  122. CoreClientParam ccp = new CoreClientParam();
  123. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  124. ccp.MethodName = "updatememo";
  125. ccp.ServerParams = new object[] { apply_id, handle_memo };
  126. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  127. }
  128. catch (Exception ex)
  129. {
  130. System.Diagnostics.Debug.WriteLine(ex.ToString());
  131. MessageBox.Show("系统出错请联系管理人员", "警告");
  132. }
  133. }
  134. private void DoQuery()
  135. {
  136. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  137. {
  138. DoQueryMe();
  139. }
  140. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  141. {
  142. DoQueryRe();
  143. }
  144. }
  145. private void DoQueryMe()
  146. {
  147. try
  148. {
  149. this.dataSet1.Clear();
  150. string heatno = this.textBox4.Text.ToString();
  151. string material_no = this.textBox5.Text.ToString();
  152. string prod_name = this.comboBox2.Text.ToString();
  153. CoreClientParam ccp = new CoreClientParam();
  154. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  155. ccp.MethodName = "getLgInformationS";
  156. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"),heatno,material_no,prod_name,"4" };
  157. ccp.SourceDataTable = this.dataSet1.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 DoQueryRe()
  167. {
  168. try
  169. {
  170. this.dataSet2.Clear();
  171. string heatno = this.textBox4.Text.ToString();
  172. string material_no = this.textBox5.Text.ToString();
  173. string prod_name = this.comboBox2.Text.ToString();
  174. CoreClientParam ccp = new CoreClientParam();
  175. ccp.ServerName = "QCM.QCM03.QCM0307.QcmRejudgeApplyServiceImpl";
  176. ccp.MethodName = "getAbnormalRecordLgInfoS";
  177. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), heatno, material_no, prod_name, "4" };
  178. ccp.SourceDataTable = this.dataSet2.Tables[0];
  179. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  180. }
  181. catch (Exception ex)
  182. {
  183. System.Diagnostics.Debug.WriteLine(ex.ToString());
  184. MessageBox.Show("系统出错,请联系管理人员", "警告");
  185. }
  186. }
  187. private void label1_Click(object sender, EventArgs e)
  188. {
  189. }
  190. private void panel4_Paint(object sender, PaintEventArgs e)
  191. {
  192. }
  193. private void panel2_Paint(object sender, PaintEventArgs e)
  194. {
  195. }
  196. private void DoQueryC()
  197. {
  198. try
  199. {
  200. UltraGridRow ugr = this.ultraGrid9.ActiveRow;
  201. if (ugr == null)
  202. return;
  203. this.dataSet4.Clear();
  204. string design_key = ugr.Cells["design_key"].Value.ToString();
  205. string smp_no = ugr.Cells["smp_no"].Value.ToString();
  206. CoreClientParam ccp = new CoreClientParam();
  207. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  208. ccp.MethodName = "GetChemeInfo";
  209. ccp.ServerParams = new object[] { design_key, smp_no};
  210. ccp.SourceDataTable = this.dataSet4.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. private void ultraGrid9_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  220. {
  221. UltraGridRow ugr = e.Cell.Row;
  222. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  223. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  224. {
  225. QCM030705 dlg = new QCM030705();
  226. dlg.lock_id = lock_id;
  227. dlg.ob = this.ob;
  228. dlg.ShowDialog();
  229. }
  230. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  231. {
  232. QCM030704 dlg = new QCM030704();
  233. dlg.lock_id = lock_id;
  234. dlg.ob = this.ob;
  235. dlg.ShowDialog();
  236. }
  237. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C")
  238. {
  239. QCM030701 dlg = new QCM030701();
  240. dlg.lock_id = lock_id;
  241. dlg.ob = this.ob;
  242. dlg.ShowDialog();
  243. }
  244. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P")
  245. {
  246. QCM030702 dlg = new QCM030702();
  247. dlg.lock_id = lock_id;
  248. dlg.ob = this.ob;
  249. dlg.ShowDialog();
  250. }
  251. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S")
  252. {
  253. QCM030703 dlg = new QCM030703();
  254. dlg.lock_id = lock_id;
  255. dlg.ob = this.ob;
  256. dlg.ShowDialog();
  257. }
  258. }
  259. private void button1_Click(object sender, EventArgs e)
  260. {
  261. int count = 0;
  262. UltraGridRow ugr = this.ultraGrid9.ActiveRow;
  263. foreach (UltraGridRow ugr1 in this.ultraGrid9.Rows)
  264. {
  265. if (ugr1.Cells["CHECK"].Value.ToString() == "True")
  266. {
  267. ugr = ugr1;
  268. count++;
  269. continue;
  270. }
  271. }
  272. if (count == 0)
  273. {
  274. MessageBox.Show("请选择数据!");
  275. return;
  276. }
  277. string prodline = "4001LGX";
  278. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  279. string prod_name = ugr.Cells["PROD_NAME"].Value.ToString();
  280. string steelname = "";
  281. QCM030710 dlg = new QCM030710();
  282. dlg.prodline = prodline;
  283. dlg.material_no = material_no;
  284. dlg.prod_name = prod_name;
  285. dlg.steel = steelname;
  286. dlg.ob = this.ob;
  287. dlg.ShowDialog();
  288. }
  289. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  290. {
  291. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  292. return null;
  293. ArrayList alist = new ArrayList();
  294. ValueList vlist = new ValueList();
  295. for (int i = 0; i < table.Rows.Count; i++)
  296. {
  297. try
  298. {
  299. if (!alist.Contains(table.Rows[i][strKey]))
  300. {
  301. alist.Add(table.Rows[i][strKey]);
  302. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  303. }
  304. }
  305. catch { }
  306. }
  307. return vlist;
  308. }
  309. private void QCM030708_Load(object sender, EventArgs e)
  310. {
  311. this.comboBox2.SelectedIndex = 0;
  312. this.ultraGrid9.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  313. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  314. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-3);
  315. //CoreClientParam ccp = new CoreClientParam();
  316. //ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  317. //ccp.MethodName = "findXmMemo";
  318. //ccp.ServerParams = new object[] { };
  319. //ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  320. //DataTable table1 = ccp.SourceDataTable;
  321. //ValueList valueList1 = GeneralValuelist(ref table1, "SM_CD", "SM_CFNM");
  322. //this.checkBoxComboBox1.DataSource = valueList1.ValueListItems;
  323. //ccp = new CoreClientParam();
  324. //ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  325. //ccp.MethodName = "findCcMemo";
  326. //ccp.ServerParams = new object[] { };
  327. //ccp = this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  328. //DataTable table2 = ccp.SourceDataTable;
  329. //ValueList valueList2 = GeneralValuelist(ref table2, "SM_CD", "SM_CFNM");
  330. //this.checkBoxComboBox2.DataSource = valueList2.ValueListItems;
  331. }
  332. private void ultraGrid2_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  333. {
  334. UltraGridRow ugr = e.Cell.Row;
  335. string lock_id = ugr.Cells["LOCK_ID"].Value.ToString();
  336. if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "F")
  337. {
  338. QCM030705 dlg = new QCM030705();
  339. dlg.lock_id = lock_id;
  340. dlg.ob = this.ob;
  341. dlg.ShowDialog();
  342. }
  343. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "D")
  344. {
  345. QCM030704 dlg = new QCM030704();
  346. dlg.lock_id = lock_id;
  347. dlg.ob = this.ob;
  348. dlg.ShowDialog();
  349. }
  350. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "C")
  351. {
  352. QCM030701 dlg = new QCM030701();
  353. dlg.lock_id = lock_id;
  354. dlg.ob = this.ob;
  355. dlg.ShowDialog();
  356. }
  357. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "P")
  358. {
  359. QCM030702 dlg = new QCM030702();
  360. dlg.lock_id = lock_id;
  361. dlg.ob = this.ob;
  362. dlg.ShowDialog();
  363. }
  364. else if (ugr.Cells["LOCK_TYPE_CODE"].Value.ToString() == "S")
  365. {
  366. QCM030703 dlg = new QCM030703();
  367. dlg.lock_id = lock_id;
  368. dlg.ob = this.ob;
  369. dlg.ShowDialog();
  370. }
  371. }
  372. private void ultraTabControl1_Click(object sender, EventArgs e)
  373. {
  374. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  375. {
  376. this.label4.Text = "审核时间";
  377. }
  378. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  379. {
  380. this.label4.Text = "申请时间";
  381. }
  382. }
  383. private void DoExport()
  384. {
  385. try
  386. {
  387. if (this.ultraGrid2.Rows.Count == 0)
  388. {
  389. MessageBox.Show("没有可以导出的数据", "提示");
  390. return;
  391. }
  392. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  393. {
  394. string fName = this.saveFileDialog1.FileName;
  395. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  396. Process.Start(fName);
  397. }
  398. }
  399. catch (Exception ex)
  400. {
  401. System.Diagnostics.Debug.WriteLine(ex.ToString());
  402. }
  403. }
  404. #region 全选
  405. private void checkBox2_CheckStateChanged(object sender, EventArgs e)
  406. {
  407. if (this.ultraTabControl1.Tabs[0].Selected)
  408. {
  409. foreach (UltraGridRow ugr in this.ultraGrid9.Rows.Where(p => p.IsFilteredOut == false).ToList())
  410. {
  411. if (checkBox2.Checked)
  412. {
  413. ugr.Cells["check"].Value = "True";
  414. }
  415. else
  416. {
  417. ugr.Cells["check"].Value = "False";
  418. }
  419. }
  420. }
  421. }
  422. #endregion
  423. }
  424. }