FrmSandBlast.cs 54 KB

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