From a95a257a702360e7632b5daeb5b554163382720c Mon Sep 17 00:00:00 2001 From: 647556386 <647556386@qq.com> Date: 星期四, 17 四月 2025 17:00:59 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 58 insertions(+), 2 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 5717f5c..14bd190 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" @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using WIDESEA_Common.APIEnum; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; using WIDESEA_Common.OtherEnum; @@ -29,14 +30,17 @@ } if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) { + FeedBackWCSTaskCompleted(taskNum); return InboundTaskCompleted(taskNum); } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { + FeedBackWCSTaskCompleted(taskNum); return OutboundTaskCompleted(taskNum); } - else if (task.TaskType.GetTaskTypeGroup() != TaskTypeGroup.RelocationGroup) + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) { + FeedBackWCSTaskCompleted(taskNum); return RelocationTaskCompleted(task); } else @@ -69,7 +73,13 @@ { x.AGVArea = agvDescription; }); - string response = HttpHelper.Post("http://127.0.0.1:9291/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("杩斿洖閿欒"); } @@ -78,5 +88,51 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + /// <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); + } + } + public WebResponseContent FeedBackWCSTaskCompleted(int taskNum) + { + try + { + Dt_ApiInfo? url = _apiInfoRepository.QueryData(x => x.ApiCode == APIEnum.FeedBackWCSTaskCompleted.ToString()).First(); + string? apiAddrss = url.ApiAddress; + if (string.IsNullOrEmpty(apiAddrss)) + { + return WebResponseContent.Instance.Error($"{taskNum},鏈壘鍒癢CS浠诲姟瀹屾垚鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�"); + } + string responseStr = HttpHelper.Get(apiAddrss + "?taskNum=" + taskNum); + WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(responseStr) ?? WebResponseContent.Instance.Error("鏈壘鍒颁换鍔″畬鎴愯繑鍥炲��"); + return content; + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + + } } } -- Gitblit v1.9.3