From 3406bbd34469982efeefe164c207dcb5c4a0dac2 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 30 四月 2026 22:03:54 +0800
Subject: [PATCH] fix: 修复多个功能模块中的问题和优化逻辑

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensS7Communicator.cs                 |    3 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs                |   63 +++++-----
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs                           |   19 ++-
 Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/TaskAddressConstants.cs                         |    4 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs             |   22 +--
 Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json                                       |    2 
 Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs                              |    9 +
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs                       |    6 
 Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/OutboundTimeConstants.cs                        |   10 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs          |    3 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs                          |    6 +
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs                  |    5 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensDBDataType.cs                     |    1 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/Connection/RedisConnectionManager.cs             |    2 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json                                       |    2 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs          |   80 ++++--------
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs       |   22 +-
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs                |   30 -----
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs          |    4 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/HttpEnum/BaseAPI.cs                                    |    2 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs                         |    8 +
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs |    3 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs               |    2 
 23 files changed, 150 insertions(+), 158 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/HttpEnum/BaseAPI.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/HttpEnum/BaseAPI.cs
index 08a0f08..89e42b5 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/HttpEnum/BaseAPI.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/HttpEnum/BaseAPI.cs
@@ -11,7 +11,7 @@
         /// <summary>
         /// WMS鎺ュ彛鍩虹URL
         /// </summary>
-        public const string WMSBaseUrl = "http://localhost:9291/api/";
+        public const string WMSBaseUrl = "http://192.168.60.30:9291/api/";
 
         /// <summary>
         /// WCS鎺ュ彛鍩虹URL
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensDBDataType.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensDBDataType.cs
index 1e678f5..fc5ef00 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensDBDataType.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensDBDataType.cs
@@ -112,6 +112,7 @@
                 DataType_Char => TypeCode.Char,
                 DataType_UInt => TypeCode.UInt16,
                 DataType_UDInt => TypeCode.UInt32,
+                DataType_ByteArray => TypeCode.SByte,
                 _ => throw new CommunicationException($"鏁版嵁绫诲瀷閿欒:銆恵dataType}銆�", CommunicationErrorType.TypeError),
             };
         }
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensS7Communicator.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensS7Communicator.cs
index c2dfc11..1d72f38 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensS7Communicator.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Communicator/Siemens/SiemensS7Communicator.cs
@@ -358,6 +358,9 @@
                             return Encoding.Default.GetString((byte[])GetContent(plc.Read(address, length), address)).ToArray();
                         return (char)GetContent(plc.ReadByte(address), address);
 
+                    case TypeCode.SByte:
+                        return Encoding.Default.GetString((byte[])GetContent(plc.Read(address, 20), address)).ToArray();
+
                     default:
                         throw new CommunicationException(string.Format(CommunicationExceptionMessage.DataTypeErrorException, typeCode.ToString(), address), CommunicationErrorType.TypeError);
                 }
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
index 267ef99..392a08b 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/IRobotTaskService.cs
@@ -83,6 +83,14 @@
         WebResponseContent GetWMSRobotTask(Dt_Task task);
 
         /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="taskType"></param>
+        /// <param name="palletCode"></param>
+        /// <returns></returns>
+        int GetRobotTaskTotalNum(int taskType, string? palletCode);
+
+        /// <summary>
         /// 鍦ㄦ湰鍦扮洿鎺ュ垱寤烘満姊版墜浠诲姟锛屼笉璋冪敤WMS鎺ュ彛
         /// </summary>
         /// <param name="task">鍑哄簱浠诲姟</param>
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
index 6be42fe..5c795e5 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/QuartzNet/SchedulerCenterServer.cs
@@ -459,11 +459,14 @@
         /// <returns></returns>
         private ITrigger CreateSimpleTrigger(DispatchInfoDTO sysSchedule)
         {
+            // Quartz瑕佹眰闂撮殧鑷冲皯1绉掞紝闃叉鏁版嵁搴撲腑IntervalSecond涓�0鎴栬礋鍊煎鑷碅rgumentOutOfRangeException
+            var intervalSeconds = sysSchedule.IntervalSecond <= 0 ? 1 : sysSchedule.IntervalSecond;
+
             ITrigger trigger = TriggerBuilder.Create()
             .WithIdentity(sysSchedule.Id.ToString(), sysSchedule.JobGroup)
             .StartAt(sysSchedule.BeginTime.GetValueOrDefault())
             .WithSimpleSchedule(x => x
-                .WithIntervalInSeconds(sysSchedule.IntervalSecond)
+                .WithIntervalInSeconds(intervalSeconds)
                 .RepeatForever()
             )
             .EndAt(sysSchedule.EndTime.GetValueOrDefault())
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/Connection/RedisConnectionManager.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/Connection/RedisConnectionManager.cs
index 8b697de..0d93b8b 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/Connection/RedisConnectionManager.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/Connection/RedisConnectionManager.cs
@@ -82,6 +82,8 @@
         public IServer GetServer()
         {
             var endpoints = _connection.Value.GetEndPoints();
+            if (endpoints == null || endpoints.Length == 0)
+                throw new InvalidOperationException("Redis娌℃湁鍙敤鐨勭粓缁撶偣锛岃妫�鏌ヨ繛鎺ラ厤缃�");
             return _connection.Value.GetServer(endpoints[0]);
         }
 
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
index fc22a70..bf34039 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/RobotTaskController.cs
@@ -1,32 +1,35 @@
-锘縰sing Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using System.Threading.Tasks;
-using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.BaseController;
-using WIDESEAWCS_Core.Enums;
-using WIDESEAWCS_DTO.TaskInfo;
-using WIDESEAWCS_ISystemServices;
-using WIDESEAWCS_ITaskInfoService;
-using WIDESEAWCS_Model.Models;
-
-namespace WIDESEAWCS_Server.Controllers.Task
-{
-    [Route("api/RobotTask")]
-    [ApiController]
-    public class RobotTaskController : ApiBaseController<IRobotTaskService, Dt_RobotTask>
-    {
-        public RobotTaskController(IRobotTaskService service) : base(service)
-        {
-            
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.BaseController;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_Server.Controllers.Task
+{
+    [Route("api/RobotTask")]
+    [ApiController]
+    public class RobotTaskController : ApiBaseController<IRobotTaskService, Dt_RobotTask>
+    {
+        public RobotTaskController(IRobotTaskService service) : base(service)
+        {
         }
-        [HttpGet, HttpPost, Route("DeleteRobotTask"), AllowAnonymous]
-        public WebResponseContent DeleteRobotTask(int id)
-        {
-            if (Service.DeleteRobotTask(id)){
+
+        [HttpGet, HttpPost, Route("DeleteRobotTask"), AllowAnonymous]
+        public WebResponseContent DeleteRobotTask(int id)
+        {
+            if (Service.DeleteRobotTask(id))
+            {
                 return WebResponseContent.Instance.OK();
-            }
-            return WebResponseContent.Instance.Error();
-        }
-
-    }
-}
+            }
+            return WebResponseContent.Instance.Error();
+        }
+
+
+        [HttpGet, HttpPost, Route("GetRobotTaskTotalNum"), AllowAnonymous]
+        public int GetRobotTaskTotalNum( int taskType, string? palletCode)
+        {
+            return Service.GetRobotTaskTotalNum(taskType, palletCode);
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
index 0b54bec..0de3b38 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -34,7 +34,7 @@
   //5.PostgreSQL
   "DBType": "SqlServer",
   //杩炴帴瀛楃涓�
-  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionString": "Data Source=192.168.60.30;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
 
   //璺ㄥ煙
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
index 38a97f2..13c1b80 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RobotTaskService.cs
@@ -20,10 +20,12 @@
 using MapsterMapper;
 using Microsoft.Extensions.Configuration;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
 using Serilog;
 using SqlSugar;
 using System.Diagnostics;
 using System.Diagnostics.CodeAnalysis;
+using System.Text;
 using WIDESEA_Core;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.HttpEnum;
@@ -73,6 +75,7 @@
             _taskExecuteDetailService = taskExecuteDetailService;
             _logger = logger;
         }
+
         public override WebResponseContent DeleteData(object[] keys)
         {
             List<int> taskKeys = new List<int>();
@@ -83,8 +86,8 @@
             List<Dt_RobotTask> tasks = BaseDal.QueryData(x => taskKeys.Contains(x.RobotTaskId));
             BaseDal.DeleteAndMoveIntoHty(tasks, OperateTypeEnum.浜哄伐鍒犻櫎);
             return WebResponseContent.Instance.OK($"鎴愬姛鍒犻櫎{tasks.Count}鏉℃暟鎹�");
-
         }
+
         public bool DeleteRobotTask(int id)
         {
             Dt_RobotTask task = BaseDal.QueryFirst(x => x.RobotTaskId == id);
@@ -133,7 +136,7 @@
 
         public Dt_RobotTask? QueryRobotCraneTask(string deviceCode)
         {
-            return BaseDal.QueryFirst(x => x.RobotRoadway == deviceCode && x.RobotTaskState != (int)TaskRobotStatusEnum.RobotExecuting, TaskOrderBy);
+            return BaseDal.QueryFirst(x => x.RobotRoadway == deviceCode, TaskOrderBy);
         }
 
         public Dt_RobotTask? QueryRobotCraneExecutingTask(string deviceCode)
@@ -341,7 +344,7 @@
         /// 鑾峰彇鏈烘鎵嬩换鍔℃�绘暟閲忋��
         /// 缁勭洏浠诲姟鍥哄畾48锛屾崲鐩樺拰鎷嗙洏浠诲姟閫氳繃鎵樼洏鍙锋煡璇MS搴撳瓨鏄庣粏鏁伴噺銆�
         /// </summary>
-        private int GetRobotTaskTotalNum(int taskType, string? palletCode)
+        public int GetRobotTaskTotalNum(int taskType, string? palletCode)
         {
             if (taskType == (int)RobotTaskTypeEnum.GroupPallet)
                 return 48;
@@ -351,8 +354,10 @@
 
             try
             {
+                QuartzLogHelper.LogInfo(_logger, $"寮�濮嬭皟鐢╓MS鎺ュ彛鑾峰彇搴撳瓨鏄庣粏鏁伴噺,鎵樼洏鍙�:銆恵palletCode}銆�", "RobotTaskService");
                 string url = $"{BaseAPI.WMSBaseUrl}Stock/GetStockDetailCount?palletCode={Uri.EscapeDataString(palletCode)}";
                 var result = _httpClientHelper.Get(url);
+                QuartzLogHelper.LogInfo(_logger, $"璋冪敤WMS鑾峰彇搴撳瓨鏄庣粏鏁伴噺鎺ュ彛,璇锋眰URL:銆恵url}銆�,鍝嶅簲鏁版嵁:銆恵result.Content}銆�,鑰楁椂:{result.Duration}ms", "RobotTaskService");
                 if (!result.IsSuccess || string.IsNullOrEmpty(result.Content))
                     return 1;
 
@@ -360,8 +365,8 @@
                 if (response == null || !response.Status)
                     return 1;
 
-                var detailCount = response.Data?.GetType().GetProperty("DetailCount")?.GetValue(response.Data);
-                return detailCount is int count and > 0 ? count : 1;
+                var detailCount = (response.Data as JObject)?["detailCount"]?.Value<int>();
+                return detailCount.HasValue && detailCount.Value > 0 ? detailCount.Value : 1;
             }
             catch
             {
@@ -466,8 +471,10 @@
                     CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
 
                     DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineDBNameNew.Barcode) && x.DeviceChildCode == sourceLineNo);
+                    //conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 20);
                     //ConveyorLineTaskCommandNew command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandNew>(sourceLineNo);  // 娴嬭瘯鐢�
-                    var barcode = conveyorLine.GetValue<ConveyorLineDBNameNew, string>(ConveyorLineDBNameNew.Barcode, sourceLineNo);
+                    var bytes = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 20);
+                    var barcode = Encoding.Default.GetString(bytes).Trim();
                     stock.SourcePalletNo = string.IsNullOrEmpty(barcode) ? string.Empty : barcode;
                 }
             }
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index 7788251..fa281cd 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -1,16 +1,11 @@
 using MapsterMapper;
 using Masuit.Tools;
-using Microsoft.Extensions.Configuration;
-using Newtonsoft.Json;
 using Quartz;
 using Serilog;
 using SqlSugar;
 using WIDESEA_Core;
-using WIDESEAWCS_Common.HttpEnum;
 using WIDESEAWCS_Common.TaskEnum;
-using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
@@ -228,7 +223,11 @@
                             {
                                 // 濡傛灉 WCS_ACK 涓� 1锛屽厛娓呴櫎锛堣〃绀哄鐞嗚繃涓婁竴娆¤姹傦級
                                 if (command.WCS_ACK == 1)
-                                    conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)0, childDeviceCode);
+                                {
+                                    conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (byte)0, childDeviceCode);
+                                    //Thread.Sleep(300);
+                                    //conveyorLine.SetValue(ConveyorLineDBNameNew.Target, (short)0, childDeviceCode);
+                                }
 
                                 // 澶勭悊鎵嬪姩鍏ュ簱浠诲姟锛堣捣鐐逛负绾夸綋鐐逛綅鐨勪换鍔★級
                                 try
@@ -247,17 +246,36 @@
                                 }
                                 continue;
                             }
+                            else
+                            {
+                                if (childDeviceCode == "2103" || childDeviceCode == "2101")
+                                {
+                                    try
+                                    {
+                                        var task = _taskService.QueryManualInboundTask(childDeviceCode);
+                                        if (task != null)
+                                        {
+                                            QuartzLogHelper.LogInfo(_logger, $"鑾峰彇鍒拌緭閫佺嚎寮�濮嬩换鍔★紝浠诲姟鍙凤細{task.TaskNum}锛岀姸鎬�: {task.TaskStatus},褰撳墠鍦板潃锛歿conveyorLine.DeviceCode}", conveyorLine.DeviceCode);
+                                            var handler = new ManualInboundTaskHandler(_taskService, _logger);
+                                            handler.WriteTaskToPlc(conveyorLine, childDeviceCode, task);
+                                        }
+                                    }
+                                    catch (Exception ex)
+                                    {
+                                        QuartzLogHelper.LogError(_logger, ex, "澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父", $"澶勭悊鎵嬪姩鍏ュ簱浠诲姟寮傚父: {ex.Message}", "CommonConveyorLineNewJob");
+                                    }
+                                }
+                            }
 
-                            // ========== 澶勭悊鏃犳墭鐩樻潯鐮佺殑鎯呭喌 ==========
-                            // 鏃犳墭鐩樻潯鐮佹椂锛岃姹傚嚭搴撲换鍔�
-                            if (command.Barcode.IsNullOrEmpty() || command.Barcode.Replace("\0", "") == "")
+                            // 濡傛灉 PLC_STB 涓� 1锛屼絾娌℃湁浠诲姟鍙凤紝鍙兘鏄柊浠诲姟鐨勫紑濮嬶紝鍏堣姹傚嚭搴撲换鍔★紙閫傜敤浜庢棤鏉$爜鐨勬儏鍐碉級
+                            if (command.TaskNo == 1000)
                             {
                                 _conveyorLineDispatch.RequestOutbound(conveyorLine, command, childDeviceCode);
                                 continue;
                             }
 
                             // ========== 澶勭悊宸叉湁浠诲姟鍙风殑鎯呭喌 ==========
-                            if (command.TaskNo > 0 && !command.Barcode.IsNullOrEmpty())
+                            if (command.TaskNo > 0)
                             {
                                 // 鏌ヨ姝e湪鎵ц鐨勪换鍔�
                                 Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
@@ -299,48 +317,6 @@
                                         conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)1, childDeviceCode);
                                     }
                                 }
-                                //else if (!command.Barcode.IsNullOrEmpty() && (childDeviceCode == "11001" || childDeviceCode == "11010"))
-                                //{
-                                //    var isWcsTask = _taskService.Db.Queryable<Dt_Task>().Any(x => x.PalletCode == command.Barcode && (x.TaskStatus == (int)TaskOutStatusEnum.OutNew || x.TaskStatus == (int)TaskInStatusEnum.InNew));
-                                //    var isRobotTask = _robotTaskService.Db.Queryable<Dt_RobotTask>().Any(x => x.RobotTargetAddressPalletCode == command.Barcode);
-                                //    if (isWcsTask || isRobotTask)
-                                //    {
-                                //        continue;
-                                //    }
-
-                                //    // 璋冪敤 WMS 鍒涘缓绌烘墭鐩樺叆搴撲换鍔�
-                                //    string configKey = nameof(ConfigKey.CreateTaskInboundAsync);
-                                //    string requestParam = new CreateTaskDto()
-                                //    {
-                                //        PalletCode = command.Barcode,
-                                //        SourceAddress = childDeviceCode,
-                                //        TargetAddress = "GWSC1",  // 鐩爣鍦板潃
-                                //        Roadway = "GWSC1",             // 宸烽亾
-                                //        WarehouseId = 1,                   // 浠撳簱 ID
-                                //        PalletType = 1,                             // 鎵樼洏绫诲瀷锛堥粯璁や负1锛�
-                                //        TaskType = TaskTypeEnum.InEmpty.GetHashCode()                         // 浠诲姟绫诲瀷锛堝叆搴�/绌烘墭鐩樺叆搴擄級
-                                //    }.Serialize();
-                                //    DateTime startTime = DateTime.Now;
-
-                                //    var responseResult = _httpClientHelper.Post<WebResponseContent>(configKey, requestParam);
-
-                                //    if (responseResult.IsSuccess && responseResult.Data.Status)
-                                //    {
-                                //        QuartzLogHelper.LogInfo(_logger, $"璋冪敤WMS鎺ュ彛鎴愬姛,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,鍝嶅簲鏁版嵁:銆恵responseResult.Data?.Data}銆�,鑰楁椂:{(DateTime.Now - startTime).TotalMilliseconds}ms", conveyorLine.DeviceCode);
-                                //        var wmsTask = JsonConvert.DeserializeObject<WMSTaskDTO>(responseResult?.Data?.Data?.ToString());
-                                //        List<WMSTaskDTO> taskDTOs = new List<WMSTaskDTO> { wmsTask };
-                                //        if (wmsTask == null) continue;
-
-                                //        if (_taskService.ReceiveWMSTask(taskDTOs).Status)
-                                //        {
-                                //            conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, (short)1, childDeviceCode);
-                                //        }
-                                //    }
-                                //    else
-                                //    {
-                                //        QuartzLogHelper.LogError(_logger, $"璋冪敤WMS鎺ュ彛澶辫触,鎺ュ彛:銆恵configKey}銆�,璇锋眰鍙傛暟:銆恵requestParam}銆�,閿欒淇℃伅:銆恵responseResult.Data?.Message}銆�", conveyorLine.DeviceCode);
-                                //    }
-                                //}
                             }
                         }
                         catch (Exception innerEx)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
index d3555a1..1b3c8d5 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
@@ -257,21 +257,21 @@
 
             // 纭畾鐩爣鍦板潃锛氱┖鎵樼洏浠诲姟浣跨敤 "2201"锛屽叾浠栦换鍔′娇鐢� NextAddress
             var isEmptyTask = task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty;
-            var targetAddress = task.CurrentAddress == "2217" ? (isEmptyTask ? "2201" : task.NextAddress) : task.NextAddress;
+            var targetAddress = task.CurrentAddress == "2217" ? (isEmptyTask ? task.TargetAddress : task.NextAddress) : task.NextAddress;
 
             // 澶勭悊鐗规畩鍦板潃 2217锛岄渶瑕佽皟鐢ㄧ洰鏍囧湴鍧�閫夋嫨鍣�
-            if (task.CurrentAddress == "2217" && !_targetAddressSelector.HandleOutboundNextAddress(conveyorLine, targetAddress, childDeviceCode))
-            {
-                return Task.CompletedTask; ;
-            }
+            //if (task.CurrentAddress == "2217" && !_targetAddressSelector.HandleOutboundNextAddress(conveyorLine, targetAddress, childDeviceCode))
+            //{
+            //    return Task.CompletedTask; ;
+            //}
 
             // 璁剧疆浠诲姟鍙枫�佹墭鐩樻潯鐮併�佺洰鏍囧湴鍧�銆乄CS_ACK
             var isTaskNoSet = conveyorLine.SetValue(ConveyorLineDBNameNew.TaskNo, task.TaskNum, childDeviceCode);
 
-            Thread.Sleep(100); // 纭繚 PLC 鑳芥纭鍙栦换鍔″彿鍚庡啀鍐欏叆鏉$爜
+            Thread.Sleep(300); // 纭繚 PLC 鑳芥纭鍙栦换鍔″彿鍚庡啀鍐欏叆鏉$爜
             var isPalletSet = conveyorLine.SetValue(ConveyorLineDBNameNew.Barcode, task.PalletCode, childDeviceCode);
 
-            Thread.Sleep(100); // 纭繚 PLC 鑳芥纭鍙栦换鍔″彿鍚庡啀鍐欏叆鏉$爜
+            Thread.Sleep(300); // 纭繚 PLC 鑳芥纭鍙栦换鍔″彿鍚庡啀鍐欏叆鏉$爜
             bool isTargetSet = conveyorLine.SetValue(ConveyorLineDBNameNew.Target, targetAddress, childDeviceCode);
             //if (targetAddress == "2217" && !isEmptyTask)
             //{
@@ -281,16 +281,16 @@
             //}
             //if (!isTargetSet || !isTaskNoSet || !isPalletSet)
             //{
-            //    QuartzLogHelper.LogError(_logger, $"RequestOutbound锛氫笅鍙戝嚭搴撲换鍔″け璐ワ紝浠诲姟鍙�: {task.TaskNum}锛屽瓙璁惧: {childDeviceCode}", conveyorLine.DeviceCode); 
+            //    QuartzLogHelper.LogError(_logger, $"RequestOutbound锛氫笅鍙戝嚭搴撲换鍔″け璐ワ紝浠诲姟鍙�: {task.TaskNum}锛屽瓙璁惧: {childDeviceCode}", conveyorLine.DeviceCode);
             //    return Task.CompletedTask;
             //}
 
             bool isWmsResult = false;
             // 鏇存柊浠诲姟鐘舵�佹垨浣嶇疆
-            if (isEmptyTask && task.NextAddress == "2217")
+            if (isEmptyTask && (task.TargetAddress == "2103" || task.TargetAddress == "2101"))
             {
                 task.TaskStatus = task.TaskStatus.GetNextNotCompletedStatus<TaskOutStatusEnum>();
-                task.NextAddress = "2201";
+                task.NextAddress = "2103";
                 isWmsResult = _taskService.Repository.UpdateData(task);
             }
             else
@@ -298,7 +298,7 @@
                 isWmsResult = _taskService.UpdateTaskStatusToNext(task).Status;
             }
 
-            if(!isWmsResult)
+            if (!isWmsResult)
             {
                 QuartzLogHelper.LogError(_logger, $"RequestOutbound锛氭洿鏂颁换鍔$姸鎬佸け璐ワ紝浠诲姟鍙�: {task.TaskNum}锛屽瓙璁惧: {childDeviceCode}", conveyorLine.DeviceCode);
                 return Task.CompletedTask;
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
index e003d18..c816827 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineTargetAddressSelector.cs
@@ -68,8 +68,11 @@
 
             var cvState = conveyorLine.GetValue<ConveyorLineDBNameNew, byte>(ConveyorLineDBNameNew.CV_State, nextAddress);
             bool isAvailable = cvState == 2;
+            WriteDebug(conveyorLine, "鍑哄簱涓嬩竴鍦板潃鐘舵��", childDeviceCode, $"CV_State={cvState}锛屽彲鐢�={isAvailable}");
             if (isAvailable)
             {
+                WriteDebug(conveyorLine, "鍑哄簱涓嬩竴鍦板潃鍙敤锛屽啓鍏ョ洰鏍囧湴鍧�", childDeviceCode, nextAddress);
+                Thread.Sleep(300); // 鐭殏绛夊緟锛岀‘淇濊澶囩姸鎬佺ǔ瀹氬悗鍐嶅啓鍏ョ洰鏍囧湴鍧�
                 return conveyorLine.SetValue(ConveyorLineDBNameNew.Target, Convert.ToInt16(nextAddress), childDeviceCode);
             }
             return false;
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
index 318ed17..06c1c36 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotTaskProcessor.cs
@@ -627,6 +627,12 @@
             // 瑙f瀽 WMS 杩斿洖鐨勪换鍔′俊鎭�
             WMSTaskDTO taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(result.Data.Data.ToJson() ?? string.Empty) ?? new WMSTaskDTO();
 
+            var task = await _taskService.Repository.QueryFirstAsync(x => x.PalletCode == taskDTO.PalletCode);
+            if(task != null)
+            {
+                await _taskService.Repository.DeleteDataAsync(task);
+            }
+
             // 璋冪敤浠诲姟鏈嶅姟鎺ユ敹 WMS 浠诲姟
             var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
             if (!content.Status)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
index d60d160..2c7f640 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
@@ -197,7 +197,7 @@
                             // 璋冪敤鎵归噺鎷嗙洏纭鎺ュ彛
                             var sourcePallet = state.CurrentTask.RobotSourceAddressPalletCode;
                             var confirmResult = _taskProcessor.PostSplitPalletConfirmAsync(sourcePallet, state.RobotCrane?.DeviceName);
-                            if (!confirmResult.IsSuccess)
+                            if (!confirmResult.IsSuccess && !confirmResult.Data.Status)
                             {
                                 QuartzLogHelper.LogError(_logger, $"鎵归噺鎷嗙洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
                                 return false;
@@ -314,7 +314,7 @@
                             // 璋冪敤鎵归噺缁勭洏纭鎺ュ彛
                             var targetPallet = state.CurrentTask.RobotTargetAddressPalletCode;
                             var confirmResult = _taskProcessor.PostGroupPalletConfirmAsync(targetPallet, state.RobotCrane?.DeviceName);
-                            if (!confirmResult.IsSuccess)
+                            if (!confirmResult.IsSuccess && !confirmResult.Data.Status)
                             {
                                 QuartzLogHelper.LogError(_logger, $"鎵归噺缁勭洏纭澶辫触: {confirmResult.ErrorMessage}", state.RobotCrane?.DeviceName ?? "Unknown");
                                 return false;
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
index 3d5241e..8cba5b3 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
@@ -396,10 +396,13 @@
                 // 鐩爣鏁伴噺涓�48锛氱洿鎺ヨ蛋鍘熸湁閫昏緫锛屼笉杩涘叆鎵规妯″紡
                 if (targetNormalCount + currentCompletedCount == targetTotal)
                 {
+                    QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氱洰鏍囨暟閲忓凡杈�48锛岀洿鎺ヤ笅鍙戝彇璐ф寚浠わ紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                     await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate);
                     return;
                 }
 
+                QuartzLogHelper.LogDebug(_logger,$"HandlePutFinishedStateAsync锛氭崲鐩樹换鍔$洰鏍囨暟閲�: {targetNormalCount}锛屽綋鍓嶅凡瀹屾垚鏁伴噺: {currentCompletedCount}锛屾祦鍚�: {(isFlowA ? "A" : "B")}锛屼换鍔″彿: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+
                 // 鍒濆鍖栨壒娆℃ā寮�
                 if (stateForUpdate.ChangePalletPhase == 0)
                 {
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
index 15fd6f2..2c7f8f4 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SocketServer/TcpSocketServer.Messaging.cs
@@ -3,6 +3,7 @@
 using System.Text.Json;
 using System.IO;
 using WIDESEAWCS_Model.Models;
+using Serilog.Core;
 
 namespace WIDESEAWCS_Tasks.SocketServer
 {
@@ -64,6 +65,7 @@
                         //{
                         //    if (_clientLastMessage.TryGetValue(clientId, out var prev) && message == prev)
                         //    {
+                        //        QuartzLogHelper.LogInfo(Logger.None, $"鏉ヨ嚜瀹㈡埛绔� {clientId} 鐨勯噸澶嶆秷鎭紝鍐呭: {message}", clientId);
                         //        continue;
                         //    }
                         //    _clientLastMessage[clientId] = message;
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index f24aa72..4568c72 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -121,36 +121,6 @@
         }
 
         /// <summary>
-        /// 鍔犺浇閰嶇疆鏂囦欢锛堜紭鍏堢骇锛氶厤缃枃浠� > 榛樿閰嶇疆锛�
-        /// </summary>
-        /// <remarks>
-        /// 浠庡簲鐢ㄧ▼搴忕洰褰曚笅鐨� StackerCraneJob/stackercrane-command-config.json 璇诲彇閰嶇疆銆�
-        /// 濡傛灉鏂囦欢涓嶅瓨鍦ㄦ垨瑙f瀽澶辫触锛屼娇鐢ㄩ粯璁ら厤缃��
-        /// </remarks>
-        /// <returns>鍫嗗灈鏈哄懡浠ら厤缃�</returns>
-        private static StackerCraneCommandConfig LoadConfig()
-        {
-            try
-            {
-                // 鏋勯�犻厤缃枃浠惰矾寰�
-                string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "StackerCraneJob", "stackercrane-command-config.json");
-                if (File.Exists(configPath))
-                {
-                    // 璇诲彇骞惰В鏋� JSON 閰嶇疆
-                    string json = File.ReadAllText(configPath);
-                    return System.Text.Json.JsonSerializer.Deserialize<StackerCraneCommandConfig>(json) ?? new StackerCraneCommandConfig();
-                }
-            }
-            catch (Exception ex)
-            {
-                // 閰嶇疆鍔犺浇澶辫触锛屼娇鐢ㄩ粯璁ら厤缃�
-                Console.WriteLine($"閰嶇疆鍔犺浇澶辫触: {ex.Message}锛屼娇鐢ㄩ粯璁ら厤缃�");
-            }
-
-            return new StackerCraneCommandConfig();
-        }
-
-        /// <summary>
         /// Quartz Job 鐨勬墽琛屽叆鍙�
         /// </summary>
         /// <remarks>
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
index 712dd6c..7e4a4ea 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneTaskSelector.cs
@@ -1,7 +1,6 @@
 using Newtonsoft.Json;
 using Serilog;
 using System.Diagnostics.CodeAnalysis;
-using System.Threading.Tasks;
 using WIDESEA_Core;
 using WIDESEAWCS_Common.Constants;
 using WIDESEAWCS_Common.HttpEnum;
@@ -10,7 +9,6 @@
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.ConveyorLine.Enum;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Service;
 
@@ -208,7 +206,7 @@
         {
             // 鍏堣繘琛屾湰鍦扮珯鍙版鏌ワ紙PLC 璇诲彇锛屽揩閫燂級锛岄伩鍏嶄笉蹇呰鐨� WMS HTTP 璋冪敤
 
-            if (outboundTask.TaskType != (int)TaskOutboundTypeEnum.OutEmpty && outboundTask.Roadway != "GWSC1" && outboundTask.TargetAddress != "CWSC1")
+            if (outboundTask.TaskType != (int)TaskOutboundTypeEnum.OutEmpty && outboundTask.TargetAddress != "CWSC1")
             {
                 // 鍒ゆ柇 TargetAddress 杈撻�佺嚎绔欏彴鏄惁绌洪棽
                 if (!IsTargetAddressConveyorStationAvailable(outboundTask))
@@ -223,18 +221,18 @@
                 return null;
             }
 
-            if (outboundTask.TargetAddress != "CWSC1")
+            //if (outboundTask.TargetAddress != "CWSC1")
+            //{
+            // 妫�鏌ユ槸鍚︽湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟鍘诲線鍚屼竴 TargetAddress
+            if (_taskService.HasExecutingTaskToTarget(outboundTask.Roadway, outboundTask.TargetAddress))
             {
-                // 妫�鏌ユ槸鍚︽湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟鍘诲線鍚屼竴 TargetAddress
-                if (_taskService.HasExecutingTaskToTarget(outboundTask.Roadway, outboundTask.TargetAddress))
-                {
-                    QuartzLogHelper.LogInfo(_logger, "TrySelectOutboundTask锛歍argetAddress: {TargetAddress} 宸叉湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟锛屼换鍔″彿: {TaskNum}",
-                        $"TrySelectOutboundTask锛歍argetAddress: {outboundTask.TargetAddress} 宸叉湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟", outboundTask.Roadway, outboundTask.TargetAddress, outboundTask.TaskNum);
-                    return null;
-                }
+                QuartzLogHelper.LogInfo(_logger, "TrySelectOutboundTask锛歍argetAddress: {TargetAddress} 宸叉湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟锛屼换鍔″彿: {TaskNum}",
+                    $"TrySelectOutboundTask锛歍argetAddress: {outboundTask.TargetAddress} 宸叉湁姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟", outboundTask.Roadway, outboundTask.TargetAddress, outboundTask.TaskNum);
+                return null;
             }
+            //}
 
-            if(outboundTask.Roadway != "GWSC1")
+            if (outboundTask.Roadway != "GWSC1")
             {
                 return outboundTask;
             }
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
index d7aee6d..2a1433c 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/LocationInfoService.cs
@@ -159,9 +159,12 @@
                     && x.LocationType == locationType)
                 .CountAsync();
 
-            // 绌洪棽璐т綅涓嶈冻鏈�浣庝繚鐣欐暟閲忔椂杩斿洖null锛岄伩鍏嶅皢宸烽亾鍒嗛厤鑰楀敖
-            const int minFreeLocationThreshold = 5;
-            if (freeCount < minFreeLocationThreshold) return null;
+            if(roadwayNo != "CWSC1")
+            {
+                // 绌洪棽璐т綅涓嶈冻鏈�浣庝繚鐣欐暟閲忔椂杩斿洖null锛岄伩鍏嶅皢宸烽亾鍒嗛厤鑰楀敖
+                const int minFreeLocationThreshold = 1;
+                if (freeCount < minFreeLocationThreshold) return null;
+            }
 
             // 鏁版嵁搴撶鎺掑簭鍙栫涓�鏉★紙鍙紶杈撳崟琛屾暟鎹級
             return await BaseDal.Db.Queryable<Dt_LocationInfo>()
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/OutboundTimeConstants.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/OutboundTimeConstants.cs
index b1e0174..fdd7553 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/OutboundTimeConstants.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/OutboundTimeConstants.cs
@@ -29,16 +29,16 @@
         /// <summary>
         /// GW_1棣栨斁鍏ュ簱鏃舵晥锛�24灏忔椂锛�
         /// </summary>
-        public const int OUTBOUND_HOURS_GW1_FIRST = 24;
+        public const double OUTBOUND_HOURS_GW1_FIRST = 24;
 
         /// <summary>
-        /// GW_1浜屾斁鍏ュ簱鏃舵晥锛�24灏忔椂锛�
+        /// GW_1浜屾斁鍏ュ簱鏃舵晥锛�5鍒嗛挓锛�
         /// </summary>
-        public const int OUTBOUND_HOURS_GW1_SECOND = 24;
+        public const double OUTBOUND_HOURS_GW1_SECOND = 0.05;
 
         /// <summary>
-        /// CW_1鍑哄簱鏃舵晥锛�12灏忔椂锛�
+        /// CW_1鍑哄簱鏃舵晥锛�3灏忔椂锛�
         /// </summary>
-        public const int OUTBOUND_HOURS_CW1 = 12;
+        public const double OUTBOUND_HOURS_CW1 = 3;
     }
 }
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/TaskAddressConstants.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/TaskAddressConstants.cs
index 21577e5..ab4ed07 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/TaskAddressConstants.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Common/Constants/TaskAddressConstants.cs
@@ -13,7 +13,7 @@
         /// <summary>
         /// 楂樻俯1鍙峰嚭搴撳湴鍧�鍒楄〃锛堣疆璇級
         /// </summary>
-        public static readonly string[] GW1_ADDRESSES = { "11001" };
+        public static readonly string[] GW1_ADDRESSES = { "11010" };
 
         /// <summary>
         /// 楂樻俯2鍙峰嚭搴撳湴鍧�
@@ -28,7 +28,7 @@
         /// <summary>
         /// 鍒嗗搴撳嚭搴撳湴鍧�
         /// </summary>
-        public const string GRADING_OUTBOUND_ADDRESS = "2103";
+        public const string GRADING_OUTBOUND_ADDRESS = "2101";
 
         /// <summary>
         /// 鍒嗗搴撳嚭搴撳湴鍧�
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
index f36e945..2d22bbb 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -141,8 +141,10 @@
                             Creater = StockConstants.SYSTEM_USER,
                             Details = null,
                             LocationCode = location.LocationCode,
-                            LocationId = location.Id
+                            LocationId = location.Id,
+                            OutboundDate = DateTime.Now
                         };
+                        location.LocationStatus = LocationStatusEnum.InStock.GetHashCode();
                         var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(location);
                         var updateStockResult = await _stockInfoService.Repository.AddDataAsync(stockInfo);
                         return await CompleteTaskAsync(task, "鍏ュ簱瀹屾垚");
@@ -167,6 +169,8 @@
 
                         stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.GetHashCode();
 
+                        stockInfo.CreateDate = DateTime.Now;
+
                         location.LocationStatus = LocationStatusEnum.InStock.GetHashCode();
 
                         var updateLocationResult = await _locationInfoService.UpdateLocationInfoAsync(location);
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
index e3428ef..3e2a67d 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -34,7 +34,7 @@
   "MainDB": "DB_WIDESEA", //褰撳墠椤圭洰鐨勪富搴擄紝鎵�瀵瑰簲鐨勮繛鎺ュ瓧绗︿覆鐨凟nabled蹇呴』涓簍rue
   //杩炴帴瀛楃涓�
   //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
-  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionString": "Data Source=192.168.60.30;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=WMS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //鏃MS鏁版嵁搴撹繛鎺�

--
Gitblit v1.9.3