FrmJgProps.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Format;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
  5. using Core.StlMes.Client.PlnSaleOrd.工序排产;
  6. using Core.StlMes.Client.PlnSaleOrd.工序排产.entity;
  7. using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
  8. using CoreFS.CA06;
  9. using Infragistics.Win;
  10. using Infragistics.Win.UltraWinGrid;
  11. using System;
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.Linq;
  18. using System.Text;
  19. using System.Windows.Forms;
  20. namespace Core.StlMes.Client.PlnSaleOrd
  21. {
  22. public partial class FrmJgProps : FrmBase
  23. {
  24. /// <summary>
  25. /// 订单编号
  26. /// </summary>
  27. private string _ProPlanId = "";
  28. /// <summary>
  29. /// 排产序号
  30. /// </summary>
  31. private string _GxPlanNo = "";
  32. /// <summary>
  33. /// 产线
  34. /// </summary>
  35. private string _PlineCode = "";
  36. /// <summary>
  37. /// 颜色
  38. /// </summary>
  39. private Color _color = new Color();
  40. private ArrayList _EntityList = null;
  41. public FrmJgProps()
  42. {
  43. this.IsLoadUserView = true;
  44. InitializeComponent();
  45. }
  46. private void FrmJgProps_Load(object sender, EventArgs e)
  47. {
  48. if (CustomInfo == null) { CustomInfo = ""; }
  49. BaseHelper.setUltraGridColumnMaxInput(ultraGridJg, new string[] { "GroupBlWtS","GroupWtS" });
  50. BaseHelper.InitCellPosition(ultraGridJg, new string[] { "JgGroupId", "GxPlanNo", "PlanSeqNo", "MinD", "MinH", "AimlengthBl", "AimCutLen", "LengthMin",
  51. "LengthMax", "GroupNumS", "SingleCutNun", "GroupBlNumS", "GroupBlWtS", "MatchnumJg", "MatchwtBl","MatchnumBl","BatchedWt","BatchedNum" ,
  52. "BatchedNumOut","RealBatchedWt","RealBatchedNum","ProducedNum","GroupWtS"});
  53. if (CustomInfo == "0") { splitContainer1.Panel2Collapsed = true; } else { BaseHelper.ForbidSort(ultraGridJg); }
  54. BaseHelper.GridColumnCount(ultraGridJg, new string[] { "GroupNumS", "GroupBlNumS" });
  55. BaseHelper.InitCellPositionMiddle(ultraGridJg, new string[] { "IsRepairPln", "IfMonitorJg", "IsPlanOk", "IfStoveIssued" });
  56. PlanHelper.InitDropPline("H", "", comPline, this.ob);
  57. PlanHelper.InitEditPline("H", "", ultraGridJg, this);
  58. PlanHelper.InitRepairType(ultraGridJg, this);
  59. BaseHelper.setOtherColumnReadOnly(ultraGridJg, new string[] { "CHC", "PlanTimeB", "RepairType", "PlanUsetime", "PlineCode" });
  60. BaseHelper.setColumnBackColor(ultraGridJg, new string[] { "PlineCode" });
  61. BaseHelper.setUltraGridColumnColor(ultraGridJg, new string[] { "CraftFileNo" }, Color.GreenYellow);
  62. _color = ultraGridJg.DisplayLayout.Override.RowSelectorAppearance.BackColor;
  63. InitColumnStyle();
  64. InitTime();
  65. EntityHelper.ShowGridCaption<PlnZyJgReadyEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  66. BaseHelper.setOtherColumnReadOnly(ultraGrid1, new string[] { "CHC" });
  67. BaseHelper.setUltraGridColumnMaxInput(ultraGrid1, new string[] { "PlanBlWt", "Singleweight", "UseBlWt" });
  68. BaseHelper.setUltraGridColumnBits(ultraGrid1, new string[] { "SingleCutNun", "PlanBlNum", "PlanJgNum", "UseBlNum", "OutJgNum" });
  69. BaseHelper.InitCellPosition(ultraGrid1, new string[] { "GxProSeq", "GxPlanNo","PlanBlWt", "Diameter", "SingleCutNun","PlanBlNum","PlanJgNum","Aimlength","CheckJVal","Outdiameter","Wallthick",
  70. "LengthMax","LengthMin","AimCutLen","AimlengthBl","MinH","MinD","UseBlNum", "UseBlWt", "OutJgNum"});
  71. BaseHelper.GridColumnSum(ultraGrid1, new string[] { "UseBlWt" });
  72. BaseHelper.GridColumnCount(ultraGrid1, new string[] { "OutJgNum", "UseBlNum" });
  73. BaseHelper.SetGroupBySum(ultraGrid1, new string[] { "PlanBlWt", "PlanBlNum", "PlanJgNum" }, "HeatPlanNo");
  74. }
  75. public override void ToolBar_Click(object sender, string ToolbarKey)
  76. {
  77. base.ToolBar_Click(sender, ToolbarKey);
  78. switch (ToolbarKey)
  79. {
  80. case "Query"://查询
  81. Query();
  82. break;
  83. case "Capacity"://产线能力维护
  84. Capacity();
  85. break;
  86. case "AddRepairPlan"://检修计划
  87. AddRepairPlan();
  88. break;
  89. case "DeleteRepairPlan"://删除检修计划
  90. DeleteRepairPlan();
  91. break;
  92. case "PlineChange"://产线调整
  93. PlineChange();
  94. break;
  95. case "TimeChange"://时间调整
  96. TimeChange();
  97. break;
  98. case "StatusChange"://状态调整
  99. StatusChange();
  100. break;
  101. case "InitData"://耗时初始化
  102. InitData();
  103. break;
  104. case "Spit"://拆分订单
  105. Spit();
  106. break;
  107. case "Merge"://合并订单
  108. Merge();
  109. break;
  110. case "Issued"://确认
  111. Issued("0");
  112. break;
  113. case "CancelIssued"://取消确认
  114. Issued("1");
  115. break;
  116. case "Confirm"://炉计划下发
  117. Issued("2");
  118. break;
  119. case "UinConfirm"://取消炉计划下发
  120. Issued("3");
  121. break;
  122. case "Export": //导出
  123. GridHelper.ulGridToExcel(ultraGridJg, "接箍排产信息");
  124. break;
  125. case "Close": //关闭
  126. this.Close();
  127. break;
  128. case "SetPlanFinish"://设置合同完成
  129. SetPlanFinish();
  130. break;
  131. case "Notice":
  132. tabNotice();
  133. break;
  134. default:
  135. break;
  136. }
  137. }
  138. /// <summary>
  139. /// 标识监制信息
  140. /// </summary>
  141. private void tabNotice()
  142. {
  143. this.ultraGridJg.UpdateData();
  144. IQueryable<UltraGridRow> checkMagRows = this.ultraGridJg.Rows.AsQueryable().Where(" CHC = 'True'");
  145. if (checkMagRows.Count() == 0)
  146. {
  147. MessageUtil.ShowTips("请选择需要操作的监制信息!");
  148. return;
  149. }
  150. ArrayList parmList = new ArrayList();
  151. foreach (UltraGridRow row in checkMagRows)
  152. {
  153. PlnGxJgPropSEntity plnOrderZgsTity = (PlnGxJgPropSEntity)row.ListObject;
  154. string plnOrderZgsEntity = JSONFormat.Format(plnOrderZgsTity);
  155. parmList.Add(plnOrderZgsEntity);
  156. }
  157. CoreClientParam ccp = new CoreClientParam();
  158. ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
  159. ccp.MethodName = "tabNoticeH";
  160. ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName(), "H" };
  161. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  162. if (ccp.ReturnCode != -1)
  163. {
  164. if (ccp.ReturnInfo.Equals("标识监制成功!"))
  165. {
  166. Query();
  167. MessageUtil.ShowTips(ccp.ReturnInfo);
  168. }
  169. else
  170. {
  171. MessageUtil.ShowTips(ccp.ReturnInfo);
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// 设置完成
  177. /// </summary>
  178. private void SetPlanFinish()
  179. {
  180. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  181. bool flag = ProducHelper.SetPlanFinish(list, UserInfo.GetUserName(), "H", this.ob);
  182. if (flag)
  183. {
  184. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  185. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  186. Query();
  187. }
  188. }
  189. /// <summary>
  190. /// 查询
  191. /// </summary>
  192. void Query()
  193. {
  194. string plineCode = "";//产线
  195. if (chcPline.Checked && comPline.Value != null) { plineCode = comPline.Value.ToString(); }
  196. if (!CustomInfo.Equals("0") && comPline.Text.Equals(""))
  197. {
  198. MessageUtil.ShowWarning("请选择产线!", ultraGridJg);
  199. return;
  200. }
  201. WaitingForm2 wf3 = new WaitingForm2("正在刷新,请稍候....");
  202. try
  203. {
  204. this.Cursor = Cursors.WaitCursor;
  205. string[] statusArray = contorlPlanStatus1.statusArr;
  206. string jgCode = "";//接箍码
  207. if (chcJgCode.Checked) { jgCode = txtJgCode.Text.Trim(); }
  208. string proPlanId = ""; //订单编号
  209. if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
  210. string planTimeB1 = "";
  211. string planTimeB2 = "";
  212. if (chcPlanTimeB.Checked && txtPlanTimeB2.Value != null && txtPlanTimeB1.Value != null)
  213. {
  214. planTimeB1 = DateTime.Parse(txtPlanTimeB1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  215. planTimeB2 = DateTime.Parse(txtPlanTimeB2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  216. }
  217. string planTimeE1 = "";
  218. string planTimeE2 = "";
  219. if (chcPlanTimeE.Checked && txtPlanTimeE2.Value != null && txtPlanTimeE1.Value != null)
  220. {
  221. planTimeE1 = DateTime.Parse(txtPlanTimeE1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  222. planTimeE2 = DateTime.Parse(txtPlanTimeE2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
  223. }
  224. string orderSeq = "";
  225. if (chkOrder.Checked) { orderSeq = txtOrder.Text.ToString().Trim(); }
  226. List<PlnGxJgPropSEntity> listSource = EntityHelper.GetData<PlnGxJgPropSEntity>
  227. ("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryPlanOrderH",
  228. new object[] { plineCode, proPlanId, jgCode, statusArray, planTimeB1, planTimeB2, planTimeE1, planTimeE2, orderSeq }, this.ob);
  229. plnGxJgPropSEntityBindingSource.DataSource = listSource;
  230. if ((!_ProPlanId.Equals("") && !_GxPlanNo.Equals("")) || _EntityList != null)
  231. foreach (UltraGridRow ugr in ultraGridJg.Rows)
  232. {
  233. if (!_ProPlanId.Equals("") && !_GxPlanNo.Equals(""))
  234. {
  235. if (ugr.Cells["ProPlanId"].Text.Trim().Equals(_ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(_GxPlanNo))
  236. {
  237. ugr.Activate();
  238. break;
  239. }
  240. }
  241. if (_EntityList != null)
  242. {
  243. for (int i = 0; i < _EntityList.Count; i++)
  244. {
  245. PlnGxJgPropSEntity entity = (PlnGxJgPropSEntity)_EntityList[i];
  246. if (ugr.Cells["ProPlanId"].Text.Trim().Equals(entity.ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(entity.GxPlanNo))
  247. {
  248. ugr.Appearance.BackColor = Color.Wheat;
  249. ugr.Activate();
  250. }
  251. }
  252. }
  253. }
  254. foreach (UltraGridRow ugr in ultraGridJg.Rows)
  255. {
  256. if (ugr.Cells["IsNoticeEp"].Text.Equals("已通知"))
  257. {
  258. ugr.Cells["IsNoticeEp"].Appearance.BackColor = Color.GreenYellow;
  259. ugr.Activate();
  260. }
  261. }
  262. _ProPlanId = "";
  263. _GxPlanNo = "";
  264. _EntityList = null;
  265. if (comPline.Value != null)
  266. {
  267. _PlineCode = comPline.Value.ToString();
  268. }
  269. }
  270. finally
  271. {
  272. wf3.Close();
  273. this.Cursor = Cursors.Default;
  274. }
  275. }
  276. private void chcPline_CheckedChanged(object sender, EventArgs e)
  277. {
  278. if (chcPline.Checked) { comPline.ReadOnly = false; } else { comPline.ReadOnly = true; }
  279. if (chcProPlanId.Checked) { txtProPlanId.ReadOnly = false; } else { txtProPlanId.ReadOnly = true; }
  280. if (chcJgCode.Checked) { txtJgCode.ReadOnly = false; } else { txtJgCode.ReadOnly = true; }
  281. if (chcPlanTimeB.Checked) { txtPlanTimeB1.ReadOnly = false; txtPlanTimeB2.ReadOnly = false; } else { txtPlanTimeB1.ReadOnly = true; txtPlanTimeB2.ReadOnly = true; }
  282. if (chcPlanTimeE.Checked) { txtPlanTimeE1.ReadOnly = false; txtPlanTimeE2.ReadOnly = false; } else { txtPlanTimeE1.ReadOnly = true; txtPlanTimeE2.ReadOnly = true; }
  283. if (chkOrder.Checked) { txtOrder.ReadOnly = false; } else { txtOrder.ReadOnly = true; }
  284. }
  285. private void InitColumnStyle()
  286. {
  287. //ultraGridJg.DisplayLayout.Bands[0].Columns["Liku"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128);
  288. // ultraGridJg.DisplayLayout.Bands[0].Columns["StockNum"].CellAppearance.BackColor = Color.FromArgb(255, 255, 128);
  289. //ultraGridJg.DisplayLayout.Bands[0].Columns["Liku"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
  290. ultraGridJg.DisplayLayout.Bands[0].Columns["PlanTimeB"].Format = "yyyy-MM-dd HH:mm:ss";
  291. ultraGridJg.DisplayLayout.Bands[0].Columns["PlanTimeB"].MaskInput = "yyyy-mm-dd hh:mm:ss";
  292. ultraGridJg.DisplayLayout.Bands[0].Columns["PlanTimeB"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
  293. //ultraGridJg.DisplayLayout.Bands[0].Columns["CraftFileLv2G"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  294. ultraGridJg.DisplayLayout.Bands[0].Columns["CraftFileNo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
  295. }
  296. private void InitTime()
  297. {
  298. DateTime now = DateTime.Now;
  299. DateTime d1 = new DateTime(now.Year, now.Month, 1);
  300. DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
  301. txtPlanTimeB1.Value = d1;
  302. txtPlanTimeB2.Value = d2;
  303. txtPlanTimeE1.Value = d1;
  304. txtPlanTimeE2.Value = d2;
  305. }
  306. /// <summary>
  307. /// 拆分
  308. /// </summary>
  309. void Spit()
  310. {
  311. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  312. bool flag = ProducHelper.SpitPlanOrder(list, "H", this.ob);
  313. if (flag)
  314. {
  315. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  316. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  317. Query();
  318. }
  319. }
  320. /// <summary>
  321. /// 合并
  322. /// </summary>
  323. void Merge()
  324. {
  325. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  326. bool flag = ProducHelper.MergePlanOrder(list, "H", this.ob);
  327. if (flag)
  328. {
  329. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  330. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  331. Query();
  332. }
  333. }
  334. /// <summary>
  335. /// 时间调整
  336. /// </summary>
  337. void TimeChange()
  338. {
  339. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  340. bool flag = ProducHelper.TimeChange(list, "H", this.ob);
  341. if (flag)
  342. {
  343. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  344. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  345. Query();
  346. }
  347. }
  348. /// <summary>
  349. ///状态调整
  350. /// </summary>
  351. void StatusChange()
  352. {
  353. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  354. bool flag = ProducHelper.StatusChange(list, "H", this.ob);
  355. if (flag)
  356. {
  357. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  358. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  359. Query();
  360. }
  361. }
  362. /// <summary>
  363. /// 检修计划
  364. /// </summary>
  365. void AddRepairPlan()
  366. {
  367. if (comPline.Value == null || comPline.Value.ToString().Equals(""))
  368. {
  369. MessageUtil.ShowTips("请选择产线!");
  370. return;
  371. }
  372. FrmJxjh frmJxjh = new FrmJxjh(this.ob, comPline.Value.ToString(), "H");
  373. frmJxjh.ShowDialog();
  374. Query();
  375. }
  376. /// <summary>
  377. /// 初始化
  378. /// </summary>
  379. void InitData()
  380. {
  381. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  382. bool flag = ProducHelper.InitData(list, "H", this.ob);
  383. if (flag)
  384. {
  385. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  386. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  387. Query();
  388. }
  389. }
  390. /// <summary>
  391. /// 产线能力维护
  392. /// </summary>
  393. void Capacity()
  394. {
  395. UltraGridRow ugr = ultraGridJg.ActiveRow;
  396. if (ugr == null)
  397. {
  398. return;
  399. }
  400. if (ugr.Cells["IsRepairPln"].Text.Equals("Y"))
  401. {
  402. MessageUtil.ShowWarning("检修计划没有产线能力!",ultraGridJg);
  403. return;
  404. }
  405. FrmBaseMaterialHPl frmBaseMaterialEPl = new FrmBaseMaterialHPl(ugr.Cells["BlWlId"].Text, ugr.Cells["OutwlId"].Text, ugr.Cells["PlineCode"].Value.ToString(), this.ob, "");
  406. frmBaseMaterialEPl.ShowDialog();
  407. }
  408. private void ultraGridJg_InitializeRow(object sender, InitializeRowEventArgs e)
  409. {
  410. PlanHelper.ControlCellEdit(e.Row);
  411. }
  412. private void ultraGridJg_MouseDown(object sender, MouseEventArgs e)
  413. {
  414. //查询界面,不能排序
  415. if (CustomInfo.Equals("0"))
  416. { return; }
  417. try
  418. { ultraGridJg.UpdateData(); }
  419. catch (Exception)
  420. {
  421. MessageUtil.ShowWarning("数据异常,请刷新数据!"); return;
  422. }
  423. if (e.Button == MouseButtons.Right)
  424. {
  425. //移动行
  426. ArrayList entityList = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  427. if (entityList == null || entityList.Count == 0)
  428. {
  429. return;
  430. }
  431. //定位行
  432. UIElement myUIElement = ultraGridJg.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
  433. UltraGridCell myCell = (UltraGridCell)myUIElement.GetContext(typeof(UltraGridCell));
  434. if (myCell == null) { return; }
  435. UltraGridRow ugr = myCell.Row;
  436. if (ugr == null) { return; }
  437. PlnGxJgPropSEntity entityD = (PlnGxJgPropSEntity)ugr.ListObject;
  438. bool flag = ProducHelper.SortPlanOrder(entityList, entityD, "H", CustomInfo, this.ob);
  439. if (flag)
  440. {
  441. _EntityList = entityList;
  442. Query();
  443. }
  444. }
  445. }
  446. string proPlanId = "";
  447. string gxPlanNo ="";
  448. private void ultraGridJg_AfterRowActivate(object sender, EventArgs e)
  449. {
  450. UltraGridRow ugrAc = ultraGridJg.ActiveRow;
  451. if (ugrAc == null)
  452. {
  453. return;
  454. }
  455. foreach (UltraGridRow ugr in ultraGridJg.Rows)
  456. {
  457. if (ugr.Cells["ProPlanId"].Text.Equals(ugrAc.Cells["ProPlanId"].Text))
  458. {
  459. ugr.RowSelectorAppearance.BackColor = Color.LightGreen;
  460. }
  461. else
  462. {
  463. ugr.RowSelectorAppearance.BackColor = _color;
  464. }
  465. if (ugr.Cells["PlanUsetime"].Value == null || ugr.Cells["PlanUsetime"].Value.ToString().Equals("") || Convert.ToDouble(ugr.Cells["PlanUsetime"].Value.ToString()) <= 0)
  466. {
  467. ugr.Cells["PlanUsetime"].Appearance.BackColor = Color.MistyRose;
  468. }
  469. if (ugr.Cells["ExeStatus"].Value.ToString().Equals("生产中"))
  470. {
  471. ugr.Cells["PlanTimeB"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  472. }
  473. if (ugr.Cells["IsRepairPln"].Text.Equals("Y"))
  474. {
  475. ugr.Cells["PlanUsetime"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  476. ugr.Cells["RepairType"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
  477. }
  478. }
  479. proPlanId = ugrAc.Cells["ProPlanId"].Text;
  480. gxPlanNo = ugrAc.Cells["GxPlanNo"].Text;
  481. if (CustomInfo == "0") return;
  482. QueryZyReadyF(proPlanId, gxPlanNo);
  483. }
  484. /// <summary>
  485. /// 查询虚拟炉计划
  486. /// </summary>
  487. /// <param name="proPlanId"></param>
  488. /// <param name="gxPlanNo"></param>
  489. private void QueryZyReadyF(string proPlanId, string gxPlanNo)
  490. {
  491. List<PlnZyJgReadyEntity> listSource = EntityHelper.GetData<PlnZyJgReadyEntity>
  492. ("com.steering.pss.plnsaleord.planStove.FrmPlanStoveH.queryPlanStovePlanId", new object[] { proPlanId, gxPlanNo }, this.ob);
  493. plnZyJgReadyEntityBindingSource.DataSource = listSource;
  494. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  495. {
  496. //没有实际炉计划,主炉计划变颜色
  497. if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
  498. {
  499. //ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
  500. ugr.Appearance.BackColor = Color.Orange;
  501. }
  502. }
  503. }
  504. private void ultraGridJg_CellChange(object sender, CellEventArgs e)
  505. {
  506. try
  507. {
  508. ultraGridJg.UpdateData();
  509. if (e.Cell.Column.Key.Equals("PlineCode"))
  510. {
  511. IQueryable<UltraGridRow> chcRows = ultraGridJg.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
  512. if (CustomInfo.Equals("0"))
  513. {
  514. e.Cell.Row.Cells["PlineName"].Value = e.Cell.Text;
  515. }
  516. else
  517. {
  518. if (chcRows != null && chcRows.Count() > 0)
  519. {
  520. foreach (UltraGridRow ugr in chcRows)
  521. {
  522. ugr.Cells["PlineCode"].Value = e.Cell.Value.ToString();
  523. ugr.Cells["PlineName"].Value = e.Cell.Text;
  524. }
  525. }
  526. }
  527. }
  528. }
  529. catch (Exception)
  530. {
  531. }
  532. }
  533. /// <summary>
  534. /// 产线调整
  535. /// </summary>
  536. private void PlineChange()
  537. {
  538. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  539. bool flag = ProducHelper.PlineChange(list, "H", this.ob);
  540. if (flag)
  541. {
  542. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  543. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  544. Query();
  545. }
  546. }
  547. private void ultraGridJg_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  548. {
  549. foreach (UltraGridRow uRow in ultraGridJg.Selected.Rows)
  550. {
  551. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  552. {
  553. uRow.Cells["CHC"].Value = true;
  554. }
  555. }
  556. }
  557. /// <summary>
  558. /// 删除检修计划
  559. /// </summary>
  560. public void DeleteRepairPlan()
  561. {
  562. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  563. bool flag = ProducHelper.DeleteRepairPlan(list, "H", this.ob);
  564. if (flag)
  565. {
  566. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  567. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  568. Query();
  569. }
  570. }
  571. /// <summary>
  572. /// 确认(取消)
  573. /// </summary>
  574. private void Issued(string isFlag)
  575. {
  576. ArrayList list = ProducHelper.GetChcRows<PlnGxJgPropSEntity>(ultraGridJg);
  577. bool flag = ProducHelper.issuedPlanOrder(list, UserInfo.GetUserName(), isFlag, "H", this.ob);
  578. if (flag)
  579. {
  580. _ProPlanId = ((PlnGxJgPropSEntity)list[0]).ProPlanId;
  581. _GxPlanNo = ((PlnGxJgPropSEntity)list[0]).GxPlanNo;
  582. Query();
  583. }
  584. }
  585. private void ultraGridJg_ClickCellButton(object sender, CellEventArgs e)
  586. {
  587. UltraGridRow row = ultraGridJg.ActiveRow;
  588. if (e.Cell.Column.Key.Equals("CraftFileNo"))
  589. {
  590. string filePath = row.GetValue("CraftPath");
  591. dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, filePath);
  592. askDown.Show();
  593. }
  594. //else if (e.Cell.Column.Key.Equals("CraftFileLv2G"))
  595. //{
  596. // string craftFileLv2G = row.GetValue("CraftFileLv2G");
  597. // dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, craftFileLv2G);
  598. // askDown.Show();
  599. //}
  600. //else if (e.Cell.Column.Key.Equals("Liku"))
  601. //{
  602. // if (CustomInfo.Equals("2")) { return; }
  603. // string exeStatus = e.Cell.Row.Cells["ExeStatus"].Text.Trim();
  604. // if (!exeStatus.Equals("计划") && !exeStatus.Equals("生产中"))
  605. // {
  606. // MessageUtil.ShowWarning("不是计划、生产中订单,不能利库!");
  607. // return;
  608. // }
  609. // if (e.Cell.Row.Cells["IsRepairPln"].Text.Equals("Y"))
  610. // {
  611. // MessageUtil.ShowWarning("检修计划,不能利库!");
  612. // return;
  613. // }
  614. // string materialNo = e.Cell.Row.Cells["InwlId"].Text.Trim();//投入物料
  615. // string plineCode = e.Cell.Row.Cells["PlineCode"].Text.Trim();//产线
  616. // string proPlanId = e.Cell.Row.Cells["ProPlanId"].Text.Trim();//订单编号
  617. // string gxPlanNo = e.Cell.Row.Cells["GxPlanNo"].Text.Trim();//排产序号
  618. // Core.StlMes.Client.PlnSaleOrd.炉计划.FrmMaterialChoose frmMaterialChoose = new Core.StlMes.Client.PlnSaleOrd.炉计划.FrmMaterialChoose(materialNo, "E", proPlanId, gxPlanNo, UserInfo.GetUserName(), this.ob);
  619. // frmMaterialChoose.ShowDialog();
  620. // Query();
  621. //}
  622. }
  623. private int splitterDistance = 0;
  624. private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
  625. {
  626. if (ultraExpandableGroupBox1.Expanded == false)
  627. {
  628. this.splitContainer1.SplitterDistance = splitContainer1.Size.Height - 26;
  629. }
  630. else
  631. {
  632. this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
  633. }
  634. }
  635. #region 炉计划操作
  636. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  637. {
  638. switch (e.Tool.Key)
  639. {
  640. //case "Update"://修改判定炉号,备注
  641. // doUpdate();
  642. // break;
  643. //case "Issued"://下发
  644. // Issuedlu("0");
  645. // break;
  646. //case "IssuedU"://撤销
  647. // Issuedlu("1");
  648. // break;
  649. case "Delete"://删除炉计划
  650. doDelete();
  651. break;
  652. case "DeleteStatr"://删除剩余炉计划
  653. doDeleteStatr();
  654. break;
  655. //case "Print"://打印
  656. // doPrint();
  657. // break;
  658. default:
  659. break;
  660. }
  661. }
  662. /// <summary>
  663. /// 删除炉计划
  664. /// </summary>
  665. private void doDelete()
  666. {
  667. UltraGridRow row = ultraGrid1.ActiveRow;
  668. if (row == null) return;
  669. int countM = 0;
  670. int countC = 0;
  671. ArrayList list = new ArrayList();
  672. foreach (UltraGridRow item in ultraGrid1.Rows)
  673. {
  674. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  675. {
  676. countM++;
  677. ArrayList list1 = new ArrayList();
  678. if (!item.Cells["Planstatus"].Text.ToString().Equals("计划"))
  679. {
  680. MessageUtil.ShowTips("选中该炉计划不是计划状态,不能删除!");
  681. return;
  682. }
  683. list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
  684. list1.Add(item.Cells["HeatPlanSqe"].Text.ToString().Trim());
  685. list.Add(list1);
  686. }
  687. }
  688. if (countM == 0)
  689. {
  690. MessageUtil.ShowTips("请勾选炉计划信息!");
  691. return;
  692. }
  693. if (MessageUtil.ShowYesNoAndQuestion("是删除炉计划?") == DialogResult.No) return;
  694. PlanComm.WaitFromOpen(this.Cursor);
  695. CoreClientParam ccp = new CoreClientParam();
  696. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveH";
  697. ccp.MethodName = "doDeleteLu";
  698. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
  699. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  700. PlanComm.WaitFromColse(this.Cursor);
  701. if (ccp.ReturnCode == -1) ;
  702. MessageUtil.ShowTips(ccp.ReturnInfo);
  703. if (ccp.ReturnInfo.Equals("删除成功!"))
  704. {
  705. QueryZyReadyF(proPlanId, gxPlanNo);
  706. }
  707. }
  708. private void doDeleteStatr()
  709. {
  710. UltraGridRow row = ultraGrid1.ActiveRow;
  711. if (row == null) return;
  712. int countM = 0;
  713. int countC = 0;
  714. ArrayList list = new ArrayList();
  715. foreach (UltraGridRow item in ultraGrid1.Rows)
  716. {
  717. if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
  718. {
  719. countM++;
  720. ArrayList list1 = new ArrayList();
  721. if (item.Cells["Planstatus"].Text.ToString().Equals("计划"))
  722. {
  723. MessageUtil.ShowTips("选中该炉计划不是计划,不能删除!");
  724. return;
  725. }
  726. list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
  727. list1.Add(item.Cells["HeatPlanSqe"].Text.ToString().Trim());
  728. list.Add(list1);
  729. }
  730. }
  731. if (countM == 0)
  732. {
  733. MessageUtil.ShowTips("请勾选炉计划信息!");
  734. return;
  735. }
  736. if (MessageUtil.ShowYesNoAndQuestion("是删除剩余炉计划?") == DialogResult.No) return;
  737. PlanComm.WaitFromOpen(this.Cursor);
  738. CoreClientParam ccp = new CoreClientParam();
  739. ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveE";
  740. ccp.MethodName = "doDeleteStatr";
  741. ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), "H" };
  742. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  743. PlanComm.WaitFromColse(this.Cursor);
  744. if (ccp.ReturnCode == -1) ;
  745. MessageUtil.ShowTips(ccp.ReturnInfo);
  746. if (ccp.ReturnInfo.Equals("删除成功!"))
  747. {
  748. QueryZyReadyF(proPlanId, gxPlanNo);
  749. }
  750. }
  751. private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
  752. {
  753. foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
  754. {
  755. if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
  756. {
  757. uRow.Cells["CHC"].Value = true;
  758. }
  759. }
  760. }
  761. #endregion
  762. private void cmbPro_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  763. {
  764. this.ultraGridJg.UpdateData();
  765. UltraGridRow row = this.ultraGridJg.ActiveRow;
  766. if (row == null)
  767. {
  768. return;
  769. }
  770. FrmProInformation fp = new FrmProInformation(ob, row.Cells["PrdcrNo"].Text, "", "H");
  771. fp.ShowDialog();
  772. }
  773. }
  774. }