From 441b6f8d257a01b2998253ef0515a201777d7e68 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期五, 04 七月 2025 14:06:49 +0800 Subject: [PATCH] 修改入库、移库、出库逻辑 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/PartialTaskService_StackCrane.cs | 103 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 64 insertions(+), 39 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/PartialTaskService_StackCrane.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/PartialTaskService_StackCrane.cs" index 97ba682..4e6adcb 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/PartialTaskService_StackCrane.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/PartialTaskService_StackCrane.cs" @@ -17,6 +17,20 @@ public partial class TaskService { + public WebResponseContent ToWMSCompletedTask(Dt_Task task) + { + WebResponseContent content = new WebResponseContent(); + try + { + WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); + HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); + return content.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } /// <summary> /// 鍫嗗灈鏈轰换鍔″畬鎴� /// </summary> @@ -45,65 +59,76 @@ _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�"); //todo 鍚屾鍒癢MS - + WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); + HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); //鏆備笉鑰冭檻澶氫釜鍑哄簱鍙� } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting) { //todo int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>(); + task.CurrentAddress = task.NextAddress; + task.NextAddress = string.Empty; task.TaskState = nextStatus; task.ModifyDate = DateTime.Now; task.Modifier = "System"; + WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); + if (task.TargetIsPickPlace) + { + task.TaskState = (int)TaskInStatusEnum.InFinish; + AddTask_Hty(task, TaskOperateTypeEnum.AutoComplete); + } + else + BaseDal.UpdateData(task); + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�"); #region 鍚慦MS鍙嶉鍫嗗灈鏈轰换鍔″畬鎴� - WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); - var ResultData = HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); - if (ResultData.Result == null) throw new Exception($"浠诲姟鐘舵�佸悓姝ュ埌WMS澶辫触!浠诲姟鍙�:{task.TaskNum}"); - content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result); - if (content.Status) - { - //isDel = content.Status; - BaseDal.UpdateData(task); - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�"); - } - #endregion - #region MyRegion - - - - //WMSTaskDTO taskDTO = new WMSTaskDTO() - //{ - // TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")), - // Grade = 1, - // PalletCode = task.PalletCode + "S", - // RoadWay = "SC01", - // SourceAddress = task.TargetAddress, - // TargetAddress = "CLOutAreaA", - // TaskState = (int)TaskOutStatusEnum.OutNew, - // Id = 0, - // TaskType = (int)TaskOutboundTypeEnum.Outbound - //}; - - //content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); + HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); #endregion } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup && task.TaskState == (int)TaskRelocationStatusEnum.SC_RelocationExecuting)//绉诲簱 { - //todo 璋冪敤WMS绉诲簱瀹屾垚 - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup && task.TaskState == (int)TaskCarStatusEnum.SC_CarExecuting) - { - int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>(); + int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskRelocationStatusEnum>(); + task.CurrentAddress = task.NextAddress; + task.NextAddress = string.Empty; task.TaskState = nextStatus; + task.ModifyDate = DateTime.Now; + task.Modifier = "System"; + WMSTaskDTO WMStask = _mapper.Map<WMSTaskDTO>(task); + if (task.TargetIsPickPlace) + { + task.TaskState = (int)TaskRelocationStatusEnum.RelocationFinish; + //WMStask.TaskState = task.TaskState; + AddTask_Hty(task, TaskOperateTypeEnum.AutoComplete); + } + else + BaseDal.UpdateData(task); + + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈虹Щ搴撳畬鎴�"); + //todo 璋冪敤WMS绉诲簱瀹屾垚 + HttpHelper.PostAsync(WMSInterfaceAddress.UpdateTaskStatus, WMStask.ToJson(), headers: new Dictionary<string, string>()); + } + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)//绉昏溅/绉昏溅鍏呯數 + { task.ModifyDate = DateTime.Now; task.Modifier = "System"; task.CurrentAddress = task.NextAddress; task.NextAddress = string.Empty; - BaseDal.UpdateData(task); - - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈虹Щ杞﹀畬鎴�"); + if (task.TaskState == (int)TaskCarStatusEnum.SC_CarExecuting) + { + int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskCarStatusEnum>(); + task.TaskState = nextStatus; + BaseDal.UpdateData(task); + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈虹Щ杞﹀畬鎴�"); + } + else if (task.TaskState == (int)CarChargingTaskEnum.CarChargingSC_CarExecuting) + { + int nextStatus = task.TaskState.GetNextNotCompletedStatus<CarChargingTaskEnum>(); + task.TaskState = nextStatus; + BaseDal.UpdateData(task); + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈虹Щ杞﹀畬鎴�"); + } } else { -- Gitblit v1.9.3