From 2c889b38311883ceb703c4e0034c798fdaa2e21c Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期二, 12 八月 2025 23:11:57 +0800 Subject: [PATCH] 更新代码,货位分配优化等 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs | 97 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 67 insertions(+), 30 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" index 3890544..b31fc0e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" @@ -46,22 +46,22 @@ { var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } + //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -98,10 +98,15 @@ agvResponseContent.Message = requestZH.Status ? "鎴愬姛" : "澶辫触"; return agvResponseContent; case "outbin"://鍑哄簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鍙栬揣瀹屾垚 - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var content = TakeFinish(task.CurrentAddress); - if (!content.Status) throw new Exception(content.Message); + if (!content.Status) + { + task.TaskState = TaskStatusEnum.AGV_TakeError.ObjToInt(); + _taskRepository.UpdateData(task); + throw new Exception(content.Message); + } task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚); _taskService.TaskCompleted(task.TaskNum); @@ -112,16 +117,16 @@ break; case "getSafetySignal"://瀹夊叏淇″彿鐢宠 { - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) throw new Exception(content.Message); - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) throw new Exception(content.Message); - } + //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) throw new Exception(content.Message); + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) throw new Exception(content.Message); + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -132,8 +137,13 @@ if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); - if (!content.Status) throw new Exception(content.Message); - Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); + if (!content.Status) + { + task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt(); + _taskRepository.UpdateData(task); + throw new Exception(content.Message); + } + Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); if (dt_Station == null) { throw new Exception($"{task.NextAddress}绔欏彴鏈畾涔�"); @@ -334,5 +344,32 @@ return WebResponseContent.Instance.Error(ex.Message); } } + + //闃荤剨浠撳嚭搴撲换鍔$┖鍌ㄤ綅寮傚父鎵嬪姩閲嶅彂AGV浠诲姟 + [HttpPost, HttpGet,Route("AgvZHTaskResend"),AllowAnonymous] + public WebResponseContent AgvZHTaskResend(int taskNum) + { + try + { + Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); + if (task == null) + { + return WebResponseContent.Instance.Error("鏈壘鍒扮浉鍏充换鍔′俊鎭�"); + } + if (task.TaskState == TaskStatusEnum.Exception.ObjToInt() && task.DeviceCode == "AGV_ZH") + { + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute); + } + else + { + return WebResponseContent.Instance.Error("浠诲姟璁惧缂栧彿涓嶆纭垨浠诲姟鐘舵�侀潪绌哄偍浣嶅紓甯�"); + } + return WebResponseContent.Instance.OK(); + } + catch(Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } -- Gitblit v1.9.3