From 96e6dc957aee5d20218ac8127a28db6a7e6ba6de Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 10 一月 2025 10:00:52 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 07d66bd..d23cf79 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -170,7 +170,7 @@
                         Dt_StationManger stationManger;
                         if (taskTypeGroup == TaskTypeGroup.InboundGroup)
                         {
-                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress);
+                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress);
                         }
                         else
                         {
@@ -181,7 +181,7 @@
                             return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�");
                         }
 
-                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi));
+                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi || item.RoadWay == x.ChildPosiDeviceCode || item.RoadWay == x.ChildPosi));
                         router = routers.FirstOrDefault();
                         if (router == null)
                         {
@@ -194,6 +194,11 @@
                             {
                                 task.NextAddress = router.NextPosi;
                                 task.DeviceCode = stationManger.StationDeviceCode;
+                            }
+                            else if(item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt())
+                            {
+                                task.NextAddress = router.NextPosi;
+                                task.DeviceCode = stationManger.StackerCraneCode;
                             }
                             else
                             {
@@ -284,8 +289,12 @@
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙颁俊鎭�");
                 }
-
-                string responseStr = HttpHelper.Get($"http://127.0.0.1:9283/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
+                string address = AppSettings.Get("WMSApiAddress");
+                if(string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                }
+                string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
                 WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                 if (responseContent != null && responseContent.Status && responseContent.Data != null)
                 {
@@ -304,6 +313,31 @@
             return content;
         }
 
+        public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string address = AppSettings.Get("WMSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                }
+                string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}",roadwayNos.Serialize());
+                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+                if (responseContent != null && responseContent.Status && responseContent.Data != null)
+                {
+                    return responseContent;
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+
         /// <summary>
         /// 鍚慦MS鐢宠鍒嗛厤璐т綅
         /// </summary>

--
Gitblit v1.9.3