修改:IBP盘bug

This commit is contained in:
joylink_zhangsai 2021-06-17 17:53:17 +08:00
parent e51130b690
commit 737edb9889
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services; package club.joylink.rtss.services;
import club.joylink.rtss.exception.BaseException;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.publishData.IbpService; import club.joylink.rtss.services.publishData.IbpService;
import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.StandOperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.handler.StandOperateHandler;
@ -143,7 +144,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
ibp.queryByType(VirtualRealityIbp.Mean.SXYS).forEach(ele -> ele.setOn(!ele.isOn())); ibp.queryByType(VirtualRealityIbp.Mean.SXYS).forEach(ele -> ele.setOn(!ele.isOn()));
break; break;
case AXLE_RESET: case AXLE_RESET:
ciApiService.axleReset(simulation, buttonCode); ciApiService.axleReset(simulation, button.getSectionCode());
element.setOn(true); element.setOn(true);
break; break;
case AXLE_PRE_RESET: case AXLE_PRE_RESET:
@ -224,7 +225,11 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
if (!button.isPressed()) if (!button.isPressed())
continue; continue;
if (!now.isBefore(button.getPressTime().plusSeconds(3))) { //按下按钮三秒时/ if (!now.isBefore(button.getPressTime().plusSeconds(3))) { //按下按钮三秒时/
try {
ciApiService.axlePreReset(simulation, button.getSectionCode()); ciApiService.axlePreReset(simulation, button.getSectionCode());
} catch (BaseException e) {
e.printStackTrace();
}
} }
} }
} }

View File

@ -567,7 +567,8 @@ public class CiApiServiceImpl implements CiApiService {
@Override @Override
public void axlePreReset(Simulation simulation, String sectionCode) { public void axlePreReset(Simulation simulation, String sectionCode) {
VirtualRealitySectionAxleCounter virtualAxleCounter = getAxleCounterAndCheck4Reset(simulation, sectionCode); VirtualRealitySectionAxleCounter virtualAxleCounter = getAxleCounterAndCheck4Reset(simulation, sectionCode);
if (!virtualAxleCounter.isOccupy())
return;
virtualAxleCounter.preReset(); virtualAxleCounter.preReset();
} }
@ -624,6 +625,8 @@ public class CiApiServiceImpl implements CiApiService {
@Override @Override
public void axleReset(Simulation simulation, String sectionCode) { public void axleReset(Simulation simulation, String sectionCode) {
VirtualRealitySectionAxleCounter axle = getAxleCounterAndCheck4Reset(simulation, sectionCode); VirtualRealitySectionAxleCounter axle = getAxleCounterAndCheck4Reset(simulation, sectionCode);
if (!axle.isOccupy())
return;
axle.axleReset(); axle.axleReset();
} }
@ -645,7 +648,6 @@ public class CiApiServiceImpl implements CiApiService {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(), BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(),
section.debugStr() + "不是计轴区段也不归属于任何计轴区段"); section.debugStr() + "不是计轴区段也不归属于任何计轴区段");
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter(); VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), section.debugStr() + "计轴未占用,无需预复位");
if (simulation.getRepository().getConfig().isStationPreResetBeforeAxlePreReset()) { if (simulation.getRepository().getConfig().isStationPreResetBeforeAxlePreReset()) {
Station deviceStation = axleSection.getDeviceStation(); Station deviceStation = axleSection.getDeviceStation();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(deviceStation, section.debugStr() + "没有所属集中站"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(deviceStation, section.debugStr() + "没有所属集中站");