服务端的TigerApi 框架,基于.NET6 2024 版本
Ben Lin
2024-10-27 8b7114c93a3a3a6c9356393ea695f881d0da8cbb
Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
@@ -25,6 +25,7 @@
        #endregion
        public BAS_LABEL_TEMP Label { get; set; }
        public List<BAS_LABEL_PV> LabelPV { get; set; }
        public bool NoNeedInStorePrint { get; set; }
        #endregion Propertys & Variables
        #region Functions
@@ -67,14 +68,22 @@
        {
            var action = new ApiAction<SubmitOutput>(new SubmitOutput());
            if (CurPosition is YadaPacking && !(CurPosition as YadaPacking).IsPrintCustomerLabel)
            //设置打印变量值
            Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
            if (CurPosition.Context.ContainsKey("CurPackage"))
            {
                (CurPosition.Context["CurPackage"] as WipPkg).InStoreLabel = Label;
            }
            //判断是否需要打印入库标签
            NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished)
                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
            if (NoNeedInStorePrint)
            {
                action = End(input);
            } 
            else
            {
               //设置打印变量值
               Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
               action.Data.Data = Label;
   
               //如果返回成功则认为当前行为可以开始执行,否则返回失败
@@ -164,12 +173,8 @@
                    ACT_VALUE_2 = Label.Variables.ToJson(),
                    ACT_RESULT = "Y",
                    ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
                    TRACE_INFO = $"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功",
                    TRACE_INFO = NoNeedInStorePrint ? $"无需打印入库标签" : $"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功",
                };
                if (CurPosition is YadaPacking && !(CurPosition as YadaPacking).IsPrintCustomerLabel)
                {
                    wipAct.TRACE_INFO = $"无需打印入库标签";
                }
                wipActs.Add(wipAct);
            }
@@ -183,11 +188,22 @@
            };
            IsFinished = true;
            CurStep.Message = Biz.L("打印完成");
            CurStep.Status = StepStatus.Finished;
            action.Data.ShortMsg = new("打印完成", ShortMessage.Types.Success);
            //action.LocaleMsg = new($"入库标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功", Label.LABEL_NAME);
            action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE);
            if (NoNeedInStorePrint)
            {
                CurStep.Message = Biz.L("无需打印");
                CurStep.Status = StepStatus.Finished;
                action.Data.ShortMsg = new("无需打印", ShortMessage.Types.Success);
                //action.LocaleMsg = new($"无需打印入库标签{0}[{1}]");
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.NoNeedPrint", Label.LABEL_NAME, Label.LABEL_CODE);
            }
            else
            {
               CurStep.Message = Biz.L("打印完成");
               CurStep.Status = StepStatus.Finished;
               action.Data.ShortMsg = new("打印完成", ShortMessage.Types.Success);
                //action.LocaleMsg = new($"入库标签{0}[{1}打印成功");
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintSuccess", Label.LABEL_NAME, Label.LABEL_CODE);
            }
            return action;
        }