From fe2a1e74780259605cd230e6f9c629c3dd7fdf15 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 20:19:06 +0800
Subject: [PATCH] feat: 添加消防任务支持并修复堆垛机状态处理

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs |   66 ++++++++++++++++++++++++---------
 1 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
index 5c80729..8d2a3ac 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_WCS.cs
@@ -193,12 +193,42 @@
                     WebResponseContent content = new WebResponseContent();
                     stockInfo.LocationCode = location.LocationCode;
                     stockInfo.LocationId = location.Id;
-                    stockInfo.OutboundDate = task.Roadway switch
+
+                    var now = DateTime.Now;
+                    if (task.Roadway.Contains("GW"))
                     {
-                        var r when r.Contains("GW") => DateTime.Now.AddHours(2),
-                        var r when r.Contains("CW") => DateTime.Now.AddHours(1),
-                        _ => DateTime.Now
-                    };
+                        if (stockInfo.Remark.IsNullOrEmpty())
+                        {
+                            stockInfo.OutboundDate = now.AddHours(16);
+                            stockInfo.Remark = "GW_1";
+                        }
+                        else if (stockInfo.Remark == "GW_1")
+                        {
+                            stockInfo.OutboundDate = now.AddHours(24);
+                            stockInfo.Remark = "GW_2";
+                        }
+                        else
+                        {
+                            stockInfo.OutboundDate = now.AddHours(16);
+                        }
+                    }
+                    else if (task.Roadway.Contains("CW"))
+                    {
+                        if (stockInfo.Remark == "GW_2")
+                        {
+                            stockInfo.OutboundDate = now.AddHours(12);
+                            stockInfo.Remark = "CW_1";
+                        }
+                        else
+                        {
+                            stockInfo.OutboundDate = now.AddHours(12);
+                        }
+                    }
+                    else
+                    {
+                        stockInfo.OutboundDate = now;
+                    }
+
                     stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.GetHashCode();
 
                     location.LocationStatus = LocationStatusEnum.InStock.GetHashCode();
@@ -208,18 +238,18 @@
                     if (!updateLocationResult || !updateStockResult)
                         return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
                     // 璋冪敤MES鎵樼洏杩涚珯
-                    var inboundRequest = new InboundInContainerRequest
-                    {
-                        EquipmentCode = "STK-GROUP-001",
-                        ResourceCode = "STK-GROUP-001",
-                        LocalTime = DateTime.Now,
-                        ContainerCode = taskDto.PalletCode
-                    };
-                    var inboundResult = _mesService.InboundInContainer(inboundRequest);
-                    if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
-                    {
-                        return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
-                    }
+                    //var inboundRequest = new InboundInContainerRequest
+                    //{
+                    //    EquipmentCode = "STK-GROUP-001",
+                    //    ResourceCode = "STK-GROUP-001",
+                    //    LocalTime = DateTime.Now,
+                    //    ContainerCode = taskDto.PalletCode
+                    //};
+                    //var inboundResult = _mesService.InboundInContainer(inboundRequest);
+                    //if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
+                    //{
+                    //    return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+                    //}
                     return await CompleteTaskAsync(task, "鍏ュ簱瀹屾垚");
                 });
             }
@@ -793,7 +823,7 @@
                     if (stockInfo.LocationId > 0 || !string.IsNullOrWhiteSpace(stockInfo.LocationCode))
                         return WebResponseContent.Instance.Error($"鎵樼洏[{stockPalletCode}]搴撳瓨宸茬粦瀹氳揣浣嶏紝涓嶈兘鍒涘缓鏈烘鎵媨taskName}浠诲姟");
                 }
-                var section = App.Configuration.GetSection("RobotTaskAddressRules").GetSection(targetLineNo).GetChildren().Select(c => c.Value).ToArray(); 
+                var section = App.Configuration.GetSection("RobotTaskAddressRules").GetSection(targetLineNo).GetChildren().Select(c => c.Value).ToArray();
 
                 var task = new Dt_Task
                 {

--
Gitblit v1.9.3