| | |
| | | import com.zy.acs.manager.common.utils.MapDataUtils; |
| | | import com.zy.acs.manager.core.domain.BlockVehicleDto; |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.core.domain.type.BlockSeverityType; |
| | | import com.zy.acs.manager.core.service.astart.MapDataDispatcher; |
| | | import com.zy.acs.manager.core.service.astart.RetreatNavigateNode; |
| | | import com.zy.acs.manager.core.service.astart.WaveNodeType; |
| | |
| | | String agvNo = agv.getUuid(); |
| | | Date now = new Date(); |
| | | Jam jam = jamService.getJam(agv.getId(), startCode.getId(), segment.getId()); |
| | | BlockSeverityType blockSeverity = BlockSeverityType.query(null == jam ? null : jam.getDuration()); |
| | | // judge avoid of jam |
| | | List<Jam> unfinishedOriginJamByCurrAgv = jamService.getUnfinishedOriginJamByAvo(agv.getId(), startCode.getId(), segment.getId()); |
| | | List<String> blackPath = this.getBlackPathList(unfinishedOriginJamByCurrAgv); |
| | |
| | | List<String> pathList = new ArrayList<>(); |
| | | |
| | | // 无障碍解 |
| | | List<String> unlockPathList = mapService.checkoutPath(agvNo, startCode, endCode, false, blackPath, segment); |
| | | List<String> unlockPathList = mapService.checkoutPath(agvNo, startCode, endCode, false, blackPath, segment, null); |
| | | // 避让解 |
| | | List<String> lockPathList = mapService.checkoutPath(agvNo, startCode, endCode, true, blackPath, segment); |
| | | List<String> lockPathList = mapService.checkoutPath(agvNo, startCode, endCode, true, blackPath, segment, null); |
| | | |
| | | if (!Cools.isEmpty(lockPathList) && // 存在避让解 |
| | | Math.abs(lockPathList.size() - unlockPathList.size()) <= Arrays.stream(mapDataDispatcher.getCodeMatrix(lev)).mapToInt(row -> row.length).sum() / 10 |
| | |
| | | pathList = lockPathList; |
| | | } else { |
| | | |
| | | // preview path |
| | | List<String> draftPath = new ArrayList<>(unlockPathList); |
| | | // 可走行路径集合计算 |
| | | List<BlockVehicleDto> blockVehicleList = this.slicePathAndReturnBlockVehicleList(lev, unlockPathList, agvNo, pathList); // jamAgvNo may was wave |
| | | List<BlockVehicleDto> blockVehicleList = this.slicePathAndReturnBlockVehicleList(lev, draftPath, agvNo, pathList); // jamAgvNo may was wave |
| | | |
| | | if (!Cools.isEmpty(pathList)) { |
| | | |
| | |
| | | Integer maxJamTimeoutFactor = null; |
| | | |
| | | // persist jam data |
| | | ArrayList<String> jamPath = new ArrayList<>(unlockPathList); |
| | | jam = this.createOrUpdateJam(agv, startCode, segment, jam, jamPath); |
| | | jam = this.createOrUpdateJam(agv, startCode, segment, jam, draftPath); |
| | | |
| | | // ? has unAvoidable block vehicles |
| | | if (blockVehicleList.stream().anyMatch(blockVehicleDto -> !blockVehicleDto.isAvoidable())) { |
| | |
| | | } else { |
| | | |
| | | // select optimal block vehicle |
| | | // String blockAgvNo = blockVehicleList.stream() |
| | | // .filter(BlockVehicleDto::isAvoidable) |
| | | // .map(BlockVehicleDto::getVehicle) |
| | | // .findFirst().orElse(null); |
| | | String blockAgvNo = this.checkoutBestSolutionOfBlocks(blockVehicleList); |
| | | if (Cools.isEmpty(blockAgvNo)) { |
| | | |
| | |
| | | } |
| | | |
| | | // notify block vehicle to avoid |
| | | if (this.notifyVehicleAvoid(blockAgvNo, blockAgvCode, jamPath, agvNo, jam)) { |
| | | if (this.notifyVehicleAvoid(blockAgvNo, blockAgvCode, draftPath, agvNo, jam)) { |
| | | if (jam.getCycleAvo() == 1) { |
| | | jam.setCycleCode(endCode.getId()); |
| | | } |