From 5171d3f59b89389bf75293afd210cfa6de4ccff7 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 23:03:49 +0800
Subject: [PATCH] feat: 添加堆垛机相关常量类并重构代码使用常量

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs |   52 +++++++++++++++++++++++++++-------------------------
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
index 8d2a3ac..d4fde20 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
@@ -4,6 +4,7 @@
 using SqlSugar;
 using System.DirectoryServices.Protocols;
 using System.Text.Json;
+using WIDESEA_Common.Constants;
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
@@ -199,29 +200,29 @@
                     {
                         if (stockInfo.Remark.IsNullOrEmpty())
                         {
-                            stockInfo.OutboundDate = now.AddHours(16);
-                            stockInfo.Remark = "GW_1";
+                            stockInfo.OutboundDate = now.AddHours(OutboundTimeConstants.OUTBOUND_HOURS_GW1_FIRST);
+                            stockInfo.Remark = StockRemarkConstants.GW1;
                         }
-                        else if (stockInfo.Remark == "GW_1")
+                        else if (stockInfo.Remark == StockRemarkConstants.GW1)
                         {
-                            stockInfo.OutboundDate = now.AddHours(24);
-                            stockInfo.Remark = "GW_2";
+                            stockInfo.OutboundDate = now.AddHours(OutboundTimeConstants.OUTBOUND_HOURS_GW1_SECOND);
+                            stockInfo.Remark = StockRemarkConstants.GW2;
                         }
                         else
                         {
-                            stockInfo.OutboundDate = now.AddHours(16);
+                            stockInfo.OutboundDate = now.AddHours(OutboundTimeConstants.OUTBOUND_HOURS_GW1_FIRST);
                         }
                     }
                     else if (task.Roadway.Contains("CW"))
                     {
-                        if (stockInfo.Remark == "GW_2")
+                        if (stockInfo.Remark == StockRemarkConstants.GW2)
                         {
-                            stockInfo.OutboundDate = now.AddHours(12);
-                            stockInfo.Remark = "CW_1";
+                            stockInfo.OutboundDate = now.AddHours(OutboundTimeConstants.OUTBOUND_HOURS_CW1);
+                            stockInfo.Remark = StockRemarkConstants.CW1;
                         }
                         else
                         {
-                            stockInfo.OutboundDate = now.AddHours(12);
+                            stockInfo.OutboundDate = now.AddHours(OutboundTimeConstants.OUTBOUND_HOURS_CW1);
                         }
                     }
                     else
@@ -302,19 +303,19 @@
                         return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
 
                     // 璋冪敤MES鎵樼洏鍑虹珯
-                    var outboundRequest = new OutboundInContainerRequest
-                    {
-                        EquipmentCode = "STK-GROUP-001",
-                        ResourceCode = "STK-GROUP-001",
-                        LocalTime = DateTime.Now,
-                        ContainerCode = taskDto.PalletCode,
-                        ParamList = new List<ParamItem>()
-                    };
-                    var outboundResult = _mesService.OutboundInContainer(outboundRequest);
-                    if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess)
-                    {
-                        return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES鍑虹珯澶辫触: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
-                    }
+                    //var outboundRequest = new OutboundInContainerRequest
+                    //{
+                    //    EquipmentCode = "STK-GROUP-001",
+                    //    ResourceCode = "STK-GROUP-001",
+                    //    LocalTime = DateTime.Now,
+                    //    ContainerCode = taskDto.PalletCode,
+                    //    ParamList = new List<ParamItem>()
+                    //};
+                    //var outboundResult = _mesService.OutboundInContainer(outboundRequest);
+                    //if (outboundResult == null || outboundResult.Data == null || !outboundResult.Data.IsSuccess)
+                    //{
+                    //    return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES鍑虹珯澶辫触: {outboundResult?.Data?.Msg ?? outboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+                    //}
 
                     return await CompleteTaskAsync(task, "鍑哄簱瀹屾垚");
                 });
@@ -637,8 +638,9 @@
                 var taskList = new List<Dt_Task>();
                 foreach (var stock in stocksToProcess)
                 {
-                    // 鏍规嵁宸烽亾纭畾鐩爣鍦板潃
-                    var targetAddress = DetermineTargetAddress(
+                    // 鏍规嵁宸烽亾纭畾鐩爣鍦板潃锛堜紭鍏堟牴鎹� Remark 纭畾锛孯emark 涓虹┖鍒欐牴鎹贩閬撻厤缃級
+                    var targetAddress = DetermineTargetAddressByRemark(
+                        stock.Remark ?? "",
                         stock.LocationDetails?.RoadwayNo ?? "",
                         targetAddressMap);
 

--
Gitblit v1.9.3