修改:新版头码车进路办理bug

This commit is contained in:
joylink_zhangsai 2021-07-21 11:17:58 +08:00
parent f8a42de456
commit 4ea0ad5e1f

View File

@ -45,32 +45,38 @@ public class AtsHeadTrainRouteSelectServiceImpl implements AtsRouteSelectService
return dcd.queryNextRoute(headSection); return dcd.queryNextRoute(headSection);
} else { } else {
// 根据车次计划查找可触发进路列表 // 根据车次计划查找可触发进路列表
Object[] results = this.queryByDestinationCode(simulation, trainInfo, targetSection, right); Object[] results = this.queryByDestinationCode(simulation, trainInfo, headSection, targetSection, right);
// 根据计划筛选需触发进路 // 根据计划筛选需触发进路
return filterRoutes(repository, trainInfo, results, dcd); return filterRoutes(repository, trainInfo, results, dcd);
} }
} }
private Object[] queryByDestinationCode(Simulation simulation, TrainInfo trainInfo, Section targetSection, Boolean right) { private Object[] queryByDestinationCode(Simulation simulation, TrainInfo trainInfo, Section headSection, Section targetSection, Boolean right) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
List<RoutePath> routePathList = repository.queryRoutePathsByEnd(targetSection); List<RoutePath> routePathList = repository.queryRoutePathsByEnd(targetSection);
if (CollectionUtils.isEmpty(routePathList)) { if (CollectionUtils.isEmpty(routePathList)) {
return null; return null;
} }
routePathList = routePathList.stream() routePathList = routePathList.stream()
.filter(routePath -> routePath.containsSection(targetSection)) .filter(routePath -> routePath.containsSection(headSection))
.collect(Collectors.toList()); .collect(Collectors.toList());
Object[] result = this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList); Object[] result = this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList);
if (!(boolean) result[1] && !(boolean) result[2]) { //不存在未触发的进路和未接近的信号机 if (!(boolean) result[1] && !(boolean) result[2]) { //不存在未触发的进路和未接近的信号机
// 判断配置是否列车停站才触发接下来的进路 // 判断配置是否列车停站才触发接下来的进路
MapConfig config = repository.getConfig(); MapConfig config = repository.getConfig();
if (config.isSignalOpenAfterParking() && !trainInfo.isParking()) { if (!config.isSignalOpenAfterParking() || trainInfo.isPlanTrain()) {
return null;
} else {
Section nextTarget = AtsHeadTrainStageService.queryNextTarget(simulation, targetSection, trainInfo, right); Section nextTarget = AtsHeadTrainStageService.queryNextTarget(simulation, targetSection, trainInfo, right);
routePathList = repository.queryRoutePathsByEnd(nextTarget); if (nextTarget != null) {
result = this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList); routePathList = repository.queryRoutePathsByEnd(nextTarget);
if (!CollectionUtils.isEmpty(routePathList)) {
routePathList = routePathList.stream()
.filter(routePath -> routePath.containsSection(headSection))
.collect(Collectors.toList());
return this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePathList);
}
}
} }
return null;
} }
return result; return result;
} }