| | |
| | | using Rhea.Common; |
| | | using Microsoft.CodeAnalysis.Differencing; |
| | | using Rhea.Common; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | CurCmd = data; |
| | | PrintTimes++; |
| | | CurStep?.SetStatusMessage(StepStatus.Normal, Biz.L("打印标签")); |
| | | action.IsSuccessed = true; |
| | | action.Data.Data = data; |
| | | action.Data.ShortMsg = new("打印标签", ShortMessage.Types.Normal); |
| | | //action.LocaleMsg = new Locale($"开始第{PrintTimes}次打印第{min.PKG_LEVEL}层包装[{min.PkgType.PKG_NAME}]的标签[{LabelDic[min.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[min.PKG_LEVEL].LABEL_NAME}]"); |
| | |
| | | } |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = true; |
| | | //action.IsSuccessed = true; |
| | | return action; |
| | | } |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码扫描失败,请重新扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanFail", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | | CurPosition.ResetNode(); |
| | | return action; |
| | | } |
| | | //验证当前包装条码是否已经被扫描过 |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"条码[{pInput.PkgSN}]无需重复扫描,请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码"); |
| | | action.LocaleMsg = new("MES.WorkAction.PackingAction.ScanRepeat", pInput.PkgSN, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME); |
| | | CurPosition.ResetNode(); |
| | | return action; |
| | | } |
| | | //客户端扫描成功 |
| | | CurCmd = null; |
| | | PrintTimes = 0; |
| | | action = SavePkgData(input, action); |
| | | if (action.IsSuccessed) |
| | | { |
| | | CurStep?.SetStatusMessage(StepStatus.Success, Biz.L("扫描成功")); |
| | | action.Data.ShortMsg = new("扫描成功", ShortMessage.Types.Success); |
| | | } |
| | | //if (action.IsSuccessed) |
| | | //{ |
| | | // CurStep?.SetStatusMessage(StepStatus.Success, Biz.L("扫描成功")); |
| | | // action.Data.ShortMsg = new("扫描成功", ShortMessage.Types.Success); |
| | | //} |
| | | } |
| | | break; |
| | | //Print:打印,打印当前包装层级的标签 |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<MES_WIP_PKG> GetMinPackageList(WipPkgItem parent) |
| | | { |
| | | List<MES_WIP_PKG> list = new(); |
| | | if (parent.Items.Any()) |
| | | { |
| | | foreach (var item in parent.Items) |
| | | { |
| | | item.Package.PARENT_SN = parent.Package?.SN; |
| | | list.AddRange(GetMinPackageList(item)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!parent.Package.IsNullOrEmpty()) |
| | | { |
| | | list.Add(parent.Package); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public ApiAction<SubmitOutput> CompletePkg() |
| | | { |
| | | var action = new ApiAction<SubmitOutput>(new SubmitOutput()); |
| | |
| | | ACT_TYPE = NodeAct.ACT_TYPE, |
| | | ACT_SN = wipSn.SN, |
| | | ACT_RESULT = "Y", |
| | | ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(), |
| | | TRACE_INFO = $"产品条码[{string.Join(",", CurPosition.CurSN)}]包装完成", |
| | | }; |
| | | wipActs.Add(wipAct); |
| | |
| | | else |
| | | { |
| | | var _pkgList = CurPkg.IsFinished ? GetPackageList(CurPkg.Item) : new(); |
| | | |
| | | //最外层包装已经完成包装,则把工序中暂存标记设为false,统一提交包装内产品的过站记录 |
| | | CurPosition.NeedTemporaryStoreDBCommitAction = false; |
| | | //保存数据 |
| | | var db = Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | CurPosition.SaveStepsCommitActionToDB(() => |
| | | { |
| | | var db = CurPosition.GetCommitDB(); |
| | | if (_pkgList.Any()) |
| | | { |
| | | db.Storageable(_pkgList, CurPosition.UserCode).ExecuteCommand(); |
| | |
| | | } |
| | | } |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |
| | | //抛出异常 |
| | | throw dbTran.ErrorException; |
| | | } |
| | | } |
| | | |
| | | if (CurPkg.IsFinished) |