FrmPlnZyJgWorkBill.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Mcp.Common;
  5. using Core.StlMes.Client.Mcp.Control;
  6. using CoreFS.CA06;
  7. using Infragistics.Win.UltraWinGrid;
  8. using System;
  9. using System.Collections;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Linq;
  15. using System.Text;
  16. using System.Windows.Forms;
  17. namespace Core.StlMes.Client.Mcp.Coupling
  18. {
  19. public partial class FrmPlnZyJgWorkBill : FrmBase
  20. {
  21. public FrmPlnZyJgWorkBill()
  22. {
  23. InitializeComponent();
  24. }
  25. private void FrmPlnZyJgWorkBill_Load(object sender, EventArgs e)
  26. {
  27. McpBaseHelper.InitPlineUnit(cmbPlinCode, this.ValidDataPurviewIds, ob, "H");
  28. }
  29. public override void ToolBar_Click(object sender, string ToolbarKey)
  30. {
  31. switch (ToolbarKey)
  32. {
  33. case "Query":
  34. DoQuery();
  35. break;
  36. case "Save":
  37. DoSave();
  38. break;
  39. case "Update":
  40. DoUpdate();
  41. break;
  42. case "Delete":
  43. DoDelete();
  44. break;
  45. case "UndBill":
  46. DoUndBill();
  47. break;
  48. case "DownBill":
  49. DoDownBill();
  50. break;
  51. case "Offline":
  52. DoOffline();
  53. break;
  54. case "DownOffline":
  55. DoDownOffline();
  56. break;
  57. case "CloseBill":
  58. DoCloseBill();
  59. break;
  60. case "DownCloseBill":
  61. DoDownCloseBill();
  62. break;
  63. case "Close":
  64. this.Close();
  65. break;
  66. }
  67. }
  68. /// <summary>
  69. /// 查询
  70. /// </summary>
  71. private void DoQuery()
  72. {
  73. string plnNo = "";
  74. string plnStrat = "";
  75. string plinCode = "";
  76. if (chkPlnNo.Checked)
  77. {
  78. if (txtPlnNo.Text == "")
  79. {
  80. MessageUtil.ShowTips("炉计划号不能为空!");
  81. return;
  82. }
  83. else {
  84. plnNo = txtPlnNo.Text.ToString().Trim();
  85. }
  86. }
  87. if (chkStarts.Checked)
  88. {
  89. if (cmbStarts.Text == "")
  90. {
  91. MessageUtil.ShowTips("炉计划状态不能为空!");
  92. return;
  93. }
  94. else
  95. {
  96. plnStrat = cmbStarts.Value.ToString();
  97. }
  98. }
  99. if (chkPlin.Checked)
  100. {
  101. if (cmbPlinCode.Text == "")
  102. {
  103. MessageUtil.ShowTips("生产产线不能为空!");
  104. return;
  105. }
  106. else
  107. {
  108. plinCode = cmbPlinCode.Value.ToString();
  109. }
  110. }
  111. ArrayList list = new ArrayList();
  112. list.Add(plnNo);
  113. list.Add(plnStrat);
  114. list.Add(plinCode);
  115. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill.geQueryPlnJg", new object[] { list }, ob);
  116. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  117. if (dt.Rows.Count < 0)
  118. {
  119. QueryPlnBill("");
  120. }
  121. }
  122. private void QueryPlnBill(string plnNo)
  123. {
  124. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill.geQueryPlnJgBill", new object[] { plnNo }, ob);
  125. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  126. }
  127. /// <summary>
  128. /// 新增
  129. /// </summary>
  130. private void DoSave()
  131. {
  132. UltraGridRow row = ultraGridPln.ActiveRow;
  133. if (row == null) { MessageUtil.ShowTips("无炉次计划!"); return; }
  134. ultraGridPln.UpdateData();
  135. int addCount = 0;
  136. ArrayList list = new ArrayList();
  137. foreach (UltraGridRow urg in ultraGridPln.Rows)
  138. {
  139. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  140. {
  141. if (urg.Cells["PLN_KEB_NUM"].Value.ToString() == "0" || urg.Cells["PLN_KEB_NUM"].Value.ToString() == "")
  142. {
  143. MessageUtil.ShowTips("请输入可编辑支数!");
  144. return;
  145. }
  146. string plnCount = "";
  147. string csCount = "";
  148. //计划个数
  149. if (urg.Cells["PLAN_BL_NUM"].Value.ToString().Equals("0"))
  150. {
  151. plnCount = "0";
  152. }
  153. else
  154. {
  155. plnCount = ((double.Parse(urg.Cells["PLAN_JG_NUM1"].Value.ToString()) / double.Parse(urg.Cells["PLAN_BL_NUM"].Value.ToString())) * double.Parse(urg.Cells["PLN_KEB_NUM"].Value.ToString())).ToString("f0");
  156. }
  157. //测算个数
  158. if (urg.Cells["PLN_KEB_NUM"].Value.ToString().Equals("0"))
  159. {
  160. csCount = "0";
  161. }
  162. else
  163. {
  164. csCount = (double.Parse(urg.Cells["AIMLENGTH_BL"].Value.ToString()) * 1000 * double.Parse(urg.Cells["PLN_KEB_NUM"].Value.ToString()) / (double.Parse(urg.Cells["AIMLENGTH"].Value.ToString()) + double.Parse(urg.Cells["AVERAGE_LEN"].Value.ToString()))).ToString("f0");
  165. }
  166. //需求个数
  167. string xqCount = (double.Parse(plnCount) * 1.03).ToString("f0");
  168. addCount += 1;
  169. ArrayList list1 = new ArrayList();
  170. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  171. list1.Add(urg.Cells["PLN_KEB_NUM"].Value.ToString());
  172. list1.Add(this.UserInfo.GetUserOrder());
  173. list1.Add(this.UserInfo.GetUserGroup());
  174. list1.Add(this.UserInfo.GetUserName());
  175. list1.Add(urg.Cells["JUDGE_STOVE_NO"].Value.ToString());
  176. list1.Add(urg.Cells["BATCH_NO"].Value.ToString());
  177. list1.Add(plnCount);
  178. list1.Add(csCount);
  179. list1.Add(xqCount);
  180. list.Add(list1);
  181. }
  182. }
  183. if (addCount == 0) { MessageUtil.ShowTips("请选择要新增的炉次计划号!"); return; }
  184. if (MessageUtil.ShowYesNoAndQuestion("是否新增工单?") == DialogResult.No)
  185. {
  186. return;
  187. }
  188. CoreClientParam ccp = new CoreClientParam();
  189. try
  190. {
  191. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  192. if (Constant.WaitingForm == null)
  193. {
  194. Constant.WaitingForm = new WaitingForm();
  195. }
  196. Constant.WaitingForm.ShowToUser = true;
  197. Constant.WaitingForm.Show();
  198. Constant.WaitingForm.Update();
  199. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  200. ccp.MethodName = "addPlnBillResult";
  201. ccp.ServerParams = new object[] { list };
  202. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  203. this.Cursor = Cursors.Default;
  204. Constant.WaitingForm.ShowToUser = false;
  205. Constant.WaitingForm.Close();
  206. Constant.WaitingForm = null;
  207. }
  208. catch (Exception ex)
  209. {
  210. this.Cursor = Cursors.Default;
  211. Constant.WaitingForm.ShowToUser = false;
  212. Constant.WaitingForm.Close();
  213. Constant.WaitingForm = null;
  214. }
  215. if (ccp.ReturnCode == -1) return;
  216. MessageUtil.ShowTips(ccp.ReturnInfo);
  217. if (ccp.ReturnInfo.Equals("新增成功!"))
  218. {
  219. DoQuery();
  220. }
  221. }
  222. /// <summary>
  223. /// 删除
  224. /// </summary>
  225. private void DoDelete()
  226. {
  227. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  228. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  229. ultraGridPlnWork.UpdateData();
  230. int delteCount = 0;
  231. ArrayList list = new ArrayList();
  232. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  233. {
  234. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  235. {
  236. delteCount += 1;
  237. ArrayList list1 = new ArrayList();
  238. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  239. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  240. list.Add(list1);
  241. }
  242. }
  243. if (delteCount == 0) { MessageUtil.ShowTips("请选择要删除的工单号!"); return; }
  244. if (MessageUtil.ShowYesNoAndQuestion("是否删除工单?") == DialogResult.No)
  245. {
  246. return;
  247. }
  248. CoreClientParam ccp = new CoreClientParam();
  249. try
  250. {
  251. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  252. if (Constant.WaitingForm == null)
  253. {
  254. Constant.WaitingForm = new WaitingForm();
  255. }
  256. Constant.WaitingForm.ShowToUser = true;
  257. Constant.WaitingForm.Show();
  258. Constant.WaitingForm.Update();
  259. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  260. ccp.MethodName = "deletePlnBillResult";
  261. ccp.ServerParams = new object[] { list };
  262. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  263. this.Cursor = Cursors.Default;
  264. Constant.WaitingForm.ShowToUser = false;
  265. Constant.WaitingForm.Close();
  266. Constant.WaitingForm = null;
  267. }
  268. catch (Exception ex)
  269. {
  270. this.Cursor = Cursors.Default;
  271. Constant.WaitingForm.ShowToUser = false;
  272. Constant.WaitingForm.Close();
  273. Constant.WaitingForm = null;
  274. }
  275. if (ccp.ReturnCode == -1) return;
  276. MessageUtil.ShowTips(ccp.ReturnInfo);
  277. if (ccp.ReturnInfo.Equals("删除成功!"))
  278. {
  279. DoQuery();
  280. }
  281. }
  282. /// <summary>
  283. /// 修改
  284. /// </summary>
  285. private void DoUpdate()
  286. {
  287. }
  288. /// <summary>
  289. /// 下发
  290. /// </summary>
  291. private void DoUndBill()
  292. {
  293. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  294. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  295. ultraGridPlnWork.UpdateData();
  296. int delteCount = 0;
  297. ArrayList list = new ArrayList();
  298. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  299. {
  300. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  301. {
  302. delteCount += 1;
  303. ArrayList list1 = new ArrayList();
  304. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  305. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  306. list1.Add(this.UserInfo.GetUserName());
  307. list.Add(list1);
  308. }
  309. }
  310. if (delteCount == 0) { MessageUtil.ShowTips("请选择要下发的工单号!"); return; }
  311. if (MessageUtil.ShowYesNoAndQuestion("是否下发工单?") == DialogResult.No)
  312. {
  313. return;
  314. }
  315. CoreClientParam ccp = new CoreClientParam();
  316. try
  317. {
  318. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  319. if (Constant.WaitingForm == null)
  320. {
  321. Constant.WaitingForm = new WaitingForm();
  322. }
  323. Constant.WaitingForm.ShowToUser = true;
  324. Constant.WaitingForm.Show();
  325. Constant.WaitingForm.Update();
  326. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  327. ccp.MethodName = "undPlnBillResult";
  328. ccp.ServerParams = new object[] { list };
  329. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  330. this.Cursor = Cursors.Default;
  331. Constant.WaitingForm.ShowToUser = false;
  332. Constant.WaitingForm.Close();
  333. Constant.WaitingForm = null;
  334. }
  335. catch (Exception ex)
  336. {
  337. this.Cursor = Cursors.Default;
  338. Constant.WaitingForm.ShowToUser = false;
  339. Constant.WaitingForm.Close();
  340. Constant.WaitingForm = null;
  341. }
  342. if (ccp.ReturnCode == -1) return;
  343. MessageUtil.ShowTips(ccp.ReturnInfo);
  344. if (ccp.ReturnInfo.Equals("下发成功!"))
  345. {
  346. DoQuery();
  347. }
  348. }
  349. /// <summary>
  350. /// 撤销下发
  351. /// </summary>
  352. private void DoDownBill()
  353. {
  354. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  355. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  356. ultraGridPlnWork.UpdateData();
  357. int delteCount = 0;
  358. ArrayList list = new ArrayList();
  359. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  360. {
  361. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  362. {
  363. delteCount += 1;
  364. ArrayList list1 = new ArrayList();
  365. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  366. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  367. list.Add(list1);
  368. }
  369. }
  370. if (delteCount == 0) { MessageUtil.ShowTips("请选择要撤销下发的工单号!"); return; }
  371. if (MessageUtil.ShowYesNoAndQuestion("是否撤销下发工单?") == DialogResult.No)
  372. {
  373. return;
  374. }
  375. CoreClientParam ccp = new CoreClientParam();
  376. try
  377. {
  378. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  379. if (Constant.WaitingForm == null)
  380. {
  381. Constant.WaitingForm = new WaitingForm();
  382. }
  383. Constant.WaitingForm.ShowToUser = true;
  384. Constant.WaitingForm.Show();
  385. Constant.WaitingForm.Update();
  386. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  387. ccp.MethodName = "downPlnBillResult";
  388. ccp.ServerParams = new object[] { list };
  389. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  390. this.Cursor = Cursors.Default;
  391. Constant.WaitingForm.ShowToUser = false;
  392. Constant.WaitingForm.Close();
  393. Constant.WaitingForm = null;
  394. }
  395. catch (Exception ex)
  396. {
  397. this.Cursor = Cursors.Default;
  398. Constant.WaitingForm.ShowToUser = false;
  399. Constant.WaitingForm.Close();
  400. Constant.WaitingForm = null;
  401. }
  402. if (ccp.ReturnCode == -1) return;
  403. MessageUtil.ShowTips(ccp.ReturnInfo);
  404. if (ccp.ReturnInfo.Equals("撤销下发成功!"))
  405. {
  406. DoQuery();
  407. }
  408. }
  409. /// <summary>
  410. /// 离线
  411. /// </summary>
  412. private void DoOffline()
  413. {
  414. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  415. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  416. ultraGridPlnWork.UpdateData();
  417. int delteCount = 0;
  418. ArrayList list = new ArrayList();
  419. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  420. {
  421. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  422. {
  423. delteCount += 1;
  424. ArrayList list1 = new ArrayList();
  425. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  426. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  427. list.Add(list1);
  428. }
  429. }
  430. if (delteCount == 0) { MessageUtil.ShowTips("请选择要离线的工单号!"); return; }
  431. if (MessageUtil.ShowYesNoAndQuestion("是否离线工单?") == DialogResult.No)
  432. {
  433. return;
  434. }
  435. CoreClientParam ccp = new CoreClientParam();
  436. try
  437. {
  438. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  439. if (Constant.WaitingForm == null)
  440. {
  441. Constant.WaitingForm = new WaitingForm();
  442. }
  443. Constant.WaitingForm.ShowToUser = true;
  444. Constant.WaitingForm.Show();
  445. Constant.WaitingForm.Update();
  446. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  447. ccp.MethodName = "offPlnBillResult";
  448. ccp.ServerParams = new object[] { list };
  449. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  450. this.Cursor = Cursors.Default;
  451. Constant.WaitingForm.ShowToUser = false;
  452. Constant.WaitingForm.Close();
  453. Constant.WaitingForm = null;
  454. }
  455. catch (Exception ex)
  456. {
  457. this.Cursor = Cursors.Default;
  458. Constant.WaitingForm.ShowToUser = false;
  459. Constant.WaitingForm.Close();
  460. Constant.WaitingForm = null;
  461. }
  462. if (ccp.ReturnCode == -1) return;
  463. MessageUtil.ShowTips(ccp.ReturnInfo);
  464. if (ccp.ReturnInfo.Equals("离线成功!"))
  465. {
  466. DoQuery();
  467. }
  468. }
  469. /// <summary>
  470. /// 取消离线
  471. /// </summary>
  472. private void DoDownOffline()
  473. {
  474. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  475. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  476. ultraGridPlnWork.UpdateData();
  477. int delteCount = 0;
  478. ArrayList list = new ArrayList();
  479. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  480. {
  481. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  482. {
  483. delteCount += 1;
  484. ArrayList list1 = new ArrayList();
  485. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  486. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  487. list.Add(list1);
  488. }
  489. }
  490. if (delteCount == 0) { MessageUtil.ShowTips("请选择要撤销离线的工单号!"); return; }
  491. if (MessageUtil.ShowYesNoAndQuestion("是否撤销离线工单?") == DialogResult.No)
  492. {
  493. return;
  494. }
  495. CoreClientParam ccp = new CoreClientParam();
  496. try
  497. {
  498. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  499. if (Constant.WaitingForm == null)
  500. {
  501. Constant.WaitingForm = new WaitingForm();
  502. }
  503. Constant.WaitingForm.ShowToUser = true;
  504. Constant.WaitingForm.Show();
  505. Constant.WaitingForm.Update();
  506. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  507. ccp.MethodName = "downOffPlnBillResult";
  508. ccp.ServerParams = new object[] { list };
  509. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  510. this.Cursor = Cursors.Default;
  511. Constant.WaitingForm.ShowToUser = false;
  512. Constant.WaitingForm.Close();
  513. Constant.WaitingForm = null;
  514. }
  515. catch (Exception ex)
  516. {
  517. this.Cursor = Cursors.Default;
  518. Constant.WaitingForm.ShowToUser = false;
  519. Constant.WaitingForm.Close();
  520. Constant.WaitingForm = null;
  521. }
  522. if (ccp.ReturnCode == -1) return;
  523. MessageUtil.ShowTips(ccp.ReturnInfo);
  524. if (ccp.ReturnInfo.Equals("撤销离线成功!"))
  525. {
  526. DoQuery();
  527. }
  528. }
  529. /// <summary>
  530. /// 关闭工单
  531. /// </summary>
  532. private void DoCloseBill()
  533. {
  534. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  535. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  536. ultraGridPlnWork.UpdateData();
  537. int delteCount = 0;
  538. ArrayList list = new ArrayList();
  539. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  540. {
  541. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  542. {
  543. delteCount += 1;
  544. ArrayList list1 = new ArrayList();
  545. //PLAN_BL_WT
  546. int plnCount = int.Parse(urg.Cells["PLAN_BL_NUM"].Value.ToString()) - int.Parse(urg.Cells["LOAD_PIECES"].Value.ToString());
  547. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  548. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  549. list1.Add(urg.Cells["LOAD_PIECES"].Value.ToString());
  550. list1.Add(urg.Cells["LOAD_WEIGHT"].Value.ToString());
  551. list.Add(list1);
  552. }
  553. }
  554. if (delteCount == 0) { MessageUtil.ShowTips("请选择要关闭的工单号!"); return; }
  555. if (MessageUtil.ShowYesNoAndQuestion("是否关闭工单?") == DialogResult.No)
  556. {
  557. return;
  558. }
  559. CoreClientParam ccp = new CoreClientParam();
  560. try
  561. {
  562. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  563. if (Constant.WaitingForm == null)
  564. {
  565. Constant.WaitingForm = new WaitingForm();
  566. }
  567. Constant.WaitingForm.ShowToUser = true;
  568. Constant.WaitingForm.Show();
  569. Constant.WaitingForm.Update();
  570. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  571. ccp.MethodName = "closePlnBillResult";
  572. ccp.ServerParams = new object[] { list };
  573. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  574. this.Cursor = Cursors.Default;
  575. Constant.WaitingForm.ShowToUser = false;
  576. Constant.WaitingForm.Close();
  577. Constant.WaitingForm = null;
  578. }
  579. catch (Exception ex)
  580. {
  581. this.Cursor = Cursors.Default;
  582. Constant.WaitingForm.ShowToUser = false;
  583. Constant.WaitingForm.Close();
  584. Constant.WaitingForm = null;
  585. }
  586. if (ccp.ReturnCode == -1) return;
  587. MessageUtil.ShowTips(ccp.ReturnInfo);
  588. if (ccp.ReturnInfo.Equals("工单关闭成功!"))
  589. {
  590. DoQuery();
  591. }
  592. }
  593. /// <summary>
  594. /// 撤销关闭工单
  595. /// </summary>
  596. private void DoDownCloseBill()
  597. {
  598. UltraGridRow row = ultraGridPlnWork.ActiveRow;
  599. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  600. ultraGridPlnWork.UpdateData();
  601. int delteCount = 0;
  602. ArrayList list = new ArrayList();
  603. foreach (UltraGridRow urg in ultraGridPlnWork.Rows)
  604. {
  605. if (Convert.ToBoolean(urg.Cells["CHK"].Text) == true)
  606. {
  607. delteCount += 1;
  608. ArrayList list1 = new ArrayList();
  609. list1.Add(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  610. list1.Add(urg.Cells["WO_ID"].Value.ToString());
  611. list1.Add(urg.Cells["LOAD_PIECES"].Value.ToString());
  612. list1.Add(urg.Cells["LOAD_WEIGHT"].Value.ToString());
  613. list.Add(list1);
  614. }
  615. }
  616. if (delteCount == 0) { MessageUtil.ShowTips("请选择撤销关闭的工单号!"); return; }
  617. if (MessageUtil.ShowYesNoAndQuestion("是否撤销关闭?") == DialogResult.No)
  618. {
  619. return;
  620. }
  621. CoreClientParam ccp = new CoreClientParam();
  622. try
  623. {
  624. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  625. if (Constant.WaitingForm == null)
  626. {
  627. Constant.WaitingForm = new WaitingForm();
  628. }
  629. Constant.WaitingForm.ShowToUser = true;
  630. Constant.WaitingForm.Show();
  631. Constant.WaitingForm.Update();
  632. ccp.ServerName = "com.steering.mes.mcp.coup.FrmPlnZyJgWorkBill";
  633. ccp.MethodName = "downClosePlnBillResult";
  634. ccp.ServerParams = new object[] { list };
  635. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  636. this.Cursor = Cursors.Default;
  637. Constant.WaitingForm.ShowToUser = false;
  638. Constant.WaitingForm.Close();
  639. Constant.WaitingForm = null;
  640. }
  641. catch (Exception ex)
  642. {
  643. this.Cursor = Cursors.Default;
  644. Constant.WaitingForm.ShowToUser = false;
  645. Constant.WaitingForm.Close();
  646. Constant.WaitingForm = null;
  647. }
  648. if (ccp.ReturnCode == -1) return;
  649. MessageUtil.ShowTips(ccp.ReturnInfo);
  650. if (ccp.ReturnInfo.Equals("撤销关闭成功!"))
  651. {
  652. DoQuery();
  653. }
  654. }
  655. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  656. {
  657. if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
  658. if (chkPlin.Checked) { cmbPlinCode.Enabled = true; } else { cmbPlinCode.Enabled = false; }
  659. if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  660. }
  661. private void ultraGridPln_AfterRowActivate(object sender, EventArgs e)
  662. {
  663. UltraGridRow urg=ultraGridPln.ActiveRow;
  664. if (urg == null) return;
  665. QueryPlnBill(urg.Cells["ZY_PLAN_ID"].Text.ToString());
  666. }
  667. private void ultraGridPln_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  668. {
  669. try
  670. {
  671. ultraGridPln.UpdateData();
  672. foreach (UltraGridRow row in ultraGridPln.Rows)
  673. {
  674. row.Cells["CHK"].Value = row.Selected;
  675. }
  676. }
  677. catch { }
  678. }
  679. private void ultraGridPlnWork_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  680. {
  681. try
  682. {
  683. ultraGridPlnWork.UpdateData();
  684. foreach (UltraGridRow row in ultraGridPlnWork.Rows)
  685. {
  686. row.Cells["CHK"].Value = row.Selected;
  687. }
  688. }
  689. catch { }
  690. }
  691. private void ultraGridPln_CellChange(object sender, CellEventArgs e)
  692. {
  693. ultraGridPln.UpdateData();
  694. if (e.Cell.Column.Key.Equals("AVERAGE_LEN"))
  695. {
  696. if(e.Cell.Row.Cells["AVERAGE_LEN"].Value.ToString().Trim().Equals("")){
  697. e.Cell.Row.Cells["AVERAGE_LEN"].Value = "0";
  698. }
  699. }
  700. //if (e.Cell.Column.Key.Equals("PLN_KEB_NUM"))
  701. //{
  702. // if (e.Cell.Row.Cells["PLN_KEB_NUM"].Value.ToString() == "")
  703. // {
  704. // e.Cell.Row.Cells["PLN_KEB_NUM"].Value = "0";
  705. // }
  706. //}
  707. }
  708. }
  709. }