| | |
| | | String batch = busSubmitParam.getBatch(); |
| | | List<TaskDto> taskDtoList = busSubmitParam.getTaskList(); |
| | | if (Cools.isEmpty(taskDtoList)) { |
| | | throw new BusinessException("taskDtoList 不能为空"); |
| | | throw new BusinessException("taskList can't be empty!"); |
| | | } |
| | | |
| | | // 优先级排序 |
| | |
| | | bus.setMemo(memo); |
| | | |
| | | if (!busService.save(bus)) { |
| | | throw new BusinessException("任务保存失败"); |
| | | throw new BusinessException("Internal Server Error!"); |
| | | } |
| | | |
| | | // 保存任务 |
| | |
| | | task.setBusId(bus.getId()); |
| | | task.setTaskSts(TaskStsType.INIT.val()); |
| | | if (!taskService.save(task)) { |
| | | throw new BusinessException(task.getSeqNum() + "任务保存失败"); |
| | | throw new BusinessException("seqNum:" + task.getSeqNum() + " failed to save!"); |
| | | } |
| | | |
| | | // 修改库位状态 |
| | |
| | | case LOC_TO_LOC: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 不是在库状态"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); |
| | | } |
| | | |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 不是空闲状态"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case LOC_TO_STA: |
| | | oriLoc = locService.getById(task.getOriLoc()); |
| | | if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 不是在库状态"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " is not in STOCK status"); |
| | | } |
| | | oriLoc.setLocSts(LocStsType.PAKOUT.val()); |
| | | oriLoc.setUpdateTime(now); |
| | | if (!locService.updateById(oriLoc)) { |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("oriLoc:" + task.getOriLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case STA_TO_LOC: |
| | | destLoc = locService.getById(task.getDestLoc()); |
| | | if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 不是空闲状态"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " is not in IDLE status"); |
| | | } |
| | | destLoc.setLocSts(LocStsType.PAKIN.val()); |
| | | destLoc.setUpdateTime(now); |
| | | if (!locService.updateById(destLoc)) { |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " 修改库位状态失败"); |
| | | throw new BusinessException("destLoc:" + task.getDestLoc$() + " failed to update"); |
| | | } |
| | | break; |
| | | case STA_TO_STA: |
| | |
| | | bus.setBusSts(BusStsType.PROGRESS.val()); |
| | | bus.setUpdateTime(now); |
| | | if (!busService.updateById(bus)) { |
| | | log.error("Bus [{}] 更新失败 !!!", bus.getUuid()); |
| | | log.error("Bus [{}] failed to Update !!!", bus.getUuid()); |
| | | } |
| | | return; |
| | | } |
| | |
| | | for (Task task : taskList) { |
| | | Agv agv = missionAssignService.execute(task, taskAllot, taskIds); |
| | | if (null == agv) { |
| | | log.warn("{}任务异常,无法检索空闲Agv...", task.getSeqNum()); |
| | | log.warn("Task[{}] has an issue, because it failed to checkout agv which is idle...", task.getSeqNum()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | task.setIoTime(now); |
| | | task.setUpdateTime(now); |
| | | if (!taskService.updateById(task)) { |
| | | throw new BusinessException(task.getSeqNum() + "任务更新失败"); |
| | | throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update"); |
| | | } |
| | | |
| | | if (taskAllot.containsKey(agv.getUuid())) { |
| | |
| | | } |
| | | for (Action action : actionList) { |
| | | action.setActionSts(ActionStsType.ISSUED.val()); |
| | | action.setStartTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | throw new BusinessException(action.getPriority() + " - " + action.getName() + "动作更新失败"); |
| | |
| | | |
| | | if (null != action) { |
| | | action.setActionSts(ActionStsType.FINISH.val()); |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | |
| | | ); |
| | | if (null != action) { |
| | | action.setActionSts(ActionStsType.FINISH.val()); |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | |
| | | ); |
| | | for (Action action : actionList) { |
| | | action.setActionSts(ActionStsType.FINISH.val()); |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |