| | |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | | try |
| | | { |
| | | if (input.Qty.ToInt32() <= 0) |
| | | { |
| | | action.Data.ShortMsg = new("请输入包装数量", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.Data.Data = "QtyError"; |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = new($"包装数量[{input.Qty}]不正确,请重新输入数量后继续包装操作"); |
| | | //action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.QtyError", input.Qty); |
| | | return action; |
| | | } |
| | | //PkgSubmit:手动结束包装,手动保存暂存的包装数据 |
| | | if (NodeCmd == "PkgSubmit") |
| | | { |
| | |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.OnlyMinPackage", input.SN); |
| | | return action; |
| | | } |
| | | if (Context.ContainsKey("CurPackage") && !Context["CurPackage"].IsNullOrEmpty() && (Context["CurPackage"] as WipPkg).WorkBatch != curSNs.First().Batch.BATCH_NO) |
| | | var curPkg = Context.ContainsKey("CurPackage") ? Context["CurPackage"] as WipPkg : null; |
| | | if (!curPkg.IsNullOrEmpty() && !curPkg.IsFinished && curPkg.WorkBatch != curSNs.First().Batch.BATCH_NO) |
| | | { |
| | | action.Data.ShortMsg = new("工单批次错误", ShortMessage.Types.Error); |
| | | action.Data.OperInfo = new(); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"正在包装工单批次[{0}]的产品,请先完成当前包装后再扫描其他批次[{1}]的产品[{2}]"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.BatchError", (Context["CurPackage"] as WipPkg).WorkBatch, curSNs.First().Batch.BATCH_NO, input.SN); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.Submit.BatchError", curPkg.WorkBatch, curSNs.First().Batch.BATCH_NO, input.SN); |
| | | return action; |
| | | } |
| | | if (curSNs.First().Batch.ACT_LINE != CurLine.LINE_CODE) |
| | |
| | | HOLD_FLAG = "N", |
| | | REWORK_FLAG = CurBatch.WO.ORDER_TYPE == BIZ_MES_WO.ORDER_TYPEs.Rework.GetValue() ? "Y" : "N", |
| | | FINISHED_FLAG = "N", |
| | | UNBIND_FLAG = "N", |
| | | INV_FLAG = "N", |
| | | DFT_FLAG = "N", |
| | | DFT_COUNT = 0, |
| | |
| | | CurWipSNHiss.Clear(); |
| | | foreach (var wipSN in wipSNs) |
| | | { |
| | | var his = new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功"); |
| | | var his = new MES_WIP_HIS(wipSN, $"工单[{wipSN.WORK_ORDER}]条码[{wipSN.SN}]在岗位[{wipSN.POST_CODE}]过站工序[{wipSN.NODE_NAME}]成功(TransId:{TransID})"); |
| | | wipSN.History.Add(his); |
| | | CurWipSNHiss.Add(his); |
| | | } |
| | |
| | | db.Storageable(_wipHiss, UserCode).ExecuteCommand(); |
| | | if (_pkgList.Any()) |
| | | { |
| | | foreach (var pkg in _pkgList.Where(q => !q.WIP_ID.IsNullOrEmpty())) |
| | | { |
| | | //包装信息保存到生产过程记录 |
| | | db.Updateable<MES_WIP_HIS>() |
| | | .SetColumns(q => q.TRAY_SN == curPkg.Item.Package.SN) |
| | | .SetColumns(q => q.INNER_SN == q.CARTON_SN) |
| | | .SetColumns(q => q.CARTON_SN == curPkg.Item.Package.SN) |
| | | .Where(q => q.WORK_ORDER == pkg.WORK_ORDER && q.WIP_ID == pkg.WIP_ID && q.OPER_CODE == "EndNode") |
| | | .ExecuteCommand(); |
| | | } |
| | | var wipIDs = _pkgList.Where(q => !q.WIP_ID.IsNullOrEmpty()).Select(q => q.WIP_ID).ToList(); |
| | | var wo = _pkgList.First().WORK_ORDER; |
| | | //包装信息保存到生产过程记录 |
| | | db.Updateable<MES_WIP_HIS>(UserCode) |
| | | .SetColumns(q => q.TRAY_SN == curPkg.Item.Package.SN) |
| | | .SetColumns(q => q.INNER_SN == q.CARTON_SN) |
| | | .SetColumns(q => q.CARTON_SN == curPkg.Item.Package.SN) |
| | | .Where(q => q.WORK_ORDER == wo && q.OPER_CODE == "EndNode" && wipIDs.Contains(q.WIP_ID)) |
| | | .ExecuteCommand(); |
| | | } |
| | | }; |
| | | } |
| | |
| | | try |
| | | { |
| | | //PkgSubmit:手动结束包装,保存暂存的包装数据 |
| | | if (NodeCmd.IsNullOrEmpty("PkgSubmit") == "PkgSubmit" || CurWipSNs.IsNullOrEmpty()) |
| | | if (NodeCmd.IsNullOrEmpty() && CurWipSNs.IsNullOrEmpty()) |
| | | { |
| | | if (Context.ContainsKey("CurPackage")) |
| | | var CurPkg = Context.ContainsKey("CurPackage") ? Context["CurPackage"] as WipPkg : null; |
| | | if (CurPkg?.IsFinished == false) |
| | | { |
| | | TempPkgAction = new PackingAction(); |
| | | TempPkgAction.Init(this); |
| | | |
| | | var CurPkg = Context["CurPackage"] as WipPkg; |
| | | int shipQty = input.Data.ToInt32(); |
| | | int curQty = CurPkg.Item.TotalQty; |
| | | int ruleQty = TempPkgAction.PkgRule.GetTotalQty(); |
| | | //有填出货数量则验证当前包装数量必须等于(出货数量/包装规则数量)的余数 |
| | | if (shipQty > 0 && curQty != shipQty % ruleQty) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"出货数量设定为[{0}],目前包装了[{1}],包装尾数的数量必需是[{2}],请装够数量后再结束包装"); |
| | | action.LocaleMsg = new("MES.Transaction.PackingNode.NotMatchShipQty", shipQty, curQty, shipQty % ruleQty); |
| | | return action; |
| | | } |
| | | |
| | | NodeCmd = "PkgSubmit"; |
| | | action = TempPkgAction.Submit(null); |