Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2022-07-07 15:30:31 +08:00
commit db198ad99d
12 changed files with 446 additions and 96 deletions

View File

@ -932,6 +932,46 @@ public class Operation {
* 行车日志取消闭塞
*/
CTC_LOG_CANCEL_BLOCK,
/**
* 行车日志保存运行信息
*/
CTC_LOG_SAVE_RUN_PLAN,
/**
* 行车日志设置运行任务
*/
CTC_LOG_SET_TASK,
/**
* 行车日志设置军用属性
*/
CTC_LOG_SET_MILITARY,
/**
* 行车日志设置超限
*/
CTC_LOG_SET_TRANSFINITE,
/**
* 行车日志设置重点列车
*/
CTC_LOG_SET_KEY_TRAINS,
/**
* 行车日志设置删除标识
*/
CTC_LOG_SET_DELETE_LABEL,
/**
* 行车日志设置进出入口不一致
*/
CTC_LOG_SET_ENTRY_OUT_DISCORDANT,
/**
* 设置股道不一致
*/
CTC_LOG_SET_TRACK_DISCORDANT,
/**************调度台******************/
/**
* 调度台保存运行计划
@ -1143,7 +1183,9 @@ public class Operation {
* 查询票据
*/
RAIL_QUERY_TICKET,
/** 给出票据 */
/**
* 给出票据
*/
RAIL_GIVE_TICKET_TO,
}

View File

@ -5,6 +5,7 @@ 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.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.CTC.service.CTCService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
@ -68,21 +69,6 @@ public class CtcStationRunPlanOperateHandler {
ctcStationRunPlanLogService.modifyRunPlanDirection(simulation, stationCode, runPlanCode, arriveDirection, departDirection, force);
}
/**
* 人工上报行车日志的到点时间
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveTime 到点时间
* @param departTime 发车时间
*/
@OperateHandlerMapping(type = Operation.Type.CTC_MODIFY_ACTUAL_TIME)
public void artificialReportRunPlanActualTime(Simulation simulation, String stationCode, String runPlanCode
, LocalTime arriveTime, LocalTime departTime) {
ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime);
}
/**
* 修改车次号
*
@ -152,21 +138,6 @@ public class CtcStationRunPlanOperateHandler {
ctcStationRunPlanLogService.signForRunPlan(simulation, stationCode);
}
/**
* 向调度中心申请股道
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param sectionCode 股道编码
* @param model 接发
*/
@OperateHandlerMapping(type = Operation.Type.CTC_STATION_APPLY_RUN_PLAN)
public void applySection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode
, StationDirection.ReceiveAndDeliverModel model) {
ctcStationRunPlanLogService.applySection(simulation, stationCode, runPlanCode, sectionCode, model);
}
/**
* 发送计划
*
@ -225,4 +196,140 @@ public class CtcStationRunPlanOperateHandler {
public void cancelBlock(Simulation simulation, String stationCode, String runPlanCode) {
ctcStationRunPlanLogService.cancelBlock(simulation, stationCode, runPlanCode);
}
/**
* 行车日志保存运行计划
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanParam 运行计划信息
* @param force 是否强制
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SAVE_RUN_PLAN)
public void saveInfo(Simulation simulation, String stationCode, CtcRunPlanParam runPlanParam, int force) {
ctcStationRunPlanLogService.saveInfo(simulation, stationCode, runPlanParam, force);
}
/**
* 设置运行任务
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param task 任务
* @param status 是否设置 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK)
public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) {
ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, task, status);
}
/**
* 设置军用
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 是否军用 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_MILITARY)
public void setMilitary(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.setMilitary(simulation, stationCode, runPlanCode, status);
}
/**
* 设置超限
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param transfinite 超限等级
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TRANSFINITE)
public void setTransfinite(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.TransfiniteType transfinite) {
ctcStationRunPlanLogService.setTransfinite(simulation, stationCode, runPlanCode, transfinite);
}
/**
* 设置重点列车
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 重点列车 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_KEY_TRAINS)
public void setKeyTrains(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.setKeyTrains(simulation, stationCode, runPlanCode, status);
}
/**
* 设置删除标识操作
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 删除状态 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_DELETE_LABEL)
public void setDelete(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode);
}
/**
* 设置进出入口不一致
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 状态 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_ENTRY_OUT_DISCORDANT)
public void setEntryOutDiscordant(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.setEntryOutDiscordant(simulation, stationCode, runPlanCode, status);
}
/**
* 设置允许股道与基本路径不一致
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 状态 1 0
*/
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TRACK_DISCORDANT)
public void setTrackDiscordant(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.setTrackDiscordant(simulation, stationCode, runPlanCode, status);
}
/**
* 人工上报行车日志的到点时间
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveTime 到点时间
* @param departTime 发车时间
*/
@OperateHandlerMapping(type = Operation.Type.CTC_MODIFY_ACTUAL_TIME)
public void artificialReportRunPlanActualTime(Simulation simulation, String stationCode, String runPlanCode
, LocalTime arriveTime, LocalTime departTime) {
ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime);
}
/**
* 向调度中心申请股道
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param sectionCode 股道编码
* @param model 接发
*/
@OperateHandlerMapping(type = Operation.Type.CTC_STATION_APPLY_RUN_PLAN)
public void applySection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode
, StationDirection.ReceiveAndDeliverModel model) {
ctcStationRunPlanLogService.applySection(simulation, stationCode, runPlanCode, sectionCode, model);
}
}

View File

@ -72,7 +72,8 @@ public class CtcZoneOperateHandler {
*/
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME)
public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, String planTime, StationDirection.ReceiveAndDeliverModel model) {
return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, LocalDateTime.parse(planTime), model);
LocalDateTime t = LocalDateTime.parse(planTime.replace(" ", "T"));
return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, t, model);
}
/**

View File

@ -222,6 +222,14 @@ public class CtcRunPlanParam implements Cloneable {
return this.runPlanCode;
}
/**
* 设置默认的实际时间
*/
public void setDefaultActual() {
this.arriveTime = this.arriveTime == null ? this.arrivePlanTime : this.arriveTime;
this.departTime = this.departTime == null ? this.departPlanTime : this.departTime;
}
/**
* 对比两个计划对象,并修改实际计划
*
@ -601,7 +609,42 @@ public class CtcRunPlanParam implements Cloneable {
* 列车类型
*/
public enum TrainType {
FAST_PASSENGER_TRAIN, // 快速旅客列车
/*************** 管内列车 local passenger train***********************/
// 管内特快旅客列车
LOCAL_EXPRESS_PASSENGER_TRAIN,
// 管内快速旅客列车
LOCAL_FAST_PASSENGER_TRAIN,
// 管内普通旅客快车
LOCAL_PASSENGER_TRAIN,
// 管内普通旅客慢车
LOCAL_SLOW_PASSENGER_TRAIN,
// 管内临时旅客列车
LOCAL_TEMPORARY_PASSENGER_TRAIN,
// 管内临时旅游列车
LOCAL_TEMPORARY_TOURIST_TRAIN,
/*************** 管内列车 local passenger train***********************/
/*************** 跨局列车 local passenger train***********************/
// 跨局快速旅客列车
FAST_PASSENGER_TRAIN,
// 跨局临时旅游列车
TEMPORARY_TOURIST_TRAIN,
// 跨两局普通旅客快车
TWO_PASSENGER_TRAIN,
// 跨两局普通旅客慢车
TWO_SLOW_PASSENGER_TRAIN,
// 跨两局临时旅客列车
TWO_TEMPORARY_PASSENGER_TRAIN,
// 跨三局及其以上普通旅客快车
MORE_PASSENGER_TRAIN,
/*************** 跨局列车 local passenger train***********************/
/****************其他列车***************************/
// 回送出入厂客车底列车
BACK_FACTORY_PASSENGER_TRAIN,
// 因故折返旅客列车
FAULT_TRUE_BACK_PASSENGER_TRAIN,
/****************其他列车***************************/
}
/**

View File

@ -239,7 +239,7 @@ public class CtcStationRunPlanLogService {
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) {
ctcStationRunPlanLog.setDelete(Boolean.TRUE);
ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
// ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
}
}
@ -280,9 +280,8 @@ public class CtcStationRunPlanLogService {
.getRunPlanByRunPlanCodeAndStationCode(stationCode, ctcRunPlanVO.getRunPlanCode());
boolean change = false;
if (runPlanLog != null) {
boolean isFinish = runPlanLog.arrivePlanTimeCheck(modifyParam.getArrivePlanTime())
&& runPlanLog.departPlanTimeCheck(modifyParam.getDepartPlanTime());
if (!isFinish) { // 已完成该车次的接发车作业又收到该接发车时间范围内的阶段计划,不取消红闪
boolean isFinish = runPlanLog.isFinish();
if (!isFinish) { // 如果存在完成流程则不允许修改已完成该车次的接发车作业又收到该接发车时间范围内的阶段计划,不取消红闪
runPlanLog.setTwinkle(true);
} else { // 行车计划未完成
runPlanLog.setBaseAttribute(modifyParam);
@ -379,6 +378,8 @@ public class CtcStationRunPlanLogService {
* @param runPlanCode 运行计划编码
*/
public void cancelTwinkle(Simulation simulation, String stationCode, String runPlanCode) {
boolean isExist = simulation.getCtcRepository().getCtcEffectRepository().isExistStageRunPlan(stationCode, null);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(isExist, "存在未签收的阶段计划");
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setTwinkle(false);
}
@ -421,6 +422,123 @@ public class CtcStationRunPlanLogService {
nextPlanLog.cancelArriveBlock();
}
/**
* 行车日志保存运行计划
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanParam 运行计划信息
* @param force 是否强制
*/
public void saveInfo(Simulation simulation, String stationCode, CtcRunPlanParam runPlanParam, int force) {
// 参数信息是否正确
boolean isNotEmpty = runPlanParam.arriveIsExist() || runPlanParam.departIsExist();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(!isNotEmpty, "缺少必填项");
if (StringUtils.isEmpty(runPlanParam.getRunPlanCode())) { // 增加
// 确定车次信息
String tripNumber = runPlanParam.generateTripNumber();
// 确定车次班次
if (StringUtils.isEmpty(runPlanParam.getGroupNumber())) {
long time = simulation.getCtcRepository().getAllRunPlanList().stream()
.filter(r -> tripNumber.equals(r.getTripNumber())).count();
runPlanParam.generateGroupNumber(time + 1);
}
runPlanParam.generateRunPlanCode();
// 设置默认的实际时间
runPlanParam.setDefaultActual();
CtcStationRunPlanLog runPlanLog = CtcStationRunPlanLog.createRunPlanLog(simulation, stationCode, runPlanParam);
runPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE);
simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog);
} else {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanParam.getRunPlanCode());
if (modifyRunPlanInfo(simulation, runPlanLog, runPlanParam)) {
runPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_MODIFY_CHANGE);
}
}
}
/**
* 设置运行任务
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param task 任务
*/
public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (status == 1) { // 设置
runPlanLog.getRunPlanTaskItemMap().put(task, new CtcStationRunPlanLog.RunPlanTaskItem(task));
} else { // 取消
runPlanLog.getRunPlanTaskItemMap().remove(task);
}
}
/**
* 设置军用
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 是否军用 1 0
*/
public void setMilitary(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setMilitary(status == 1);
}
/**
* 设置超限
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param transfinite 超限等级
*/
public void setTransfinite(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.TransfiniteType transfinite) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setTransfinite(transfinite);
}
/**
* 设置重点列车
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 重点列车 1 0
*/
public void setKeyTrains(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setKeyTrains(status == 1);
}
/**
* 设置进出入口不一致
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 状态 1 0
*/
public void setEntryOutDiscordant(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setEntryOutDiscordant(status == 1);
}
/**
* 设置允许股道与基本路径不一致
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param runPlanCode 运行计划编码
* @param status 状态 1 0
*/
public void setTrackDiscordant(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setTrackDiscordant(status == 1);
}
/**
* 修改原始数据并返回修改属性的对象
*
@ -497,8 +615,8 @@ public class CtcStationRunPlanLogService {
}
// 实际时间
LocalDateTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime();
if (actualTime != null && !Objects.equals(actualTime.toString(), runPlanItem.getActualTime())) {
runPlanItem.setActualTime(actualTime.toString());
if (actualTime != null && !Objects.equals(actualTime.toLocalTime().toString(), runPlanItem.getActualTime())) {
runPlanItem.setActualTime(actualTime.toLocalTime().toString());
}
// 股道编码
String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode();

View File

@ -46,6 +46,8 @@ public class CtcZoneService {
planParam.generateGroupNumber(time);
}
planParam.generateRunPlanCode();
// 设置默认的实际时间
planParam.setDefaultActual();
}
railwayRepository.saveRunPlan(planParam);
return planParam;

View File

@ -25,7 +25,6 @@ import club.joylink.rtss.websocket.WebSocketMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
@ -163,9 +162,10 @@ public class CTCLogicLoop {
// 接车计划到点列车占压区段与接车计划股道一致且列车是停站状态
CtcStationRunPlanLog.RunPlanItem arriveRunPlan = runPlan.getArriveRunPlan();
if (arriveRunPlan != null) {
if (!StringUtils.hasText(arriveRunPlan.getActualTime())) {
if (!arriveRunPlan.isFinish()) {
if (headSection.equals(arriveRunPlan.getTrackSection()) && train.isParkingAt()) {
arriveRunPlan.setActualTime(actualTime);
arriveRunPlan.setFinish(true);
//设置上一站的<邻站到达>
Station previousStation = runPlan.findPreviousStation();
if (previousStation != null) {
@ -183,11 +183,12 @@ public class CTCLogicLoop {
// 发车计划发点列车位置越过出站信号机
CtcStationRunPlanLog.RunPlanItem departRunPlan = runPlan.getDepartRunPlan();
if (departRunPlan != null) {
if (!StringUtils.hasText(departRunPlan.getActualTime())) { //实际发车时间没填
if (!departRunPlan.isFinish()) { //实际发车时间没填
Section trackSection = departRunPlan.getTrackSection();
Signal signal = trackSection.getSignalOf(departRunPlan.isRight());
if (headPosition.isAheadOf(signal.getPosition(), departRunPlan.isRight())) { //车头越过出站信号机
departRunPlan.setActualTime(actualTime);
departRunPlan.setFinish(true);
//设置下一站的<邻站出发>
Station nextStation = runPlan.findNextStation();
if (nextStation != null) {
@ -396,7 +397,8 @@ public class CTCLogicLoop {
changeMap.put(k, Boolean.TRUE);
}
});
if (!Objects.equals(simulation.getCtcRepository().isRunPlanSendOut(), changeMap.isEmpty())) {
// 为空时
if (!Objects.equals(simulation.getCtcRepository().getRunPlanSendOut(), changeMap.isEmpty()) || !changeMap.isEmpty()) {
simulation.getCtcRepository().setRunPlanSendOut(changeMap.isEmpty());
sendCtcMessage(simulation.getId(), changeMap, WebSocketMessageType.SIMULATION_CTC_RUN_PLAN_CONFIRM_SEND
, simulation.getSimulationUserIds());

View File

@ -151,13 +151,27 @@ public class CtcEffectRepository {
return null;
}
return this.stationStageRunPlanMap.values().stream()
.filter(r -> {
Integer oldVersion = this.getStageRunPlanVersionMap().get(r.getStationCode());
return !CollectionUtils.isEmpty(r.getCtcRunPlanVOList()) && (oldVersion == null || oldVersion < r.getVersion().get());
})
.filter(r -> isExistStageRunPlan(r.getStationCode(), r))
.map(CtcStageRunPlanRepository::generateStatus).collect(Collectors.toList());
}
/**
* 是否存在阶段计划
*
* @param stationCode 车站编码
* @param r 阶段计划
* @return 是否存在
*/
public boolean isExistStageRunPlan(String stationCode, CtcStageRunPlanRepository r) {
CtcStageRunPlanRepository repository = r == null ? this.stationStageRunPlanMap.get(stationCode) : r;
if (repository != null) {
Integer oldVersion = this.getStageRunPlanVersionMap().get(repository.getStationCode());
return !CollectionUtils.isEmpty(repository.getCtcRunPlanVOList())
&& (oldVersion == null || oldVersion < repository.getVersion().get());
}
return false;
}
/**
* 将修改的计划发布至申请区
*

View File

@ -98,7 +98,7 @@ public class CtcRepository {
/**
* 是否需要发送计划消息
*/
private boolean runPlanSendOut;
private Boolean runPlanSendOut;
/******************************************* 以上为车站终端数据:车站为单位 *******************************************/
/**
@ -133,6 +133,7 @@ public class CtcRepository {
this.ctcZoneRepository.reset();
this.ctcEffectRepository.reset();
this.ctcManageRepository.reset();
this.runPlanSendOut = null;
// this.runPlanStatusVOMap.clear();
this.allRunPlanList.clear();
this.simulationRunPlanMap.clear();

View File

@ -185,21 +185,25 @@ public class CtcStationRunPlanLog {
public void finishArrive(LocalTime time) {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan);
arriveRunPlan.setActualTime(time.toString());
arriveRunPlan.setFinish(true);
}
public void cancelArrive() {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan);
arriveRunPlan.setActualTime(arriveRunPlan.getPlanTimeStr());
arriveRunPlan.setFinish(false);
}
public void finishDeparture(LocalTime time) {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(departRunPlan);
departRunPlan.setActualTime(time.toString());
departRunPlan.setFinish(true);
}
public void cancelDeparture() {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(departRunPlan);
departRunPlan.setActualTime(departRunPlan.getPlanTimeStr());
arriveRunPlan.setFinish(false);
}
/**
@ -282,43 +286,18 @@ public class CtcStationRunPlanLog {
}
/**
* 接车完成
*
* @return 接车是否完成
* 是否生效
* 当行车计划已预告说明已预告
*/
public boolean arriveFinish() {
return this.arriveRunPlan != null && !StringUtils.isEmpty(this.arriveRunPlan.getActualTime());
}
public boolean arrivePlanTimeCheck(LocalDateTime planTime) {
if (this.arriveFinish() && planTime != null) { // 列车已到达
// 在原计划之后不合理
return this.arriveRunPlan.getPlanTime().isBefore(planTime);
}
return true;
public boolean isEffect() {
return (this.arriveRunPlan != null && this.arriveRunPlan.isEffect()) || (this.departRunPlan != null && this.departRunPlan.isEffect());
}
/**
* 发车完成
*
* @return 发车是否完成
*/
public boolean departFinish() {
return this.departRunPlan != null && !StringUtils.isEmpty(this.departRunPlan.getActualTime());
}
public boolean departPlanTimeCheck(LocalDateTime planTime) {
if (this.departFinish() && planTime != null) { // 列车已发车
return this.departRunPlan.getPlanTime().isAfter(planTime);
}
return true;
}
/**
* 流程是否完成
* 计划中是否有流程完成
*/
public boolean isFinish() {
return this.arriveFinish() && this.departFinish();
return (this.arriveRunPlan != null && this.arriveRunPlan.isFinish()) || (this.departRunPlan != null && this.departRunPlan.isFinish());
}
@Setter
@ -418,6 +397,11 @@ public class CtcStationRunPlanLog {
*/
private String adjacentMessageTime;
/**
* 是否完成
*/
private boolean finish;
public RunPlanItem(CtcRunPlanParam paramInfo) {
this.paramInfo = paramInfo;
@ -440,6 +424,15 @@ public class CtcStationRunPlanLog {
public String getPlanTimeStr() {
return planTime == null ? null : planTime.toLocalTime().toString();
}
/**
* 是否生效
*
* @return 生效结果
*/
public boolean isEffect() {
return this.finish || RunPlanItem.WAIT.equals(this.adjacentMessage) || RunPlanItem.FINISH.equals(this.adjacentMessage);
}
}
/**
@ -506,7 +499,7 @@ public class CtcStationRunPlanLog {
// 实际时间
LocalDateTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime();
if (actualTime != null) {
runPlanItem.setActualTime(actualTime.toString());
runPlanItem.setActualTime(actualTime.toLocalTime().toString());
}
// 股道编码
String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode();

View File

@ -104,13 +104,18 @@ public class CtcStationRunPlanLogVO {
/**
* 列车运行计划作业
*/
private Map<CtcStationRunPlanLog.RunPlanTask, CtcStationRunPlanLog.RunPlanTaskItem> runPlanTaskItemMap;
private Map<CtcStationRunPlanLog.RunPlanTask, String> runPlanTaskItemMap;
/**
* 是否闪烁
*/
private Boolean twinkle;
/**
* 生效
*/
private Boolean effect;
public CtcStationRunPlanLogVO(String stationCode, String code) {
this.stationCode = stationCode;
this.code = code;
@ -132,7 +137,8 @@ public class CtcStationRunPlanLogVO {
this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致
this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致
this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车
this.runPlanTaskItemMap = ctcStationRunPlanLog.getRunPlanTaskItemMap(); // 列车运行计划作业
this.runPlanTaskItemMap = new HashMap<>(ctcStationRunPlanLog.getRunPlanTaskItemMap().size()); // 列车运行计划作业
ctcStationRunPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> this.runPlanTaskItemMap.put(k, k.getOptionName()));
if (ctcStationRunPlanLog.getArriveRunPlan() != null) { // 到达计划
this.arriveRunPlan = new RunPlanItem(ctcStationRunPlanLog.getArriveRunPlan());
if (ctcStationRunPlanLog.getArriveRunPlan().getElectrical() != null) {
@ -149,6 +155,7 @@ public class CtcStationRunPlanLogVO {
this.planProperties = this.electrical ? "电力;" : "";
}
this.twinkle = ctcStationRunPlanLog.isTwinkle();
this.effect = ctcStationRunPlanLog.isEffect();
}
/**
@ -166,18 +173,11 @@ public class CtcStationRunPlanLogVO {
change = true;
}
// 存在不一样的选项
Map<CtcStationRunPlanLog.RunPlanTask, CtcStationRunPlanLog.RunPlanTaskItem> modifyMap = new HashMap<>();
Map<CtcStationRunPlanLog.RunPlanTask, String> modifyMap = new HashMap<>();
runPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> {
CtcStationRunPlanLog.RunPlanTaskItem statusItem = null;
if (!this.getRunPlanTaskItemMap().containsKey(k)) {
statusItem = v.clone();
modifyMap.put(k, statusItem);
this.getRunPlanTaskItemMap().put(k, statusItem);
} else {
statusItem = new CtcStationRunPlanLog.RunPlanTaskItem(k);
if (this.getRunPlanTaskItemMap().get(k).compareAndChange(v, statusItem)) {
modifyMap.put(k, statusItem);
}
modifyMap.put(k, k.getOptionName());
this.getRunPlanTaskItemMap().put(k, k.getOptionName());
}
});
if (runPlanLog.getRunPlanTaskItemMap().size() != this.getRunPlanTaskItemMap().size() || !CollectionUtils.isEmpty(modifyMap)) {
@ -227,7 +227,7 @@ public class CtcStationRunPlanLogVO {
change = true;
}
// 晚点原因
if (!Objects.equals(this.getLateReason(), runPlanLog.getLateReason())) {
if (!Objects.equals(this.lateReason, runPlanLog.getLateReason())) {
this.lateReason = runPlanLog.getLateReason();
changeCtcStationRunPlanLogVO.setLateReason(runPlanLog.getLateReason());
change = true;
@ -241,11 +241,17 @@ public class CtcStationRunPlanLogVO {
changeCtcStationRunPlanLogVO.setDepartRunPlan(changeDepartItem);
change = change || changeDepartItem != null;
// 是否闪烁
if (!Objects.equals(this.getTwinkle(), runPlanLog.isTwinkle())) {
if (!Objects.equals(this.twinkle, runPlanLog.isTwinkle())) {
this.twinkle = runPlanLog.isTwinkle();
changeCtcStationRunPlanLogVO.setTwinkle(runPlanLog.isTwinkle());
change = true;
}
// 是否生效
if (!Objects.equals(this.effect, runPlanLog.isEffect())) {
this.effect = runPlanLog.isEffect();
changeCtcStationRunPlanLogVO.setEffect(runPlanLog.isEffect());
change = true;
}
return change ? changeCtcStationRunPlanLogVO : null;
}
@ -279,7 +285,7 @@ public class CtcStationRunPlanLogVO {
changeRunItem.setStationCode(runPlanItem.getStation().getCode());
change = true;
}
// 临站预告完毕
// 临站预告完毕
if (!Objects.equals(paramInfo.getAdjacentStatus(), runPlanItem.getAdjacentStatus())) {
paramInfo.setAdjacentStatus(runPlanItem.getAdjacentStatus());
changeRunItem.setAdjacentStatus(runPlanItem.getAdjacentStatus());
@ -321,6 +327,12 @@ public class CtcStationRunPlanLogVO {
changeRunItem.setAdjacentMessageTime(runPlanItem.getAdjacentMessageTime());
change = true;
}
// 是否完成流程
if (!Objects.equals(paramInfo.getFinish(), runPlanItem.isFinish())) {
paramInfo.setFinish(runPlanItem.isFinish());
changeRunItem.setFinish(runPlanItem.isFinish());
change = true;
}
return change ? changeRunItem : null; // 没有变化返回null
}
@ -377,6 +389,11 @@ public class CtcStationRunPlanLogVO {
*/
private String adjacentMessageTime;
/**
* 流程完成
*/
private Boolean finish;
public RunPlanItem() {
}
@ -396,6 +413,7 @@ public class CtcStationRunPlanLogVO {
this.actualTime = runPlanItem.getActualTime();
this.accessName = runPlanItem.getAccessName();
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
this.finish = runPlanItem.isFinish();
}
}
}

View File

@ -577,7 +577,16 @@ public class CommandBO {
List<Step> steps = command.getStepByType(Step.StepType.DRIVE);
Step driveStep = steps.get(0);
if (train.isStopAtThePosition(driveStep.getTargetPosition())) { //如果列车已经停到目标位置
boolean isRight = train.isRight(); // 列车运行方向
Section section = train.getHeadPosition().getSection(); // 列车车头所在区段
Section targetSection = getTargetSection(isRight, section);
if (Objects.equals(section, targetSection)) {
command.getTargetMember().setCommand(null);
} else {
SectionPosition targetPosition = new SectionPosition(targetSection, targetSection.getStopPointByDirection(isRight));
driveStep.setTargetPosition(targetPosition);
return driveStep;
}
} else {
return driveStep;
}