新增:IBP盘扣车状态(西安三问题35)

This commit is contained in:
joylink_zhangsai 2021-06-08 15:46:54 +08:00
parent c3c8ebaf38
commit 5a5f8a4508
7 changed files with 61 additions and 7 deletions

View File

@ -72,16 +72,16 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
List<Stand> 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<Stand> downStands = station.getNormalStand(config.isRight(false));
List<Stand> 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));
//下行关门

View File

@ -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);
/**

View File

@ -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);

View File

@ -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);
}
}
/**
* 取消扣车
*

View File

@ -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;
}
/**

View File

@ -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);

View File

@ -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;