| | |
| | | private PatrolService patrolService; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | @Autowired |
| | | private AgvAreaDispatcher agvAreaDispatcher; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:agv:update')") |
| | | @OperationLog("Locate All Agv") |
| | |
| | | task.setPriority(999); |
| | | task.setIoTime(now); |
| | | task.setStartTime(now); |
| | | task.setMemo("HANDLE"); |
| | | task.setMemo("AUTO"); |
| | | if (!taskService.save(task)) { |
| | | throw new BusinessException(task.getSeqNum() + "任务保存失败"); |
| | | } |
| | |
| | | } |
| | | if (null == endCode) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), endCode.getId())) { |
| | | throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + endCode.getData()); |
| | | } |
| | | if (!taskService.removeById(task.getId())) { |
| | | throw new BusinessException("failed to remove task"); |
| | |
| | | if (null == oriLoc) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), oriLoc.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); |
| | | } |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | |
| | | } |
| | | if (null == destLoc) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), destLoc.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); |
| | | } |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | |
| | | if (null == oriLoc) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), oriLoc.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始库位【" + oriLoc.getLocNo() + "】"); |
| | | } |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + oriLoc.getLocNo() + " 不是在库状态"); |
| | | } |
| | |
| | | } |
| | | if (null == destSta) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), destSta.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destSta.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标站点【" + destSta.getStaNo() + "】"); |
| | | } |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败"); |
| | |
| | | if (null == oriSta) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), oriSta.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriSta.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始站点【" + oriSta.getStaNo() + "】"); |
| | | } |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败"); |
| | | } |
| | |
| | | } |
| | | if (null == destLoc) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), destLoc.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标库位【" + destLoc.getLocNo() + "】"); |
| | | } |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + destLoc.getLocNo() + " 不是空闲状态"); |
| | |
| | | if (null == oriSta) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), oriSta.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriSta.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达起始站点【" + oriSta.getStaNo() + "】"); |
| | | } |
| | | if (null == staReserveService.reserveStaOut(oriSta, task, 1)) { |
| | | throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败"); |
| | | } |
| | |
| | | if (null == destSta) { |
| | | return R.error(); |
| | | } |
| | | if (!agvAreaDispatcher.match(agv.getId(), destSta.getCode())) { |
| | | // throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destSta.getCode$()); |
| | | throw new BusinessException("AGV【" + agv.getUuid() + "】无法到达目标站点【" + destSta.getStaNo() + "】"); |
| | | } |
| | | if (null == staReserveService.reserveStaIn(destSta, task, 1)) { |
| | | throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败"); |
| | | } |