From 5a5f8a4508dc5e3209a1d2bb722510859eebdc0e Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 8 Jun 2021 15:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9AIBP=E7=9B=98?= =?UTF-8?q?=E6=89=A3=E8=BD=A6=E7=8A=B6=E6=80=81=EF=BC=88=E8=A5=BF=E5=AE=89?= =?UTF-8?q?=E4=B8=89=E9=97=AE=E9=A2=9835=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/VirtualRealityIbpService.java | 12 +++++------ .../rtss/simulation/cbtc/CI/CiApiService.java | 4 ++++ .../simulation/cbtc/CI/CiApiServiceImpl.java | 12 +++++++++++ .../cbtc/CI/service/StandService.java | 21 +++++++++++++++++++ .../rtss/simulation/cbtc/data/map/Stand.java | 6 +++++- .../cbtc/data/status/StandStatus.java | 10 +++++++++ .../cbtc/data/vo/StandStatusVO.java | 3 +++ 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java index 5160064e9..8848f23e3 100644 --- a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java +++ b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java @@ -72,16 +72,16 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService { List upStands = station.getNormalStand(config.isRight(true)); switch (button) { case XXKC: - downStands.forEach(stand -> ciApiService.standHoldTrain(simulation, stand.getCode(), false)); + downStands.forEach(stand -> ciApiService.ibpHoldTrain(simulation, stand.getCode())); break; case XXZZKC: - downStands.forEach(stand -> ciApiService.standHoldTrainCancel(simulation, stand.getCode(), false)); + downStands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode())); break; case SXKC: - upStands.forEach(stand -> ciApiService.standHoldTrain(simulation, stand.getCode(), false)); + upStands.forEach(stand -> ciApiService.ibpHoldTrain(simulation, stand.getCode())); break; case SXZZKC: - upStands.forEach(stand -> ciApiService.standHoldTrainCancel(simulation, stand.getCode(), false)); + upStands.forEach(stand -> ciApiService.ibpHoldTrainCancel(simulation, stand.getCode())); break; case JJTC: upStands.forEach(stand -> ciApiService.standEC(simulation, stand)); @@ -175,9 +175,9 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService { List downStands = station.getNormalStand(config.isRight(false)); List upStands = station.getNormalStand(config.isRight(true)); //下行扣车 - vrIbp.setXxkcLight(downStands.stream().anyMatch(Stand::isStationHoldTrain)); + vrIbp.setXxkcLight(downStands.stream().anyMatch(Stand::isIbpHoldTrain)); //上行扣车 - vrIbp.setSxkcLight(upStands.stream().anyMatch(Stand::isStationHoldTrain)); + vrIbp.setSxkcLight(upStands.stream().anyMatch(Stand::isIbpHoldTrain)); //紧急停车灯 vrIbp.setJjtcLight(downStands.stream().allMatch(Stand::isEmergencyClosed) && upStands.stream().allMatch(Stand::isEmergencyClosed)); //下行关门 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java index 7a560a2eb..024918ded 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiService.java @@ -262,6 +262,10 @@ public interface CiApiService { void sysHoldTrainCancel(Simulation simulation, String standCode); + void ibpHoldTrain(Simulation simulation, String standCode); + + void ibpHoldTrainCancel(Simulation simulation, String standCode); + void standHoldTrainCancelAll(Simulation simulation, String standCode); /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index 4289f9a07..f9259c6dc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -367,6 +367,18 @@ public class CiApiServiceImpl implements CiApiService { this.standService.cancelSysHoldTrain(simulation, stand); } + @Override + public void ibpHoldTrain(Simulation simulation, String standCode) { + Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); + this.standService.ibpHoldTrain(simulation, stand); + } + + @Override + public void ibpHoldTrainCancel(Simulation simulation, String standCode) { + Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); + this.standService.cancelIbpHoldTrain(simulation, stand); + } + @Override public void standHoldTrainCancelAll(Simulation simulation, String standCode) { Stand stand = simulation.getRepository().getByCode(standCode, Stand.class); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java index ef8cc7a97..96bb844cb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/StandService.java @@ -109,6 +109,27 @@ public class StandService { this.reopenSignal(simulation, stand); } } + + public void ibpHoldTrain(Simulation simulation, Stand stand) { + stand.setIbpHoldTrain(true); + // 关闭出站信号机 + Signal signal = stand.getSection().getSignalOf(stand.isRight()); + if (Objects.nonNull(signal)) { + MapConfig config = simulation.getRepository().getConfig(); + if (config.isStandHoldCloseLogicLight() || !signal.isLogicLight()) { + this.signalService.close(simulation, signal); + } + } + } + + public void cancelIbpHoldTrain(Simulation simulation, Stand stand) { + stand.setIbpHoldTrain(false); + // 如果所有扣车都取消,开放出站信号机 + if (!stand.isHoldTrain()) { + this.reopenSignal(simulation, stand); + } + } + /** * 取消扣车 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java index 4cf9283a6..0d45b504d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java @@ -88,6 +88,9 @@ public class Stand extends MayOutOfOrderDevice { /**系统扣车*/ private volatile boolean sysHoldTrain; + /** IBP盘扣车 */ + private boolean ibpHoldTrain; + /** * 区间自动扣车 */ @@ -169,6 +172,7 @@ public class Stand extends MayOutOfOrderDevice { this.stationHoldTrain = false; this.centerHoldTrain = false; this.sysHoldTrain = false; + this.ibpHoldTrain = false; this.autoHoldTrain = false; this.allSkip = false; this.skipSet = Collections.synchronizedSet(new HashSet<>()); @@ -193,7 +197,7 @@ public class Stand extends MayOutOfOrderDevice { */ //TODO 反向扣车是否计算在内 public boolean isHoldTrain() { - return stationHoldTrain || centerHoldTrain || sysHoldTrain; + return stationHoldTrain || centerHoldTrain || sysHoldTrain || ibpHoldTrain; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java index 1dbd16e51..7d88d6cd8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java @@ -45,6 +45,9 @@ public class StandStatus extends DeviceStatus { @JsonSerialize(using = Boolean2NumSerializer.class) private boolean sysHoldTrain; + @JsonSerialize(using = Boolean2NumSerializer.class) + private boolean ibpHoldTrain; + /**区间自动扣车*/ @JsonSerialize(using = Boolean2NumSerializer.class) private boolean autoHoldTrain; @@ -98,6 +101,7 @@ public class StandStatus extends DeviceStatus { this.stationHoldTrain = stand.isStationHoldTrain(); this.centerHoldTrain = stand.isCenterHoldTrain(); this.sysHoldTrain = stand.isSysHoldTrain(); + this.ibpHoldTrain = stand.isIbpHoldTrain(); this.autoHoldTrain = stand.isAutoHoldTrain(); this.allSkip = stand.isAllSkip(); this.skipSet = new HashSet<>(stand.getSkipSet()); @@ -157,6 +161,11 @@ public class StandStatus extends DeviceStatus { status.setSysHoldTrain(this.sysHoldTrain); change = true; } + if (!Objects.equals(this.ibpHoldTrain, stand.isIbpHoldTrain())) { + this.ibpHoldTrain = stand.isIbpHoldTrain(); + status.setIbpHoldTrain(this.isIbpHoldTrain()); + change = true; + } if (!Objects.equals(this.autoHoldTrain, stand.isAutoHoldTrain())) { this.autoHoldTrain = stand.isAutoHoldTrain(); status.setAutoHoldTrain(this.autoHoldTrain); @@ -240,6 +249,7 @@ public class StandStatus extends DeviceStatus { statusVO.setAutoHoldTrain(autoHoldTrain); statusVO.setCenterHoldTrain(centerHoldTrain); statusVO.setSysHoldTrain(sysHoldTrain); + statusVO.setIbpHoldTrain(ibpHoldTrain); statusVO.setStationHoldTrain(stationHoldTrain); statusVO.setEmergencyClosed(emergencyClosed); statusVO.setTrainParking(trainParking); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java index d01b4ca30..7de033b8c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/StandStatusVO.java @@ -41,6 +41,9 @@ public class StandStatusVO extends DeviceStatusVO { @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean sysHoldTrain; + @JsonSerialize(using = Boolean2NumSerializer.class) + private Boolean ibpHoldTrain; + /**区间自动扣车*/ @JsonSerialize(using = Boolean2NumSerializer.class) private Boolean autoHoldTrain;