| | |
| | | // ArrayList<List<TaskPosDto>> list = JSON.parseObject(travel.getTaskContent(), new TypeReference<ArrayList<List<TaskPosDto>>>() {}); |
| | | |
| | | // * sync wave scope |
| | | if (!avoidWaveCalculator.calcWaveScope()) { |
| | | log.error("failed to calculate avoid wave matrix ..."); |
| | | return; |
| | | } |
| | | // if (!avoidWaveCalculator.calcWaveScope(agvModelService.getByAgvId(agv.getId()))) { |
| | | // log.error("failed to calculate avoid wave matrix ..."); |
| | | // return; |
| | | // } |
| | | |
| | | // checkout path |
| | | Code startCode = agvDetailService.getCurrentCode(travel.getAgvId()); |
| | | Code endCode = codeService.getCacheById(endNode); |
| | | // long startTime = System.currentTimeMillis(); |
| | | List<String> pathList = this.checkoutPath(agv, startCode, endCode, segment); |
| | | List<Jam> unfinishedOriginJamByCurrAgv = jamService.getUnfinishedOriginJamByAvo(agv.getId(), startCode.getId(), segment.getId()); |
| | | List<String> blackPath = this.getBlackPathList(unfinishedOriginJamByCurrAgv); |
| | | List<String> pathList = mapService.checkoutPath(agv.getUuid(), startCode, endCode, false, blackPath, segment); |
| | | |
| | | |
| | | //List<String> pathList = this.checkoutPath(agv, startCode, endCode, segment); |
| | | // System.out.println("checkoutPath: " + (System.currentTimeMillis() - startTime)); |
| | | if (Cools.isEmpty(pathList)) { |
| | | return; |
| | |
| | | insertSeg.setPosType(TaskPosDto.PosType.MOVE.toString()); |
| | | insertSeg.setState(SegmentStateType.WAITING.toString()); |
| | | if (!segmentService.save(insertSeg)) { |
| | | log.error("Segment [{}] failed to save !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | log.error("Segment [{}] failed to save !!!", insertSeg.getTravelId() + " - " + insertSeg.getSerial()); |
| | | } |
| | | segmentList.add(insertSeg); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | mapService.lockPath(null, pathList, agv.getUuid()); |
| | | //mapService.lockPath(null, pathList, agv.getUuid()); |
| | | |
| | | // startTime = System.currentTimeMillis(); |
| | | mainService.generateAction(segment.getAgvId(), segmentList, pathList, now); |
| | |
| | | log.error("TrafficService.trigger", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | throw new RuntimeException("trigger method caught an exception", e); |
| | | } |
| | | } |
| | | |
| | |
| | | List<String> lockPathList = mapService.checkoutPath(agvNo, startCode, endCode, true, blackPath, segment); |
| | | |
| | | if (!Cools.isEmpty(lockPathList) && // 存在避让解 |
| | | Math.abs(lockPathList.size() - unlockPathList.size()) <= Arrays.stream(mapDataDispatcher.getCodeMatrix(lev)).mapToInt(row -> row.length).sum() / 10 |
| | | Math.abs(lockPathList.size() - unlockPathList.size()) <= Arrays.stream(mapDataDispatcher.getCodeMatrix(lev)).mapToInt(row -> row.length).sum() / 10 |
| | | ) { |
| | | |
| | | pathList = lockPathList; |
| | |
| | | } |
| | | } |
| | | |
| | | // 无可走行路径 |
| | | // 无可走行路径 |
| | | } else { |
| | | |
| | | if (Cools.isEmpty(blockVehicleList)) { |
| | |
| | | |
| | | // the wave of first node |
| | | Double avoidDistance = MapDataUtils.getVehicleWaveSafeDistance( |
| | | agvModelService.getById(jamAgv.getAgvModel()).getDiameter(), |
| | | agvModelService.getByAgvId(jamAgv.getId()).getDiameter(), |
| | | MapDataConstant.MAX_DISTANCE_BETWEEN_ADJACENT_AGV_FACTOR |
| | | ); |
| | | List<String> waveCodeList = mapService.getWaveScopeByCode(lev, firstCodeNode, avoidDistance) |
| | |
| | | if (!blockVehicleDto.isAvoidable()) { |
| | | continue; |
| | | } |
| | | Long agvId = agvService.getAgvId(blockVehicleDto.getVehicle()); |
| | | // 当前vehicle正在进行避让作业 |
| | | if (!Cools.isEmpty(jamService.getUnfinishedAvoSegByAvo(blockVehicleDto.getVehicle(), null))) { |
| | | if (!Cools.isEmpty(jamService.getUnfinishedAvoSegByAvo(agvId, null))) { |
| | | continue; |
| | | } |
| | | // 当前vehicle正在进行滚筒输送线等待 |
| | | if (travelService.hasRollerWaiting(agvId)) { |
| | | continue; |
| | | } |
| | | // if (segmentService.isRollerWaiting(agvId)) { |
| | | // continue; |
| | | // } |
| | | return blockVehicleDto.getVehicle(); |
| | | } |
| | | return null; |