From eec9f268552af1d0ce8c95312930770669f1cc18 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期五, 16 八月 2024 22:40:16 +0800
Subject: [PATCH] 增加客户端需要的工序信息和短消息

---
 Tiger.Business.MES/WorkAction/PackingAction.cs |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Tiger.Business.MES/WorkAction/PackingAction.cs b/Tiger.Business.MES/WorkAction/PackingAction.cs
index 4c47c62..88f623c 100644
--- a/Tiger.Business.MES/WorkAction/PackingAction.cs
+++ b/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})鏁版嵁涓嶆槸姝e湪澶勭悊鐨勫寘瑁呭眰绾{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;
         }
 

--
Gitblit v1.9.3