【超限等级设置、设置任务】

This commit is contained in:
weizhihong 2022-07-08 17:01:26 +08:00
parent a8a5a4c884
commit f8a8f5cc75
5 changed files with 60 additions and 13 deletions

View File

@ -216,12 +216,12 @@ public class CtcStationRunPlanOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param task 任务 * @param taskKey 任务Key
* @param status 是否设置 1 0 * @param status 是否设置 1 0
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK) @OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK)
public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) { public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) {
ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, task, status); ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, taskKey, status);
} }
/** /**
@ -316,7 +316,7 @@ public class CtcStationRunPlanOperateHandler {
, LocalTime arriveTime, LocalTime departTime) { , LocalTime arriveTime, LocalTime departTime) {
ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime); ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime);
} }
/** /**
* 向调度中心申请股道 * 向调度中心申请股道
* *

View File

@ -131,6 +131,11 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private Boolean departElectrical; private Boolean departElectrical;
/**
* 超限等级
*/
private CtcStationRunPlanLog.TransfiniteType transfinite;
/** /**
* 到达超限 * 到达超限
*/ */
@ -166,11 +171,6 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private Boolean entryOutDiscordant; private Boolean entryOutDiscordant;
/**
* 超限等级
*/
private CtcStationRunPlanLog.TransfiniteType transfinite;
/** /**
* 记事 * 记事
*/ */
@ -656,6 +656,15 @@ public class CtcRunPlanParam implements Cloneable {
return this.arriveElectrical != null || this.departElectrical != null; return this.arriveElectrical != null || this.departElectrical != null;
} }
/**
* 是否指定到达出发超限等级
*
* @return 是否存在
*/
public boolean arriveAndDepartTransfinite() {
return this.arriveTransfinite != null || this.departTransfinite != null;
}
@Override @Override
public CtcRunPlanParam clone() { public CtcRunPlanParam clone() {
try { try {

View File

@ -459,9 +459,11 @@ public class CtcStationRunPlanLogService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param task 任务 * @param taskKey 任务Key
*/ */
public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) { public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) {
CtcStationRunPlanLog.RunPlanTask task = CtcStationRunPlanLog.RunPlanTask.getTaskByKey(taskKey);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(task);
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (status == 1) { // 设置 if (status == 1) { // 设置
runPlanLog.getRunPlanTaskItemMap().put(task.getOptionKey(), new CtcStationRunPlanLog.RunPlanTaskItem(task)); runPlanLog.getRunPlanTaskItemMap().put(task.getOptionKey(), new CtcStationRunPlanLog.RunPlanTaskItem(task));
@ -710,7 +712,19 @@ public class CtcStationRunPlanLogService {
Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical(); Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical();
runPlanItem.setElectrical(electrical); runPlanItem.setElectrical(electrical);
} else { } else {
runPlanItem.setElectrical(paramInfo.getElectrical()); // 设置默认电力
if (paramInfo.getElectrical() != null && !Objects.equals(runPlanItem.isElectrical(), paramInfo.getElectrical())) {
runPlanItem.setElectrical(paramInfo.getElectrical());
}
}
// 超限设置
if (paramInfo.arriveAndDepartTransfinite()) {
CtcStationRunPlanLog.TransfiniteType transfinite = arrive ? paramInfo.getArriveTransfinite() : paramInfo.getDepartTransfinite();
runPlanItem.setTransfinite(transfinite);
} else {
if (!Objects.equals(runPlanItem.getTransfinite(), paramInfo.getTransfinite())) {
runPlanItem.setTransfinite(paramInfo.getTransfinite());
}
} }
} }
return change; return change;

View File

@ -436,6 +436,10 @@ public class CtcStationRunPlanLog {
*/ */
private boolean finish; private boolean finish;
/**
* 超限等级
*/
private TransfiniteType transfinite;
public RunPlanItem(CtcRunPlanParam paramInfo) { public RunPlanItem(CtcRunPlanParam paramInfo) {
this.paramInfo = paramInfo; this.paramInfo = paramInfo;
@ -447,6 +451,7 @@ public class CtcStationRunPlanLog {
this.adjacentMessageTime = ""; this.adjacentMessageTime = "";
this.setOutTypeMap = new HashMap<>(SetOutType.values().length); this.setOutTypeMap = new HashMap<>(SetOutType.values().length);
this.processTypeMap = new HashMap<>(ProcessType.values().length); this.processTypeMap = new HashMap<>(ProcessType.values().length);
this.transfinite = TransfiniteType.NO;
} }
public void initAccessName() { public void initAccessName() {
@ -555,6 +560,13 @@ public class CtcStationRunPlanLog {
} else { } else {
runPlanItem.setElectrical(paramInfo.getElectrical()); runPlanItem.setElectrical(paramInfo.getElectrical());
} }
// 超限等级
if (paramInfo.arriveAndDepartTransfinite()) {
TransfiniteType transfinite = arrive ? paramInfo.getArriveTransfinite() : paramInfo.getDepartTransfinite();
runPlanItem.setTransfinite(transfinite);
} else {
runPlanItem.setTransfinite(paramInfo.getTransfinite());
}
} }
return runPlanItem; return runPlanItem;
} }
@ -613,7 +625,7 @@ public class CtcStationRunPlanLog {
* @param key 唯一键 * @param key 唯一键
* @return 运行任务 * @return 运行任务
*/ */
public RunPlanTask getTaskByKey(String key) { public static RunPlanTask getTaskByKey(String key) {
return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key)) return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key))
.findFirst().orElseGet(null); .findFirst().orElseGet(null);
} }

View File

@ -408,6 +408,12 @@ public class CtcStationRunPlanLogVO {
changeRunItem.setElectrical(runPlanItem.isElectrical()); changeRunItem.setElectrical(runPlanItem.isElectrical());
change = true; change = true;
} }
// 超限
if (runPlanItem.getTransfinite() != null && !Objects.equals(paramInfo.getTransfinite(), runPlanItem.getTransfinite().getVal())) {
paramInfo.setTransfinite(runPlanItem.getTransfinite().getVal());
changeRunItem.setTransfinite(runPlanItem.getTransfinite().getVal());
change = true;
}
return change ? changeRunItem : null; // 没有变化返回null return change ? changeRunItem : null; // 没有变化返回null
} }
@ -474,6 +480,11 @@ public class CtcStationRunPlanLogVO {
*/ */
private Boolean electrical; private Boolean electrical;
/**
* 超限等级
*/
private String transfinite;
public RunPlanItem() { public RunPlanItem() {
} }
@ -495,6 +506,7 @@ public class CtcStationRunPlanLogVO {
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
this.finish = runPlanItem.isFinish(); this.finish = runPlanItem.isFinish();
this.electrical = runPlanItem.isElectrical(); this.electrical = runPlanItem.isElectrical();
this.transfinite = runPlanItem.getTransfinite().getVal();
} }
} }
} }