From 4d0371aa548eb7b5e1678b2036da95bb322d2cf1 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 10 三月 2026 19:56:25 +0800
Subject: [PATCH] 优化出入库完成反馈WMS

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs |   16 +++++++-
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs           |   88 ++++++++++++++++++++++++--------------------
 2 files changed, 62 insertions(+), 42 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs"
index 25945e8..f3aaf28 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/WMSInOutBoundCompleteFeedback.cs"
@@ -15,6 +15,18 @@
         /// 浠诲姟鍙�
         /// </summary>
         public string taskCode { get; set; }
+        /// <summary>
+        /// 涓婃父閿欒鎻忚堪
+        /// </summary>
+        public string memo { get; set; }
+        /// <summary>
+        /// 涓婃父鐘舵�佺爜
+        /// </summary>
+        public string custStatus { get; set; }
+        /// <summary>
+        /// 浠诲姟鐘舵�侊細1-鎵ц涓紝2-瀹屾垚锛�3-澶辫触 4-璧风偣瀹屾垚
+        /// </summary>
+        public int status { get; set; }
 
         /// <summary>
         /// 瀹瑰櫒缂栫爜
@@ -35,12 +47,12 @@
         /// 涓氬姟绫诲瀷
         /// 1-闈㈡枡锛�2-鎴愬搧锛�3-瑁佸壀锛�4-閰嶅
         /// </summary>
-        public int? businessType { get; set; }
+        //public int? businessType { get; set; }
 
         /// <summary>
         /// 瀹屾垚绫诲瀷
         /// 1-鑷姩瀹屾垚锛�2-鎵嬪姩瀹屾垚
         /// </summary>
-        public int completeType { get; set; } = 1;
+        //public int completeType { get; set; } = 1;
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index 99bb24d..9157118 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -59,7 +59,8 @@
                             break;
                         default:
                             task.TaskState = ReturnTaskStatus(gALAXIS.taskStatus, deviceTypeEnum);
-                            BaseDal.UpdateData(task);
+                            if (gALAXIS.taskStatus == 10) TaskFeedback(task, 1);
+                            else BaseDal.UpdateData(task);
                             break;
                     }
                 }
@@ -106,7 +107,7 @@
                     }
                     else if (Rgv.messageType == 10)
                     {
-                        if(Rgv.content.status == 4)
+                        if (Rgv.content.status == 4)
                         {
                             if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.TakeFinish)
                             {
@@ -117,7 +118,7 @@
                             {
                                 TaskCompleted(task, deviceTypeEnum);
                             }
-                            else if(task.TaskType == (int)TaskTypeEnum.CPOutbound || task.TaskType == (int)TaskTypeEnum.CPMoveInventory)//鍑哄簱銆佺Щ搴撳畬鎴�
+                            else if (task.TaskType == (int)TaskTypeEnum.CPOutbound || task.TaskType == (int)TaskTypeEnum.CPMoveInventory)//鍑哄簱銆佺Щ搴撳畬鎴�
                             {
                                 TaskCompleted(task, deviceTypeEnum);
                             }
@@ -128,7 +129,7 @@
             }
             catch (Exception ex)
             {
-                 content.Error(ex.Message);
+                content.Error(ex.Message);
             }
             finally
             {
@@ -215,10 +216,11 @@
             try
             {
                 dt_Task.TaskState = TaskStatusEnum.TakeFinish.ObjToInt();
-                Db.Ado.BeginTran();
+                TaskFeedback(dt_Task, 4);
+                //Db.Ado.BeginTran();
                 UpdateLocationStatus(dt_Task.SourceAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.Free);
-                BaseDal.UpdateData(dt_Task);
-                Db.Ado.CommitTran();
+                //BaseDal.UpdateData(dt_Task);
+                //Db.Ado.CommitTran();
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
@@ -240,45 +242,17 @@
         {
             try
             {
-                WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
-                WMSReturn agvContent = null;
                 dt_Task.TaskState = TaskStatusEnum.Finish.ObjToInt();
-
-                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
-                if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
-                else
-                {
-                    boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
-                    boundCompleteFeedback.containerCode = dt_Task.PalletCode;
-                    boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
-                    boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
-                    switch (deviceTypeEnum)
-                    {
-                        case DeviceTypeEnum.GALAXIS:
-                            boundCompleteFeedback.businessType = 1;
-                            break;
-                        case DeviceTypeEnum.YuanLiJuHe:
-                            boundCompleteFeedback.businessType = 2;
-                            break;
-                    }
-
-                    boundCompleteFeedback.completeType = 1;
-                    string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
-                    agvContent = response.DeserializeObject<WMSReturn>();
-                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
-                }
-                Db.Ado.BeginTran();
+                TaskFeedback(dt_Task, 2);
+                //Db.Ado.BeginTran();
                 UpdateLocationStatus(dt_Task.TargetAddress, dt_Task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
-                if (agvContent != null && agvContent.code == 0)
-                    BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
-                else
-                    BaseDal.UpdateData(dt_Task);
-                Db.Ado.CommitTran();
+
+                //Db.Ado.CommitTran();
                 return WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
             {
-                Db.Ado.RollbackTran();
+                //Db.Ado.RollbackTran();
                 throw new Exception(ex.Message);
             }
         }
@@ -361,5 +335,39 @@
             }
         }
         #endregion
+
+        #region 涓婃姤WMS
+        public WebResponseContent TaskFeedback(Dt_Task dt_Task, int Status)
+        {
+            WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
+            WMSReturn agvContent = null;
+            try
+            {
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
+                if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+                else
+                {
+                    boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
+                    boundCompleteFeedback.containerCode = dt_Task.PalletCode;
+                    boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
+                    boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
+                    boundCompleteFeedback.status = Status;
+                    boundCompleteFeedback.custStatus = "";
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
+                    agvContent = response.DeserializeObject<WMSReturn>();
+                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
+                }
+            }
+            catch (Exception ex)
+            {
+                dt_Task.ExceptionMessage = ex.Message;
+            }
+            if (agvContent != null && agvContent.code == 0 && Status == 2)
+                BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
+            else
+                BaseDal.UpdateData(dt_Task);
+            return WebResponseContent.Instance.OK();
+        }
+        #endregion
     }
 }

--
Gitblit v1.9.3