列车初始化bug修改;取消进路延时解锁条件修改;设头码车时查询路径逻辑修改
This commit is contained in:
parent
8911cfa6b1
commit
17abe86959
@ -193,8 +193,16 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
TrainInfo firstTrain = repository.querySignalApproachedFirstTrain(route.getStart());
|
||||
if (route.isApproachLock() /*&& Objects.nonNull(firstTrain) && !firstTrain.isStop()*/) { // 接近锁闭,总人解
|
||||
this.routeService.humanCancel(simulation, route);
|
||||
if (route.isApproachLock()) { // 接近锁闭,总人解
|
||||
if (firstTrain != null) {
|
||||
if (!firstTrain.isStop()) {
|
||||
this.routeService.humanCancel(simulation, route);
|
||||
} else {
|
||||
this.routeService.cancelNoApproachLock(simulation, route);
|
||||
}
|
||||
} else {
|
||||
this.routeService.humanCancel(simulation, route);
|
||||
}
|
||||
} else {
|
||||
this.routeService.cancelNoApproachLock(simulation, route);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class CalculateService {
|
||||
@ -748,33 +747,37 @@ public class CalculateService {
|
||||
List<Signal> signals = new ArrayList<>();
|
||||
List<Section> sections = new ArrayList<>(); //找到第一个同向信号机途径的区段
|
||||
Section section = startSection;
|
||||
//如果已经停在折返轨,如果有已经/正在办理的进路,只要有进路办理那边的信号机,否则两边都要
|
||||
//如果已经停在折返轨,[如果有已经/正在办理的进路,只要有进路办理那边的信号机,否则两边都要](去掉)
|
||||
if (startSection.isTurnBackTrack() && stop) { //如果停在折返轨
|
||||
sections.add(startSection);
|
||||
Signal signal1 = startSection.getSignalOf(right);
|
||||
Signal signal2 = startSection.getSignalOf(!right);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(signal1 != null || signal2 != null,
|
||||
String.format("折返轨[%s]两边都没有信号机", startSection.getCode()));
|
||||
if (signal1 == null || signal2 == null) { //如果有一边信号机没有
|
||||
signals.add(signal1 != null ? signal1 : signal2);
|
||||
} else {
|
||||
List<Route> routeList1 = signal1.getRouteList();
|
||||
List<Route> routeList2 = signal2.getRouteList();
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(routeList1) || !CollectionUtils.isEmpty(routeList2),
|
||||
String.format("信号机[%s][%s]都没有进路", signal1.getCode(), signal2.getCode()));
|
||||
if (CollectionUtils.isEmpty(routeList1) || CollectionUtils.isEmpty(routeList2)) { //如果有一边的信号机没有进路
|
||||
signals.add(!CollectionUtils.isEmpty(routeList1) ? signal1 : signal2);
|
||||
} else {
|
||||
boolean routes1HasSetting = routeList1.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
boolean routes2HasSetting = routeList2.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
if (routes1HasSetting || routes2HasSetting) { //如果有一边的信号机有进路排列
|
||||
signals.add(routes1HasSetting ? signal1 : signal2);
|
||||
} else { //如果两边信号机都没有进路排列
|
||||
signals.add(signal1);
|
||||
signals.add(signal2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (signal1 != null)
|
||||
signals.add(signal1);
|
||||
if (signal2 != null)
|
||||
signals.add(signal2);
|
||||
// if (signal1 == null || signal2 == null) { //如果有一边信号机没有
|
||||
// signals.add(signal1 != null ? signal1 : signal2);
|
||||
// } else {
|
||||
// List<Route> routeList1 = signal1.getRouteList();
|
||||
// List<Route> routeList2 = signal2.getRouteList();
|
||||
// BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(!CollectionUtils.isEmpty(routeList1) || !CollectionUtils.isEmpty(routeList2),
|
||||
// String.format("[%s][%s]都没有进路", signal1.debugStr(), signal2.debugStr()));
|
||||
// if (CollectionUtils.isEmpty(routeList1) || CollectionUtils.isEmpty(routeList2)) { //如果有一边的信号机没有进路
|
||||
// signals.add(!CollectionUtils.isEmpty(routeList1) ? signal1 : signal2);
|
||||
// } else {
|
||||
// boolean routes1HasSetting = routeList1.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
// boolean routes2HasSetting = routeList2.stream().anyMatch(route -> route.isLock() || route.isSetting());
|
||||
// if (routes1HasSetting || routes2HasSetting) { //如果有一边的信号机有进路排列
|
||||
// signals.add(routes1HasSetting ? signal1 : signal2);
|
||||
// } else { //如果两边信号机都没有进路排列
|
||||
// signals.add(signal1);
|
||||
// signals.add(signal2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
sections.add(section);
|
||||
@ -805,7 +808,7 @@ public class CalculateService {
|
||||
if (!CollectionUtils.isEmpty(pathSet))
|
||||
break;
|
||||
}
|
||||
System.out.println(String.format("路径查找用时:%s", System.currentTimeMillis() - start));
|
||||
log.info(String.format("路径查找用时:%s", System.currentTimeMillis() - start));
|
||||
return pathSet;
|
||||
}
|
||||
|
||||
@ -823,16 +826,16 @@ public class CalculateService {
|
||||
return pathSet;
|
||||
}
|
||||
boolean signalRight = signal.isRight();
|
||||
if (followSettingRoute == null || followSettingRoute) {
|
||||
//如果信号机的进路中有已经锁闭或者正在排列的,从已经排列的进路找起
|
||||
List<Route> settingRoutes = routeList.stream().filter(route -> route.isLock() || route.isSetting()).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(settingRoutes)) {
|
||||
routeList = settingRoutes;
|
||||
followSettingRoute = true;
|
||||
} else {
|
||||
followSettingRoute = false;
|
||||
}
|
||||
}
|
||||
// if (followSettingRoute == null || followSettingRoute) {
|
||||
// //如果信号机的进路中有已经锁闭或者正在排列的,从已经排列的进路找起
|
||||
// List<Route> settingRoutes = routeList.stream().filter(route -> route.isLock() || route.isSetting()).collect(Collectors.toList());
|
||||
// if (!CollectionUtils.isEmpty(settingRoutes)) {
|
||||
// routeList = settingRoutes;
|
||||
// followSettingRoute = true;
|
||||
// } else {
|
||||
// followSettingRoute = false;
|
||||
// }
|
||||
// }
|
||||
//通过进路,递归寻找路径
|
||||
for (Route route : routeList) {
|
||||
List<Section> newSections = new ArrayList<>(sections);
|
||||
|
@ -433,7 +433,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.pantograph1Up = true;
|
||||
this.pantograph2Up = true;
|
||||
this.linkTrain = null;
|
||||
this.lastTwoPassedResponders.clear();
|
||||
this.lastTwoPassedResponders = new FixedQueue<>(Responders_Record);
|
||||
}
|
||||
|
||||
public boolean isEB() {
|
||||
|
Loading…
Reference in New Issue
Block a user