【行车日志删除标识操作】

【行车计划同一车次限制】
This commit is contained in:
weizhihong 2022-07-18 14:21:30 +08:00
parent febb565223
commit c794758d09
5 changed files with 31 additions and 29 deletions

View File

@ -108,7 +108,7 @@ public class CtcStationRunPlanOperateHandler {
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_REMOVE_RUN_PLAN) @OperateHandlerMapping(type = Operation.Type.CTC_REMOVE_RUN_PLAN)
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) { public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode);
} }
/** /**
@ -273,7 +273,7 @@ public class CtcStationRunPlanOperateHandler {
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_DELETE_LABEL) @OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_DELETE_LABEL)
public void setDelete(Simulation simulation, String stationCode, String runPlanCode, int status) { public void setDelete(Simulation simulation, String stationCode, String runPlanCode, int status) {
ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode); ctcStationRunPlanLogService.removeRunPlan(simulation, stationCode, runPlanCode, status);
} }
/** /**

View File

@ -231,11 +231,14 @@ public class CtcStationRunPlanLogService {
* @param stationCode 车站信息 * @param stationCode 车站信息
* @param runPlanCode 运行编码 * @param runPlanCode 运行编码
*/ */
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) { public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode, int status) {
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) { if (status == 1 && ctcStationRunPlanLog.getStatus() != -1) {
ctcStationRunPlanLog.setDelete(Boolean.TRUE); ctcStationRunPlanLog.setStatus(-1);
// ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE); ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
} else {
ctcStationRunPlanLog.setStatus(0);
ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE);
} }
} }
@ -438,12 +441,11 @@ public class CtcStationRunPlanLogService {
// 确定车次信息 // 确定车次信息
String tripNumber = runPlanParam.generateTripNumber(); String tripNumber = runPlanParam.generateTripNumber();
// 确定车次班次 // 确定车次班次
if (StringUtils.isEmpty(runPlanParam.getGroupNumber())) { long time = simulation.getCtcRepository().getAllRunPlanList().stream()
long time = simulation.getCtcRepository().getAllRunPlanList().stream() .filter(r -> tripNumber.equals(r.getTripNumber()) && stationCode.equals(r.getStation().getCode()))
.filter(r -> tripNumber.equals(r.getTripNumber()) && stationCode.equals(r.getStation().getCode())) .count();
.count(); BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(time > 0, "本站存在相同车次运行记录");
runPlanParam.generateGroupNumber(time + 1); runPlanParam.generateGroupNumber(time + 1);
}
runPlanParam.generateRunPlanCode(); runPlanParam.generateRunPlanCode();
// 设置默认的实际时间 // 设置默认的实际时间
runPlanParam.setDefaultActual(); runPlanParam.setDefaultActual();
@ -598,8 +600,8 @@ public class CtcStationRunPlanLogService {
*/ */
private boolean modifyRunPlanInfo(Simulation simulation, CtcStationRunPlanLog runPlanLog, CtcRunPlanParam planParam) { private boolean modifyRunPlanInfo(Simulation simulation, CtcStationRunPlanLog runPlanLog, CtcRunPlanParam planParam) {
boolean change; boolean change;
if (planParam.getStatus() == -1) { if (planParam.getStatus() == -1) { // 删除状态
runPlanLog.setDelete(Boolean.TRUE); runPlanLog.setStatus(planParam.getStatus());
} }
// 到达 // 到达
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true, false); change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true, false);

View File

@ -43,11 +43,11 @@ public class CtcZoneService {
if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息 if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息
// 确定车次信息 // 确定车次信息
String tripNumber = planParam.generateTripNumber(); String tripNumber = planParam.generateTripNumber();
// 目前先限制添加车次
long time = railwayRepository.getTripNumberNum(planParam.getStationCode(), tripNumber);
BusinessExceptionAssertEnum.DATA_ERROR.assertNotTrue(time > 1, "本站存在相同车次运行记录");
// 确定车次班次 // 确定车次班次
if (StringUtils.isEmpty(planParam.getGroupNumber())) { planParam.generateGroupNumber(time);
long time = railwayRepository.getTripNumberNum(planParam.getStationCode(), tripNumber);
planParam.generateGroupNumber(time);
}
planParam.generateRunPlanCode(); planParam.generateRunPlanCode();
// 设置默认的实际时间 // 设置默认的实际时间
planParam.setDefaultActual(); planParam.setDefaultActual();

View File

@ -88,11 +88,6 @@ public class CtcStationRunPlanLog {
*/ */
private boolean origin; private boolean origin;
/**
* 是否删除
*/
private Boolean delete;
/** /**
* 客运车 * 客运车
*/ */
@ -154,6 +149,11 @@ public class CtcStationRunPlanLog {
*/ */
private CtcRunPlanParam.RunType runType; private CtcRunPlanParam.RunType runType;
/**
* 状态
*/
private int status;
public CtcStationRunPlanLog(CtcRunPlanParam paramInfo) { public CtcStationRunPlanLog(CtcRunPlanParam paramInfo) {
this.planParam = paramInfo; this.planParam = paramInfo;
this.code = paramInfo.getRunPlanCode(); this.code = paramInfo.getRunPlanCode();
@ -195,7 +195,7 @@ public class CtcStationRunPlanLog {
} }
}); });
// 删除状态 // 删除状态
this.delete = paramInfo.getStatus() == -1; this.status = paramInfo.getStatus();
this.startRunPlan = paramInfo.getStartRunPlan() != null && paramInfo.getStartRunPlan(); this.startRunPlan = paramInfo.getStartRunPlan() != null && paramInfo.getStartRunPlan();
this.endRunPlan = paramInfo.getEndRunPlan() != null && paramInfo.getEndRunPlan(); this.endRunPlan = paramInfo.getEndRunPlan() != null && paramInfo.getEndRunPlan();
this.trainType = paramInfo.getTrainType(); this.trainType = paramInfo.getTrainType();

View File

@ -67,7 +67,7 @@ public class CtcStationRunPlanLogVO {
/** /**
* 删除标识 * 删除标识
*/ */
private Boolean delete; private Integer status;
/** /**
* 重点列车 * 重点列车
@ -153,7 +153,7 @@ public class CtcStationRunPlanLogVO {
this.tripNumber = ctcStationRunPlanLog.getTripNumber(); this.tripNumber = ctcStationRunPlanLog.getTripNumber();
this.remark = ctcStationRunPlanLog.getRemark(); this.remark = ctcStationRunPlanLog.getRemark();
this.lateReason = ctcStationRunPlanLog.getLateReason(); this.lateReason = ctcStationRunPlanLog.getLateReason();
this.delete = ctcStationRunPlanLog.getDelete(); // 删除 this.status = ctcStationRunPlanLog.getStatus(); // 删除
this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车 this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车
this.military = ctcStationRunPlanLog.getMilitary(); // 军用 this.military = ctcStationRunPlanLog.getMilitary(); // 军用
this.transfinite = ctcStationRunPlanLog.getTransfinite(); // 超限等级 this.transfinite = ctcStationRunPlanLog.getTransfinite(); // 超限等级
@ -193,9 +193,9 @@ public class CtcStationRunPlanLogVO {
public CtcStationRunPlanLogVO compareAndChange(CtcStationRunPlanLog runPlanLog) { public CtcStationRunPlanLogVO compareAndChange(CtcStationRunPlanLog runPlanLog) {
CtcStationRunPlanLogVO changeCtcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlanLog.getStation().getCode(), runPlanLog.getCode()); CtcStationRunPlanLogVO changeCtcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlanLog.getStation().getCode(), runPlanLog.getCode());
boolean change = false; boolean change = false;
if (!Objects.equals(this.delete, runPlanLog.getDelete())) { if (!Objects.equals(this.status, runPlanLog.getStatus())) {
this.delete = runPlanLog.getDelete(); this.status = runPlanLog.getStatus();
changeCtcStationRunPlanLogVO.setDelete(runPlanLog.getDelete()); changeCtcStationRunPlanLogVO.setStatus(runPlanLog.getStatus());
change = true; change = true;
} }
// 存在不一样的选项 // 存在不一样的选项