From 17bca2d690f283ec110c0c327a8508ed8fba9d21 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 05 六月 2025 09:21:19 +0800
Subject: [PATCH] 最新代码提交

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs |   55 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 41 insertions(+), 14 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs"
index 54f6266..30a4ea6 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs"
@@ -18,35 +18,35 @@
 {
     public partial class TaskService
     {
-        public WebResponseContent TaskCompleted(int taskNum)
+        public async Task<WebResponseContent> TaskCompleted(int taskNum)
         {
             try
             {
-                Dt_Task task = Repository.QueryFirst(x => x.TaskNum == taskNum);
+                Dt_Task task = await Repository.QueryFirstAsync(x => x.TaskNum == taskNum);
                 if (task == null)
                 {
-                    return WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�");
+                    return await Task.FromResult(WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�"));
                 }
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                 {
-                    return InboundTaskCompleted(taskNum);
+                    return await Task.FromResult(InboundTaskCompleted(taskNum));
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
-                    return OutboundTaskCompleted(taskNum);
+                    return await Task.FromResult(OutboundTaskCompleted(taskNum));
                 }
-                else if (task.TaskType.GetTaskTypeGroup() != TaskTypeGroup.RelocationGroup)
+                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                 {
-                    return RelocationTaskCompleted(task);
+                    return await Task.FromResult(RelocationTaskCompleted(task));
                 }
                 else
                 {
-                    return WebResponseContent.Instance.Error($"鏈壘鍒拌绫诲瀷浠诲姟,浠诲姟绫诲瀷:{task.TaskType}");
+                    return await Task.FromResult(WebResponseContent.Instance.Error($"鏈壘鍒拌绫诲瀷浠诲姟,浠诲姟绫诲瀷:{task.TaskType}"));
                 }
             }
             catch (Exception ex)
             {
-                return WebResponseContent.Instance.Error(ex.Message);
+                return await Task.FromResult(WebResponseContent.Instance.Error(ex.Message));
             }
         }
 
@@ -69,7 +69,13 @@
                 {
                     x.AGVArea = agvDescription;
                 });
-                string response = HttpHelper.Post("http://127.0.0.1:9281/api/Task/ReceiveTask", taskDTOs.Serialize());
+
+                string url = AppSettings.Get("WCS");
+                if (string.IsNullOrEmpty(url))
+                {
+                    throw new Exception($"鏈壘鍒癢CSAApi鍦板潃,璇锋鏌ラ厤缃枃浠�");
+                }
+                string response = HttpHelper.Post($"{url}/api/Task/ReceiveTask", taskDTOs.Serialize());
 
                 return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒");
             }
@@ -79,9 +85,30 @@
             }
         }
 
-        //public WebResponseContent UpdateTaskInfo(WCSTaskDTO taskDTO)
-        //{
-
-        //}
+        /// <summary>
+        /// 淇敼浠诲姟鐘舵��
+        /// </summary>
+        /// <param name="task"></param>
+        /// <returns></returns>
+        public WebResponseContent UpdateTaskInfo(WCSTaskDTO task)
+        {
+            try
+            {
+                Dt_Task wmsTask = BaseDal.QueryFirst(x=>x.TaskNum == task.TaskNum);
+                if (wmsTask != null)
+                {
+                    wmsTask.TaskStatus = task.TaskState;
+                    wmsTask.CurrentAddress = task.CurrentAddress;
+                    wmsTask.NextAddress = task.NextAddress;
+                    wmsTask.Dispatchertime = task.Dispatchertime;
+                    BaseDal.UpdateData(wmsTask);
+                }
+                return WebResponseContent.Instance.OK();
+            }
+            catch(Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }

--
Gitblit v1.9.3