修改岔心所在计轴区段预复位成功后,预复位状态未清除的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; return;
//进入计轴区段判断 //进入计轴区段判断
Section headAxleCounterSectionNew = headPositionNew.getSection(); Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection();
if (!headAxleCounterSectionNew.isAxleCounter()) { if (headAxleCounterSectionNew != null) {
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent(); Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection();
} if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //车头所在计轴区段发生变化
if (!headAxleCounterSectionNew.isAxleCounter()) { //当是物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
}
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
Section headSectionOld = headPosition.getSection();
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight); headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
} }
} }
//离开计轴区段判断 //离开计轴区段判断
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true); SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true);
Section tailAxleCounterSection = tailPositionOld.getSection(); Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection();
if (!tailAxleCounterSection.isAxleCounter()) { if (tailAxleCounterSection != null) {
tailAxleCounterSection = tailAxleCounterSection.getParent();
}
if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true); SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true);
Section tailSectionNew = tailPositionNew.getSection(); Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection();
if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样 if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //车尾所在计轴区段发生变化
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight); tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
} }
} }