| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.工序排产.entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.PlnSaleOrd.工序排产
- {
- public class ProducHelper
- {
- /// <summary>
- /// 查询选择记录
- /// </summary>
- /// <returns>ArrayList</returns>
- public static ArrayList GetChcRows<T>(UltraGrid ug)
- {
- try { ug.UpdateData(); }
- catch (Exception) { return null; }
- IQueryable<UltraGridRow> chcRows = ug.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
- if (chcRows == null || chcRows.Count() == 0)
- {
- return null;
- }
- ArrayList list = new ArrayList();
- foreach (UltraGridRow ugr in chcRows)
- {
- T t = (T)ugr.ListObject;
- list.Add(t);
- }
- return list;
- }
- public static ProducEntity GenerationProEntity(object obj, string processCode)
- {
- ProducEntity proEntity = new ProducEntity();
- if (processCode.Equals("B"))
- {
- Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity.PlnOrderCastSEntity entity = (Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity.PlnOrderCastSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo.ToString();
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.PlanNumS - entity.PlanedNum - entity.PlanNumSold);
- proEntity.PlanWgt = Convert.ToString(entity.PlanWtS - entity.PlanedWt-entity.PlanWtSold);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.GxProSeq = entity.GxProSeq.ToString();
- proEntity.IfStoveIssued = "";
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = Convert.ToString(entity.PlanWtS - entity.PlanedWt - entity.PlanWtSold);
- proEntity.InNums = Convert.ToString(entity.PlanNumS - entity.PlanedNum - entity.PlanNumSold);
- proEntity.Castingtype = entity.Castingtype;
- proEntity.WeigthSMin = Convert.ToString(entity.PlanWtMin);
- if (entity.PlanedNum == 0)
- {
- proEntity.FurnDz = "0";
- }
- else
- {
- proEntity.FurnDz ="1";
- }
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("C"))
- {
- PlnOrderDzSEntity entity = (PlnOrderDzSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.NumS);
- proEntity.PlanWgt = Convert.ToString(entity.WeigthS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = entity.GxProSeq;
- proEntity.IfStoveIssued = "";
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = "0";
- proEntity.InNums = "0";
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("D"))
- {
- PlnOrderZgSEntity entity = (PlnOrderZgSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.NumS);
- proEntity.PlanWgt = Convert.ToString(entity.WeigthS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = Convert.ToString(entity.GxProSeq);
- proEntity.IfStoveIssued = entity.IfStoveIssued;
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = entity.InWeightS.ToString();
- proEntity.InNums = entity.InNumS.ToString();
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.GpreqNum = entity.GpreqNum.ToString();
- proEntity.GpreqWeight = entity.GpreqWeight.ToString();
- proEntity.WeigthSMin = entity.WeigthSMin.ToString();
- proEntity.PlansNum = int.Parse(entity.PlansNum.ToString());
- proEntity.OrderNo = entity.OrderNo;
- proEntity.Memo = entity.Memo;
- proEntity.ProgyMemo = entity.ProgyMemo;
- proEntity.FurnaNum = entity.FurnaNum.ToString();
- proEntity.FurnaWeight = entity.FurnaWeight.ToString();
- proEntity.CkNum = entity.CkNum.ToString();
- proEntity.CkWeight = entity.CkWeight.ToString();
- proEntity.LjNum = entity.LjNum.ToString();
- proEntity.LjWeight = entity.LjWeight.ToString();
- proEntity.MatchNumIn = entity.MatchNumIn.ToString();
- proEntity.MatchWtIn = entity.MatchWtIn.ToString();
- proEntity.ExpectWt=entity.ExpectWt.ToString();
- proEntity.ExpectNum = entity.ExpectNum.ToString();
- proEntity.ReducedWt = entity.ReducedWt.ToString();
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("E"))
- {
- PlnOrderDbkSEntity entity = (PlnOrderDbkSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.NumS);
- proEntity.PlanWgt = Convert.ToString(entity.WeigthS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = Convert.ToString(entity.GxProSeq);
- proEntity.IfStoveIssued = entity.IfStoveIssued;
- proEntity.InWeightS = entity.InWeightS.ToString();
- proEntity.InNums = entity.InNumS.ToString();
- proEntity.ProMonth = entity.ProMonth;
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.WeigthSMin = Convert.ToString(entity.MinWgt);
- proEntity.ExpectWt = entity.ExpectWt.ToString();
- proEntity.ExpectNum = entity.ExpectNum.ToString();
- proEntity.ReducedWt = entity.ExpectWt.ToString();
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("F"))
- {
- PlnOrderRclSEntity entity = (PlnOrderRclSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.NumS);
- proEntity.PlanWgt = Convert.ToString(entity.WeigthS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = Convert.ToString(entity.GxProSeq);
- proEntity.IfStoveIssued = entity.IfStoveIssued;
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = entity.InWeightS.ToString();
- proEntity.InNums = entity.InNumS.ToString();
- proEntity.WeigthSMin = entity.WeigthSMin.ToString();
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.ExpectWt = entity.ExpectWt.ToString();
- proEntity.ExpectNum = entity.ExpectNum.ToString();
- proEntity.ReducedWt = entity.ExpectWt.ToString();
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("G"))
- {
- PlnOrderJgxSEntity entity = (PlnOrderJgxSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.NumS);
- proEntity.PlanWgt = Convert.ToString(entity.WeigthS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = Convert.ToString(entity.GxProSeq);
- proEntity.IfStoveIssued = entity.IfStoveIssued;
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = entity.InWeightS.ToString();
- proEntity.InNums = entity.InNumS.ToString();
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.ExpectWt = entity.ExpectWtJ.ToString();
- proEntity.ExpectNum = entity.ExpectNumJ.ToString();
- proEntity.ReducedWt = entity.ExpectWtJ.ToString();
- proEntity.WeigthSMin = entity.InWeightS.ToString();
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- else if (processCode.Equals("H"))
- {
- PlnGxJgPropSEntity entity = (PlnGxJgPropSEntity)obj;
- entity.PlanTimeB = Convert.ToDateTime(entity.PlanTimeB).ToString("yyyy-MM-dd HH:mm:ss");
- proEntity.ProPlanId = entity.ProPlanId;
- proEntity.GxPlanNo = entity.GxPlanNo;
- proEntity.IsPlanOk = entity.IsPlanOk;
- proEntity.IsRepairPln = entity.IsRepairPln;
- proEntity.PlanNum = Convert.ToString(entity.GroupBlNumS);
- proEntity.PlanWgt = Convert.ToString(entity.GroupBlWtS);
- proEntity.ExeStatus = entity.ExeStatus;
- proEntity.GxProSeq = entity.GxProSeq;
- proEntity.IfStoveIssued = entity.IsStoveIssued;
- proEntity.ProMonth = entity.ProMonth;
- proEntity.InWeightS = entity.GroupBlWtS.ToString();
- proEntity.InNums = entity.GroupBlNumS.ToString();
- proEntity.ReducedWt = entity.GroupBlWtS.ToString();
- proEntity.WeigthSMin = entity.GroupBlWtS.ToString();
- proEntity.ExpectWt = entity.GroupBlWtS.ToString();
- proEntity.ExpectNum = entity.GroupBlNumS.ToString();
- proEntity.PlanUseTime = Convert.ToString(entity.PlanUsetime);
- proEntity.JsonStr = JSONFormat.Format(entity);
- }
- return proEntity;
- }
- /// <summary>
- /// 排产确认
- /// </summary>
- /// <param name="entityList">实体类集合</param>
- /// <param name="username">操作人</param>
- /// <param name="isFlag">下发标识</param>
- /// <param name="procesCode">工序</param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool issuedPlanOrder(ArrayList entityList, string username, string isFlag, string procesCode, OpeBase ob)
- {
- if (entityList == null || entityList.Count == 0)
- {
- MessageUtil.ShowWarning("请选择订单!");
- return false;
- }
- ArrayList jsonList = new ArrayList();
- foreach (object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, procesCode);
- if (!entity.IfStoveIssued.Equals("是") && isFlag.Equals("3"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划未下发!");
- return false;
- }
- if (entity.IfStoveIssued.Equals("是") && isFlag.Equals("2"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划已下发!");
- return false;
- }
- if (!entity.IsPlanOk.Equals("是") && isFlag.Equals("2"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 未确认!");
- return false;
- } if (!procesCode.Equals("B"))
- {
- if (entity.IsPlanOk.Equals("是") && isFlag.Equals("0"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")已经确认!");
- return false;
- }
- if (!entity.IsPlanOk.Equals("是") && isFlag.Equals("1"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")未确认!");
- return false;
- }
- }
- else
- {
- if (entity.IsPlanOk.Equals("是") && isFlag.Equals("0"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")已经下发!");
- return false;
- }
- if (!entity.IsPlanOk.Equals("是") && isFlag.Equals("1"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")未下发!");
- return false;
- }
- }
- jsonList.Add(entity.JsonStr);
- }
- if (procesCode.Equals("B"))
- {
- if (MessageUtil.ShowYesNoAndQuestion(isFlag.Equals("0") ? "是否下发?" : "是否取消下发?") == DialogResult.No)
- {
- return false;
- }
- }
- else {
- if (MessageUtil.ShowYesNoAndQuestion(isFlag.Equals("0") ? "是否确认?" : isFlag.Equals("1") ? "是否取消确认?" : isFlag.Equals("2") ? "是否炉计划下发?" : "是否取消炉计划下发?") == DialogResult.No)
- {
- return false;
- }
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.issued", new object[] { jsonList, isFlag, username, procesCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 订单拆分
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="procesCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool SpitPlanOrder(ArrayList entityList, string procesCode, OpeBase ob)
- {
- if (entityList == null)
- {
- MessageUtil.ShowWarning("请选择订单!");
- return false;
- }
- if (entityList.Count > 1)
- {
- MessageUtil.ShowWarning("不能一次性拆分多条订单!");
- return false;
- }
- ProducEntity entity = ProducHelper.GenerationProEntity(entityList[0], procesCode);
- if (entity.IsRepairPln.Equals("是"))
- {
- MessageUtil.ShowTips("检修计划不能拆分!");
- return false;
- }
- //if (entity.IsPlanOk.Equals("是"))
- //{
- // MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 已确认!");
- // return false;
- //}
- //if (entity.IfStoveIssued.Equals("是"))
- //{
- // MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
- // return false;
- //}
- if (!entity.ExeStatus.Equals("计划") && !entity.ExeStatus.Equals("生产中"))
- {
- MessageUtil.ShowTips("不是计划/生产中状态,不能拆分!");
- return false;
- }
- string wgt = "";
- string num = "";
- int numF = 0;
- if (procesCode.Equals("D"))
- {
- wgt = entity.GpreqWeight;
- num = entity.GpreqNum;
- //if (entity.LjNum.Equals("0"))
- //{
- numF = int.Parse(entity.LjNum);
- //}
- //if (entity.FurnaNum != null && !entity.FurnaNum.Equals(""))
- //{
- // numF += int.Parse(entity.FurnaNum);
- //}
- //if (entity.CkNum != null && !entity.CkNum.Equals(""))
- //{
- // numF += int.Parse(entity.CkNum);
- //}
- //if (entity.LjNum != null && !entity.LjNum.Equals(""))
- //{
- // numF += int.Parse(entity.LjNum);
- //}
- }
- else if (procesCode.Equals("B") || procesCode.Equals("C"))
- {
- wgt = entity.PlanWgt;
- num = entity.PlanNum;
- }
- else
- {
- wgt = entity.InWeightS;
- num = entity.InNums;
- }
- if (wgt == "")
- {
- wgt = "0";
- }
- if (num == "")
- {
- wgt = "0";
- }
- string[] param = null;
- if (!procesCode.Equals("D"))
- {
- if (procesCode.Equals("B"))
- {
- //重量与支数验证
- if (double.Parse(wgt) <= 0)//|| int.Parse(num) <= 1
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")重量为0吨,支数小于或者等于1支!");
- return false;
- }
- //重量与支数比例
- double ratio = double.Parse(wgt) / int.Parse(num);
- FrmSpitWgt frmSpitWgt = new FrmSpitWgt(double.Parse(wgt), int.Parse(num), ratio, procesCode, numF, entity.Castingtype, entity.FurnDz);
- frmSpitWgt.ShowDialog();
- double spitWgt = frmSpitWgt.AlreadySpitWgt;
- int spitNum = frmSpitWgt.AlreadySpitNum;
- int countNum = frmSpitWgt.CountNum;
- if (spitWgt <= 0) { return false; }
-
- param = PlanHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.ControlOrderPlan.spitPlanOrder", new object[] { entity.JsonStr, spitWgt.ToString(), spitNum.ToString(), procesCode, countNum.ToString() }, ob);
- }
- else
- {
- double ratio = double.Parse(wgt) / int.Parse(num);
- FrmSpitWgtZg frmSpitWgtzg = new FrmSpitWgtZg(double.Parse(wgt), int.Parse(num), ratio, procesCode, numF, entity, ob);
- frmSpitWgtzg.ShowDialog();
- double spitWgt = frmSpitWgtzg.AlreadySpitWgt;
- int spitNum = frmSpitWgtzg.AlreadySpitNum;
- string heatPlanNo = frmSpitWgtzg.HeatPlanNo;
- if (spitWgt <= 0) { return false; }
- if (heatPlanNo.Equals("") && int.Parse(entity.InNums) - spitNum < numF)
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")分配剩余需坯支数不能小于利库或计划支数!");
- return false;
- }
- param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.spitPlanOrderM", new object[] { entity.JsonStr, spitWgt.ToString(), spitNum.ToString(), heatPlanNo, procesCode }, ob);
- //param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.spitPlanOrder", new object[] { entity.JsonStr, spitWgt.ToString(), spitNum.ToString(), procesCode }, ob);
- }
- }
- else
- {
- double ratio = double.Parse(wgt) / int.Parse(num);
- FrmSpitWgtZg frmSpitWgtzg = new FrmSpitWgtZg(double.Parse(wgt), int.Parse(num), ratio, "D", numF,entity, ob);
- frmSpitWgtzg.ShowDialog();
- double spitWgt = frmSpitWgtzg.AlreadySpitWgt;
- int spitNum = frmSpitWgtzg.AlreadySpitNum;
- string heatPlanNo = frmSpitWgtzg.HeatPlanNo;
- if (spitWgt <= 0) { return false; }
- if (heatPlanNo.Equals("")&&int.Parse(entity.GpreqNum) - spitNum < numF)
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ")分配剩余需坯支数不能小于利库或LJ支数!");
- return false;
- }
- param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.spitPlanOrderZg", new object[] { entity.JsonStr, spitWgt.ToString(), spitNum.ToString(), heatPlanNo }, ob);
- }
-
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 合并订单
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="procesCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool MergePlanOrder(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null || entityList.Count == 1)
- {
- MessageUtil.ShowWarning("请选择多条订单!");
- return false;
- }
-
- ArrayList jsonList = new ArrayList();
- string proPlanId = "";
- foreach (object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
- if (entity.IsRepairPln.Equals("是")||entity.IsRepairPln.Equals("Y"))
- {
- MessageUtil.ShowTips("检修计划不能合并!");
- return false;
- }
- if (!entity.ExeStatus.Equals("计划") && !entity.ExeStatus.Equals("生产中"))
- {
- MessageUtil.ShowTips("不是计划/生产中状态!");
- return false;
- }
- if (proPlanId.Equals("")) { proPlanId = entity.ProPlanId; }
-
- if (!entity.ProPlanId.Equals(proPlanId))
- {
- MessageUtil.ShowTips("相同订单编号才能合并!");
- return false;
- }
- if (entity.IfStoveIssued.Equals("是"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
- return false;
- }
- //if (entity.IsPlanOk.Equals("是"))
- //{
- // MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 已确认!");
- // return false;
- //}
- if (processCode.Equals("B"))
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.ControlFurNacePlan.getFurnacePlnOrderProPlanId", new object[] { entity.ProPlanId, entity.GxPlanNo }, ob);
- if (dt.Rows.Count > 0)
- {
- MessageUtil.ShowTips("铸造订单(" + entity.ProPlanId + "/" + entity.GxPlanNo + ")已组浇,浇次为:" + dt.Rows[0]["CAST_NO"].ToString() + ",炉次为:" + dt.Rows[0]["FURNACENO"].ToString() + ",不能合并");
- return false;
- }
- }
- jsonList.Add(entity.JsonStr);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否合并?") == DialogResult.No)
- {
- return false;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.mergePlanOrder", new object[] { jsonList, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 排序
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="obj"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool SortPlanOrder(ArrayList entityList, object obj, string processCode,string customInfo, OpeBase ob)
- { //定位行计划
- ProducEntity entityD = ProducHelper.GenerationProEntity(obj,processCode);
- if (!entityD.ExeStatus.Equals("计划")) { return false; }
- if (processCode.Equals("E"))
- {
- if (customInfo.Equals("1") && entityD.IfStoveIssued.Equals("1")) { return false; }
- }
- //定位行序号
- string gxProSeqD = entityD.GxProSeq.ToString();
- //移动行序号集合
- ArrayList seqList = new ArrayList();
- ArrayList list = new ArrayList();
- //获取数据库服务器当前时间
- string time = DateTime.Now.ToString("yyyy-MM");
- DataTable dt= ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.selectSystemTime",null, ob);
- DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
- dtFormat.ShortDatePattern = "yyyy-MM-dd HH:mm:ss";
- if (dt.Rows.Count > 0)
- {
- DateTime ds1 = Convert.ToDateTime(dt.Rows[0]["DATIME"].ToString());
- //DateTime ds1 = Convert.ToDateTime("2021-03-26 00:00:00", dtFormat);
- DateTime ds2 = Convert.ToDateTime(dt.Rows[0]["DATIME"].ToString().Substring(0, 7) + "-25 21:00:00");
- //time = dt.Rows[0]["DATIME"].ToString().Substring(0,7);
- if ((ds1.CompareTo(ds2)) > 0)
- {
- time = ds1.AddMonths(1).ToString("yyyy-MM-dd HH:mm:ss").Substring(0,7);
- }
- else
- {
- time = dt.Rows[0]["DATIME"].ToString().Substring(0, 7);
- }
- }
- foreach (object entityM in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(entityM, processCode);
- //调整行只能为计划中的
- if (!entity.ExeStatus.Equals("计划")) { return false ; }
- if (processCode.Equals("E"))
- {
- if (customInfo.Equals("1") && entity.IfStoveIssued.Equals("1")) { return false; }
- }
- if (processCode.Equals("D"))
- {
- if (DateTime.Compare(Convert.ToDateTime(entity.ProMonth), Convert.ToDateTime(time)) <= 0)
- {
- if (DateTime.Compare(Convert.ToDateTime(time), Convert.ToDateTime(entityD.ProMonth)) < 0)
- {
- MessageUtil.ShowTips("所选合同:" + entity.OrderNo + ",生产年月小于等于当前日历年月,不能调整至当前日历年月之后 。");
- return false;
- }
- }
- else
- {
- if (DateTime.Compare(Convert.ToDateTime(entityD.ProMonth), Convert.ToDateTime(entity.ProMonth)) < 0)
- {
- MessageUtil.ShowTips("所选合同:" + entity.OrderNo + ",生产年月大于当前日历年月, 。");
- return false;
- }
- }
- }
- seqList.Add(Convert.ToInt32(entity.GxProSeq));
- list.Add(entity.JsonStr);
- }
- seqList.Sort();
- //如果鼠标坐标行在调整行的中间,则不允许调整
- if (Convert.ToInt32(gxProSeqD) >= (int)seqList[0] && Convert.ToInt32(gxProSeqD) <= (int)seqList[seqList.Count - 1])
- {
- return false ;
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否调整生产顺序至:" + entityD.GxProSeq + "位?") == DialogResult.No)
- {
- return false ;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.sortPlanOrder", new object[] { list, entityD.JsonStr, processCode, customInfo }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 状态调整
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool StatusChange(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null || entityList.Count!=1)
- {
- MessageUtil.ShowWarning("请选择一条订单!");
- return false;
- }
- ProducEntity entity = ProducHelper.GenerationProEntity(entityList[0], processCode);
- if (MessageUtil.ShowYesNoAndQuestion("是否状态调整?") == DialogResult.No)
- {
- return false;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.statusChange", new object[] { entity.JsonStr, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 时间调整
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool TimeChange(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null || entityList.Count != 1)
- {
- MessageUtil.ShowWarning("请选择一条订单!");
- return false;
- }
- ProducEntity entity = ProducHelper.GenerationProEntity(entityList[0], processCode);
- if (!entity.ExeStatus.Equals("生产中"))
- {
- MessageUtil.ShowWarning("只有生产中的订单才能调整时间!");
- return false;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否时间调整?") == DialogResult.No)
- {
- return false;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.TimeChange", new object[] { entity.JsonStr, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 初始化数据
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool InitData(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null )
- {
- MessageUtil.ShowWarning("请选择订单!");
- return false;
- }
- ArrayList jsonlist = new ArrayList();
- foreach (Object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
- //if (entity.IfStoveIssued.Equals("是"))
- //{
- // MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
- // return false;
- //}
- if (entity.PlanUseTime == null || entity.PlanUseTime.Equals(""))
- {
- MessageUtil.ShowWarning("计划耗时不能为空!");
- return false ;
- }
- jsonlist.Add(entity.JsonStr);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否初始化数据?") == DialogResult.No)
- {
- return false ;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.initData", new object[] { jsonlist, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 产线调整
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool PlineChange(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null)
- {
- MessageUtil.ShowWarning("请选择订单!");
- return false;
- }
- ArrayList jsonlist = new ArrayList();
- foreach (object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
- //if (entity.IfStoveIssued.Equals("是"))
- //{
- // MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
- // return false;
- //}
- if (entity.IsRepairPln.Equals("是"))
- {
- MessageUtil.ShowTips("检修计划不能产线调整!");
- return false ;
- }
- if (!entity.ExeStatus.Equals("计划"))
- {
- MessageUtil.ShowTips("不是计划状态,不能产线调整!");
- return false ;
- }
- jsonlist.Add(entity.JsonStr);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否产线调整?") == DialogResult.No)
- {
- return false ;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.plineChange", new object[] { jsonlist, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 删除检修
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool DeleteRepairPlan(ArrayList entityList, string processCode, OpeBase ob)
- {
- if (entityList == null)
- {
- MessageUtil.ShowWarning("请选择检修订单!");
- return false;
- }
- ArrayList jsonlist = new ArrayList();
- foreach (Object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
- if (entity.IfStoveIssued.Equals("是"))
- {
- MessageUtil.ShowWarning("订单编号(" + entity.ProPlanId + ") 炉计划下发!");
- return false;
- }
- if (!entity.IsRepairPln.Equals("是"))
- {
- MessageUtil.ShowWarning("不是检修计划,不能删除!");
- return false ;
- }
- if (!entity.ExeStatus.Equals("计划"))
- {
- MessageUtil.ShowWarning("检修计划不是计划状态,不能删除!");
- return false ;
- }
- jsonlist.Add(entity.JsonStr);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否删除检修计划?") == DialogResult.No)
- {
- return false ;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.deleteRepairPlan", new object[] { jsonlist, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 设置完成
- /// </summary>
- /// <param name="entityList"></param>
- /// <param name="processCode"></param>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static bool SetPlanFinish(ArrayList entityList,string username, string processCode, OpeBase ob)
- {
- if (entityList == null)
- {
- MessageUtil.ShowWarning("请选择订单!");
- return false;
- }
- ArrayList jsonlist = new ArrayList();
- foreach (Object obj in entityList)
- {
- ProducEntity entity = ProducHelper.GenerationProEntity(obj, processCode);
- if (entity.IsRepairPln.Equals("是"))
- {
- MessageUtil.ShowWarning("检修计划订单,不能设置完成!");
- return false;
- }
- //if (entity.GxProSeq.Equals("0"))
- //{
- // MessageUtil.ShowWarning("订单已经设置完成!");
- // return false;
- //}
- jsonlist.Add(entity.JsonStr);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否设置完成(此操作数据暂不可恢复)?") == DialogResult.No)
- {
- return false;
- }
- string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.setPlanFinish", new object[] { jsonlist, username, processCode }, ob);
- if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); return false; }
- else
- {
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { return true; } else { return false; }
- }
- }
- /// <summary>
- /// 查询炼轧数据
- /// </summary>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static DataTable QueryLZData( OpeBase ob)
- {
- return ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryLZData", new object[] { }, ob);
- }
- /// <summary>
- /// 查询轧管炼轧数据
- /// </summary>
- /// <param name="ob"></param>
- /// <returns></returns>
- public static DataTable QueryLZDataZg(OpeBase ob)
- {
- return ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryLZDataZg", new object[] { }, ob);
- }
- /// <summary>
- /// 赋值炼轧数据
- /// </summary>
- /// <param name="ug"></param>
- /// <param name="ob"></param>
- public static void copyLZData(UltraGrid ug,string flag, OpeBase ob)
- {
- if (ug.Rows.Count == 0) { return; }
- DataTable dt = ProducHelper.QueryLZData(ob);
- if (dt == null || dt.Rows.Count == 0){ return;}
-
- foreach(UltraGridRow ugr in ug.Rows){
- string key = ugr.Cells["OrdLnDlyPk"].Text + "-" + ugr.Cells["PlnDivideId"].Text;
- DataRow[] drs = dt.Select("PK ='" + key+"'");
- if (drs != null && drs.Length> 0)
- {
- ugr.Cells["FinishWgt"].Value = drs[0]["FINISH_WGT"].ToString();
- ugr.Cells["UnfinishWgt"].Value = drs[0]["UNFINISH_WGT"].ToString();
- ugr.Cells["UnfinishTime"].Value = drs[0]["UNFINISH_TIME"].ToString();
- ugr.Cells["UnfinishNum"].Value = drs[0]["UNFINISH_NUM"].ToString();
- if (flag.Equals("D") && !ugr.Cells["AfPlanTimeB"].Text.Equals("") && !drs[0]["UNFINISH_TIME"].ToString().Equals(""))
- {
- DateTime t1 = DateTime.Parse(ugr.Cells["AfPlanTimeB"].Text);
- DateTime t2 = DateTime.Parse(drs[0]["UNFINISH_TIME"].ToString());
- ugr.Cells["DifTime"].Value = String.Format("{0:N0} ", (t1 - t2).TotalDays);
- }
- }
- }
- }
- /// <summary>
- /// 赋值轧管炼轧数据
- /// </summary>
- /// <param name="ug"></param>
- /// <param name="ob"></param>
- public static void copyLZDataZg(UltraGrid ug, string flag, OpeBase ob)
- {
- if (ug.Rows.Count == 0) { return; }
- DataTable dt = ProducHelper.QueryLZDataZg(ob);
- if (dt == null || dt.Rows.Count == 0) { return; }
- foreach (UltraGridRow ugr in ug.Rows)
- {
- string key = ugr.Cells["proPlanId"].Text + "-" + ugr.Cells["gxPlanNo"].Text;
- DataRow[] drs = dt.Select("订单号 ='" + ugr.Cells["proPlanId"].Text + "' AND 序号='" + ugr.Cells["gxPlanNo"].Text + "'");
- if (drs != null && drs.Length > 0)
- {
- if (!drs[0]["LJ支"].ToString().Equals(""))
- {
- ugr.Cells["LjNum"].Value = drs[0]["LJ支"].ToString();
- ugr.Cells["LjWeight"].Value = drs[0]["LJ吨"].ToString();
- }
- if (!drs[0]["装炉支"].ToString().Equals(""))
- {
- ugr.Cells["FurnaNum"].Value = drs[0]["装炉支"].ToString();
- ugr.Cells["FurnaWeight"].Value = drs[0]["装炉吨"].ToString();
- }
- if (!drs[0]["出库支"].ToString().Equals(""))
- {
- ugr.Cells["CkNum"].Value = drs[0]["出库支"].ToString();
- ugr.Cells["CkWeight"].Value = drs[0]["出库吨"].ToString();
- }
- //ugr.Cells["LjNum"].Value = drs[0]["LJ支"].ToString();
- //ugr.Cells["LjWeight"].Value = drs[0]["LJ吨"].ToString();
- //ugr.Cells["FurnaNum"].Value = drs[0]["装炉支"].ToString();
- //ugr.Cells["FurnaWeight"].Value = drs[0]["装炉吨"].ToString();
- //ugr.Cells["CkNum"].Value = drs[0]["出库支"].ToString();
- //ugr.Cells["CkWeight"].Value = drs[0]["出库吨"].ToString();
- //if (flag.Equals("D") && !ugr.Cells["AfPlanTimeB"].Text.Equals("") && !drs[0]["UNFINISH_TIME"].ToString().Equals(""))
- //{
- // DateTime t1 = DateTime.Parse(ugr.Cells["AfPlanTimeB"].Text);
- // DateTime t2 = DateTime.Parse(drs[0]["UNFINISH_TIME"].ToString());
- // ugr.Cells["DifTime"].Value = String.Format("{0:N0} ", (t1 - t2).TotalDays);
- //}
- }
- }
- }
- }
- }
|