FrmVrpLoading.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  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 Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Collections;
  14. using com.steering.mes.mcp.entity;
  15. using Core.Mes.Client.Comm.Tool;
  16. using Core.StlMes.Client.Mcp.Control;
  17. using Core.StlMes.Client.Mcp.VRP.Vrp;
  18. namespace Core.StlMes.Client.Htt
  19. {
  20. public partial class FrmVrpLoading : FrmBase
  21. {
  22. private string SlGx
  23. {
  24. get
  25. {
  26. if (plineCode == "C018")
  27. {
  28. return "650101";
  29. }
  30. else if (plineCode == "C021")
  31. {
  32. return "650401";
  33. }
  34. else if (plineCode == "C014")
  35. {
  36. return "650501";
  37. }
  38. else if (plineCode == "C013")
  39. {
  40. return "650601";
  41. }
  42. else if (plineCode == "C070")
  43. {
  44. return "650701";
  45. }
  46. return "650401";
  47. }
  48. }
  49. // private string SlGxname = "";
  50. private string departm = "";
  51. private string plineCode = "";
  52. private string[] plineCodes ;
  53. private string dingwei = "";
  54. public FrmVrpLoading()
  55. {
  56. InitializeComponent();
  57. this.IsLoadUserView = true;
  58. }
  59. protected override void OnLoad(EventArgs e)
  60. {
  61. base.OnLoad(e);
  62. this.planExpanQuery1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  63. }
  64. public override void ToolBar_Click(object sender, string ToolbarKey)
  65. {
  66. //base.ToolBar_Click(sender, ToolbarKey);
  67. switch (ToolbarKey)
  68. {
  69. case "DoQuery":
  70. QuerySinglePlan();
  71. break;
  72. case "DoLoading":
  73. DoSave();
  74. break;
  75. case "DoReturn":
  76. DoReturn();
  77. break;
  78. case "DoUpdate":
  79. DoUpdate();
  80. break;
  81. case "DoBeside":
  82. DoBeside();
  83. break;
  84. case "CelBeside":
  85. DoCelBeside();
  86. break;
  87. case "DoClose":
  88. this.Close();
  89. break;
  90. case "Export":
  91. Mes.Client.Comm.Globals.ulGridToExcel(ultraGrid1, Text);
  92. break;
  93. }
  94. }
  95. private void DoCelBeside()
  96. {
  97. UltraGridRow row = ultraGrid1.ActiveRow;
  98. if (row == null) return;
  99. ArrayList list = new ArrayList();
  100. list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
  101. list.Add(row.Cells["PLINE_CODE"].Value.ToString());
  102. list.Add(SlGx);
  103. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  104. {
  105. return;
  106. }
  107. CoreClientParam ccp = new CoreClientParam();
  108. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  109. ccp.MethodName = "undoBeside";
  110. ccp.ServerParams = new Object[] { list };
  111. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  112. if (ccp.ReturnCode != -1)
  113. {
  114. MessageUtil.ShowTips(ccp.ReturnInfo);
  115. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  116. {
  117. QuerySinglePlan();
  118. initControl();
  119. }
  120. }
  121. }
  122. /// <summary>
  123. /// 工序结炉
  124. /// </summary>
  125. private void DoBeside()
  126. {
  127. UltraGridRow row = ultraGrid1.ActiveRow;
  128. if (row == null)
  129. {
  130. MessageUtil.ShowTips("请选择需要结炉的工单号!");
  131. return;
  132. }
  133. ArrayList list = new ArrayList();
  134. list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
  135. list.Add(row.Cells["PLINE_CODE"].Value.ToString());
  136. list.Add(SlGx);
  137. list.Add(row.Cells["JUDGE_STOVE_NO"].Value.ToString());
  138. list.Add(row.Cells["BATCH_NO"].Value.ToString());
  139. list.Add(row.Cells["BATCH_GROUD_NO"].Value.ToString());
  140. list.Add(row.Cells["JUGDE_APPLY_CODE"].Value.ToString());
  141. list.Add(row.Cells["NEXT_PROCESS_CODE"].Value.ToString());
  142. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  143. {
  144. return;
  145. }
  146. CoreClientParam ccp = new CoreClientParam();
  147. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  148. ccp.MethodName = "updateDoBeside";
  149. ccp.ServerParams = new Object[] { list };
  150. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  151. if (ccp.ReturnCode != -1)
  152. {
  153. MessageUtil.ShowTips(ccp.ReturnInfo);
  154. if (ccp.ReturnInfo.Equals("结炉成功!"))
  155. {
  156. QuerySinglePlan();
  157. initControl();
  158. }
  159. }
  160. }
  161. /// <summary>
  162. /// 简单查询
  163. /// </summary>
  164. private void QuerySinglePlan()
  165. {
  166. string starts = "";
  167. string plnNo = "";
  168. string judgeStoveNo = "";
  169. string loadStoveNo = "";
  170. #region 条件
  171. if (chkPlnNo.Checked)
  172. {
  173. if (string.IsNullOrEmpty(txtRollBatchId.Text.Trim()))
  174. {
  175. MessageUtil.ShowTips("请输入炉次计划号!");
  176. return;
  177. }
  178. else
  179. {
  180. plnNo = txtRollBatchId.Text.ToString().Trim();
  181. }
  182. }
  183. if (chkJuNo.Checked)
  184. {
  185. if (string.IsNullOrEmpty(txtZyBatchId.Text.Trim()))
  186. {
  187. MessageUtil.ShowTips("请输入炉号!");
  188. return;
  189. }
  190. else
  191. {
  192. judgeStoveNo = txtZyBatchId.Text.ToString().Trim();
  193. }
  194. }
  195. if (checkLoad.Checked)
  196. {
  197. if (string.IsNullOrEmpty(loadJudgeNo.Text.Trim()))
  198. {
  199. MessageUtil.ShowTips("请输入上料炉号!");
  200. return;
  201. }
  202. else
  203. {
  204. loadStoveNo = loadJudgeNo.Text.ToString().Trim();
  205. }
  206. }
  207. #endregion
  208. PlnZyDbkMEntity plan = new PlnZyDbkMEntity();
  209. plan.JudgeStoveNo = judgeStoveNo;//生产批次号
  210. plan.HeatPlanNo = plnNo;//组料炉批号
  211. plan.Planstatus = starts;
  212. plan.FeedHeatNo = loadStoveNo;
  213. string dobeside = "";
  214. string index = "";
  215. if (ultraOptionSet1.CheckedIndex.ToString() == "0")
  216. {
  217. index = "0";
  218. dobeside = ultraOptionSet1.CheckedItem.DataValue.ToString();
  219. }
  220. else if (ultraOptionSet1.CheckedIndex.ToString() == "1")
  221. {
  222. index = "1";
  223. dobeside = ultraOptionSet1.CheckedItem.DataValue.ToString();
  224. }
  225. else
  226. {
  227. index = "2";
  228. }
  229. string[] start = contorlPlanStatus1.statusArr;
  230. //查询镦拔扩计划
  231. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryDbkPlan", new object[] { plan, plineCodes, dobeside,index,start }, this.ob);
  232. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  233. foreach (UltraGridRow urg in ultraGrid1.Rows)
  234. {
  235. if (urg.Cells["PLANSTATUS"].Text.Equals("生产中"))
  236. {
  237. urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.LightGreen;
  238. }
  239. if (urg.Cells["PLANSTATUS"].Text.Equals("生产完成"))
  240. {
  241. urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
  242. }
  243. if (urg.Cells["PLANSTATUS"].Text.Equals("关闭"))
  244. {
  245. urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
  246. }
  247. if (urg.Cells["BESIDE_STATUS"].Text.Equals("上料结炉"))
  248. {
  249. urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray;
  250. }
  251. }
  252. if (dt.Rows.Count > 0)
  253. {
  254. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  255. {
  256. if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_SQE"].Value.ToString() == dingwei)
  257. {
  258. UltraGridRow row = ultraGrid1.Rows[i];
  259. row.Activate();
  260. }
  261. }
  262. }
  263. }
  264. //查询管号队列
  265. private void QueryPortVrp(string planNo)
  266. {
  267. //查询管号队列
  268. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryDbkPortVrp", new object[] { planNo }, this.ob);
  269. GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
  270. foreach (UltraGridRow urg in ultraGrid3.Rows)
  271. {
  272. if (urg.Cells["MAT_STATUS"].Text.Equals("剔除"))
  273. {
  274. urg.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
  275. }
  276. }
  277. }
  278. /// <summary>
  279. /// 上料计划详情
  280. /// </summary>
  281. /// <param name="sender"></param>
  282. /// <param name="e"></param>
  283. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  284. {
  285. ultraGrid1.UpdateData();
  286. UltraGridRow row = ultraGrid1.ActiveRow;
  287. if (row == null) return;
  288. dingwei = row.Cells["HEAT_PLAN_SQE"].Value.ToString();
  289. string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
  290. this.GetLoadResult(heatNo);
  291. plineCode = row.Cells["PLINE_CODE"].Value.ToString();
  292. VrpLoadingResultEntity result = new VrpLoadingResultEntity();
  293. if (row.Cells["IF_MONITOR_DBK"].Text.ToString().Equals("是"))
  294. {
  295. this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  296. this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
  297. }
  298. else
  299. {
  300. this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["Producer"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  301. this.planExpanQuery1.Grid.DisplayLayout.Bands[0].Columns["ProducerTime"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
  302. }
  303. planExpanQuery1.JudNo = row.Cells["FEED_HEAT_NO"].Text.ToString();
  304. planExpanQuery1.BatchNo = row.Cells["BATCH_NO"].Text.ToString();
  305. planExpanQuery1.GroupNo = row.Cells["BATCH_GROUD_NO"].Text.ToString();
  306. planExpanQuery1.danum = row.Cells["MATERIAL_COUNT"].Value.ToString();
  307. planExpanQuery1.PlineCode = plineCode;
  308. planExpanQuery1.Ob = this.ob;
  309. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  310. result.ProNum = row.Cells["ACT_COUNT"].Value.ToString();
  311. result.ProWt = row.Cells["ACT_WEIGHT"].Value.ToString();
  312. result.LoadShift = UserInfo.GetUserOrder();
  313. result.LoadGroup = UserInfo.GetUserGroup();
  314. result.LoadUser = UserInfo.GetUserName();
  315. result.LoadTime = time;
  316. result.ProducerTime = time;
  317. this.planExpanQuery1.Value = result;
  318. QueryPortVrp(heatNo);
  319. }
  320. /// <summary>
  321. /// 根据计划号查询上料实绩
  322. /// </summary>
  323. /// <param name="planNo"></param>
  324. private void GetLoadResult(string heatNo)
  325. {
  326. //查询上料实绩
  327. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getLoadResult", new object[] { heatNo }, this.ob);
  328. GridHelper.CopyDataToDatatable(ref dt, ref dtLoadRecord, true);
  329. ultraGridLoad.UpdateData();
  330. ultraGridLoad.ActiveRow = null;
  331. }
  332. /// <summary>
  333. /// 初始化控件
  334. /// </summary>
  335. private void initControl()
  336. {
  337. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  338. VrpLoadingResultEntity result = new VrpLoadingResultEntity();
  339. result.ProNum = "";
  340. result.ProWt = "";
  341. result.LoadShift = UserInfo.GetUserOrder();
  342. result.LoadGroup = UserInfo.GetUserGroup();
  343. result.LoadUser = UserInfo.GetUserName();
  344. result.LoadTime = time;
  345. result.ProducerTime = time;
  346. this.planExpanQuery1.Value = result;
  347. }
  348. /// <summary>
  349. /// 上料实绩新增
  350. /// </summary>
  351. private void DoSave()
  352. {
  353. if (this.planExpanQuery1.ValidInput1())
  354. {
  355. UltraGridRow row = ultraGrid1.ActiveRow;
  356. if (row != null)
  357. {
  358. string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
  359. string gxh="0";
  360. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryOrderDbkS", new object[] { plineCode}, this.ob);
  361. if(dt2.Rows.Count>0)
  362. {
  363. gxh=dt2.Rows[0]["GX_PRO_SEQ"].ToString();
  364. }
  365. if (gxh != "")
  366. {
  367. if (row.Cells["EXE_STATUS"].Text.Equals("计划") && int.Parse(gxh) != int.Parse(row.Cells["GX_PRO_SEQ"].Text.ToString()))
  368. {
  369. MessageUtil.ShowTips("该炉计划不是当前上料行,不允许上料");
  370. return;
  371. }
  372. if (row.Cells["EXE_STATUS"].Text.ToString().Equals("生产完成"))
  373. {
  374. MessageUtil.ShowTips("该炉计划上料行已生产完成,不允许上料");
  375. return;
  376. }
  377. if (row.Cells["EXE_STATUS"].Text.ToString().Equals("关闭"))
  378. {
  379. MessageUtil.ShowTips("该炉计划上料行已关闭,不允许上料");
  380. return;
  381. }
  382. }
  383. //this.planExpanQuery1.UpdateData();
  384. VrpLoadingResultEntity result = this.planExpanQuery1.Value;
  385. result.HeatPlanNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
  386. //result.ProNum =row.Cells["PRO_NUM"].Value.ToString();
  387. if (result.ProNum.Equals("") || result.ProNum.Equals("0"))
  388. {
  389. MessageUtil.ShowTips("上料支数不能为空或零");
  390. return;
  391. }
  392. //查询上料实绩支数总和
  393. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getLoadResult1", new object[] { row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
  394. //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
  395. //this.planExpanQuery1.Value = result;
  396. string pronum = "";
  397. if (dt.Rows.Count > 0)
  398. {
  399. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  400. }
  401. else
  402. {
  403. pronum = "0";
  404. }
  405. /*
  406. * 2025 - 02 - 25 不合理 注释
  407. * if (double.Parse(pronum) + double.Parse(result.ProNum) > double.Parse(row.Cells["IN_NUM"].Value.ToString()))
  408. {
  409. //if (MessageUtil.ShowYesNoAndQuestion("上料实绩支数已经超过了计划支数,是否继续。") == DialogResult.No) return;
  410. MessageUtil.ShowTips("上料实绩支数已经超过了计划支数");
  411. return;
  412. }*/
  413. if (double.Parse(result.ProNum) > double.Parse(row.Cells["ACT_COUNT"].Value.ToString()))
  414. {
  415. MessageUtil.ShowTips("上料支数已经超过了库存支数!");
  416. return;
  417. }
  418. if (MessageUtil.ShowYesNoAndQuestion("是否上料?") == DialogResult.No)
  419. {
  420. return;
  421. }
  422. CoreClientParam ccp = new CoreClientParam();
  423. try
  424. {
  425. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  426. if (Constant.WaitingForm == null)
  427. {
  428. Constant.WaitingForm = new WaitingForm();
  429. }
  430. Constant.WaitingForm.ShowToUser = true;
  431. Constant.WaitingForm.Show();
  432. Constant.WaitingForm.Update();
  433. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  434. ccp.MethodName = "saveLoadingResult";
  435. ccp.ServerParams = new Object[] { result, row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["HEAT_PLAN_SQE"].Value.ToString(), SlGx, row.Cells["PLINE_CODE"].Value.ToString(), groupNo };
  436. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  437. this.Cursor = Cursors.Default;
  438. Constant.WaitingForm.ShowToUser = false;
  439. Constant.WaitingForm.Close();
  440. Constant.WaitingForm = null;
  441. }
  442. catch (Exception ex)
  443. {
  444. this.Cursor = Cursors.Default;
  445. Constant.WaitingForm.ShowToUser = false;
  446. Constant.WaitingForm.Close();
  447. Constant.WaitingForm = null;
  448. }
  449. if (ccp.ReturnCode == -1) return;
  450. MessageUtil.ShowTips(ccp.ReturnInfo);
  451. if (ccp.ReturnInfo.Equals("上料成功!"))
  452. {
  453. QuerySinglePlan();
  454. doOver();
  455. }
  456. }
  457. }
  458. }
  459. private void doOver()
  460. {
  461. ultraGrid1.UpdateData();
  462. UltraGridRow row = ultraGrid1.ActiveRow;
  463. if (row == null) return;
  464. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getquerymaternum", new object[] { row.Cells["HEAT_PLAN_NO"].Text.ToString() }, this.ob);
  465. if (dt1.Rows[0]["NUM"].ToString() == "0" || dt1.Rows[0]["WT"].ToString() == "0.000")
  466. {
  467. if (MessageUtil.ShowYesNoAndQuestion("待上料量或重量为0,是否结炉?") == DialogResult.No)
  468. {
  469. return;
  470. }
  471. else
  472. {
  473. DoBeside();
  474. }
  475. }
  476. }
  477. /// <summary>
  478. /// 撤销上料
  479. /// </summary>
  480. private void DoReturn()
  481. {
  482. UltraGridRow row = ultraGrid1.ActiveRow;
  483. UltraGridRow Rows = ultraGridLoad.ActiveRow;
  484. if (Rows == null)
  485. {
  486. if(ultraGridLoad.Rows.Count<=0) return;
  487. Rows = ultraGridLoad.Rows[0];
  488. }
  489. if (row == null) return;
  490. //this.instructionCardControl1.UpdateData();
  491. int delCount = 0;
  492. string outnum = row.Cells["OUTNUM_CUT"].Value.ToString();
  493. string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
  494. // ArrayList list = new ArrayList();
  495. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  496. //foreach (UltraGridRow ugr in ultraGridLoad.Rows)
  497. //{
  498. delCount += 1;
  499. ArrayList list1 = new ArrayList();
  500. list1.Add(Rows.Cells["RESULT_NO"].Value.ToString());
  501. list1.Add(row.Cells["FEED_HEAT_NO"].Value.ToString());
  502. list1.Add(row.Cells["BATCH_NO"].Value.ToString());
  503. list1.Add(Rows.Cells["PRO_NUM"].Value.ToString());
  504. list1.Add(this.UserInfo.GetUserName());
  505. list1.Add(time);
  506. //list.Add(list1);
  507. //}
  508. if (delCount == 0)
  509. {
  510. MessageUtil.ShowTips("请选择上料信息!");
  511. return;
  512. }
  513. //查询是否存在上料之后的数据
  514. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryInfoPlan", new object[] { SlGx, row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
  515. if (dt.Rows.Count > 0)
  516. {
  517. if (MessageUtil.ShowYesNoAndQuestion("存在上料后工序,是否继续删除?") == DialogResult.No) return;
  518. }
  519. if (MessageUtil.ShowYesNoAndQuestion("是否确认撤销上料?") == DialogResult.No)
  520. {
  521. return;
  522. }
  523. CoreClientParam ccp = new CoreClientParam();
  524. try
  525. {
  526. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  527. if (Constant.WaitingForm == null)
  528. {
  529. Constant.WaitingForm = new WaitingForm();
  530. }
  531. Constant.WaitingForm.ShowToUser = true;
  532. Constant.WaitingForm.Show();
  533. Constant.WaitingForm.Update();
  534. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  535. ccp.MethodName = "returnLoadingResult";
  536. ccp.ServerParams = new Object[] { list1, row.Cells["HEAT_PLAN_NO"].Value.ToString(), row.Cells["PLINE_CODE"].Value.ToString(), SlGx,outnum,groupNo };
  537. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  538. this.Cursor = Cursors.Default;
  539. Constant.WaitingForm.ShowToUser = false;
  540. Constant.WaitingForm.Close();
  541. Constant.WaitingForm = null;
  542. }
  543. catch (Exception ex)
  544. {
  545. this.Cursor = Cursors.Default;
  546. Constant.WaitingForm.ShowToUser = false;
  547. Constant.WaitingForm.Close();
  548. Constant.WaitingForm = null;
  549. }
  550. if (ccp.ReturnCode == -1) return;
  551. MessageUtil.ShowTips(ccp.ReturnInfo);
  552. if (ccp.ReturnInfo.Equals("撤销上料成功!"))
  553. {
  554. QuerySinglePlan();
  555. }
  556. }
  557. //<summary>
  558. //修改上料
  559. //</summary>
  560. private void DoUpdate()
  561. {
  562. UltraGridRow row = ultraGrid1.ActiveRow;
  563. UltraGridRow urg = ultraGridLoad.ActiveRow;
  564. if (urg == null) return;
  565. if (row == null) return;
  566. if (this.planExpanQuery1.ValidInput1())
  567. {
  568. this.planExpanQuery1.UpdateData();
  569. VrpLoadingResultEntity result = this.planExpanQuery1.Value;
  570. result.PlineCode = row.Cells["PLINE_CODE"].Value.ToString();
  571. //查询是否存在上料之后的工序
  572. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpLoading.getQueryInfoPlan", new object[] { row.Cells["HEAT_PLAN_NO"].Value.ToString() }, this.ob);
  573. if (dt.Rows.Count > 0)
  574. {
  575. MessageUtil.ShowTips("存在上料后工序,不能删除!");
  576. return;
  577. }
  578. if (MessageUtil.ShowYesNoAndQuestion("是否删除上料信息?") == DialogResult.No) return;
  579. CoreClientParam ccp = new CoreClientParam();
  580. try
  581. {
  582. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  583. if (Constant.WaitingForm == null)
  584. {
  585. Constant.WaitingForm = new WaitingForm();
  586. }
  587. Constant.WaitingForm.ShowToUser = true;
  588. Constant.WaitingForm.Show();
  589. Constant.WaitingForm.Update();
  590. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  591. ccp.MethodName = "updateLoadingResult";
  592. ccp.ServerParams = new Object[] { result, urg.Cells["RESULT_NO"].Value.ToString(), row.Cells["HEAT_PLAN_NO"].Value.ToString(), SlGx };
  593. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  594. this.Cursor = Cursors.Default;
  595. Constant.WaitingForm.ShowToUser = false;
  596. Constant.WaitingForm.Close();
  597. Constant.WaitingForm = null;
  598. }
  599. catch (Exception ex)
  600. {
  601. this.Cursor = Cursors.Default;
  602. Constant.WaitingForm.ShowToUser = false;
  603. Constant.WaitingForm.Close();
  604. Constant.WaitingForm = null;
  605. }
  606. if (ccp.ReturnCode == -1) return;
  607. MessageUtil.ShowTips(ccp.ReturnInfo);
  608. if (ccp.ReturnInfo.Equals("删除上料成功!"))
  609. {
  610. QuerySinglePlan();
  611. }
  612. }
  613. }
  614. private void FrmVrpLoading_Load(object sender, EventArgs e)
  615. {
  616. string code = "";
  617. //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
  618. //cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
  619. ///departm = UserInfo.GetDepartment();
  620. // plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
  621. plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "E",ob);
  622. /* //获取工序
  623. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { code }, this.ob);
  624. if (dt2.Rows.Count > 0)
  625. {
  626. SlGx = dt2.Rows[0]["BASECODE"].ToString();
  627. SlGxname = dt2.Rows[0]["BASENAME"].ToString();
  628. }*/
  629. QuerySinglePlan();
  630. initControl();
  631. }
  632. /// <summary>
  633. /// 上料
  634. /// </summary>
  635. /// <param name="sender"></param>
  636. /// <param name="e"></param>
  637. private void ultraGridLoad_AfterRowActivate(object sender, EventArgs e)
  638. {
  639. UltraGridRow urg = ultraGridLoad.ActiveRow;
  640. if (urg == null) return;
  641. VrpLoadingResultEntity result = new VrpLoadingResultEntity();
  642. result.LoadShift = urg.Cells["LOAD_SHIFT"].Value.ToString();
  643. result.LoadGroup = urg.Cells["LOAD_GROUP"].Value.ToString();
  644. result.LoadUser = urg.Cells["UPDATE_NAME"].Value.ToString() == "" ? this.UserInfo.GetUserName() : urg.Cells["UPDATE_NAME"].Value.ToString();
  645. result.ProNum = urg.Cells["PRO_NUM"].Value.ToString();
  646. result.ProWt = urg.Cells["PRO_WT"].Value.ToString();
  647. result.LoadTime = urg.Cells["LOAD_TIME"].Value.ToString();
  648. result.Producer = urg.Cells["PRODUCER"].Value.ToString();
  649. result.ProducerTime = urg.Cells["PRODUCER_TIME"].Value.ToString();
  650. this.planExpanQuery1.Value = result;
  651. }
  652. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  653. {
  654. if (chkPlnNo.Checked) { txtRollBatchId.Enabled = true; } else { txtRollBatchId.Enabled = false; }
  655. if (chkJuNo.Checked) { txtZyBatchId.Enabled = true; } else { txtZyBatchId.Enabled = false; }
  656. if (checkLoad.Checked) { loadJudgeNo.Enabled = true; } else { loadJudgeNo.Enabled = false; }
  657. }
  658. /// <summary>
  659. /// 物料支数
  660. /// </summary>
  661. /// <param name="sender"></param>
  662. /// <param name="e"></param>
  663. private void ultraGridMat_AfterRowActivate(object sender, EventArgs e)
  664. {
  665. UltraGridRow urg = ultraGrid1.ActiveRow;
  666. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  667. VrpLoadingResultEntity result = new VrpLoadingResultEntity();
  668. if (urg == null) { return; }
  669. result.ProNum = urg.Cells["ACT_COUNT"].Text.ToString();
  670. result.ProWt = urg.Cells["ACT_WEIGHT"].Value.ToString();
  671. result.LoadShift = UserInfo.GetUserOrder();
  672. result.LoadGroup = UserInfo.GetUserGroup();
  673. result.LoadUser = UserInfo.GetUserName();
  674. result.LoadTime = time;
  675. result.ProducerTime = time;
  676. //planExpanQuery1.JudNo = urg.Cells["JUDGE_STOVE_NO"].Text.ToString();
  677. //planExpanQuery1.BatchNo = urg.Cells["BATCH_NO"].Text.ToString();
  678. //planExpanQuery1.GroupNo = urg.Cells["BATCH_GROUD_NO"].Text.ToString();
  679. //planExpanQuery1.Ob = this.ob;
  680. this.planExpanQuery1.Value = result;
  681. }
  682. private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  683. {
  684. UltraGridRow row = ultraGrid1.ActiveRow;
  685. string craftPath = YdmBaseClass.getQueryCraftNoDBK(row.Cells["CRAFT_FILE_NO"].Text.ToString(), row.Cells["CRAFT_SEQ"].Text.ToString(), ob);
  686. if (e.Button.Key.ToLower().Equals("select"))
  687. {
  688. FormFileDown down = new FormFileDown(ob, craftPath);
  689. down.CtrlFileDown1.Button3.Visible = false;
  690. down.ShowDialog();
  691. }
  692. }
  693. private void BtOffline_Click(object sender, EventArgs e)
  694. {
  695. UltraGridRow row = ultraGrid1.ActiveRow;
  696. if (row == null) return;
  697. UltraGridRow row3 = ultraGrid3.ActiveRow;
  698. if (row3 == null) return;
  699. /* UltraGridRow row2 = ultraGridLoad.ActiveRow;
  700. if (row2 == null) return;*/
  701. string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
  702. if (OfflineNum.Value.ToString().Equals("0"))
  703. {
  704. MessageUtil.ShowTips("请输入离线支数!");
  705. return;
  706. }
  707. if (txtReasion.Text.Trim().ToString().Equals(""))
  708. {
  709. MessageUtil.ShowTips("请输入离线原因!");
  710. return;
  711. }
  712. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  713. ArrayList list = new ArrayList();
  714. list.Add(row.Cells["HEAT_PLAN_NO"].Value.ToString());
  715. list.Add(SlGx);
  716. list.Add("");
  717. list.Add(this.UserInfo.GetUserName());
  718. list.Add(time);
  719. list.Add(this.UserInfo.GetUserOrder());
  720. list.Add(this.UserInfo.GetUserGroup());
  721. list.Add(OfflineNum.Value.ToString());
  722. list.Add(row3.Cells["JUDGE_STOVE_NO"].Value.ToString());
  723. list.Add(row3.Cells["BATCH_NO"].Value.ToString());
  724. list.Add(txtReasion.Text.ToString());
  725. // list.Add(row2.Cells["RESULT_NO"].Value.ToString());
  726. if (MessageUtil.ShowYesNoAndQuestion("是否离线?") == DialogResult.No) return;
  727. CoreClientParam ccp = new CoreClientParam();
  728. try
  729. {
  730. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  731. if (Constant.WaitingForm == null)
  732. {
  733. Constant.WaitingForm = new WaitingForm();
  734. }
  735. Constant.WaitingForm.ShowToUser = true;
  736. Constant.WaitingForm.Show();
  737. Constant.WaitingForm.Update();
  738. ccp.ServerName = "com.steering.mes.mcp.Vrp.FrmVrpLoading";
  739. ccp.MethodName = "offLineExpandResult";
  740. ccp.ServerParams = new Object[] { list, row.Cells["PLINE_CODE"].Value.ToString(), groupNo };
  741. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  742. this.Cursor = Cursors.Default;
  743. Constant.WaitingForm.ShowToUser = false;
  744. Constant.WaitingForm.Close();
  745. Constant.WaitingForm = null;
  746. }
  747. catch (Exception ex)
  748. {
  749. this.Cursor = Cursors.Default;
  750. Constant.WaitingForm.ShowToUser = false;
  751. Constant.WaitingForm.Close();
  752. Constant.WaitingForm = null;
  753. }
  754. if (ccp.ReturnCode != -1)
  755. {
  756. MessageUtil.ShowTips(ccp.ReturnInfo);
  757. if (ccp.ReturnInfo.Equals("离线成功!"))
  758. {
  759. QuerySinglePlan();
  760. txtReasion.Clear();
  761. }
  762. }
  763. }
  764. }
  765. }