From c2cdf0b95d4c9214646c860609b8c838d6ffa779 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 15 八月 2025 13:42:10 +0800
Subject: [PATCH] AGV,成品库代码更新上传

---
 项目代码/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs |   77 ++++++++++++++++++++++++++++++++++----
 1 files changed, 69 insertions(+), 8 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 17eb286..fbca59f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -251,6 +251,32 @@
                                 task.NextAddress = router.NextPosi;
                             }
                         }
+                        else
+                        {
+                            if (taskTypeGroup == TaskTypeGroup.InboundGroup && !task.Roadway.Contains("YL"))
+                            {
+                                task.CurrentAddress = router.StartPosi;
+                                task.NextAddress = "";
+                                task.DeviceCode = router.ChildPosiDeviceCode;
+                            }
+                            else
+                            {
+                                router = routers.FirstOrDefault(x=>x.ChildPosiDeviceCode==task.Roadway);
+                                task.CurrentAddress = router.StartPosi;
+                                task.NextAddress = router.NextPosi;
+                                task.DeviceCode = router.ChildPosi;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && x.StartPosi=="AGV" && x.ChildPosiDeviceCode==item.RoadWay);
+                        router = routers.FirstOrDefault();
+                        if (routers.Count == 1)
+                        {
+                            task.NextAddress = router.NextPosi;
+                            task.DeviceCode = router.ChildPosi;
+                        }
                     }
                     tasks.Add(task);
                 }
@@ -314,14 +340,49 @@
             }
             return content;
         }
-
-        /// <summary>
-        /// 
+        // <summary>
+        /// 璇锋眰鍏ュ簱浠诲姟
         /// </summary>
-        /// <param name="palletCode"></param>
-        /// <param name="sourceAddress"></param>
+        /// <param name="palletCode">鎵樼洏鍙�</param>
+        /// <param name="sourceAddress">璧峰鍦板潃</param>
+        /// /// <param name="roadWay">宸烽亾</param>
         /// <returns></returns>
-        public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, int taskType=630)
+        public WebResponseContent RequestYLWMSTaskSimple(string palletCode, string sourceAddress)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string address = AppSettings.Get("WMSApiAddress");
+                if (string.IsNullOrEmpty(address))
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒癢MSApi鍦板潃");
+                }
+                string responseStr = HttpHelper.Get($"{address}/api/Task/RequestYLWMSTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}");
+                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+                if (responseContent != null && responseContent.Status && responseContent.Data != null)
+                {
+                    WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString());
+                    if (taskDTO != null)
+                    {
+                        content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                    }
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+        }
+        // <summary>
+        /// 璇锋眰鍏ュ簱浠诲姟
+        /// </summary>
+        /// <param name="palletCode">鎵樼洏鍙�</param>
+        /// <param name="sourceAddress">璧峰鍦板潃</param>
+        /// /// <param name="roadWay">宸烽亾</param>
+        /// <returns></returns>
+        public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress, string roadWay="", int taskType=630)
         {
             WebResponseContent content = new WebResponseContent();
             try
@@ -342,8 +403,8 @@
                 {
                     Id = 1,
                     TaskNum = DateTime.Now.ToString("mmss").ObjToInt(),
-                    PalletCode="",
-                    RoadWay="",
+                    PalletCode= palletCode,
+                    RoadWay= roadWay ?? "",
                     TaskType= taskType,
                     PalletType=1,
                     TaskStatus=TaskStatusEnum.New.ObjToInt(),

--
Gitblit v1.9.3