From 40df5d91f800bb8b7be2638c13b4f9292d461221 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期一, 10 三月 2025 18:13:50 +0800
Subject: [PATCH] 增加送货单清点事务

---
 Tiger.Business.WMS/Transaction/WMSTransactionBase.cs |   63 ++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs b/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
index b985a25..92e4fce 100644
--- a/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
+++ b/Tiger.Business.WMS/Transaction/WMSTransactionBase.cs
@@ -13,6 +13,7 @@
 using Newtonsoft.Json;
 using Tiger.Business.WMS.Seastone;
 using Tiger.IBusiness;
+using Tiger.Model.Entitys.MES.Position;
 
 namespace Tiger.Business.WMS.Transaction
 {
@@ -70,7 +71,7 @@
         {
             var action = new ApiAction();
 
-            ResetInfo();
+            ResetScan();
             action.IsSuccessed = true;
             //action.LocaleMsg = new($"鎿嶄綔宸查噸缃紝璇烽噸鏂版壂鎻�");
             action.LocaleMsg = new("WMS.Transaction.Reset");
@@ -80,15 +81,71 @@
         /// <summary>
         /// 閲嶇疆褰撳墠鎿嶄綔锛屾湁闇�瑕佸垯閲嶅啓姝ゆ柟娉�
         /// </summary>
-        public virtual void ResetInfo()
+        public virtual void ResetScan()
         {
             ProcessingSn = null;
         }
         #endregion
 
         #region MQTT
+        /// <summary>
+        /// 璁剧疆褰撳墠鏉$爜鐨勫伐搴忎俊鎭�
+        /// </summary>
+        public ApiAction<ScanOutput> SetOutPutMqttMsg(ApiAction<ScanOutput> action, string locale = null)
+        {
+            MQTT.Message msg = new()
+            {
+                IsSuccessed = action.IsSuccessed,
+                Content = Biz.T(action.LocaleMsg, locale),
+            };
+            switch (action.Status)
+            {
+                case ApiAction.StatusCodes.Success:
+                    msg.Voice = MQTT.Voice.Success;
+                    msg.Color = "#FF1E90FF";
+                    break;
+                case ApiAction.StatusCodes.Warning:
+                    msg.Voice = MQTT.Voice.Warning;
+                    msg.Color = "#FFB8860B";
+                    break;
+                case ApiAction.StatusCodes.Error:
+                case ApiAction.StatusCodes.Failed:
+                    msg.Voice = MQTT.Voice.Fail;
+                    msg.Color = "#FFFF0000";
+                    break;
+                case ApiAction.StatusCodes.Exception:
+                    msg.Voice = MQTT.Voice.Fail;
+                    msg.Color = "#FF8B0000";
+                    break;
+                case ApiAction.StatusCodes.Normal:
+                case ApiAction.StatusCodes.NeedConfrim:
+                case ApiAction.StatusCodes.Confrimed:
+                default:
+                    msg.Voice = MQTT.Voice.Silent;
+                    msg.Color = "#FF000000";
+                    break;
+            }
+            if (action.IsSuccessed)
+            {
+                msg.Voice = MQTT.Voice.Success;
+                msg.Color = "#FF228B22";
+            }
+            else if (!action.IsSuccessed)
+            {
+                msg.Voice = MQTT.Voice.Fail;
+                msg.Color = "#FFFF0000";
+            }
+            else
+            {
+                msg.Voice = MQTT.Voice.Silent;
+                msg.Color = "#FF000000";
+            }
+            action.Data.MqttMsg = msg;
+            return action;
+        }
+
         private Thread MQTTThread;
-        private void MQTT()
+        private void Mqtt()
         {
             try
             {

--
Gitblit v1.9.3