From 89051aef8a2c1a85d457914cf6317fe70e0e321c Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期日, 29 十二月 2024 04:33:10 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Completed.cs | 80 +++++++++++++++++++++++++++++++--------- 1 files changed, 62 insertions(+), 18 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 5d4650e..5717f5c 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" @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -17,22 +18,65 @@ { public partial class TaskService { - //public WebResponseContent TaskCompleted(int taskNum) - //{ - // try - // { - // Dt_Task task = Repository.QueryFirst(x => x.TaskNum == taskNum); - // if (task == null) - // { - // return WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�"); - // } - // if(task.TaskType.get) - - // } - // catch (Exception ex) - // { - // return WebResponseContent.Instance.Error(ex.Message); - // } - //} + public WebResponseContent TaskCompleted(int taskNum) + { + try + { + Dt_Task task = Repository.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�"); + } + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + { + return InboundTaskCompleted(taskNum); + } + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + { + return OutboundTaskCompleted(taskNum); + } + else if (task.TaskType.GetTaskTypeGroup() != TaskTypeGroup.RelocationGroup) + { + return RelocationTaskCompleted(task); + } + else + { + return WebResponseContent.Instance.Error($"鏈壘鍒拌绫诲瀷浠诲姟,浠诲姟绫诲瀷:{task.TaskType}"); + } + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } + + /// <summary> + /// 浠诲姟淇℃伅鎺ㄩ�佽嚦WCS + /// </summary> + /// <returns></returns> + public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "") + { + try + { + Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error($"閿欒,鏈壘鍒拌浠诲姟淇℃伅"); + } + + List<WMSTaskDTO> taskDTOs = new List<WMSTaskDTO> { _mapper.Map<WMSTaskDTO>(task) }; + taskDTOs.ForEach(x => + { + x.AGVArea = agvDescription; + }); + string response = HttpHelper.Post("http://127.0.0.1:9291/api/Task/ReceiveTask", taskDTOs.Serialize()); + + return JsonConvert.DeserializeObject<WebResponseContent>(response) ?? WebResponseContent.Instance.Error("杩斿洖閿欒"); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } -- Gitblit v1.9.3