From 29f20b28392d212c04c0c40a512894f8622cfa53 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 16 四月 2025 09:32:01 +0800
Subject: [PATCH] 合并

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
index eeb52ee..f4e72e0 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -1,6 +1,7 @@
 锘縰sing Masuit.Tools;
 using Masuit.Tools.Systems;
 using Newtonsoft.Json;
+using System.Threading.Tasks;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
@@ -165,7 +166,7 @@
                     AbNormalStationBZTask(conveyorLine, command, childDeviceCode);
                     break;
                 case 1:
-                    RequestWmsTask(conveyorLine, command, childDeviceCode);
+                    RequestWmsTask(conveyorLine, command, childDeviceCode, stationManager);
                     break;
             }
         }
@@ -411,9 +412,19 @@
         /// <summary>
         /// 璇锋眰WMS浠诲姟
         /// </summary>
-        private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
+        private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, Dt_StationManager stationManager)
         {
             if (command.ConveyorLineBarcode.IsNullOrEmpty()) return;
+
+            var Hastask = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
+            if (Hastask != null)
+            {
+                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(Hastask);
+                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
+                return;
+            }
+
             var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode);
             if (content.Status)
             {
@@ -421,15 +432,16 @@
                 if (task != null)
                 {
                     ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
-                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                     conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                    //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                     _taskService.UpdateTaskStatusToNext(task);
                 }
             }
             else
             {
                 WriteInfo(conveyorLine.DeviceName, content.Message);
+                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                 ConsoleHelper.WriteErrorLine($"銆恵conveyorLine.DeviceName}銆戞墭鐩樺彿锛氥�恵command.ConveyorLineBarcode}銆戣姹傜偣浣嶏細銆恵childDeviceCode}銆戝紓甯镐俊鎭�恵content.Message}銆�");
             }
         }

--
Gitblit v1.9.3