修改:设置头码车时的寻路逻辑

This commit is contained in:
joylink_zhangsai 2021-06-03 14:40:45 +08:00
parent ce1425198c
commit b17175b2af
2 changed files with 8 additions and 10 deletions

View File

@ -275,7 +275,7 @@ public class AtsTrainService {
Section section = allSections.get(i); Section section = allSections.get(i);
List<RoutePath> routePaths = repository.queryRoutePathsByEndAndContainsSection(section, headSection); List<RoutePath> routePaths = repository.queryRoutePathsByEndAndContainsSection(section, headSection);
if (!CollectionUtils.isEmpty(routePaths)) { if (!CollectionUtils.isEmpty(routePaths)) {
if (routePaths.stream().anyMatch(routePath -> !routePath.hasReverseRoute())) { //有不含反向进路的路径 if (routePaths.stream().anyMatch(routePath -> !routePath.isReverse())) { //有不含反向进路的路径
fromSection = section; fromSection = section;
selectRouting = routing; selectRouting = routing;
break; break;

View File

@ -427,15 +427,13 @@ public class RoutePath {
return list; return list;
} }
public boolean hasReverseRoute() { public boolean isReverse() {
for (Route route : this.routeList) { Section section = sectionList.get(0);
Section section = route.getSectionList().get(0); if (section.isRightLine()) {
if (section.isRightLine() && !route.getStart().isRight()) { //右向区段但进路是左向 return !this.isRight();
return true;
}
if (section.isLeftLine() && route.getStart().isRight()) { //左向区段但进路是右向
return true;
} }
if (section.isLeftLine()) {
return this.isRight();
} }
return false; return false;
} }