| | |
| | | // .map(BlockVehicleDto::getVehicle) |
| | | // .findFirst().orElse(null); |
| | | String blockAgvNo = this.checkoutBestSolutionOfBlocks(blockVehicleList); |
| | | if (Cools.isEmpty(blockAgvNo)) { |
| | | |
| | | // block vehicle info |
| | | Agv blockAgv = agvService.selectByUuid(blockAgvNo); |
| | | String blockAgvCode = codeService.getById(agvDetailService.selectByAgvId(blockAgv.getId()).getRecentCode()).getData(); |
| | | maxJamTimeoutFactor = 2; |
| | | |
| | | do { |
| | | } else { |
| | | |
| | | // 阻塞车辆正在原地作业,等待 ===>> 超过等待时间,绕路 |
| | | List<Segment> runningSegList = segmentService.getByAgvAndState(blockAgv.getId(), SegmentStateType.RUNNING.toString()); |
| | | if (!Cools.isEmpty(runningSegList)) { |
| | | maxJamTimeoutFactor = 1; |
| | | break; |
| | | } |
| | | // block vehicle info |
| | | Agv blockAgv = agvService.selectByUuid(blockAgvNo); |
| | | String blockAgvCode = codeService.getById(agvDetailService.selectByAgvId(blockAgv.getId()).getRecentCode()).getData(); |
| | | |
| | | // 判断下个任务是否为原地任务,如果是则等待 ===>> 超过等待时间,绕路;如果不是,让阻塞车辆避让 |
| | | List<Segment> waitingSegList = segmentService.getJustWaitingSeg(blockAgv.getId()); |
| | | if (null != waitingSegList |
| | | && waitingSegList.stream().anyMatch( |
| | | waitingSeg -> waitingSeg.getEndNode().equals(codeService.selectByData(blockAgvCode).getId()) |
| | | )) { |
| | | maxJamTimeoutFactor = 1; |
| | | break; |
| | | } |
| | | do { |
| | | |
| | | // notify block vehicle to avoid |
| | | if (this.notifyVehicleAvoid(blockAgvNo, blockAgvCode, jamPath, agvNo, jam)) { |
| | | if (jam.getCycleAvo() == 1) { |
| | | jam.setCycleCode(endCode.getId()); |
| | | // 阻塞车辆正在原地作业,等待 ===>> 超过等待时间,绕路 |
| | | List<Segment> runningSegList = segmentService.getByAgvAndState(blockAgv.getId(), SegmentStateType.RUNNING.toString()); |
| | | if (!Cools.isEmpty(runningSegList)) { |
| | | maxJamTimeoutFactor = 1; |
| | | break; |
| | | } |
| | | jam.setAvoAgv(blockAgv.getId()); |
| | | jam.setNotifyTime(new Date()); |
| | | if (!jamService.updateById(jam)) { |
| | | throw new CoolException(jam.getUuid() + "-jam failed to update!!!"); |
| | | |
| | | // 判断下个任务是否为原地任务,如果是则等待 ===>> 超过等待时间,绕路;如果不是,让阻塞车辆避让 |
| | | List<Segment> waitingSegList = segmentService.getJustWaitingSeg(blockAgv.getId()); |
| | | if (null != waitingSegList |
| | | && waitingSegList.stream().anyMatch( |
| | | waitingSeg -> waitingSeg.getEndNode().equals(codeService.selectByData(blockAgvCode).getId()) |
| | | )) { |
| | | maxJamTimeoutFactor = 1; |
| | | break; |
| | | } |
| | | } else { |
| | | |
| | | maxJamTimeoutFactor = 1; |
| | | } |
| | | // notify block vehicle to avoid |
| | | if (this.notifyVehicleAvoid(blockAgvNo, blockAgvCode, jamPath, agvNo, jam)) { |
| | | if (jam.getCycleAvo() == 1) { |
| | | jam.setCycleCode(endCode.getId()); |
| | | } |
| | | jam.setAvoAgv(blockAgv.getId()); |
| | | jam.setNotifyTime(new Date()); |
| | | if (!jamService.updateById(jam)) { |
| | | throw new CoolException(jam.getUuid() + "-jam failed to update!!!"); |
| | | } |
| | | } else { |
| | | |
| | | } while (false); |
| | | maxJamTimeoutFactor = 1; |
| | | } |
| | | |
| | | } while (false); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |