From fdf7bb595ee00e5fef7b4e110fbe32f637c069f6 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期一, 18 八月 2025 08:38:46 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 68 ++++++++++++++++----------------- 1 files changed, 33 insertions(+), 35 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" index d4daa32..4724199 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" @@ -51,7 +51,7 @@ { var task = _taskRepository.QueryFirst(x => secureApplyModel.ReceiveTaskID.ObjToInt() == x.TaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var content = TakeRequest(task.CurrentAddress); if (!content.Status) @@ -200,17 +200,18 @@ if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟鍙枫�恵agvUpdateModel.ReceiveTaskID}銆�"); switch (agvUpdateModel.GoodsState) { - //case 1://鍑哄簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鍙栬揣瀹屾垚 - // if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - // { - // var content = TakeFinish(task.CurrentAddress); - // if (!content.Status) throw new Exception(content.Message); - // task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); - // var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚); - // _taskService.TaskCompleted(task.TaskNum); - // } - // break; - case 2://鍏ュ簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鏀捐揣瀹屾垚 + case "1"://鍑哄簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鍙栬揣瀹屾垚 + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + { + var content = TakeFinish(task.CurrentAddress); + if (!content.Status) + { + throw new Exception(content.Message); + }; + return agvResponse.OK("鎴愬姛", "0"); + } + break; + case "2"://鍏ュ簱鏍规嵁杩欎釜淇″彿鍒ゆ柇鏀捐揣瀹屾垚 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) { Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.StationCode == task.NextAddress); @@ -224,6 +225,11 @@ task.DeviceCode = dt_Station.StationDeviceCode; var up = _taskRepository.UpdateData(task); return agvResponse.OK("鎴愬姛","0"); + } + else if(task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + { + _taskService.TaskCompleted(task.TaskNum); + return agvResponse.OK("鎴愬姛", "0"); } break; default: @@ -321,45 +327,36 @@ [HttpPost, HttpGet, Route("TakeRequest"), AllowAnonymous] public WebResponseContent TakeRequest(string code) { + WebResponseContent content = new WebResponseContent(); try { - Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); if (stationManger == null) { - return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); + return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃畕code}"); } IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device == null) { - return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶�"); + return WebResponseContent.Instance.Error($"鏈壘鍒板搴旇澶噞stationManger.StationDeviceCode}"); } OtherDevice otherDevice = (OtherDevice)device; - bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); - if (canPut) + short Command = otherDevice.GetValue<R_ConveyorLineCPDB, short>(R_ConveyorLineCPDB.Command, stationManger.StationCode); + if (Command == 2) { - otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); - return WebResponseContent.Instance.OK(); + content.OK("鍏佽鍙栨枡"); } else { - otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); - Thread.Sleep(1000); - canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); - if (canPut) - { - return WebResponseContent.Instance.OK(); - } - else - { - return WebResponseContent.Instance.Error($"鍙栬揣鐢宠涓�"); - } + return content.Error("绂佹鍙栨枡"); } + return content; } catch (Exception ex) { - return WebResponseContent.Instance.Error(ex.Message); + return content.Error(ex.Message); } } @@ -374,7 +371,7 @@ { try { - Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == code); + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == code); if (stationManger == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃�"); @@ -386,9 +383,10 @@ } OtherDevice otherDevice = (OtherDevice)device; - otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); - Thread.Sleep(1000); - otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); + if (device.DeviceCode.Contains("CP")) + { + otherDevice.SetValue(W_ConveyorLineCPDB.W_Command, 2, stationManger.StationCode); + } return WebResponseContent.Instance.OK(); } catch (Exception ex) -- Gitblit v1.9.3