| | |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | 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.service.astart.DynamicNodeType; |
| | | 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; |
| | |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * Wavefront |
| | |
| | | } else { |
| | | |
| | | // 可走行路径集合计算 |
| | | List<String> blockVehicleList = this.slicePathAndReturnBlockVehicleList(lev, unlockPathList, agvNo, pathList); // jamAgvNo may was wave |
| | | List<BlockVehicleDto> blockVehicleList = this.slicePathAndReturnBlockVehicleList(lev, unlockPathList, agvNo, pathList); // jamAgvNo may was wave |
| | | |
| | | if (!Cools.isEmpty(pathList)) { |
| | | |
| | | if (!Cools.isEmpty(blockVehicleList) && !pathList.get(pathList.size() - 1).equals(endCode.getData())) { |
| | | String blockAgvNo = blockVehicleList.get(0); |
| | | if (mapDataDispatcher.queryCodeListFromDynamicNode(null, blockAgvNo).size() > 1 && pathList.size() <= MIN_SLICE_PATH_LENGTH) { |
| | | if (!pathList.get(pathList.size() - 1).equals(endCode.getData())) { |
| | | |
| | | assert !Cools.isEmpty(blockVehicleList); |
| | | if (blockVehicleList.stream().anyMatch(blockVehicleDto -> !blockVehicleDto.isAvoidable()) |
| | | && pathList.size() <= MIN_SLICE_PATH_LENGTH) { |
| | | pathList.clear(); |
| | | } |
| | | } |
| | |
| | | // 阻塞车辆列表 |
| | | assert !Cools.isEmpty(blockVehicleList); |
| | | |
| | | String blockAgvNo = blockVehicleList.get(0); |
| | | String blockAgvNo = blockVehicleList.stream() |
| | | .filter(BlockVehicleDto::isAvoidable) |
| | | .map(BlockVehicleDto::getVehicle) |
| | | .findFirst().orElse(null); |
| | | // 如果全是运行中的阻塞agv,则不进行避让逻辑 todo |
| | | if (Cools.isEmpty(blockAgvNo)) { |
| | | return pathList; |
| | | } |
| | | |
| | | boolean initJamCache = false; |
| | | if (null == jam) { |
| | |
| | | return pathList; |
| | | } |
| | | |
| | | private List<String> slicePathAndReturnBlockVehicleList(Integer lev, List<String> fullPathList, String agvNo, List<String> pathList) { |
| | | List<String> blockVehicleList = new ArrayList<>(); |
| | | private List<BlockVehicleDto> slicePathAndReturnBlockVehicleList(Integer lev, List<String> fullPathList, String agvNo, List<String> pathList) { |
| | | List<BlockVehicleDto> blockVehicleList = new ArrayList<>(); |
| | | |
| | | DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(lev); |
| | | String[][] waveMatrix = mapDataDispatcher.getWaveMatrix(lev); |
| | |
| | | List<String> waveNodeList = MapDataUtils.parseWaveNode(waveNode); |
| | | List<String> otherWaveList = MapDataUtils.hasOtherWave(waveNodeList, agvNo); |
| | | if (!Cools.isEmpty(otherWaveList)) { |
| | | blockVehicleList.addAll(otherWaveList); |
| | | for (String otherWave : otherWaveList) { |
| | | if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) { |
| | | blockVehicleList.add(new BlockVehicleDto(otherWave, false)); |
| | | } else { |
| | | blockVehicleList.add(new BlockVehicleDto(otherWave, true)); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | DynamicNode dynamicNode = dynamicMatrix[node[0]][node[1]]; |
| | | String vehicle = dynamicNode.getVehicle(); |
| | | assert !vehicle.equals(DynamicNodeType.BLOCK.val); |
| | | if (!vehicle.equals(DynamicNodeType.ACCESS.val) && !vehicle.equals(agvNo)) { |
| | | blockVehicleList.add(vehicle); |
| | | break; |
| | | } |
| | | // DynamicNode dynamicNode = dynamicMatrix[node[0]][node[1]]; |
| | | // String vehicle = dynamicNode.getVehicle(); |
| | | // assert !vehicle.equals(DynamicNodeType.BLOCK.val); |
| | | // if (!vehicle.equals(DynamicNodeType.ACCESS.val) && !vehicle.equals(agvNo)) { |
| | | // blockVehicleList.add(vehicle); |
| | | // break; |
| | | // } |
| | | |
| | | pathList.add(code); |
| | | } |
| | |
| | | pathList.clear(); |
| | | } |
| | | |
| | | return blockVehicleList; |
| | | return blockVehicleList.stream().distinct().collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |