服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-16 eec9f268552af1d0ce8c95312930770669f1cc18
Tiger.Business.MES/WorkAction/PackingAction.cs
@@ -175,6 +175,7 @@
                CurCmd = data;
                PrintTimes++;
                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.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, min.PKG_LEVEL, min.PkgType.PKG_NAME, LabelDic[min.PKG_LEVEL]?.LABEL_CODE, LabelDic[min.PKG_LEVEL].LABEL_NAME);
            }
@@ -203,6 +204,7 @@
                        if (!pInput.IsFinish || pInput.PkgSN.IsNullOrEmpty())
                        {
                            var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel);
                            action.Data.ShortMsg = new("扫描错误", ShortMessage.Types.Error);
                            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);
@@ -212,6 +214,7 @@
                        if (GetPackageList(CurPkg.Item).Any(q => q.SN == pInput.PkgSN))
                        {
                            var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel);
                            action.Data.ShortMsg = new("扫描错误", ShortMessage.Types.Error);
                            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);
@@ -221,6 +224,10 @@
                        CurCmd = null;
                        PrintTimes = 0;
                        action = SavePkgData(input, action);
                        if (action.IsSuccessed)
                        {
                            action.Data.ShortMsg = new("扫描成功", ShortMessage.Types.Success);
                        }
                    }
                    break;
                //Print:打印,打印当前包装层级的标签
@@ -238,6 +245,7 @@
                            data.PkgLevel = dtl.PKG_LEVEL;
                            CurCmd = data;
                            action.Data.Data = data;
                            action.Data.ShortMsg = new("扫描标签", ShortMessage.Types.Normal);
                            //action.LocaleMsg = new($"请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码");
                            action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME);
                        } 
@@ -249,6 +257,7 @@
                            {
                                PrintTimes++;
                                action.Data.Data = CurCmd;
                                action.Data.ShortMsg = new("重新打印", ShortMessage.Types.Normal);
                                //action.LocaleMsg = new Locale($"开始{PrintTimes}次打印第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签[{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]");
                                action.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME);
                            }
@@ -256,6 +265,7 @@
                            {
                                CurCmd = null;
                                PrintTimes = 0;
                                action.Data.ShortMsg = new("打印失败", ShortMessage.Types.Failed);
                                action.IsSuccessed = false;
                                //action.LocaleMsg = new($"尝试第{PrintTimes}次打印第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签[{LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE}: {LabelDic[dtl.PKG_LEVEL].LABEL_NAME}]失败,工序已重置,请重新扫描进站产品条码");
                                action.LocaleMsg = new("MES.WorkAction.PackingAction.PrintFail3Times", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME);
@@ -277,6 +287,7 @@
                            data.PkgLevel = CurPkgItem.PKG_LEVEL;
                            CurCmd = data;
                            action.Data.Data = data;
                            action.Data.ShortMsg = new("包装成功", ShortMessage.Types.Success);
                            //action.LocaleMsg = new($"请把包装[{CurPkgItem.Package.SN}]上称称重");
                            action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighing", CurPkgItem.Package.SN);
                        }
@@ -301,6 +312,7 @@
                        else
                        {
                            action.IsSuccessed = false;
                            action.Data.ShortMsg = new("称重失败", ShortMessage.Types.Failed);
                            //action.LocaleMsg = new($"包装[{CurPkgItem.Package.SN}]称重数据异常,请重新上称称重");
                            action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseWeighingAgain", CurPkgItem.Package.SN);
                            return action;
@@ -331,6 +343,7 @@
                            data.PkgLevel = dtl.PKG_LEVEL;
                            CurCmd = data;
                            action.Data.Data = data;
                            action.Data.ShortMsg = new("扫描标签", ShortMessage.Types.Normal);
                            //action.LocaleMsg = new($"请扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码");
                            action.LocaleMsg = new("MES.WorkAction.PackingAction.PleaseScanLabel", dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME);
                        }
@@ -346,6 +359,7 @@
                            CurCmd = data;
                            PrintTimes++;
                            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.LocaleMsg = new Locale("MES.WorkAction.PackingAction.BeginPrint", PrintTimes, dtl.PKG_LEVEL, dtl.PkgType.PKG_NAME, LabelDic[dtl.PKG_LEVEL]?.LABEL_CODE, LabelDic[dtl.PKG_LEVEL].LABEL_NAME);
                        }
@@ -522,6 +536,7 @@
                    //数据异常
                    else
                    {
                        action.Data.ShortMsg = new("包装错误", ShortMessage.Types.Error);
                        var pdtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel);
                        action.IsSuccessed = false;
                        //action.LocaleMsg = new($"客户端提交的包装层级[{pdtl.PKG_LEVEL}]({pdtl.PkgType.PKG_NAME})数据不是正在处理的包装层级[{dtl.PKG_LEVEL}]({dtl.PkgType.PKG_NAME}),工序已重置,请重新扫描进站产品条码");
@@ -532,6 +547,7 @@
            }
            catch (System.Exception ex)
            {
                action.Data.ShortMsg = new("包装异常", ShortMessage.Types.Exception);
                var dtl = PkgRule.Details.First(q => q.PKG_LEVEL == pInput.PkgLevel);
                action.CatchExceptionWithLog(ex, $"包装行为:扫描第{dtl.PKG_LEVEL}层包装[{dtl.PkgType.PKG_NAME}]的标签条码[{input.SN}]后保存数据失败");
                action.IsSuccessed = false;
@@ -562,6 +578,7 @@
            data.PkgLevel = CurPkg.Item.PKG_LEVEL;
            CurCmd = data;
            action.Data.Data = data;
            action.Data.ShortMsg = new("保存包装数据", ShortMessage.Types.Normal);
            //action.LocaleMsg = new($"第{CurPkg.Item.PKG_LEVEL}层包装[{CurPkg.Item.PKG_NAME}]已经全部完成,保存包装数据");
            action.LocaleMsg = new("MES.WorkAction.PackingAction.PackageComplete", CurPkg.Item.PKG_LEVEL, CurPkg.Item.PKG_NAME);
@@ -685,8 +702,9 @@
            }
            IsFinished = true;
            action.LocaleMsg = new($"产品条码[{CurPosition.CurSN}]包装完成");
            action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPosition.CurSN);
            action.Data.ShortMsg = new("包装完成", ShortMessage.Types.Success);
            action.LocaleMsg = new($"条码[{CurPkg.Item.Package.SN}]包装完成");
            action.LocaleMsg = new("MES.WorkAction.PackingAction.PackingSuccess", CurPkg.Item.Package.SN);
            return action;
        }