【批量修改行车日志功能】
【PLC信号板按钮、指示灯网关地址配置】
This commit is contained in:
parent
11070c6aa4
commit
8ab7b56869
@ -910,6 +910,11 @@ public class Operation {
|
||||
// */
|
||||
// CTC_PASS,
|
||||
|
||||
/**
|
||||
* 批量修改运行计划
|
||||
*/
|
||||
CTC_BATCH_MODIFY_RUN_PLAN,
|
||||
|
||||
/**
|
||||
* 修改股道
|
||||
*/
|
||||
|
@ -3,12 +3,14 @@ package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcStationRunPlanLogService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@OperateHandler
|
||||
@Slf4j
|
||||
@ -16,6 +18,19 @@ public class CtcStationRunPlanOperateHandler {
|
||||
@Autowired
|
||||
private CtcStationRunPlanLogService ctcStationRunPlanLogService;
|
||||
|
||||
/**
|
||||
* 修改行车计划信息
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param stationCode 车站编码
|
||||
* @param planParamList 修改行车参数
|
||||
* @param force 是否强制 0:不强制。1:强制
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.CTC_BATCH_MODIFY_RUN_PLAN)
|
||||
public void modifyBatchRunPlan(Simulation simulation, String stationCode, List<CtcRunPlanParam> planParamList, int force) {
|
||||
ctcStationRunPlanLogService.modifyBatchRunPlan(simulation, stationCode, planParamList, force);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行车计划股道信息
|
||||
*
|
||||
@ -32,7 +47,6 @@ public class CtcStationRunPlanOperateHandler {
|
||||
ctcStationRunPlanLogService.modifyRunPlanTrackSection(simulation, stationCode, runPlanCode, arriveSectionCode, departSectionCode, force);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 人工上报行车日志的到点时间
|
||||
*
|
||||
|
@ -0,0 +1,72 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.operation.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class CtcRunPlanParam {
|
||||
/**
|
||||
* 运行计划编码
|
||||
*/
|
||||
private String runPlanCode;
|
||||
|
||||
/**
|
||||
* 到达股道
|
||||
*/
|
||||
private String arriveSectionCode;
|
||||
|
||||
/**
|
||||
* 发车股道
|
||||
*/
|
||||
private String departSectionCode;
|
||||
|
||||
/**
|
||||
* 到达时间
|
||||
*/
|
||||
private LocalTime arriveTime;
|
||||
|
||||
/**
|
||||
* 发车时间
|
||||
*/
|
||||
private LocalTime departTime;
|
||||
|
||||
/**
|
||||
* 到达车次
|
||||
*/
|
||||
private String arriveTripNumber;
|
||||
|
||||
/**
|
||||
* 发车车次
|
||||
*/
|
||||
private String departTripNumber;
|
||||
|
||||
/**
|
||||
* 到达车站
|
||||
*/
|
||||
private String arriveStationCode;
|
||||
|
||||
/**
|
||||
* 发车车站
|
||||
*/
|
||||
private String departStationCode;
|
||||
|
||||
/**
|
||||
* 到达口
|
||||
*/
|
||||
private String arriveSignalCode;
|
||||
|
||||
/**
|
||||
* 发车口
|
||||
*/
|
||||
private String departSignalCode;
|
||||
|
||||
/**
|
||||
* 状态:-1:删除,0:修改,1:添加
|
||||
*/
|
||||
private int status;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.ATS.service.runplan;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
@ -19,6 +20,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@ -32,6 +34,167 @@ public class CtcStationRunPlanLogService {
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* 批量修改运行计划
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param stationCode 车站编码
|
||||
* @param planParamList 参数信息
|
||||
* @param force 是否强制
|
||||
*/
|
||||
public void modifyBatchRunPlan(Simulation simulation, String stationCode, List<CtcRunPlanParam> planParamList, int force) {
|
||||
if (force == 0) {
|
||||
boolean isNormal = planParamList.stream().filter(param -> param.getStatus() == 0)
|
||||
.anyMatch(p -> {
|
||||
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getCtcStationRunPlanLog(stationCode, p.getRunPlanCode());
|
||||
if (!StringUtils.isEmpty(p.getArriveSectionCode())) {
|
||||
RouteSequence.Line arriveLine = simulation.getCtcRepository()
|
||||
.getRouteSequenceLine(stationCode, runPlanLog.getTripNumber(), false);
|
||||
if ((arriveLine != null && arriveLine.getRoute().isLock())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(p.getDepartSectionCode())) {
|
||||
RouteSequence.Line departLine = simulation.getCtcRepository()
|
||||
.getRouteSequenceLine(stationCode, runPlanLog.getTripNumber(), true);
|
||||
if ((departLine != null && departLine.getRoute().isLock())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (isNormal) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "进路状态不允许修改到达股道");
|
||||
}
|
||||
}
|
||||
List<CtcStationRunPlanLog> runPlanLogList = new ArrayList<>(planParamList.size());
|
||||
planParamList.stream().forEach(p -> {
|
||||
if (p.getStatus() <= 0) {
|
||||
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getCtcStationRunPlanLog(stationCode, p.getRunPlanCode());
|
||||
if (p.getStatus() == 0) {
|
||||
modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), p, true);
|
||||
modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), p, false);
|
||||
runPlanLogList.add(runPlanLog);
|
||||
} else if (p.getStatus() == -1) {
|
||||
runPlanLog.setDelete(true);
|
||||
runPlanLogList.add(runPlanLog);
|
||||
}
|
||||
} else if (p.getStatus() == 1) {
|
||||
CtcStationRunPlanLog runPlanLog = addRunPlanLog(simulation, stationCode, p);
|
||||
simulation.getCtcRepository().addCtcStationRunPlan(runPlanLog);
|
||||
runPlanLogList.add(runPlanLog);
|
||||
}
|
||||
});
|
||||
websocketMessageSend(simulation, runPlanLogList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改行车计划属性信息
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param runPlanItem 接发条目
|
||||
* @param paramInfo 参数
|
||||
* @param arrive 是否到达
|
||||
*/
|
||||
private void modifyRunPlanItemInfo(Simulation simulation, CtcStationRunPlanLog.RunPlanItem runPlanItem
|
||||
, CtcRunPlanParam paramInfo, boolean arrive) {
|
||||
if (runPlanItem != null) {
|
||||
// 实际时间
|
||||
LocalTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime();
|
||||
if (actualTime != null) {
|
||||
runPlanItem.setActualTime(actualTime.toString());
|
||||
}
|
||||
// 股道编码
|
||||
String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode();
|
||||
if (!StringUtils.isEmpty(sectionCode)) {
|
||||
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||
runPlanItem.setTrackSection(section);
|
||||
}
|
||||
// 车次
|
||||
String tripNumber = arrive ? paramInfo.getArriveTripNumber() : paramInfo.getDepartTripNumber();
|
||||
if (!StringUtils.isEmpty(tripNumber)) {
|
||||
runPlanItem.setTripNumber(tripNumber);
|
||||
}
|
||||
// 车站
|
||||
String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode();
|
||||
if (!StringUtils.isEmpty(stationCode)) {
|
||||
Station station = simulation.getRepository().getByCode(stationCode, Station.class);
|
||||
runPlanItem.setStation(station);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加行车日志
|
||||
*
|
||||
* @param simulation
|
||||
* @param stationCode
|
||||
* @param paramInfo
|
||||
* @return
|
||||
*/
|
||||
private CtcStationRunPlanLog addRunPlanLog(Simulation simulation, String stationCode, CtcRunPlanParam paramInfo) {
|
||||
CtcStationRunPlanLog ctcStationRunPlanLog = new CtcStationRunPlanLog();
|
||||
Station station = simulation.getRepository().getByCode(stationCode, Station.class);
|
||||
String tripNumber = StringUtils.isEmpty(paramInfo.getArriveTripNumber()) ?
|
||||
paramInfo.getDepartTripNumber() : paramInfo.getArriveTripNumber();
|
||||
ctcStationRunPlanLog.setCode(RandomGenerator.uuid());
|
||||
ctcStationRunPlanLog.setStation(station);
|
||||
ctcStationRunPlanLog.setTripNumber(tripNumber);
|
||||
if (!StringUtils.isEmpty(paramInfo.getArriveTripNumber())) {
|
||||
CtcStationRunPlanLog.RunPlanItem arriveRunPlanItem = createRunPlanItem(simulation, paramInfo, true);
|
||||
ctcStationRunPlanLog.setArriveRunPlan(arriveRunPlanItem);
|
||||
}
|
||||
if (!StringUtils.isEmpty(paramInfo.getDepartTripNumber())) {
|
||||
CtcStationRunPlanLog.RunPlanItem departRunPlanItem = createRunPlanItem(simulation, paramInfo, false);
|
||||
ctcStationRunPlanLog.setDepartRunPlan(departRunPlanItem);
|
||||
}
|
||||
return ctcStationRunPlanLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建运行计划实体
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param paramInfo 参数信息
|
||||
* @param arrive 是否到达
|
||||
* @return 运行计划实体
|
||||
*/
|
||||
private CtcStationRunPlanLog.RunPlanItem createRunPlanItem(Simulation simulation, CtcRunPlanParam paramInfo, boolean arrive) {
|
||||
CtcStationRunPlanLog.RunPlanItem runPlanItem = new CtcStationRunPlanLog.RunPlanItem();
|
||||
// 车次
|
||||
String tripNumber = arrive ? paramInfo.getArriveTripNumber() : paramInfo.getDepartTripNumber();
|
||||
runPlanItem.setTripNumber(tripNumber);
|
||||
// 实际时间
|
||||
LocalTime planTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime();
|
||||
runPlanItem.setPlanTime(planTime);
|
||||
// 股道编码
|
||||
String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode();
|
||||
// 股道
|
||||
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||
runPlanItem.setTrackSection(section);
|
||||
// 车站\邻站
|
||||
String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode();
|
||||
Station adjacentStation = simulation.getRepository().getByCode(stationCode, Station.class);
|
||||
runPlanItem.setStation(adjacentStation);
|
||||
// 运行方向
|
||||
String signalCode = arrive ? paramInfo.getArriveSignalCode() : paramInfo.getDepartSignalCode();
|
||||
Signal signal = simulation.getRepository().getByCode(signalCode, Signal.class);
|
||||
runPlanItem.setPlanLineName(signal.getShowName());
|
||||
StationDirection stationDirection = adjacentStation.getStationDirectionMap().values().stream()
|
||||
.filter(s -> s.getSignal().equals(signal))
|
||||
.findFirst().orElse(null);
|
||||
if (stationDirection != null) {
|
||||
runPlanItem.setStationDirection(stationDirection);
|
||||
runPlanItem.setRight(stationDirection.getRight());
|
||||
runPlanItem.initPlanLineName();
|
||||
}
|
||||
// 接发状态
|
||||
StationDirection.ReceiveAndDeliverModel runModel = arrive ?
|
||||
StationDirection.ReceiveAndDeliverModel.R : StationDirection.ReceiveAndDeliverModel.D;
|
||||
runPlanItem.setRunModel(runModel);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运行股道
|
||||
*
|
||||
@ -64,15 +227,19 @@ public class CtcStationRunPlanLogService {
|
||||
}
|
||||
}
|
||||
if (ctcStationRunPlanLog != null) {
|
||||
Section arriveSection = simulation.getRepository().getByCode(arriveSectionCode, Section.class);
|
||||
if (ctcStationRunPlanLog.getArriveRunPlan() != null
|
||||
&& ctcStationRunPlanLog.getArriveRunPlan().getStationPlan() != null) {
|
||||
ctcStationRunPlanLog.getArriveRunPlan().setTrackSection(arriveSection);
|
||||
if (!StringUtils.isEmpty(arriveSectionCode)) {
|
||||
Section arriveSection = simulation.getRepository().getByCode(arriveSectionCode, Section.class);
|
||||
if (ctcStationRunPlanLog.getArriveRunPlan() != null
|
||||
&& ctcStationRunPlanLog.getArriveRunPlan().getStationPlan() != null) {
|
||||
ctcStationRunPlanLog.getArriveRunPlan().setTrackSection(arriveSection);
|
||||
}
|
||||
}
|
||||
Section departSection = simulation.getRepository().getByCode(departSectionCode, Section.class);
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan() != null
|
||||
&& ctcStationRunPlanLog.getDepartRunPlan().getStationPlan() != null) {
|
||||
ctcStationRunPlanLog.getDepartRunPlan().setTrackSection(departSection);
|
||||
if (!StringUtils.isEmpty(departSectionCode)) {
|
||||
Section departSection = simulation.getRepository().getByCode(departSectionCode, Section.class);
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan() != null
|
||||
&& ctcStationRunPlanLog.getDepartRunPlan().getStationPlan() != null) {
|
||||
ctcStationRunPlanLog.getDepartRunPlan().setTrackSection(departSection);
|
||||
}
|
||||
}
|
||||
websocketMessageSend(simulation, Arrays.asList(ctcStationRunPlanLog));
|
||||
}
|
||||
@ -92,10 +259,18 @@ public class CtcStationRunPlanLogService {
|
||||
CtcStationRunPlanLog ctcStationRunPlanLog =
|
||||
simulation.getCtcRepository().getCtcStationRunPlanLog(stationCode, runPlanCode);
|
||||
if (ctcStationRunPlanLog.getArriveRunPlan() != null) {
|
||||
ctcStationRunPlanLog.getArriveRunPlan().setActualTime(arriveTime.toString());
|
||||
if (arriveTime != null) {
|
||||
ctcStationRunPlanLog.getArriveRunPlan().setActualTime(arriveTime.toString());
|
||||
} else {
|
||||
ctcStationRunPlanLog.getArriveRunPlan().setActualTime(null);
|
||||
}
|
||||
}
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan() != null) {
|
||||
ctcStationRunPlanLog.getDepartRunPlan().setActualTime(departTime.toString());
|
||||
if (departTime != null) {
|
||||
ctcStationRunPlanLog.getDepartRunPlan().setActualTime(departTime.toString());
|
||||
} else {
|
||||
ctcStationRunPlanLog.getDepartRunPlan().setActualTime(null);
|
||||
}
|
||||
}
|
||||
websocketMessageSend(simulation, Arrays.asList(ctcStationRunPlanLog));
|
||||
}
|
||||
|
@ -29,6 +29,16 @@ public class CtcRepository {
|
||||
// generateRouteSequence();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加单个行车日志
|
||||
*
|
||||
* @param ctcStationRunPlanLog 日志信息
|
||||
*/
|
||||
public void addCtcStationRunPlan(CtcStationRunPlanLog ctcStationRunPlanLog) {
|
||||
this.ctcStationRunPlanLogList.add(ctcStationRunPlanLog);
|
||||
// generateRouteSequence();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ctc 行车日志
|
||||
*
|
||||
|
@ -65,6 +65,83 @@ public class HhcjIbpConfigVO extends RealConfigVO {
|
||||
*/
|
||||
private Integer r_sx_hsjc = 21;
|
||||
|
||||
/***************************** 信号盘 ************************************/
|
||||
/**
|
||||
* 下行扣车按钮
|
||||
*/
|
||||
private Integer r_xx_kc = 0;
|
||||
|
||||
/**
|
||||
* 下行扣车指示灯
|
||||
*/
|
||||
private Integer w_xx_kc_light = 0;
|
||||
|
||||
/**
|
||||
* 下行终止扣车
|
||||
*/
|
||||
private Integer r_xx_zzkc = 1;
|
||||
|
||||
/**
|
||||
* 下行取消紧急停车
|
||||
*/
|
||||
private Integer r_xx_qxjjtc = 2;
|
||||
|
||||
/**
|
||||
* 下行紧急停车按钮
|
||||
*/
|
||||
private Integer r_xx_jjtc = 3;
|
||||
|
||||
/**
|
||||
* 下行紧急停车灯
|
||||
*/
|
||||
private Integer w_xx_jjtc_light = 1;
|
||||
|
||||
/**
|
||||
* 下行蜂鸣器
|
||||
*/
|
||||
private Integer w_xx_alarm = 2;
|
||||
|
||||
/**
|
||||
* 上行扣车按钮
|
||||
*/
|
||||
private Integer r_sx_kc = 4;
|
||||
|
||||
/**
|
||||
* 上行扣车指示灯
|
||||
*/
|
||||
private Integer w_sx_kc_light = 3;
|
||||
|
||||
/**
|
||||
* 上行终止扣车
|
||||
*/
|
||||
private Integer r_sx_zzkc = 5;
|
||||
|
||||
/**
|
||||
* 上行取消紧急停车
|
||||
*/
|
||||
private Integer r_sx_qxjjtc = 6;
|
||||
|
||||
/**
|
||||
* 上行紧急停车
|
||||
*/
|
||||
private Integer r_sx_jjtc = 7;
|
||||
|
||||
/**
|
||||
* 上行紧急停车灯
|
||||
*/
|
||||
private Integer w_sx_jjtc_light = 4;
|
||||
|
||||
/**
|
||||
* 上行报警切除
|
||||
*/
|
||||
private Integer r_sx_bjqc = 8;
|
||||
|
||||
/**
|
||||
* 上行试灯按钮
|
||||
*/
|
||||
private Integer r_sx_sd = 9;
|
||||
|
||||
/***************************** 信号 ************************************/
|
||||
public HhcjIbpConfigVO() {
|
||||
super(0, 304);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user