FrmCoupLoading.cs 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  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.StlMes.Client.Mcp.Common;
  16. using Core.Mes.Client.Comm.Tool;
  17. using Core.StlMes.Client.Mcp;
  18. using Core.StlMes.Client.Mcp.CollarMaterial;
  19. using Core.StlMes.Client.Mcp.Control;
  20. using Core.StlMes.Client.Mcp.Entity;
  21. using Core.StlMes.Client.Mcp.BaseMethod;
  22. using Core.StlMes.Client.Mcp.Coupling;
  23. using Core.StlMes.Client.Mcp.Report;
  24. namespace Core.StlMes.Client.Coup
  25. {
  26. public partial class FrmCoupLoading : FrmBase
  27. {
  28. private string departm="";//获取部门ID
  29. private string[] plineCode = null;//获取产线代码
  30. private string SlGx = "";//上料工序
  31. private string SLGxName = "";//上料名称
  32. public string LiXian = "";
  33. private string StrMemo = "";//备注
  34. private string[] plineCodes;
  35. public FrmCoupLoading()
  36. {
  37. InitializeComponent();
  38. this.IsLoadUserView = true;
  39. }
  40. protected override void OnLoad(EventArgs e)
  41. {
  42. base.OnLoad(e);
  43. //禁控件过滤
  44. // this.coupWoIdPlanControl1.Grid.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  45. // //设置计划区控件只读
  46. ////this.coupWoIdPlanControl1.SetAllColumnsActiveOnly();
  47. //coupWoIdPlanControl1.Ob = this.ob;
  48. }
  49. /// <summary>
  50. /// 初始化页面
  51. /// </summary>
  52. /// <param name="sender"></param>
  53. /// <param name="e"></param>
  54. private void FrmCoupLoading_Load(object sender, EventArgs e)
  55. {
  56. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGridWoId.DisplayLayout.Bands[0]);
  57. EntityHelper.ShowGridCaption<PlnZyJgWorkbillEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  58. EntityHelper.ShowGridCaption<CouplingLoadingResultEntity>(ultraGridLoad.DisplayLayout.Bands[0]);
  59. departm = UserInfo.GetDeptid();
  60. //plineCode = McpBaseHelper.GetPCodePline(departm,this.ob);
  61. plineCodes = comm.GetPlineCode(this.ValidDataPurviewIds, "H", ob);
  62. //获取工序
  63. DataTable dt2 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700301" }, this.ob);
  64. if (dt2.Rows.Count > 0)
  65. {
  66. SlGx = dt2.Rows[0]["BASECODE"].ToString();
  67. SLGxName = dt2.Rows[0]["BASENAME"].ToString();
  68. }
  69. ProTime.Value = DateTime.Today;
  70. txtBC.Value = this.UserInfo.GetUserOrder();
  71. txtBz.Value = this.UserInfo.GetUserGroup();
  72. txtUser.Text = this.UserInfo.GetUserName();
  73. BaseHelper.setOtherColumnReadOnly(ultraGridWoId, new string[] { "CHC", "CraftNoJg2" });
  74. BaseHelper.setUltraGridColumnMaxInput(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt" });
  75. BaseHelper.setUltraGridColumnBits(ultraGridWoId, new string[] { "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" });
  76. BaseHelper.InitCellPosition(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt", "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" });
  77. BaseHelper.GridColumnSum(ultraGridWoId, new string[] { "PlanBlWt", "RealBlWt", "OutWt" });
  78. BaseHelper.GridColumnCount(ultraGridWoId, new string[] { "PlanJgNum", "CsJgNum", "XqJgNum", "PlanBlNum", "RealBlNum", "OutNum" });
  79. }
  80. public override void ToolBar_Click(object sender, string ToolbarKey)
  81. {
  82. switch (ToolbarKey)
  83. {
  84. case "Query":
  85. QuerySinglePlan();
  86. break;
  87. case "Save":
  88. Save();
  89. break;
  90. case "Delete":
  91. DoDelete();
  92. break;
  93. case"Back"://回库
  94. doBack();
  95. break;
  96. case "CancelBack"://撤销回库
  97. CancelBack();
  98. break;
  99. case "Offline"://离线
  100. Offline();
  101. break;
  102. case "unOffline":
  103. unOffline();
  104. break;
  105. case "DoBeside"://结炉
  106. DoBeside();
  107. break;
  108. case "UndoBeside"://撤销结炉
  109. UndoBeside();
  110. break;
  111. case "Confirm":
  112. confirm();//确认
  113. break;
  114. case"CancelConfirm":
  115. cancelConfirm();
  116. break;
  117. case "Print":
  118. Print();
  119. break;
  120. case "Close":
  121. this.Close();
  122. break;
  123. }
  124. }
  125. /// <summary>
  126. /// 打印收料单
  127. /// </summary>
  128. private void Print()
  129. {
  130. this.ultraGridWoId.UpdateData();
  131. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  132. if (uRow == null) return;
  133. string woId = uRow.Cells["WoId"].Text.Trim();
  134. string strurl = "";
  135. strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepJgConsignationForm.cpt" + "&WO_ID=" + woId;
  136. FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
  137. fBug.AutoSize = true;
  138. fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  139. fBug.WindowState = FormWindowState.Maximized;
  140. fBug.Text = "收料单";
  141. fBug.Show();
  142. }
  143. ///
  144. /// 取消确认
  145. ///
  146. private void cancelConfirm()
  147. {
  148. ultraGridLoad.UpdateData();
  149. UltraGridRow uRow = this.ultraGridLoad.ActiveRow;
  150. if (uRow == null) { MessageUtil.ShowTips("无上料实绩!"); return; }
  151. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  152. if (row == null)
  153. {
  154. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  155. }
  156. ArrayList list1 = new ArrayList();
  157. int UpdaCount = 0;
  158. foreach (UltraGridRow ugr in ultraGridLoad.Rows)
  159. {
  160. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  161. {
  162. if (ugr.Cells["Confirm"].Value.ToString().Equals("0"))
  163. {
  164. MessageUtil.ShowTips("选中有没确认实绩,不允许取消确认!");
  165. return;
  166. }
  167. UpdaCount += 1;
  168. ArrayList list = new ArrayList();
  169. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  170. list.Add(UserInfo.GetUserName());
  171. list.Add(DateTime.Now.ToString());
  172. list1.Add(list);
  173. }
  174. }
  175. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择上料实绩数据!"); return; }
  176. if (MessageUtil.ShowYesNoAndQuestion("是否取消确认上料实绩?") == DialogResult.No)
  177. {
  178. return;
  179. }
  180. CoreClientParam ccp = new CoreClientParam();
  181. try
  182. {
  183. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  184. if (Constant.WaitingForm == null)
  185. {
  186. Constant.WaitingForm = new WaitingForm();
  187. }
  188. Constant.WaitingForm.ShowToUser = true;
  189. Constant.WaitingForm.Show();
  190. Constant.WaitingForm.Update();
  191. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  192. ccp.MethodName = "getCancelConfirm";
  193. ccp.ServerParams = new object[] { list1 };
  194. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  195. this.Cursor = Cursors.Default;
  196. Constant.WaitingForm.ShowToUser = false;
  197. Constant.WaitingForm.Close();
  198. Constant.WaitingForm = null;
  199. }
  200. catch (Exception ex)
  201. {
  202. this.Cursor = Cursors.Default;
  203. Constant.WaitingForm.ShowToUser = false;
  204. Constant.WaitingForm.Close();
  205. Constant.WaitingForm = null;
  206. }
  207. if (ccp.ReturnCode != -1)
  208. {
  209. MessageUtil.ShowTips(ccp.ReturnInfo);
  210. if (ccp.ReturnInfo.Equals("取消确认成功!"))
  211. {
  212. QuerySinglePlan();
  213. }
  214. }
  215. }
  216. ///
  217. /// 确认
  218. ///
  219. private void confirm()
  220. {
  221. ultraGridLoad.UpdateData();
  222. UltraGridRow uRow = this.ultraGridLoad.ActiveRow;
  223. if (uRow == null) { MessageUtil.ShowTips("无上料实绩!"); return; }
  224. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  225. if (row == null)
  226. {
  227. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  228. }
  229. ArrayList list1 = new ArrayList();
  230. int UpdaCount = 0;
  231. foreach (UltraGridRow ugr in ultraGridLoad.Rows)
  232. {
  233. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  234. {
  235. if (ugr.Cells["Confirm"].Value.ToString().Equals("1"))
  236. {
  237. MessageUtil.ShowTips("选中有已确认实绩,不允许再次确认!");
  238. return;
  239. }
  240. UpdaCount += 1;
  241. ArrayList list = new ArrayList();
  242. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  243. list.Add(UserInfo.GetUserName());
  244. list.Add(DateTime.Now.ToString());
  245. list1.Add(list);
  246. }
  247. }
  248. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择上料实绩数据!"); return; }
  249. if (MessageUtil.ShowYesNoAndQuestion("是否确认上料实绩?") == DialogResult.No)
  250. {
  251. return;
  252. }
  253. CoreClientParam ccp = new CoreClientParam();
  254. try
  255. {
  256. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  257. if (Constant.WaitingForm == null)
  258. {
  259. Constant.WaitingForm = new WaitingForm();
  260. }
  261. Constant.WaitingForm.ShowToUser = true;
  262. Constant.WaitingForm.Show();
  263. Constant.WaitingForm.Update();
  264. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  265. ccp.MethodName = "getConfirm";
  266. ccp.ServerParams = new object[] { list1 };
  267. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  268. this.Cursor = Cursors.Default;
  269. Constant.WaitingForm.ShowToUser = false;
  270. Constant.WaitingForm.Close();
  271. Constant.WaitingForm = null;
  272. }
  273. catch (Exception ex)
  274. {
  275. this.Cursor = Cursors.Default;
  276. Constant.WaitingForm.ShowToUser = false;
  277. Constant.WaitingForm.Close();
  278. Constant.WaitingForm = null;
  279. }
  280. if (ccp.ReturnCode != -1)
  281. {
  282. MessageUtil.ShowTips(ccp.ReturnInfo);
  283. if (ccp.ReturnInfo.Equals("确认成功!"))
  284. {
  285. QuerySinglePlan();
  286. }
  287. }
  288. }
  289. /// <summary>
  290. /// 离线
  291. /// </summary>
  292. private void Offline()
  293. {
  294. string _strat = "";
  295. UltraGridRow row = ultraGridWoId.ActiveRow;
  296. if (row == null) return;
  297. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  298. {
  299. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  300. return;
  301. }
  302. if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032378")
  303. {
  304. MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!");
  305. return;
  306. }
  307. if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032381")
  308. {
  309. MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!");
  310. return;
  311. }
  312. if (row.Cells["FeedHeatNo"].Text.ToString() == "A21032548")
  313. {
  314. MessageUtil.ShowTips("天淮来料离线需要测试,请联系视拓!");
  315. return;
  316. }
  317. UltraGridRow row1 = ultraGridLoad.ActiveRow;
  318. if (row1 == null)
  319. {
  320. MessageUtil.ShowTips("没有上料实绩不能离线!");
  321. return;
  322. }
  323. OffLine frm = new OffLine();
  324. frm.ShowDialog();
  325. LiXian = frm.StrNum;
  326. _strat = frm.Strat;
  327. StrMemo = frm.StrMemo;
  328. if (_strat.Equals("")) return;
  329. if (LiXian.Equals("") || LiXian.Equals("0")) { MessageUtil.ShowTips("离线支数不能为空!"); return; }
  330. //查询上料实绩支数总和
  331. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  332. string pronum = "";
  333. if (dt.Rows.Count > 0)
  334. {
  335. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  336. }
  337. else
  338. {
  339. pronum = "0";
  340. }
  341. string woId = row.Cells["WoId"].Value.ToString();
  342. if (row1.Cells["OffNum"].Value.ToString() == "")
  343. {
  344. row1.Cells["OffNum"].Value = "0";
  345. }
  346. if (int.Parse(pronum) < int.Parse(LiXian) + int.Parse(offlinePiece.Value.ToString()))
  347. {
  348. MessageUtil.ShowTips("离线支数不能大于上料支数!");
  349. return;
  350. }
  351. string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  352. ArrayList list = new ArrayList();
  353. list.Add(LiXian);
  354. list.Add(row.Cells["WoId"].Text.ToString());
  355. list.Add(row.Cells["HeatPlanNo"].Text.ToString());
  356. list.Add(row.Cells["JudgeStoveNo"].Text.ToString());
  357. list.Add(row.Cells["BatchNo"].Text.ToString());
  358. list.Add(row.Cells["PlineCode"].Text.ToString());
  359. list.Add(row.Cells["PlineName"].Text.ToString());
  360. list.Add(this.UserInfo.GetUserName());
  361. list.Add(this.UserInfo.GetUserOrder());
  362. list.Add(this.UserInfo.GetUserGroup());
  363. list.Add(time);
  364. list.Add(row1.Cells["ResultNo"].Value.ToString());
  365. list.Add(StrMemo);
  366. list.Add(row.Cells["BatchGroudNo"].Value.ToString());
  367. list.Add(row.Cells["FeedHeatNo"].Text.ToString());
  368. CoreClientParam ccp = new CoreClientParam();
  369. try
  370. {
  371. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  372. if (Constant.WaitingForm == null)
  373. {
  374. Constant.WaitingForm = new WaitingForm();
  375. }
  376. Constant.WaitingForm.ShowToUser = true;
  377. Constant.WaitingForm.Show();
  378. Constant.WaitingForm.Update();
  379. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  380. ccp.MethodName = "lixianThreadingResult";
  381. ccp.ServerParams = new object[] { list, SlGx, SLGxName };
  382. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  383. this.Cursor = Cursors.Default;
  384. Constant.WaitingForm.ShowToUser = false;
  385. Constant.WaitingForm.Close();
  386. Constant.WaitingForm = null;
  387. }
  388. catch (Exception ex)
  389. {
  390. this.Cursor = Cursors.Default;
  391. Constant.WaitingForm.ShowToUser = false;
  392. Constant.WaitingForm.Close();
  393. Constant.WaitingForm = null;
  394. }
  395. if (ccp.ReturnCode != -1)
  396. {
  397. MessageUtil.ShowTips(ccp.ReturnInfo);
  398. if (ccp.ReturnInfo.Equals("离线成功!"))
  399. {
  400. QuerySinglePlan();
  401. // DoClean();
  402. }
  403. }
  404. }
  405. /// <summary>
  406. /// 撤销离线
  407. /// </summary>
  408. private void unOffline()
  409. {
  410. ultraGrid2.UpdateData();
  411. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  412. if (uRow == null) { MessageUtil.ShowTips("切管实绩无数据!"); return; }
  413. UltraGridRow row = this.ultraGridWoId.ActiveRow;
  414. if (uRow == null)
  415. {
  416. MessageUtil.ShowTips("无工单信息,不允许此操作!");
  417. }
  418. if (row.Cells["ZyBillStatus"].Value.ToString() == "生产完成")
  419. {
  420. MessageUtil.ShowTips("此炉次计划整体已生产完成,不允许此操作!");
  421. return;
  422. }
  423. string woId = row.Cells["WoId"].Value.ToString();
  424. ArrayList list1 = new ArrayList();
  425. int UpdaCount = 0;
  426. foreach (UltraGridRow ugr in ultraGridLoad.Rows)
  427. {
  428. if (Convert.ToBoolean(ugr.Cells["CHECK"].Text) == true)
  429. {
  430. UpdaCount += 1;
  431. ArrayList list = new ArrayList();
  432. list.Add(ugr.Cells["ResultNo"].Text.ToString());
  433. list.Add(ugr.Cells["OffNum"].Text.ToString());
  434. list1.Add(list);
  435. }
  436. }
  437. if (UpdaCount == 0) { MessageUtil.ShowTips("请选择离线数据!"); return; }
  438. if (MessageUtil.ShowYesNoAndQuestion("是否撤销离线?") == DialogResult.No)
  439. {
  440. return;
  441. }
  442. CoreClientParam ccp = new CoreClientParam();
  443. try
  444. {
  445. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  446. if (Constant.WaitingForm == null)
  447. {
  448. Constant.WaitingForm = new WaitingForm();
  449. }
  450. Constant.WaitingForm.ShowToUser = true;
  451. Constant.WaitingForm.Show();
  452. Constant.WaitingForm.Update();
  453. ccp.ServerName = "com.steering.mes.mcp.coup.CoupCutService";
  454. ccp.MethodName = "unlixianThreadingResult";
  455. ccp.ServerParams = new object[] { list1, row.Cells["WoId"].Text.ToString(), SlGx };
  456. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  457. this.Cursor = Cursors.Default;
  458. Constant.WaitingForm.ShowToUser = false;
  459. Constant.WaitingForm.Close();
  460. Constant.WaitingForm = null;
  461. }
  462. catch (Exception ex)
  463. {
  464. this.Cursor = Cursors.Default;
  465. Constant.WaitingForm.ShowToUser = false;
  466. Constant.WaitingForm.Close();
  467. Constant.WaitingForm = null;
  468. }
  469. if (ccp.ReturnCode == -1) return;
  470. MessageUtil.ShowTips(ccp.ReturnInfo);
  471. if (ccp.ReturnInfo.Equals("撤销离线成功!"))
  472. {
  473. QuerySinglePlan();
  474. }
  475. }
  476. /// <summary>
  477. /// 结炉
  478. /// </summary>
  479. private void DoBeside()
  480. {
  481. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  482. if (uRow == null)
  483. {
  484. MessageUtil.ShowTips("请选择需要结炉的工单号!");
  485. return;
  486. }
  487. //查询上料实绩支数总和
  488. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { uRow.Cells["WoId"].Value.ToString() }, this.ob);
  489. string pronum = "";
  490. if (dt.Rows.Count > 0)
  491. {
  492. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  493. }
  494. else
  495. {
  496. pronum = "0";
  497. }
  498. UltraGridRow Row = this.ultraGrid2.ActiveRow;
  499. if(Row!=null)
  500. {
  501. if (Convert.ToInt32(uRow.Cells["PlanBlNum"].Value) > Convert.ToInt32(pronum))
  502. {
  503. MessageUtil.ShowTips("上料支数的和不能小于计划支数!");
  504. return;
  505. }
  506. }
  507. string woId = uRow.Cells["WoId"].Value.ToString();
  508. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  509. {
  510. return;
  511. }
  512. CoreClientParam ccp = new CoreClientParam();
  513. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  514. ccp.MethodName = "doBeside";
  515. ccp.ServerParams = new object[] { SlGx, woId };
  516. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  517. if (ccp.ReturnCode != -1)
  518. {
  519. MessageUtil.ShowTips(ccp.ReturnInfo);
  520. if (ccp.ReturnInfo.Equals("结炉成功!"))
  521. {
  522. QuerySinglePlan();
  523. }
  524. }
  525. }
  526. /// <summary>
  527. /// 撤销结炉
  528. /// </summary>
  529. private void UndoBeside()
  530. {
  531. UltraGridRow uRow = this.ultraGridWoId.ActiveRow;
  532. if (uRow == null)
  533. {
  534. MessageUtil.ShowTips("请选择需要撤销结炉的工单号!");
  535. return;
  536. }
  537. //string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  538. string woId = uRow.Cells["WoId"].Value.ToString();
  539. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, zYgNo }, this.ob);
  540. //if (!dt.Rows[0]["CUT_STATUS"].ToString().Equals("生产完成"))
  541. //{
  542. // MessageUtil.ShowTips("此工单工序点未结炉,不允许此操作!");
  543. // return;
  544. //}
  545. //if (dt.Rows[0]["ZY_BILL_STATUS"].ToString().Equals("生产完成"))
  546. //{
  547. // MessageUtil.ShowTips("此工单状态生产完成,不允许此操作!");
  548. // return;
  549. //}
  550. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  551. {
  552. return;
  553. }
  554. CoreClientParam ccp = new CoreClientParam();
  555. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  556. ccp.MethodName = "undoBeside";
  557. ccp.ServerParams = new object[] { SlGx, woId };
  558. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  559. if (ccp.ReturnCode != -1)
  560. {
  561. MessageUtil.ShowTips(ccp.ReturnInfo);
  562. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  563. {
  564. QuerySinglePlan();
  565. }
  566. }
  567. }
  568. /// <summary>
  569. /// 简单查询
  570. /// </summary>
  571. private void QuerySinglePlan()
  572. {
  573. string woId = "";
  574. string[] starts = { };
  575. string judgeStoveNo = "";
  576. string plnNo = "";
  577. #region 条件
  578. if (chkStarts.Checked)
  579. {
  580. if (string.IsNullOrEmpty(cmbStarts.Text.Trim()))
  581. {
  582. MessageUtil.ShowTips("请选择工单状态!");
  583. return;
  584. }
  585. else
  586. {
  587. starts = (cmbStarts.Value as List<object>).Select(p => p.ToString().Trim()).ToArray();
  588. }
  589. }
  590. if (chkwoId.Checked)
  591. {
  592. if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
  593. {
  594. MessageUtil.ShowTips("请输入工单号!");
  595. return;
  596. }
  597. else
  598. {
  599. woId = txtWoId.Text.ToString().Trim();
  600. }
  601. }
  602. else
  603. {
  604. woId = "";
  605. }
  606. if (chkPlnNo.Checked)
  607. {
  608. if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim()))
  609. {
  610. MessageUtil.ShowTips("请输入炉次计划号!");
  611. return;
  612. }
  613. else
  614. {
  615. plnNo = txtPlnNo.Text.ToString().Trim();
  616. }
  617. }
  618. else
  619. {
  620. plnNo = "";
  621. }
  622. if (chkJuNo.Checked)
  623. {
  624. if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
  625. {
  626. MessageUtil.ShowTips("请输入炉号!");
  627. return;
  628. }
  629. else
  630. {
  631. judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
  632. }
  633. }
  634. else
  635. {
  636. judgeStoveNo = "";
  637. }
  638. #endregion
  639. List<PlnZyJgWorkbillEntity> listSource = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  640. ("com.steering.mes.mcp.coup.CoupLoadingService.getQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob);
  641. plnZyJgWorkbillEntitySource.DataSource = listSource;
  642. GridHelper.RefreshAndAutoSize(ultraGridWoId);
  643. List<PlnZyJgWorkbillEntity> listSource1 = EntityHelper.GetData<PlnZyJgWorkbillEntity>
  644. ("com.steering.mes.mcp.coup.CoupLoadingService.ulgetQueryWoId", new object[] { woId, plnNo, judgeStoveNo, starts, plineCodes }, this.ob);
  645. bindingSource1.DataSource = listSource1;
  646. GridHelper.RefreshAndAutoSize(ultraGrid1);
  647. }
  648. private void ultraGridWoId_AfterRowActivate(object sender, EventArgs e)
  649. {
  650. this.ultraGrid1AfterRowActivate();
  651. }
  652. /// <summary>
  653. /// 上料计划详情
  654. /// </summary>
  655. private void ultraGrid1AfterRowActivate()
  656. {
  657. UltraGridRow row = ultraGridWoId.ActiveRow;
  658. if (row != null)
  659. {
  660. string zYgNo = row.Cells["HeatPlanNo"].Value.ToString();
  661. string woId = row.Cells["WoId"].Value.ToString();
  662. string judNo = row.Cells["FeedHeatNo"].Value.ToString();
  663. //string judNo = row.Cells["JudgeStoveNo"].Value.ToString();
  664. string batchNo = row.Cells["BatchNo"].Value.ToString();
  665. string batchNoGroup = row.Cells["BatchGroudNo"].Value.ToString();
  666. //string plNo = row.Cells["BatchGroudNo"].Value.ToString();
  667. //this.getJGCutPlan(woId,zYgNo);
  668. this.getMatZcM(judNo, batchNo, batchNoGroup);
  669. this.getCoupLing(woId);
  670. }
  671. if (row == null)
  672. {
  673. numPieces.Value = "0";
  674. }
  675. else
  676. {
  677. numPieces.Value = row.Cells["PlanBlNum"].Text.ToString();
  678. }
  679. }
  680. /// <summary>
  681. /// 查询物料信息
  682. /// </summary>
  683. /// <param name="judNo"></param>
  684. /// <param name="batchNo"></param>
  685. private void getMatZcM(string judNo, string batchNo, string batchNoGroup)
  686. {
  687. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getMatZcMById", new object[] { judNo, batchNo, batchNoGroup }, this.ob);
  688. GridHelper.CopyDataToDatatable(ref dt, ref dtPipes, true);
  689. UltraGridColumn[] col = new UltraGridColumn[] { ultraGrid2.DisplayLayout.Bands[0].Columns["STD_NAME"]};
  690. GridHelper.RefreshAndAutoSizeExceptColumns(ultraGrid2, col);
  691. }
  692. /// <summary>
  693. /// 查询上料信息
  694. /// </summary>
  695. /// <param name="judNo"></param>
  696. /// <param name="batchNo"></param>
  697. private void getCoupLing(string woId)
  698. {
  699. List<CouplingLoadingResultEntity> listSource1 = EntityHelper.GetData<CouplingLoadingResultEntity>
  700. ("com.steering.mes.mcp.coup.CoupLoadingService.getCoupLingById", new object[] {woId }, this.ob);
  701. CoupLoadResultEntitybindingSource.DataSource = listSource1;
  702. GridHelper.RefreshAndAutoSize(ultraGridLoad);
  703. foreach (UltraGridRow urg in ultraGridLoad.Rows)
  704. {
  705. if (urg.Cells["Confirm"].Value.Equals("1"))
  706. {
  707. urg.Appearance.BackColor = Color.LightGreen;
  708. }
  709. }
  710. }
  711. /// <summary>
  712. /// 接箍切断计划详细
  713. /// </summary>
  714. /// <param name="planNO"></param>
  715. //private void getJGCutPlan(string woId,string planNO)
  716. //{
  717. // DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryWoIdDetails", new object[] { woId, planNO }, this.ob);
  718. // if (dt != null && dt.Rows.Count > 0)
  719. // {
  720. // this.coupWoIdPlanControl1.Value.PlineName = dt.Rows[0]["PLINE_NAME"].ToString();
  721. // this.coupWoIdPlanControl1.Value.CutMachGrpNm = dt.Rows[0]["CUT_MACH_GRP_NM"].ToString();
  722. // this.coupWoIdPlanControl1.Value.Memo = dt.Rows[0]["MEMO"].ToString();
  723. // this.coupWoIdPlanControl1.Value.ZyPlanId = dt.Rows[0]["ZY_PLAN_ID"].ToString();
  724. // this.coupWoIdPlanControl1.Value.IfMonitorJg = dt.Rows[0]["IF_MONITOR_JG"].ToString();
  725. // this.coupWoIdPlanControl1.Value.LoadPieces = dt.Rows[0]["LOAD_PIECES"].ToString();
  726. // this.coupWoIdPlanControl1.Value.LoadWeight = dt.Rows[0]["LOAD_WEIGHT"].ToString();
  727. // this.coupWoIdPlanControl1.Value.ProPlanId = dt.Rows[0]["PRO_PLAN_ID"].ToString();
  728. // this.coupWoIdPlanControl1.Value.Steelname = dt.Rows[0]["STEELNAME"].ToString();
  729. // this.coupWoIdPlanControl1.Value.Gradename = dt.Rows[0]["GRADENAME"].ToString();
  730. // this.coupWoIdPlanControl1.Value.JglDesc = dt.Rows[0]["JGL_DESC"].ToString();
  731. // this.coupWoIdPlanControl1.Value.CodeJg = dt.Rows[0]["CODE_JG"].ToString();
  732. // this.coupWoIdPlanControl1.Value.ModelDesc = dt.Rows[0]["MODEL_DESC"].ToString();
  733. // this.coupWoIdPlanControl1.Value.SpecJgDesc = dt.Rows[0]["SPEC_JG_DESC"].ToString();
  734. // this.coupWoIdPlanControl1.Value.StyleJg = dt.Rows[0]["STYLE_JG"].ToString();
  735. // this.coupWoIdPlanControl1.Value.PlanJgNum = dt.Rows[0]["PLAN_JG_NUM"].ToString();
  736. // this.coupWoIdPlanControl1.Value.CsJgNum = dt.Rows[0]["CS_JG_NUM"].ToString();
  737. // this.coupWoIdPlanControl1.Value.XqJgNum = dt.Rows[0]["XQ_JG_NUM"].ToString();
  738. // this.coupWoIdPlanControl1.Value.InstoreNum = dt.Rows[0]["INSTORE_NUM"].ToString();
  739. // this.coupWoIdPlanControl1.Value.BlWlDesc = dt.Rows[0]["BL_WL_DESC"].ToString();
  740. // //this.coupWoIdPlanControl1.Value.LoadWeight = "";
  741. // this.coupWoIdPlanControl1.UpdateData();
  742. // }
  743. //}
  744. /// <summary>
  745. /// 上料实绩保存
  746. /// </summary>
  747. private void Save()
  748. {
  749. UltraGridRow row = ultraGridWoId.ActiveRow;
  750. if (row == null) { MessageUtil.ShowTips("无工单信息,请确认!"); return; }
  751. string woId=row.Cells["WoId"].Text.ToString();
  752. UltraGridRow rowMat = ultraGrid2.ActiveRow;
  753. if (rowMat == null) { MessageUtil.ShowTips("无物料信息,请确认!"); return; }
  754. string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  755. if (numPieces.Value.ToString() == "0")
  756. {
  757. MessageUtil.ShowTips("上料支数不能为零或空!");
  758. return;
  759. }
  760. if(Convert.ToInt32(numPieces.Value)>Convert.ToInt32(rowMat.Cells["ACT_COUNT"].Value))
  761. {
  762. MessageUtil.ShowTips("库存不足!");
  763. return;
  764. }
  765. else
  766. {
  767. //查询上料实绩支数总和
  768. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getLoadResult1", new object[] { row.Cells["WoId"].Value.ToString() }, this.ob);
  769. //VrpLoadingResultEntity result1 = new VrpLoadingResultEntity();
  770. //this.planExpanQuery1.Value = result;
  771. string pronum = "";
  772. if (dt.Rows.Count > 0)
  773. {
  774. pronum = dt.Rows[0]["PRO_NUM"].ToString();
  775. }
  776. else
  777. {
  778. pronum = "0";
  779. }
  780. if (Convert.ToInt32(numPieces.Value) + Convert.ToInt32(pronum) > Convert.ToInt32(row.Cells["PlanBlNum"].Value))
  781. {
  782. MessageUtil.ShowTips("计划不足!");
  783. return;
  784. }
  785. }
  786. //string woId = row.Cells["WO_ID"].Text.ToString();
  787. //string planNo = row.Cells["ZY_PLAN_ID"].Text.ToString();
  788. //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getCoupCountById1", new object[] { planNo,woId,txtBC.Value.ToString() }, this.ob);
  789. //if(!dt.Rows[0]["COUNT"].ToString().Equals("0"))
  790. //{
  791. // MessageUtil.ShowTips("该【" + woId + "】工单同一班次下已存在上料记录!");
  792. // return;
  793. //}
  794. if(txtBC.Value==null||txtBC.Value=="")
  795. {
  796. MessageUtil.ShowTips("班次不能为空!");
  797. return;
  798. }
  799. if(txtBz.Value == null||txtBz.Value=="")
  800. {
  801. MessageUtil.ShowTips("班组不能为空!");
  802. return;
  803. }
  804. if(Convert.ToInt32(numPieces.Value)>Convert.ToInt32(row.Cells["PlanJgNum"].Value))
  805. {
  806. MessageUtil.ShowTips("上料支数不能大于计划支数!");
  807. return;
  808. }
  809. ArrayList list = new ArrayList();
  810. list.Add(this.UserInfo.GetUserName());
  811. list.Add(datetime);
  812. list.Add(txtBC.Value.ToString());
  813. list.Add(txtBz.Value.ToString());
  814. list.Add(numPieces.Value.ToString());
  815. list.Add(ProTime.Value.ToString("yyyy-MM-dd"));
  816. list.Add(txtUser.Text.Trim());
  817. list.Add(txtMemo.Text.Trim());
  818. list.Add(txtPlace.Text.Trim());
  819. list.Add(txtMach.Text.Trim());
  820. list.Add(numFail.Text.Trim());
  821. if (MessageUtil.ShowYesNoAndQuestion("是否上料?") == DialogResult.No)
  822. {
  823. return;
  824. }
  825. CoreClientParam ccp = new CoreClientParam();
  826. try
  827. {
  828. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  829. if (Constant.WaitingForm == null)
  830. {
  831. Constant.WaitingForm = new WaitingForm();
  832. }
  833. Constant.WaitingForm.ShowToUser = true;
  834. Constant.WaitingForm.Show();
  835. Constant.WaitingForm.Update();
  836. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  837. ccp.MethodName = "saveLoadResult";
  838. ccp.ServerParams = new object[] { list, SlGx, woId };
  839. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  840. this.Cursor = Cursors.Default;
  841. Constant.WaitingForm.ShowToUser = false;
  842. Constant.WaitingForm.Close();
  843. Constant.WaitingForm = null;
  844. }
  845. catch (Exception ex)
  846. {
  847. this.Cursor = Cursors.Default;
  848. Constant.WaitingForm.ShowToUser = false;
  849. Constant.WaitingForm.Close();
  850. Constant.WaitingForm = null;
  851. }
  852. if (ccp.ReturnCode == -1) return;
  853. MessageUtil.ShowTips(ccp.ReturnInfo);
  854. if (ccp.ReturnInfo.Equals("上料成功!"))
  855. {
  856. QuerySinglePlan();
  857. }
  858. }
  859. /// <summary>
  860. /// 回库
  861. /// </summary>
  862. private void doBack()
  863. {
  864. string _strat = "";
  865. string backNum = "";
  866. ultraGridWoId.UpdateData();
  867. UltraGridRow row = ultraGridWoId.ActiveRow;
  868. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  869. UltraGridRow rowMat = ultraGridLoad.ActiveRow;
  870. if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; }
  871. if(rowMat.Cells["Confirm"].Value.Equals("1"))
  872. {
  873. MessageUtil.ShowTips("选中的上料实绩已经确认,不允许回库!");
  874. return;
  875. }
  876. string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  877. Oback frm = new Oback();
  878. frm.ShowDialog();
  879. backNum = frm.StrNum;
  880. _strat = frm.Strat;
  881. if (_strat.Equals("")) return;
  882. if (backNum.Equals("") || backNum.Equals("0")) { MessageUtil.ShowTips("回库支数不能为空!"); return; }
  883. ArrayList list1 = new ArrayList();
  884. foreach (UltraGridRow item in ultraGridLoad.Rows)
  885. {
  886. if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true)
  887. {
  888. if(int.Parse(backNum)>=int.Parse(item.Cells["LoadPieces"].Value.ToString()))
  889. {
  890. MessageUtil.ShowTips("回库支数不能大于等于上料支数!");
  891. return;
  892. }
  893. ArrayList list = new ArrayList();
  894. list.Add(item.Cells["ResultNo"].Text.ToString());
  895. list.Add(backNum);
  896. list.Add(this.UserInfo.GetUserName());
  897. list.Add(datetime);
  898. list.Add(item.Cells["WoId"].Text.ToString());
  899. list1.Add(list);
  900. }
  901. }
  902. if (MessageUtil.ShowYesNoAndQuestion("是否回库?") == DialogResult.No)
  903. {
  904. return;
  905. }
  906. CoreClientParam ccp = new CoreClientParam();
  907. try
  908. {
  909. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  910. if (Constant.WaitingForm == null)
  911. {
  912. Constant.WaitingForm = new WaitingForm();
  913. }
  914. Constant.WaitingForm.ShowToUser = true;
  915. Constant.WaitingForm.Show();
  916. Constant.WaitingForm.Update();
  917. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  918. ccp.MethodName = "doBackResult";
  919. ccp.ServerParams = new object[] { list1, SlGx };
  920. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  921. this.Cursor = Cursors.Default;
  922. Constant.WaitingForm.ShowToUser = false;
  923. Constant.WaitingForm.Close();
  924. Constant.WaitingForm = null;
  925. }
  926. catch (Exception ex)
  927. {
  928. this.Cursor = Cursors.Default;
  929. Constant.WaitingForm.ShowToUser = false;
  930. Constant.WaitingForm.Close();
  931. Constant.WaitingForm = null;
  932. }
  933. if (ccp.ReturnCode == -1) return;
  934. MessageUtil.ShowTips(ccp.ReturnInfo);
  935. if (ccp.ReturnInfo.Equals("回库成功!"))
  936. {
  937. QuerySinglePlan();
  938. }
  939. }
  940. private void CancelBack()
  941. {
  942. string _strat = "";
  943. string backNum = "";
  944. ultraGridWoId.UpdateData();
  945. UltraGridRow row = ultraGridWoId.ActiveRow;
  946. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  947. UltraGridRow rowMat = ultraGridLoad.ActiveRow;
  948. if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; }
  949. if (rowMat.Cells["Confirm"].Value.Equals("1"))
  950. {
  951. MessageUtil.ShowTips("选中的上料实绩已经确认,不允许撤销回库!");
  952. return;
  953. }
  954. int Data = 0;
  955. string count = "";
  956. //查询工单回库多少支
  957. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getCoupBackPiece", new object[] { row.Cells["WoId"].Text.ToString() }, this.ob);
  958. if (!dt.Rows[0]["COUNT"].ToString().Equals("0"))
  959. {
  960. count = dt.Rows[0]["COUNT"].ToString();
  961. }
  962. string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  963. Oback frm = new Oback();
  964. frm.ShowDialog();
  965. backNum = frm.StrNum;
  966. _strat = frm.Strat;
  967. if (_strat.Equals("")) return;
  968. if (backNum.Equals("") || backNum.Equals("0")) { MessageUtil.ShowTips("撤销回库支数不能为空!"); return; }
  969. ArrayList list1 = new ArrayList();
  970. foreach (UltraGridRow item in ultraGridLoad.Rows)
  971. {
  972. if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true)
  973. {
  974. Data += 1;
  975. if (int.Parse(backNum) > int.Parse(count))
  976. {
  977. MessageUtil.ShowTips("撤销回库支数不能大于回库支数!");
  978. return;
  979. }
  980. ArrayList list = new ArrayList();
  981. list.Add(item.Cells["ResultNo"].Text.ToString());
  982. list.Add(backNum);
  983. list.Add(this.UserInfo.GetUserName());
  984. list.Add(datetime);
  985. list.Add(item.Cells["WoId"].Text.ToString());
  986. list1.Add(list);
  987. }
  988. }
  989. if (Data == 0) { MessageUtil.ShowTips("请选择回库过的上料数据!"); return; }
  990. if (MessageUtil.ShowYesNoAndQuestion("是否撤销回库?") == DialogResult.No)
  991. {
  992. return;
  993. }
  994. CoreClientParam ccp = new CoreClientParam();
  995. try
  996. {
  997. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  998. if (Constant.WaitingForm == null)
  999. {
  1000. Constant.WaitingForm = new WaitingForm();
  1001. }
  1002. Constant.WaitingForm.ShowToUser = true;
  1003. Constant.WaitingForm.Show();
  1004. Constant.WaitingForm.Update();
  1005. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  1006. ccp.MethodName = "doCancelBackResult";
  1007. ccp.ServerParams = new object[] { list1, SlGx };
  1008. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1009. this.Cursor = Cursors.Default;
  1010. Constant.WaitingForm.ShowToUser = false;
  1011. Constant.WaitingForm.Close();
  1012. Constant.WaitingForm = null;
  1013. }
  1014. catch (Exception ex)
  1015. {
  1016. this.Cursor = Cursors.Default;
  1017. Constant.WaitingForm.ShowToUser = false;
  1018. Constant.WaitingForm.Close();
  1019. Constant.WaitingForm = null;
  1020. }
  1021. if (ccp.ReturnCode == -1) return;
  1022. MessageUtil.ShowTips(ccp.ReturnInfo);
  1023. if (ccp.ReturnInfo.Equals("撤销回库成功!"))
  1024. {
  1025. QuerySinglePlan();
  1026. }
  1027. }
  1028. /// <summary>
  1029. /// 上料实绩删除
  1030. /// </summary>
  1031. private void DoDelete()
  1032. {
  1033. ultraGridWoId.UpdateData();
  1034. UltraGridRow row = ultraGridWoId.ActiveRow;
  1035. if (row == null) { MessageUtil.ShowTips("无工单信息!"); return; }
  1036. UltraGridRow rowMat = ultraGridLoad.ActiveRow;
  1037. if (rowMat == null) { MessageUtil.ShowTips("无上料实绩记录!"); return; }
  1038. if (rowMat.Cells["Confirm"].Value.Equals("1"))
  1039. {
  1040. MessageUtil.ShowTips("选中的上料实绩已经确认,不允许删除!");
  1041. return;
  1042. }
  1043. string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  1044. ArrayList list1 = new ArrayList();
  1045. foreach (UltraGridRow item in ultraGridLoad.Rows)
  1046. {
  1047. if (Convert.ToBoolean(item.Cells["CHECK"].Text) == true)
  1048. {
  1049. ArrayList list = new ArrayList();
  1050. list.Add(item.Cells["ResultNo"].Text.ToString());
  1051. list.Add(this.UserInfo.GetUserName());
  1052. list.Add(datetime);
  1053. list.Add(this.UserInfo.GetUserOrder());
  1054. list.Add(this.UserInfo.GetUserGroup());
  1055. list.Add(row.Cells["FeedHeatNo"].Text.ToString());
  1056. list1.Add(list);
  1057. }
  1058. }
  1059. if (MessageUtil.ShowYesNoAndQuestion("是否撤销上料?") == DialogResult.No)
  1060. {
  1061. return;
  1062. }
  1063. CoreClientParam ccp = new CoreClientParam();
  1064. try
  1065. {
  1066. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  1067. if (Constant.WaitingForm == null)
  1068. {
  1069. Constant.WaitingForm = new WaitingForm();
  1070. }
  1071. Constant.WaitingForm.ShowToUser = true;
  1072. Constant.WaitingForm.Show();
  1073. Constant.WaitingForm.Update();
  1074. ccp.ServerName = "com.steering.mes.mcp.coup.CoupLoadingService";
  1075. ccp.MethodName = "deleteLoadResult";
  1076. ccp.ServerParams = new object[] { list1, SlGx };
  1077. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1078. this.Cursor = Cursors.Default;
  1079. Constant.WaitingForm.ShowToUser = false;
  1080. Constant.WaitingForm.Close();
  1081. Constant.WaitingForm = null;
  1082. }
  1083. catch (Exception ex)
  1084. {
  1085. this.Cursor = Cursors.Default;
  1086. Constant.WaitingForm.ShowToUser = false;
  1087. Constant.WaitingForm.Close();
  1088. Constant.WaitingForm = null;
  1089. }
  1090. if (ccp.ReturnCode == -1) return;
  1091. MessageUtil.ShowTips(ccp.ReturnInfo);
  1092. if (ccp.ReturnInfo.Equals("撤销上料成功!"))
  1093. {
  1094. QuerySinglePlan();
  1095. }
  1096. }
  1097. /// <summary>
  1098. /// 按回车键触发查询按钮
  1099. /// </summary>
  1100. /// <param name="sender"></param>
  1101. /// <param name="e"></param>
  1102. private void ContPublic_KeyDown(object sender, KeyEventArgs e)
  1103. {
  1104. if (e.KeyCode == Keys.Enter)
  1105. {
  1106. QuerySinglePlan();
  1107. }
  1108. }
  1109. //private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  1110. //{
  1111. // UltraGridRow urg=ultraGrid2.ActiveRow;
  1112. // if (urg == null)
  1113. // {
  1114. // numPieces.Value = "0";
  1115. // }
  1116. // else
  1117. // {
  1118. // numPieces.Value = urg.Cells["ACT_COUNT"].Text.ToString();
  1119. // }
  1120. //}
  1121. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  1122. {
  1123. if (chkStarts.Checked) { cmbStarts.Enabled = true; } else { cmbStarts.Enabled = false; }
  1124. if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
  1125. if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  1126. if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
  1127. }
  1128. private void ultraGridLoad_AfterRowActivate(object sender, EventArgs e)
  1129. {
  1130. UltraGridRow rowMat = ultraGridLoad.ActiveRow;
  1131. if (rowMat == null) return;
  1132. //numPieces.Value = rowMat.Cells["LoadPieces"].Text.ToString();
  1133. //txtBC.Text = rowMat.Cells["LoadShift"].Text.ToString();
  1134. //txtBz.Text = rowMat.Cells["LoadGroup"].Text.ToString();
  1135. if (rowMat.Cells["ProTime"].Text.ToString().Equals(""))
  1136. {
  1137. ProTime.Value = DateTime.Today;
  1138. }
  1139. else
  1140. {
  1141. ProTime.Value = DateTime.Parse(rowMat.Cells["ProTime"].Text.ToString());
  1142. }
  1143. txtUser.Value = rowMat.Cells["LoadUser"].Text.ToString();
  1144. //查询工单的离线支数
  1145. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.CoupLoadingService.getQueryOfflinePiece", new object[] { rowMat.Cells["WoId"].Value }, this.ob);
  1146. if (dt.Rows.Count > 0)
  1147. {
  1148. if (dt.Rows[0]["OFFLINE_NUM_BJ"].ToString() == null || dt.Rows[0]["OFFLINE_NUM_BJ"].ToString() == "")
  1149. {
  1150. offlinePiece.Value = 0;
  1151. }
  1152. else
  1153. {
  1154. offlinePiece.Value = Convert.ToInt64(dt.Rows[0]["OFFLINE_NUM_BJ"].ToString());
  1155. }
  1156. }
  1157. }
  1158. private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1159. {
  1160. //UltraGridRow row = ultraGridWoId.ActiveRow;
  1161. //string craftPath = YdmBaseClass.getQueryCraftNoJG(row.Cells["CraftNoJg2"].Text.ToString(), row.Cells["CraftSeq2"].Text.ToString(), ob);
  1162. //if (e.Button.Key.ToLower().Equals("select"))
  1163. //{
  1164. // FormFileDown down = new FormFileDown(ob, craftPath);
  1165. // down.CtrlFileDown1.Button3.Visible = false;
  1166. // down.ShowDialog();
  1167. //}
  1168. UltraGridRow row = ultraGridWoId.ActiveRow;
  1169. if (row == null) return;
  1170. string orderNo = row.Cells["OrderNoSeq"].Text.ToString();
  1171. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilCouplingProcess2.cpt"
  1172. + "&ORDER_NO=" + orderNo;
  1173. FrmRepExcel down = new FrmRepExcel(ob, strurl);
  1174. down.Text = "接箍二级工艺";
  1175. down.Visible = false;
  1176. down.Size = new Size(740, this.Height);
  1177. down.WindowState = FormWindowState.Maximized;
  1178. down.ShowDialog();
  1179. }
  1180. private void numPieces_AfterEnterEditMode(object sender, EventArgs e)
  1181. {
  1182. this.BeginInvoke(new MethodInvoker(this.numPieces.SelectAll));
  1183. }
  1184. private void card_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  1185. {
  1186. UltraGridRow row = ultraGridLoad.ActiveRow;
  1187. if (row == null) return;
  1188. string woId = row.Cells["WoId"].Text.ToString();
  1189. string judgeNo = row.Cells["JudgeStoveNo"].Text.ToString();
  1190. string plinCode = row.Cells["PlineCode"].Text.ToString();
  1191. string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=CouplingDeliveryCard.cpt"
  1192. + "&woId=" + woId + "&judgeNo=" + judgeNo + "&plineCode=" +plinCode;
  1193. FrmRepExcel down = new FrmRepExcel(ob, strurl);
  1194. down.Text = "接箍传递卡";
  1195. down.Visible = false;
  1196. down.Size = new Size(740, this.Height);
  1197. down.WindowState = FormWindowState.Maximized;
  1198. down.ShowDialog();
  1199. }
  1200. }
  1201. }