服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-10-28 17077d5f5dc14c5ff5e6d757efa49c53e2b9afad
Tiger.Business.MES/WorkAction/PrintInStoreLabel.cs
@@ -55,7 +55,7 @@
        /// <returns></returns>
        public Locale GetBeginMsg()
        {
            var msg = new Locale("MES.WorkAction.PrintInStoreLabel.BeginMsg", CurPosition.CurSN, Label.LABEL_CODE, Label.LABEL_NAME);
            var msg = new Locale("MES.WorkAction.PrintInStoreLabel.BeginMsg", CurPosition.CurSN, Label?.LABEL_CODE, Label?.LABEL_NAME);
            //var msg = new Locale($"开始打印条码[{CurPosition.CurWipSN.SN}]的入库标签[{Label.LABEL_CODE}: {Label.LABEL_NAME}]");
            return msg;
        }
@@ -68,9 +68,7 @@
        {
            var action = new ApiAction<SubmitOutput>(new SubmitOutput());
            NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished)
                                    || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
            if (NoNeedInStorePrint)
            if (Label.IsNullOrEmpty())
            {
                action = End(input);
            } 
@@ -78,13 +76,28 @@
            {
               //设置打印变量值
               Label = CurPosition.SetLabelVariables(LabelPV, Label, this);
               action.Data.Data = Label;
               if (CurPosition.Context.ContainsKey("CurPackage"))
               {
                   (CurPosition.Context["CurPackage"] as WipPkg).InStoreLabel = Label;
               }
   
               //如果返回成功则认为当前行为可以开始执行,否则返回失败
               CurStep.Message = Biz.L("打印开始");
               CurStep.Status = StepStatus.Normal;
               action.IsSuccessed = true;
               action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success);
               //判断是否需要打印入库标签
               NoNeedInStorePrint = (!CurPosition.Context.ContainsKey("CurPackage") || !(CurPosition.Context["CurPackage"] as WipPkg).IsFinished)
                                       || (CurPosition is YadaPacking && (CurPosition as YadaPacking).IsPrintCustomerLabel);
               if (NoNeedInStorePrint)
               {
                   action = End(input);
               }
               else
               {
                  action.Data.Data = Label;
                  //如果返回成功则认为当前行为可以开始执行,否则返回失败
                  CurStep.Message = Biz.L("打印开始");
                  CurStep.Status = StepStatus.Normal;
                  action.IsSuccessed = true;
                  action.Data.ShortMsg = new("打印开始", ShortMessage.Types.Success);
               }
            }
            return action;
        }
@@ -109,7 +122,7 @@
                action.Data.ShortMsg = new("打印失败", ShortMessage.Types.Failed);
                action.IsSuccessed = false;
                //action.LocaleMsg = new($"入库标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印失败", Label.LABEL_NAME);
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintFail", Label.LABEL_NAME, Label.LABEL_CODE);
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintFail", Label?.LABEL_NAME, Label?.LABEL_CODE);
                //如果行为设置为出错需要重置工序操作
                if (NodeAct.NEED_RESET == "Y")
                {
@@ -163,11 +176,11 @@
                    PRD_CODE = wipSn.PRD_CODE,
                    ACT_TYPE = NodeAct.ACT_TYPE,
                    ACT_SN = wipSn.SN,
                    ACT_VALUE_1 = Label.LABEL_CODE,
                    ACT_VALUE_2 = Label.Variables.ToJson(),
                    ACT_VALUE_1 = Label?.LABEL_CODE,
                    ACT_VALUE_2 = Label?.ToJson(),
                    ACT_RESULT = "Y",
                    ELAPSED_TIME = CurStep.GetElapsedTime().TotalMilliseconds.ToInt64(),
                    TRACE_INFO = NoNeedInStorePrint ? $"无需打印入库标签" : $"标签{Label.LABEL_NAME}[{Label.LABEL_CODE}]打印成功",
                    TRACE_INFO = NoNeedInStorePrint ? $"无需打印入库标签" : $"标签{Label?.LABEL_NAME}[{Label?.LABEL_CODE}]打印成功",
                };
                wipActs.Add(wipAct);
            }
@@ -188,7 +201,7 @@
                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);
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.NoNeedPrint", Label?.LABEL_NAME, Label?.LABEL_CODE);
            } 
            else
            {
@@ -196,7 +209,7 @@
               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);
                action.LocaleMsg = new("MES.WorkAction.PrintInStoreLabel.PrintSuccess", Label?.LABEL_NAME, Label?.LABEL_CODE);
            }
            return action;
        }