| | |
| | | public string NodeCmd { get; set; } |
| | | public PackingAction TempPkgAction { get; set; } |
| | | public bool IsPrintCustomerLabel { get; set; } |
| | | public string ShippingOrder { get; set; } |
| | | #endregion Propertys & Variables |
| | | |
| | | #region Functions |
| | |
| | | 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; |
| | | } |
| | | //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; |
| | | //} |
| | | if (input.Options.ContainsKey("IsPrintCustomerLabel")) |
| | | { |
| | | IsPrintCustomerLabel = input.Options["IsPrintCustomerLabel"].ToBoolean(); |
| | | } |
| | | if (input.Options.ContainsKey("ShippingOrder")) |
| | | { |
| | | ShippingOrder = IsPrintCustomerLabel ? input.Options["ShippingOrder"].ToString() : ""; |
| | | } |
| | | //PkgSubmit:手动结束包装,手动保存暂存的包装数据 |
| | | if (NodeCmd == "PkgSubmit") |
| | |
| | | wipSN.OPER_CODE = curNode.OPER_CODE; |
| | | wipSN.SEGMENT = curNode.SEGMENT; |
| | | wipSN.OPERATION_TIME = DateTime.Now; |
| | | wipSN.SHIPPING_ORDER = ShippingOrder; |
| | | wipSN.UNBIND_FLAG = "N"; |
| | | var curShiftPeriod = GetShiftPeriodForNow(); |
| | | if (!curShiftPeriod.IsNullOrEmpty()) |
| | | { |
| | |
| | | var _woSns = woSNs.Clone(); |
| | | var _wipSns = CurWipSNs.Clone(); |
| | | var _wipHiss = wipHiss.Clone(); |
| | | var _pkgList = curPkg?.IsFinished == true ? GetPackageList(curPkg.Item) : new(); |
| | | var _pkgList = curPkg?.IsFinished == true ? GetPackageList(curPkg.Item).Clone() : new(); |
| | | var _wipIDs = curPkg?.IsFinished == true ? curPkg.Item.GetWipSnList().Select(q => q.Key).ToList().Clone() : new(); |
| | | //保存数据 |
| | | endAction = () => |
| | | { |
| | |
| | | db.Storageable(_wipHiss, UserCode).ExecuteCommand(); |
| | | if (_pkgList.Any()) |
| | | { |
| | | var wipIDs = _pkgList.Where(q => !q.WIP_ID.IsNullOrEmpty()).Select(q => q.WIP_ID).ToList(); |
| | | //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)) |
| | | .Where(q => q.WORK_ORDER == wo && q.OPER_CODE == "EndNode" && _wipIDs.Contains(q.WIP_ID)) |
| | | .ExecuteCommand(); |
| | | } |
| | | }; |
| | |
| | | TempPkgAction.Init(this); |
| | | |
| | | int shipQty = input.Data.ToInt32(); |
| | | int curQty = CurPkg.Item.TotalQty; |
| | | double curQty = CurPkg.Item.TotalQty; |
| | | int ruleQty = TempPkgAction.PkgRule.GetTotalQty(); |
| | | //有填出货数量则验证当前包装数量必须等于(出货数量/包装规则数量)的余数 |
| | | if (shipQty > 0 && curQty != shipQty % ruleQty) |
| | |
| | | return action; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 打印测试标签 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<PackingActionOutput>> TestPrint() |
| | | { |
| | | var action = new ApiAction<PackingActionOutput>(); |
| | | try |
| | | { |
| | | var CurPkg = Context.ContainsKey("CurPackage") ? Context["CurPackage"] as WipPkg : null; |
| | | var LabelPV = Biz.Db.Queryable<BAS_LABEL_PV>().ToList(); |
| | | var label = CurPkg.Item.LABEL_CODE.IsNullOrEmpty() ? null : Biz.Db.Queryable<BAS_LABEL_TEMP>().Where(q => q.LABEL_CODE == CurPkg.Item.LABEL_CODE).IncludesAllFirstLayer().First(); |
| | | var printLb = SetLabelVariables(LabelPV, label, new PackingAction(), CurPkg); |
| | | action.Data = new PackingActionOutput() |
| | | { |
| | | ExecCode = "PrintTest", |
| | | PkgInfo = CurPkg, |
| | | PrintLable = printLb, |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, $"包装工序:打印测试标签异常"); |
| | | } |
| | | return action; |
| | | } |
| | | |
| | | #endregion Functions |
| | | |
| | | /// <summary> |