修改岔心所在计轴区段预复位成功后,预复位状态未清除的bug

This commit is contained in:
joylink_zhangsai 2021-12-06 13:22:48 +08:00
parent 2258062e9a
commit f5c711da90

View File

@ -136,29 +136,20 @@ public class VRTrainRunningService {
return;
//进入计轴区段判断
Section headAxleCounterSectionNew = headPositionNew.getSection();
if (!headAxleCounterSectionNew.isAxleCounter()) {
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (!headAxleCounterSectionNew.isAxleCounter()) { //当是物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
Section headSectionOld = headPosition.getSection();
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样
Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection();
if (headAxleCounterSectionNew != null) {
Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection();
if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //车头所在计轴区段发生变化
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
}
}
//离开计轴区段判断
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true);
Section tailAxleCounterSection = tailPositionOld.getSection();
if (!tailAxleCounterSection.isAxleCounter()) {
tailAxleCounterSection = tailAxleCounterSection.getParent();
}
if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段
Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection();
if (tailAxleCounterSection != null) {
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true);
Section tailSectionNew = tailPositionNew.getSection();
if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样
Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection();
if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //车尾所在计轴区段发生变化
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
}
}