From 5732962e2fe146d81273b4b02faaec87c05f0417 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期一, 30 十二月 2024 00:29:19 +0800 Subject: [PATCH] 1 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" index 9b15909..000b58c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" @@ -41,7 +41,7 @@ agvResponseContent.ReqCode = secureApplyModel.ReqCode; try { - var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode.ObjToInt() == x.TaskNum); + var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode== x.AgvTaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) { @@ -85,8 +85,8 @@ { if (agvUpdateModel == null) throw new Exception("鏈幏鍙栧埌璇锋眰鍙傛暟"); agvResponseContent.ReqCode = agvUpdateModel.ReqCode; - var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode.ObjToInt() == x.TaskNum); - if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); + var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); + if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.TaskCode}銆�"); switch (agvUpdateModel.Method) { case "start": @@ -104,14 +104,38 @@ return agvResponseContent; } 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); + } + task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); + var up = _taskRepository.UpdateData(task); + agvResponseContent.Code = up ? "0" : "1"; + agvResponseContent.Message = up ? "鎴愬姛" : "澶辫触"; + return agvResponseContent; + } case "end"://鍏ュ簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鏀捐揣瀹屾垚 if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); if (!content.Status) throw new Exception(content.Message); - task.CurrentAddress = task.NextAddress; + Dt_StationManger dt_Station=_stationMangerRepository.QueryFirst(x=>x.AGVStationCode== task.NextAddress); + if (dt_Station==null) + { + throw new Exception($"{task.NextAddress}AGV绔欏彴鏈畾涔�"); + } + task.CurrentAddress = dt_Station.StationCode; task.NextAddress = ""; task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); + task.DeviceCode = "SC01_CSJ"; var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; agvResponseContent.Message = up ? "鎴愬姛" : "澶辫触"; @@ -294,7 +318,8 @@ OtherDevice otherDevice = (OtherDevice)device; otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); - + Thread.Sleep(1000); + otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); return WebResponseContent.Instance.OK(); } catch (Exception ex) -- Gitblit v1.9.3