【修改连挂后,故障车到达位置】

This commit is contained in:
weizhihong 2023-06-07 08:55:21 +08:00
parent 8cb9d9bb84
commit c84538bc4f
1 changed files with 22 additions and 15 deletions

View File

@ -433,22 +433,29 @@ public class AtsTrainService {
throw new SimulationException(SimulationExceptionType.System_Fault, "只能选列车或区段");
}
Section section = (Section) element;
VirtualRealityTrain linkTrain = train.getLinkTrain();
if (linkTrain != null) {
Section linkTrainTargetSection = section.getNextRunningSectionOf(right);
if (linkTrainTargetSection.isStandTrack()) {
SectionPosition linkTrainTargetPosition = new SectionPosition(linkTrainTargetSection, linkTrainTargetSection.getStopPointByDirection(right));
Float distance = CalculateService.calculateDistance(linkTrain.getHeadPosition(), linkTrainTargetPosition, right, false);
if (distance == null) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "无法到达的位置");
}
tempTargetPosition = CalculateService.calculateNextPositionByStartAndLen(headPosition, right, distance, false);
} else {
tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
}
} else {
tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
// VirtualRealityTrain linkTrain = train.getLinkTrain();
// if (linkTrain != null) {
// Section linkTrainTargetSection = section.getNextRunningSectionOf(right);
// if (linkTrainTargetSection.isStandTrack()) {
// SectionPosition linkTrainTargetPosition = new SectionPosition(linkTrainTargetSection, linkTrainTargetSection.getStopPointByDirection(right));
// Float distance = CalculateService.calculateDistance(linkTrain.getHeadPosition(), linkTrainTargetPosition, right, false);
// if (distance == null) {
// throw new SimulationException(SimulationExceptionType.Illegal_Argument, "无法到达的位置");
// }
// tempTargetPosition = CalculateService.calculateNextPositionByStartAndLen(headPosition, right, distance, false);
// } else {
// tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
// }
// } else {
// tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
// }
Section targetSection = section.getNextRunningSectionOf(right);
SectionPosition trainTargetPosition = new SectionPosition(targetSection, targetSection.getStopPointByDirection(right));
Float distance = CalculateService.calculateDistance(train.getHeadPosition(), trainTargetPosition, right, false);
if (distance == null) {
throw new SimulationException(SimulationExceptionType.Illegal_Argument, "无法到达的位置");
}
tempTargetPosition = new SectionPosition(section, section.getStopPointByDirection(right));
} else {
VirtualRealityTrain targetTrain = repository.getVRByCode(targetDeviceCode, VirtualRealityTrain.class);
SectionPosition targetTrainTailPosition = targetTrain.calculateTailPosition();