FrmCouplingAppl.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. using com.steering.mes.mcp.entity;
  2. using Core.Mes.Client.Comm.Control;
  3. using Core.Mes.Client.Comm.Format;
  4. using Core.Mes.Client.Comm.Server;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.Mcp.CollarMaterial;
  7. using Core.StlMes.Client.Mcp.Common;
  8. using Core.StlMes.Client.Mcp.Control;
  9. using Core.StlMes.Client.Mcp.Entity;
  10. using CoreFS.CA06;
  11. using Infragistics.Win;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System;
  14. using System.Collections;
  15. using System.Collections.Generic;
  16. using System.ComponentModel;
  17. using System.Data;
  18. using System.Drawing;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Windows.Forms;
  22. namespace Core.StlMes.Client.Mcp.Coupling
  23. {
  24. public partial class FrmCouplingAppl : FrmBase
  25. {
  26. private string[] arr = null;
  27. private string departm = "";//获取部门ID
  28. private string[] plineCode = null;//获取产线代码
  29. private string cutGx = "";//交库工序
  30. public FrmCouplingAppl()
  31. {
  32. InitializeComponent();
  33. this.IsLoadUserView = true;
  34. }
  35. private void FrmCouplingAppl_Load(object sender, EventArgs e)
  36. {
  37. DateTime now = DateTime.Now;
  38. DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
  39. DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
  40. this.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
  41. this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
  42. EntityHelper.ShowGridCaption<CouplingMatMEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  43. EntityHelper.ShowGridCaption<CouplingMatMEntity1>(ultraGrid2.DisplayLayout.Bands[0]);
  44. EntityHelper.ShowGridCaption<Core.StlMes.Client.Mcp.Entity.QcmZgJugdeApplyEntity>(ultraGrid3.DisplayLayout.Bands[0]);
  45. ultraGrid2.DisplayLayout.Bands[0].Columns["isFlag"].Header.Caption = "前工序是否紧急放行";
  46. this.IsLoadUserView = true;
  47. arr = this.ValidDataPurviewIds;
  48. //departm = UserInfo.GetDeptid();
  49. //plineCode = McpBaseHelper.GetPCodePline(departm, this.ob);
  50. ////获取交库工序
  51. //DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "700313" }, this.ob);
  52. //if (dt3.Rows.Count > 0)
  53. //{
  54. // cutGx = dt3.Rows[0]["BASECODE"].ToString();
  55. //}
  56. //PipeManageClass.BindComBaseInfo(cmbStroage, this.ob);
  57. }
  58. public override void ToolBar_Click(object sender, string ToolbarKey)
  59. {
  60. switch (ToolbarKey)
  61. {
  62. case "DoQuery":
  63. if (ultraTabControl1.SelectedTab.Index == 0)
  64. {
  65. QuerySinglePlan();
  66. }
  67. else if (ultraTabControl1.SelectedTab.Index == 1)
  68. {
  69. QueryZgJugdeApply();
  70. }
  71. break;
  72. //case "MatQuery":
  73. // DoMatQuery();//材料查询
  74. // break;
  75. case "DoDecision":
  76. DoDecision();//申请判定
  77. break;
  78. case "cancelDoDecision":
  79. cancelDoDecision();//撤销申请判定
  80. break;
  81. case "UpdateProWgt":
  82. updateProWgt();
  83. break;
  84. case "DoUpdate":
  85. DoUpdate();//库位修改
  86. break;
  87. case "DoDelete":
  88. DoDelete();
  89. break;
  90. case "DoBeside"://结炉
  91. DoBeside();
  92. break;
  93. case "UndoBeside"://撤销结炉
  94. UndoBeside();
  95. break;
  96. case "DoClose":
  97. this.Close();
  98. break;
  99. }
  100. }
  101. /// <summary>
  102. /// 查询送判数据
  103. /// </summary>
  104. private void QueryZgJugdeApply()
  105. {
  106. string Woid = "";
  107. string jugeNo = "";
  108. string startTim = "";
  109. string endTim = "";
  110. ArrayList list = new ArrayList();
  111. if (this.chkwoId.Checked && this.txtWoId.Text.Trim() != "")
  112. {
  113. Woid = this.txtWoId.Text.Trim();
  114. }
  115. if (this.chkJuNo.Checked && this.txtJudgeStoveNO.Text.Trim() != "")
  116. {
  117. jugeNo = this.txtJudgeStoveNO.Text.Trim();
  118. }
  119. if (chkTim2.Checked)
  120. {
  121. if (DateTime.Parse(this.StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  122. {
  123. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  124. return;
  125. }
  126. else
  127. {
  128. startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  129. endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  130. }
  131. }
  132. list.Add(startTim);
  133. list.Add(endTim);
  134. list.Add(jugeNo);
  135. list.Add(this.ultraOptionSet1.CheckedItem.DataValue.ToString());
  136. list.Add(Woid);
  137. QcmZgJudgebindingSource1.Clear();
  138. List<Core.StlMes.Client.Mcp.Entity.QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.Mcp.Entity.QcmZgJugdeApplyEntity>(
  139. "com.steering.mes.mcp.coup.FrmCouplingAppl.QueryZgJugdeApply", new object[] { list, arr }, this.ob);
  140. QcmZgJudgebindingSource1.DataSource = listSource;
  141. // WriteTextToGrid();
  142. }
  143. /// <summary>
  144. /// 回报过磅重量
  145. /// </summary>
  146. private void updateProWgt()
  147. {
  148. this.ultraGrid1.UpdateData();
  149. this.ultraGrid2.UpdateData();
  150. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  151. if (uRow == null)
  152. {
  153. MessageUtil.ShowTips("请选择需要回报过磅重量的炉信息!");
  154. return;
  155. }
  156. if (!StringUtil.IsDouble(uRow.Cells["ProWt"].Value.ToString3()))
  157. {
  158. MessageUtil.ShowTips("过磅重量应输入数字!");
  159. return;
  160. }
  161. if (Double.Parse(uRow.Cells["ProWt"].Value.ToString3()) <= 0)
  162. {
  163. MessageUtil.ShowTips("请输入正确的过磅重量!");
  164. return;
  165. }
  166. ArrayList list = new ArrayList();
  167. list.Add(uRow.Cells["JudgeStoveNo"].Value.ToString());
  168. list.Add(uRow.Cells["ProWt"].Value.ToString3());
  169. list.Add(uRow.Cells["BelongCode"].Value.ToString());
  170. ArrayList ArrList = new ArrayList();
  171. IQueryable<UltraGridRow> checkMags = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  172. if (checkMags.Count() == 0)
  173. {
  174. MessageUtil.ShowTips("请选择需要回报过磅重量的炉信息!");
  175. }
  176. else
  177. {
  178. foreach (UltraGridRow urg in checkMags)
  179. {
  180. ArrayList arrList = new ArrayList();
  181. if (!StringUtil.IsDouble(urg.Cells["ProWt"].Value.ToString3()))
  182. {
  183. MessageUtil.ShowTips("过磅重量应输入数字!");
  184. return;
  185. }
  186. if (Double.Parse(urg.Cells["ProWt"].Value.ToString3()) < 0)
  187. {
  188. MessageUtil.ShowTips("请输入正确的过磅重量!");
  189. return;
  190. }
  191. arrList.Add(urg.Cells["JudgeStoveNo"].Value.ToString());
  192. arrList.Add(urg.Cells["ProWt"].Value.ToString3());
  193. arrList.Add(urg.Cells["BelongCode"].Value.ToString());
  194. arrList.Add(urg.Cells["BatchNo"].Value.ToString());
  195. arrList.Add(urg.Cells["JgOrderno"].Value.ToString());
  196. ArrList.Add(arrList);
  197. }
  198. }
  199. CoreClientParam ccp = new CoreClientParam();
  200. ccp.ServerName = "com.steering.mes.mcp.coup.FrmCouplingAppl";
  201. ccp.MethodName = "updateProWgt";
  202. ccp.ServerParams = new object[] { list, ArrList };
  203. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  204. if (ccp.ReturnCode != -1)
  205. {
  206. if (ccp.ReturnInfo.Equals("回报成功!"))
  207. {
  208. QuerySinglePlan();
  209. MessageUtil.ShowTips(ccp.ReturnInfo);
  210. }
  211. else
  212. {
  213. MessageUtil.ShowTips(ccp.ReturnInfo);
  214. }
  215. }
  216. }
  217. /// <summary>
  218. /// 撤销申请判定
  219. /// </summary>
  220. private void cancelDoDecision()
  221. {
  222. this.ultraGrid2.UpdateData();
  223. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  224. if (uRow == null) return;
  225. string plinCode = uRow.Cells["PlineCode"].Text.ToString();
  226. IQueryable<UltraGridRow> checkMags = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  227. if (checkMags.Count() == 0)
  228. {
  229. MessageUtil.ShowTips("请选择需要撤销送判的炉批信息!");
  230. return;
  231. }
  232. ArrayList parmList = new ArrayList();
  233. foreach (UltraGridRow row in checkMags)
  234. {
  235. string valueFlag = "";
  236. string instock = "";
  237. string processDesc = "";
  238. DataTable dtPln = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmCouplingAppl.SelectValueFlag",
  239. new object[] { row.Cells["DeterNo"].Value.ToString(), row.Cells["DeterNoSeq"].Value.ToString(),
  240. row.Cells["JudgeStoveNo"].Value.ToString(),row.Cells["BatchNo"].Value.ToString(),
  241. plinCode },
  242. this.ob);
  243. if (dtPln.Rows.Count > 0)
  244. {
  245. valueFlag = dtPln.Rows[0]["VALIDFLAG"].ToString();
  246. instock = dtPln.Rows[0]["INSTOCK_FLAG"].ToString();
  247. }
  248. if (!valueFlag.Equals("00") && !valueFlag.Equals("10"))
  249. {
  250. MessageUtil.ShowTips("该炉批已不是初始状态/撤判状态,不允许撤销申请判定!");
  251. return;
  252. }
  253. if (instock.Equals("1"))
  254. {
  255. MessageUtil.ShowTips("质保部已经接收不允许撤销!");
  256. return;
  257. }
  258. CouplingMatMEntity1 matBcEntity = (CouplingMatMEntity1)row.ListObject;
  259. if (matBcEntity.DeterNo.Equals(""))
  260. {
  261. MessageUtil.ShowTips("炉批未送判,不允许撤销申请判定!");
  262. return;
  263. }
  264. string matEntity = JSONFormat.Format(matBcEntity);
  265. parmList.Add(matEntity);
  266. }
  267. CoreClientParam ccp = new CoreClientParam();
  268. ccp.ServerName = "com.steering.mes.mcp.coup.FrmCouplingAppl";
  269. ccp.MethodName = "cancelDoDecision";
  270. ccp.ServerParams = new object[] { parmList };
  271. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  272. if (ccp.ReturnCode != -1)
  273. {
  274. if (ccp.ReturnInfo.Equals("撤销成功!"))
  275. {
  276. string applyCode = ccp.ReturnObject.ToString();
  277. QuerySinglePlan();
  278. //this.txtMemo.Text = "";
  279. MessageUtil.ShowTips(ccp.ReturnInfo);
  280. }
  281. else
  282. {
  283. MessageUtil.ShowTips(ccp.ReturnInfo);
  284. }
  285. }
  286. }
  287. /// <summary>
  288. /// 库位修改
  289. /// </summary>
  290. private void DoUpdate()
  291. {
  292. //ultraGrid3.UpdateData();
  293. //UltraGridRow urg = ultraGrid3.ActiveRow;
  294. //if (urg == null) { MessageUtil.ShowTips("无库存信息!"); return; }
  295. //int addCount = 0;
  296. //ArrayList list = new ArrayList();
  297. //string date = DateTime.Now.ToString();
  298. //foreach (UltraGridRow uRow in ultraGrid3.Rows)
  299. //{
  300. // if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  301. // {
  302. // addCount += 1;
  303. // if (uRow.Cells["KEP_NO"].Text.Trim() == "")
  304. // {
  305. // MessageUtil.ShowTips("框号不能为空!");
  306. // return;
  307. // }
  308. // if (uRow.Cells["STORAGE_NO"].Text.Trim() == "")
  309. // {
  310. // MessageUtil.ShowTips("库位不能空!");
  311. // return;
  312. // }
  313. // ArrayList list1 = new ArrayList();
  314. // list1.Add(uRow.Cells["MAT_NO"].Value.ToString());
  315. // list1.Add(uRow.Cells["ZY_PLAN_ID"].Value.ToString());
  316. // list1.Add(uRow.Cells["RESULT_NO"].Value.ToString());
  317. // list1.Add(uRow.Cells["KEP_NO"].Value.ToString());
  318. // list1.Add(uRow.Cells["STORAGE_NO"].Value.ToString());
  319. // list1.Add(this.UserInfo.GetUserName());
  320. // list1.Add(date);
  321. // list.Add(list1);
  322. // }
  323. //}
  324. // if (addCount == 0) { MessageUtil.ShowTips("请选择接箍库存信息!"); return; }
  325. if (MessageUtil.ShowYesNoAndQuestion("是否修改位置?") == DialogResult.No)
  326. {
  327. return;
  328. }
  329. CoreClientParam ccp = new CoreClientParam();
  330. try
  331. {
  332. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  333. if (Constant.WaitingForm == null)
  334. {
  335. Constant.WaitingForm = new WaitingForm();
  336. }
  337. Constant.WaitingForm.ShowToUser = true;
  338. Constant.WaitingForm.Show();
  339. Constant.WaitingForm.Update();
  340. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInLibrary";
  341. ccp.MethodName = "updateLibraryResult";
  342. // ccp.ServerParams = new object[] { list};
  343. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  344. this.Cursor = Cursors.Default;
  345. Constant.WaitingForm.ShowToUser = false;
  346. Constant.WaitingForm.Close();
  347. Constant.WaitingForm = null;
  348. }
  349. catch (Exception ex)
  350. {
  351. this.Cursor = Cursors.Default;
  352. Constant.WaitingForm.ShowToUser = false;
  353. Constant.WaitingForm.Close();
  354. Constant.WaitingForm = null;
  355. }
  356. if (ccp.ReturnCode == -1) return;
  357. MessageUtil.ShowTips(ccp.ReturnInfo);
  358. if (ccp.ReturnInfo.Equals("修改位置成功!"))
  359. {
  360. QuerySinglePlan();
  361. }
  362. }
  363. /// <summary>
  364. /// 材料查询
  365. /// </summary>
  366. private void DoMatQuery()
  367. {
  368. string woId = "";
  369. string judgeStoveNo = "";
  370. string plnNo = "";
  371. #region 条件
  372. if (chkwoId.Checked && string.IsNullOrEmpty(txtWoId.Text.Trim()))
  373. {
  374. MessageUtil.ShowTips("请输入工单号!");
  375. return;
  376. }
  377. else
  378. {
  379. woId = txtWoId.Text.ToString().Trim();
  380. }
  381. //if (chkPlnNo.Checked && string.IsNullOrEmpty(txtPlnNo.Text.Trim()))
  382. //{
  383. // MessageUtil.ShowTips("请输入炉次计划号!");
  384. // return;
  385. //}
  386. //else
  387. //{
  388. // plnNo = txtPlnNo.Text.ToString().Trim();
  389. //}
  390. if (chkJuNo.Checked && string.IsNullOrEmpty(txtJudgeStoveNO.Text.Trim()))
  391. {
  392. MessageUtil.ShowTips("请输入炉号!");
  393. return;
  394. }
  395. else
  396. {
  397. judgeStoveNo = txtJudgeStoveNO.Text.ToString().Trim();
  398. }
  399. #endregion
  400. ArrayList list = new ArrayList();
  401. list.Add(woId);
  402. list.Add(plnNo);
  403. list.Add(judgeStoveNo);
  404. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmInLibrary.doQueryMatNo", new object[] { list, plineCode[0].ToString() }, this.ob);
  405. // GridHelper.CopyDataToDatatable(ref dt, ref dateMat, true);
  406. }
  407. private void QuerySinglePlan()
  408. {
  409. string Woid = "";
  410. string jugeNo = "";
  411. string startTim = "";
  412. string endTim = "";
  413. ArrayList list = new ArrayList();
  414. if (this.chkwoId.Checked && this.txtWoId.Text.Trim() != "")
  415. {
  416. Woid = this.txtWoId.Text.Trim();
  417. }
  418. if (this.chkJuNo.Checked && this.txtJudgeStoveNO.Text.Trim() != "")
  419. {
  420. jugeNo = this.txtJudgeStoveNO.Text.Trim();
  421. }
  422. if (chkTim2.Checked)
  423. {
  424. if (DateTime.Parse(this.StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  425. {
  426. MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
  427. return;
  428. }
  429. else
  430. {
  431. startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  432. endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
  433. }
  434. }
  435. list.Add(startTim);
  436. list.Add(endTim);
  437. list.Add(jugeNo);
  438. list.Add(this.ultraOptionSet1.CheckedItem.DataValue.ToString());
  439. list.Add(Woid);
  440. CouplingMatMbindingSource.Clear();
  441. List<CouplingMatMEntity> listSource = EntityHelper.GetData<CouplingMatMEntity>(
  442. "com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryMat", new object[] { list, arr }, this.ob);
  443. CouplingMatMbindingSource.DataSource = listSource;
  444. }
  445. /// <summary>
  446. /// 编辑区Gird
  447. /// </summary>
  448. /// <param name="sender"></param>
  449. /// <param name="e"></param>
  450. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  451. {
  452. string woid = "";
  453. string judgeNo = "";
  454. UltraGridRow urg = ultraGrid1.ActiveRow;
  455. if (urg == null)
  456. {
  457. return;
  458. }
  459. else
  460. {
  461. woid = urg.Cells["WoId"].Value.ToString();
  462. judgeNo = urg.Cells["JudgeStoveNo"].Value.ToString();
  463. }
  464. ultraGrid1.UpdateData();
  465. if (urg.Cells["ProWt"].Text != "")
  466. {
  467. string count = "";
  468. DataTable dtHtt = ServerHelper.GetData("com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJudgeBathCount",
  469. new object[] { woid, judgeNo, this.ultraOptionSet1.CheckedItem.DataValue.ToString() },
  470. this.ob); //热处理类型
  471. if (dtHtt.Rows.Count > 0)
  472. {
  473. count =
  474. (Convert.ToDouble(urg.Cells["ProWt"].Text.ToString()) /
  475. Convert.ToDouble(urg.Cells["ProNum"].Text.ToString())).ToString("f6");
  476. }
  477. foreach (UltraGridRow row in this.ultraGrid2.Rows)
  478. {
  479. // row.Cells["PonderGrossWt"].Value = (Convert.ToDouble(count) * Convert.ToInt32(dtHtt.Rows[i]["COUNT"].ToString())).ToString("f3");
  480. row.Cells["ProWt"].Value =
  481. (Convert.ToDouble(count) * Convert.ToInt32(row.Cells["ProNum"].Text.ToString())).ToString("f3");
  482. row.Cells["CHK"].Value = "True";
  483. row.Update();
  484. }
  485. }
  486. }
  487. private void DoDecision()
  488. {
  489. this.ultraGrid2.UpdateData();
  490. UltraGridRow uRow = this.ultraGrid2.ActiveRow;
  491. UltraGridRow sRow = this.ultraGrid1.ActiveRow;
  492. if (uRow == null) return;
  493. if (sRow == null) return;
  494. string PlinCode = sRow.Cells["PlineCode"].Value.ToString();
  495. string judgeNo = sRow.Cells["JudgeStoveNo"].Value.ToString();
  496. string batchNo = uRow.Cells["BatchNo"].Value.ToString();
  497. IQueryable<UltraGridRow> checkMags = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  498. if (checkMags.Count() == 0)
  499. {
  500. MessageUtil.ShowTips("请选择需要送判的炉批信息!");
  501. return;
  502. }
  503. //UltraGridRow uug = this.ultraGrid2.ActiveRow;
  504. //if (uug != null)
  505. //{
  506. // foreach (UltraGridRow row in checkMags)
  507. // {
  508. // if(row.Cells["IsFlag"].Text == "是")
  509. // {
  510. // MessageUtil.ShowTips("前工序有紧急放行但未判定或判定不合格,不允许申请判定!");
  511. // return;
  512. // }
  513. // }
  514. //}
  515. //if (sRow.Cells["Target"].Text.Equals("A"))
  516. //{
  517. // if (double.Parse(sRow.Cells["PonderGrossWt"].Text.ToString3()) <= 0)
  518. // {
  519. // MessageUtil.ShowTips("A字头必须回报过磅重量!");
  520. // return;
  521. // }
  522. //}
  523. //if (PlinCode.Equals("C018"))
  524. //{
  525. // DataTable dtwt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpApplyNew.getQueryWt",
  526. // new object[] { sRow.Cells["JudgeStoveNo"].Value.ToString(), sRow.Cells["ActCount"].Value.ToString() },
  527. // this.ob);
  528. // if (dtwt.Rows.Count > 0)
  529. // {
  530. // if (dtwt.Rows[0]["PONDER_GROSS_WT"].Equals("0"))
  531. // {
  532. // MessageUtil.ShowTips("必须回报过磅重量!");
  533. // return;
  534. // }
  535. // }
  536. //}
  537. //else
  538. //{
  539. // if (sRow.Cells["Target"].Text.Equals("A"))
  540. // {
  541. // DataTable dtwt = ServerHelper.GetData("com.steering.mes.mcp.Vrp.FrmVrpApplyNew.getQueryWt",
  542. // new object[] { sRow.Cells["JudgeStoveNo"].Value.ToString(), sRow.Cells["ActCount"].Value.ToString() },
  543. // this.ob);
  544. // if (dtwt.Rows.Count > 0)
  545. // {
  546. // //if (dtwt.Rows[0]["PONDER_GROSS_WT"].Equals("0"))
  547. // //{
  548. // // MessageUtil.ShowTips("必须回报过磅重量!");
  549. // // return;
  550. // //}
  551. // }
  552. // }
  553. //}
  554. ArrayList parmList = new ArrayList();
  555. foreach (UltraGridRow row in checkMags)
  556. {
  557. CouplingMatMEntity1 matBcEntity = (CouplingMatMEntity1)row.ListObject;
  558. if (!matBcEntity.DeterNo.Equals(""))
  559. {
  560. MessageUtil.ShowTips("炉批已进行送判,不允许重复送判!");
  561. return;
  562. }
  563. string matEntity = JSONFormat.Format(matBcEntity);
  564. parmList.Add(matEntity);
  565. }
  566. CoreClientParam ccp = new CoreClientParam();
  567. ccp.ServerName = "com.steering.mes.mcp.coup.FrmCouplingAppl";
  568. ccp.MethodName = "doDecision";
  569. ccp.ServerParams = new object[] { parmList,UserInfo.GetUserName() };
  570. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  571. if (ccp.ReturnCode != -1)
  572. {
  573. if (ccp.ReturnInfo.Equals("申请判定成功!"))
  574. {
  575. QuerySinglePlan();
  576. MessageUtil.ShowTips("申请判定成功!");
  577. }
  578. else
  579. {
  580. MessageUtil.ShowTips(ccp.ReturnInfo);
  581. }
  582. }
  583. }
  584. /// <summary>
  585. /// ultraGrid2 触发事件
  586. /// </summary>
  587. /// <param name="sender"></param>
  588. /// <param name="e"></param>
  589. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  590. {
  591. UltraGridRow row = ultraGrid1.ActiveRow;
  592. if (row == null)
  593. {
  594. //List<CouplingComInfoEntity> listSource = new List<Entity.CouplingComInfoEntity>();
  595. //CouplingComInfoEntity.DataSource = listSource;
  596. //GridHelper.RefreshAndAutoSize(ultraGrid3);
  597. }
  598. else
  599. {
  600. //List<CouplingComInfoEntity> listSource = EntityHelper.GetData<CouplingComInfoEntity>
  601. // ("com.steering.mes.mcp.coup.FrmInLibrary.doQueryInfoResult", new object[] { row.Cells["ZY_PLAN_ID"].Text.ToString(), row.Cells["WO_ID"].Text.ToString() }, this.ob);
  602. //CouplingComInfoEntity.DataSource = listSource;
  603. //GridHelper.RefreshAndAutoSize(ultraGrid3);
  604. }
  605. }
  606. /// <summary>
  607. /// 删除交库实绩
  608. /// </summary>
  609. private void DoDelete()
  610. {
  611. //ultraGrid3.UpdateData();
  612. //UltraGridRow urg = ultraGrid3.ActiveRow;
  613. //if (urg == null) { MessageUtil.ShowTips("无交库信息!"); return; }
  614. //int addCount = 0;
  615. //ArrayList list = new ArrayList();
  616. //foreach (UltraGridRow uRow in ultraGrid3.Rows)
  617. //{
  618. // if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
  619. // {
  620. // addCount += 1;
  621. // ArrayList list1 = new ArrayList();
  622. // list1.Add(uRow.Cells["DEAL_ORDE"].Value.ToString());
  623. // list1.Add(uRow.Cells["WO_ID"].Value.ToString());
  624. // list1.Add(uRow.Cells["ZY_PLAN_ID"].Value.ToString());
  625. // list1.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
  626. // list1.Add(uRow.Cells["BATCH_NO"].Value.ToString());
  627. // list1.Add(this.UserInfo.GetUserName());
  628. // list1.Add(this.UserInfo.GetUserOrder());
  629. // list1.Add(this.UserInfo.GetUserGroup());
  630. // list1.Add(cutGx);
  631. // list1.Add(uRow.Cells["PIECES"].Value.ToString());
  632. // list1.Add(uRow.Cells["RESULT_NO"].Value.ToString());
  633. // list.Add(list1);
  634. // }
  635. //}
  636. //if (addCount == 0) { MessageUtil.ShowTips("请选择要删除的交库信息!"); return; }
  637. //if (MessageUtil.ShowYesNoAndQuestion("是否删除交库信息?") == DialogResult.No)
  638. //{
  639. // return;
  640. //}
  641. CoreClientParam ccp = new CoreClientParam();
  642. try
  643. {
  644. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  645. if (Constant.WaitingForm == null)
  646. {
  647. Constant.WaitingForm = new WaitingForm();
  648. }
  649. Constant.WaitingForm.ShowToUser = true;
  650. Constant.WaitingForm.Show();
  651. Constant.WaitingForm.Update();
  652. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInLibrary";
  653. ccp.MethodName = "deleteLibraryResult";
  654. // ccp.ServerParams = new object[] { list };
  655. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  656. this.Cursor = Cursors.Default;
  657. Constant.WaitingForm.ShowToUser = false;
  658. Constant.WaitingForm.Close();
  659. Constant.WaitingForm = null;
  660. }
  661. catch (Exception ex)
  662. {
  663. this.Cursor = Cursors.Default;
  664. Constant.WaitingForm.ShowToUser = false;
  665. Constant.WaitingForm.Close();
  666. Constant.WaitingForm = null;
  667. }
  668. if (ccp.ReturnCode == -1) return;
  669. MessageUtil.ShowTips(ccp.ReturnInfo);
  670. if (ccp.ReturnInfo.Equals("撤销交库成功!"))
  671. {
  672. QuerySinglePlan();
  673. }
  674. }
  675. /// <summary>
  676. /// 结炉
  677. /// </summary>
  678. private void DoBeside()
  679. {
  680. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  681. if (uRow == null)
  682. {
  683. MessageUtil.ShowTips("请选择需要结炉的工单号!");
  684. return;
  685. }
  686. string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  687. string woId = uRow.Cells["WO_ID"].Value.ToString();
  688. ArrayList list = new ArrayList();
  689. list.Add(zYgNo);
  690. list.Add(woId);
  691. list.Add(cutGx);
  692. if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
  693. {
  694. return;
  695. }
  696. CoreClientParam ccp = new CoreClientParam();
  697. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInLibrary";
  698. ccp.MethodName = "doBeside";
  699. ccp.ServerParams = new object[] { list };
  700. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  701. if (ccp.ReturnCode != -1)
  702. {
  703. MessageUtil.ShowTips(ccp.ReturnInfo);
  704. if (ccp.ReturnInfo.Equals("结炉成功!"))
  705. {
  706. QuerySinglePlan();
  707. }
  708. }
  709. }
  710. /// <summary>
  711. /// 撤销结炉
  712. /// </summary>
  713. private void UndoBeside()
  714. {
  715. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  716. if (uRow == null)
  717. {
  718. MessageUtil.ShowTips("请选择需要撤销结炉的工单号!");
  719. return;
  720. }
  721. string zYgNo = uRow.Cells["ZY_PLAN_ID"].Value.ToString();
  722. string woId = uRow.Cells["WO_ID"].Value.ToString();
  723. ArrayList list = new ArrayList();
  724. list.Add(zYgNo);
  725. list.Add(woId);
  726. list.Add(cutGx);
  727. if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
  728. {
  729. return;
  730. }
  731. CoreClientParam ccp = new CoreClientParam();
  732. ccp.ServerName = "com.steering.mes.mcp.coup.FrmInLibrary";
  733. ccp.MethodName = "undoBeside";
  734. ccp.ServerParams = new object[] { list };
  735. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  736. if (ccp.ReturnCode != -1)
  737. {
  738. MessageUtil.ShowTips(ccp.ReturnInfo);
  739. if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
  740. {
  741. QuerySinglePlan();
  742. }
  743. }
  744. }
  745. private void chkStarts_CheckedChanged(object sender, EventArgs e)
  746. {
  747. if (chkJuNo.Checked) { txtJudgeStoveNO.Enabled = true; } else { txtJudgeStoveNO.Enabled = false; }
  748. // if (chkPlnNo.Checked) { txtPlnNo.Enabled = true; } else { txtPlnNo.Enabled = false; }
  749. if (chkwoId.Checked) { txtWoId.Enabled = true; } else { txtWoId.Enabled = false; }
  750. }
  751. private void FrmInLibrary_Shown(object sender, EventArgs e)
  752. {
  753. if (toolMenu.Toolbars[0].Tools.Exists("DoQuery")) { toolMenu.Toolbars[0].Tools["DoQuery"].InstanceProps.Visible = DefaultableBoolean.True; }
  754. if (toolMenu.Toolbars[0].Tools.Exists("MatQuery")) { toolMenu.Toolbars[0].Tools["MatQuery"].InstanceProps.Visible = DefaultableBoolean.False; }
  755. if (toolMenu.Toolbars[0].Tools.Exists("DoSave")) { toolMenu.Toolbars[0].Tools["DoSave"].InstanceProps.Visible = DefaultableBoolean.True; }
  756. if (toolMenu.Toolbars[0].Tools.Exists("DoUpdate")) { toolMenu.Toolbars[0].Tools["DoUpdate"].InstanceProps.Visible = DefaultableBoolean.False; }
  757. if (toolMenu.Toolbars[0].Tools.Exists("DoDelete")) { toolMenu.Toolbars[0].Tools["DoDelete"].InstanceProps.Visible = DefaultableBoolean.True; }
  758. if (toolMenu.Toolbars[0].Tools.Exists("DoBeside")) { toolMenu.Toolbars[0].Tools["DoBeside"].InstanceProps.Visible = DefaultableBoolean.True; }
  759. if (toolMenu.Toolbars[0].Tools.Exists("UndoBeside")) { toolMenu.Toolbars[0].Tools["UndoBeside"].InstanceProps.Visible = DefaultableBoolean.True; }
  760. }
  761. private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
  762. {
  763. if (toolMenu == null) return;
  764. if (ultraTabControl1.SelectedTab.Index == 0)
  765. {
  766. chkTim2.Text = "入库日期";
  767. }
  768. else if (ultraTabControl1.SelectedTab.Index == 1)
  769. {
  770. chkTim2.Text = "送判日期";
  771. }
  772. }
  773. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  774. {
  775. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  776. if (uRow == null)
  777. {
  778. return;
  779. }
  780. doQueryJudgeBath(uRow.Cells["WoId"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["DeterNo"].Text);
  781. }
  782. /// <summary>
  783. /// 查询炉批信息
  784. /// </summary>
  785. private void doQueryJudgeBath(string woid, string judgeNo, string jugdeApplyCode)
  786. {
  787. UltraGridRow uRow = this.ultraGrid1.ActiveRow;
  788. if (uRow == null)
  789. {
  790. return;
  791. }
  792. List<CouplingMatMEntity1> listSource = EntityHelper.GetData<CouplingMatMEntity1>(
  793. "com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryJudgeBath", new object[] { woid, judgeNo, jugdeApplyCode, this.ultraOptionSet1.CheckedItem.DataValue.ToString() }, this.ob);
  794. CouplingMatMbindingSource1.DataSource = listSource;
  795. foreach (UltraGridRow row in this.ultraGrid2.Rows)
  796. {
  797. row.Cells["CHK"].Value = "True";
  798. row.Update();
  799. }
  800. List<Core.StlMes.Client.Mcp.Entity.QcmZgJugdeApplyEntity> listSource1 = EntityHelper.GetData<Core.StlMes.Client.Mcp.Entity.QcmZgJugdeApplyEntity>(
  801. "com.steering.mes.mcp.coup.FrmCouplingAppl.doQueryQcmZgApplyData", new object[] { uRow.Cells["JudgeStoveNo"].Text }, this.ob);
  802. if(listSource1.Count>0)
  803. {
  804. ultraGrid2.DisplayLayout.Bands[0].Columns["isFlag"].Header.Caption = "前工序是否紧急放行";
  805. foreach (UltraGridRow row in this.ultraGrid2.Rows)
  806. {
  807. row.Cells["isFlag"].Value = "是";
  808. }
  809. }
  810. else
  811. {
  812. ultraGrid2.DisplayLayout.Bands[0].Columns["isFlag"].Header.Caption = "前工序是否紧急放行";
  813. foreach (UltraGridRow row in this.ultraGrid2.Rows)
  814. {
  815. row.Cells["isFlag"].Value = "否";
  816. }
  817. }
  818. }
  819. private void ultraGrid3_ClickCellButton(object sender, CellEventArgs e)
  820. {
  821. this.ultraGrid3.UpdateData();
  822. if (e.Cell.Column.Key == "JugdeApplyCode")
  823. {
  824. string jugdeApplyCode = ultraGrid3.ActiveRow.Cells["JugdeApplyCode"].Value.ToString();
  825. string judgeStoveNo = ultraGrid3.ActiveRow.Cells["JudgeStoveNo"].Value.ToString();
  826. string ordenNo = ultraGrid3.ActiveRow.Cells["ProOrderNo"].Value.ToString();
  827. FrmQcmAddAsk orderZg = new FrmQcmAddAsk(jugdeApplyCode, judgeStoveNo, ordenNo, this.ob);
  828. orderZg.ShowDialog();
  829. }
  830. }
  831. private void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
  832. {
  833. this.ultraGrid1.UpdateData();
  834. IQueryable<UltraGridRow> checkMags = this.ultraGrid2.Rows.AsQueryable().Where(" CHK = 'True'");
  835. foreach (UltraGridRow row in checkMags)
  836. {
  837. CouplingMatMEntity1 matBcEntity = (CouplingMatMEntity1)row.ListObject;
  838. if (!matBcEntity.DeterNo.Equals(""))
  839. {
  840. MessageUtil.ShowTips("炉批已进行送判,不允许修改重量!");
  841. return;
  842. }
  843. }
  844. if (e.Cell.Column.Key == "ProWt")
  845. {
  846. string jugdeApplyCode = ultraGrid1.ActiveRow.Cells["CodeJg"].Value.ToString();
  847. string woId = ultraGrid1.ActiveRow.Cells["WoId"].Value.ToString();
  848. string piece = ultraGrid1.ActiveRow.Cells["ProNum"].Value.ToString();
  849. FrmQcmJgWt orderZg = new FrmQcmJgWt(jugdeApplyCode,woId, this.ob);
  850. orderZg.ShowDialog();
  851. ComMscJgEntity slmEntity = orderZg.SlmEntity;
  852. if (slmEntity==null)
  853. {
  854. return;
  855. }
  856. QuerySinglePlan();
  857. //e.Cell.Row.Cells["ProWt"].Value = Convert.ToDecimal((Convert.ToDouble(slmEntity.WeightJg)/1000) * int.Parse(piece));
  858. ultraGrid1_CellChange(null, null);
  859. }
  860. }
  861. }
  862. }