From 17e5dbd7bd0364e27a33f1a7dab91cf33d5dcabc Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 04 三月 2026 11:52:12 +0800
Subject: [PATCH] 增强Redis缓存服务与设备通信优化

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 7ae869a..288f717 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -179,6 +179,9 @@
         /// <returns></returns>
         public Dt_Task QueryExecutingConveyorLineTask(int taskNum, string nextAddress)
         {
+            if (string.IsNullOrEmpty(nextAddress))
+                throw new ArgumentNullException(nameof(nextAddress), "涓嬩竴鍦板潃涓嶈兘涓虹┖");
+
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
         }
 
@@ -190,6 +193,9 @@
         /// <returns></returns>
         public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
         {
+            if (string.IsNullOrEmpty(currentAddress))
+                throw new ArgumentNullException(nameof(currentAddress), "褰撳墠鍦板潃涓嶈兘涓虹┖");
+
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
         }
 
@@ -273,6 +279,9 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                if (string.IsNullOrEmpty(message))
+                    throw new ArgumentNullException(nameof(message), "寮傚父淇℃伅涓嶈兘涓虹┖");
+
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
@@ -371,7 +380,8 @@
                         {
                             PalletCode = task.PalletCode,
                         };
-                        var result = _httpClientHelper.Post<WebResponseContent>("WMS", taskDto.ToJson(), nameof(ConfigKey.GetTasksLocation));
+
+                        var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.GetTasksLocation), taskDto.ToJson(), nameof(ConfigKey.GetTasksLocation));
                         if (!result.IsSuccess && !result.Data.Status)
                         {
                             return WebResponseContent.Instance.Error($"璋冪敤WMS鎺ュ彛鑾峰彇浠诲姟鐩爣鍦板潃澶辫触,浠诲姟鍙�:銆恵task.TaskNum}銆�,閿欒淇℃伅:銆恵content.Message}銆�");
@@ -434,6 +444,9 @@
         {
             try
             {
+                if (string.IsNullOrEmpty(currentAddress))
+                    throw new ArgumentNullException(nameof(currentAddress), "褰撳墠鍦板潃涓嶈兘涓虹┖");
+
                 Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress);
                 if (task == null) throw new Exception($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
 
@@ -455,6 +468,7 @@
             }
             catch (Exception ex)
             {
+                Console.WriteLine($"UpdatePosition 鏇存柊浠诲姟浣嶇疆澶辫触,浠诲姟鍙�:銆恵taskNum}銆�,閿欒淇℃伅:銆恵ex.Message}銆�");
             }
             return null;
         }
@@ -487,7 +501,7 @@
 
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
 
-                    var result = _httpClientHelper.Post<WebResponseContent>("WMS", (new StockInfoDTO() { PalletCode = task.PalletCode, TaskNum = task.TaskNum }).ToJson());
+                    var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.OutboundFinishTaskAsync), (new StockInfoDTO() { PalletCode = task.PalletCode, TaskNum = task.TaskNum }).ToJson());
                     if (result.IsSuccess && result.Data.Status)
                     {
                         return content.Error($"閫氱煡WMS绯荤粺鍫嗗灈鏈哄嚭搴撳畬鎴愭垚鍔�,浠诲姟鍙�:銆恵task.TaskNum}銆�,鎵樼洏鍙�:銆恵task.PalletCode}銆�");
@@ -508,7 +522,7 @@
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
 
 
-                    var result = _httpClientHelper.Post<WebResponseContent>("WMS", (new CreateTaskDto()
+                    var result = _httpClientHelper.Post<WebResponseContent>(nameof(ConfigKey.InboundFinishTaskAsync), (new CreateTaskDto()
                     {
                         PalletCode = task.PalletCode,
                     }).ToJson());

--
Gitblit v1.9.3