From e643b7df9f40f85807634d4e4595f3a48921c9db Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Thu, 1 Sep 2022 10:39:49 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A4=A7=E9=93=81=E8=B0=83=E5=BA=A6?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E6=95=B0=E6=8D=AE=E6=B5=81=E8=BD=AC=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/CTC/rail/dcmd/RailDCMD.java | 302 ++++++++++++++++++ .../cbtc/CTC/rail/dcmd/RailDCMDService.java | 32 ++ 2 files changed, 334 insertions(+) create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMD.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMD.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMD.java new file mode 100644 index 000000000..c8b86f8a2 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMD.java @@ -0,0 +1,302 @@ +package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd; + +import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; +import lombok.Data; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 调度命令数据定义 + */ +@Data +public class RailDCMD { + /** + * 标题 + */ + private String title; + /** + * 调度命令号 + */ + private String code; + /** + * 中转识别号 + */ + private String transitId; + /** + * 当前状态 + *
+ * 调度命令流转状态 + */ + private FlowStatus flowStatus = FlowStatus.INIT; + /** + * 发令时间 + */ + private LocalDateTime sendTime; + /** + * 发令者信息:发令人和发令单位 + */ + private DCMDSender sender; + /** + * 调度命令正文 + */ + private String content; + /** + * 调度命令类型 + */ + private Type type; + + + /////////////////////////////////TO:调度命令受令者;调度命令的状态///////////////////////////////////////////////// + /** + * 受令单位(即接收调度命令的车站) + *
+ * 选填
+ */
+ private Map
+ * 选填
+ */
+ private List
+ * 选填
+ */
+ private List
+ * 选填
+ */
+ private List
+ * 调度台和车站二选一
+ */
+ @Data
+ public static class DCMDSender{
+ /**
+ * 调度命令的编写者(仿真成员)
+ */
+ private String authorId;
+ /**
+ * 调度台code
+ */
+ private String disCode;
+ /**
+ * 车站code
+ */
+ private String stationCode;
+ }
+ /**
+ * TSR列控服务器受令
+ */
+ @Data
+ public static class DCMDTsrReceiver{
+ /**
+ * 调度命令流转状态
+ */
+ private FlowStatus flowStatus = FlowStatus.INIT;
+ /**
+ * 受令列控服务器code
+ */
+ private String tsrCode;
+ /**
+ * 收令时间
+ */
+ private LocalDateTime receivedTime;
+ /**
+ * 签收状态
+ */
+ private SignStatus sigState = SignStatus.UNSIGNED;
+ /**
+ * 签收人
+ */
+ private String signedBy;
+
+ /**
+ * 签收时间
+ */
+ private LocalDateTime time;
+ }
+ /**
+ * 调度台受令
+ */
+ @Data
+ public static class DCMDDisReceiver{
+ /**
+ * 调度命令流转状态
+ */
+ private FlowStatus flowStatus = FlowStatus.INIT;
+ /**
+ * 受令调度台code
+ */
+ private String disCode;
+ /**
+ * 收令时间
+ */
+ private LocalDateTime receivedTime;
+ /**
+ * 签收状态
+ */
+ private SignStatus sigState = SignStatus.UNSIGNED;
+ /**
+ * 签收人
+ */
+ private String signedBy;
+
+ /**
+ * 签收时间
+ */
+ private LocalDateTime time;
+ }
+ /**
+ * 车载受令
+ */
+ @Data
+ public static class DCMDTrainReceiver{
+ /**
+ * 中转车站
+ *
+ * 当为Null时,通过GSM-R通信直接发送给机车;
+ * 调度命令分类:
+ * 调度台1->调度台2
+ * 调度命令由车站开始发出:
- * 调度命令流转状态
- */
- private FlowStatus flowStatus = FlowStatus.INIT;
- /**
- * 发令时间
- */
- private LocalDateTime sendTime;
- /**
- * 发令者信息:发令人和发令单位
- */
- private DCMDSender sender;
- /**
- * 调度命令正文
- */
- private String content;
- /**
- * 调度命令类型
- */
- private Type type;
-
-
- /////////////////////////////////TO:调度命令受令者;调度命令的状态/////////////////////////////////////////////////
- /**
- * 受令单位(即接收调度命令的车站)
- *
- * 选填
- */
- private Map
- * 选填
- */
- private List
- * 选填
- */
- private List
- * 选填
- */
- private List
- * 调度台和车站二选一
- */
- @Data
- public static class DCMDSender{
- /**
- * 调度命令的编写者(仿真成员)
- */
- private String authorId;
- /**
- * 调度台code
- */
- private String disCode;
- /**
- * 车站code
- */
- private String stationCode;
- }
- /**
- * TSR列控服务器受令
- */
- @Data
- public static class DCMDTsrReceiver{
- /**
- * 调度命令流转状态
- */
- private FlowStatus flowStatus = FlowStatus.INIT;
- /**
- * 受令列控服务器code
- */
- private String tsrCode;
- /**
- * 收令时间
- */
- private LocalDateTime receivedTime;
- /**
- * 签收状态
- */
- private SignStatus sigState = SignStatus.UNSIGNED;
- /**
- * 签收人
- */
- private String signedBy;
-
- /**
- * 签收时间
- */
- private LocalDateTime time;
- }
- /**
- * 调度台受令
- */
- @Data
- public static class DCMDDisReceiver{
- /**
- * 调度命令流转状态
- */
- private FlowStatus flowStatus = FlowStatus.INIT;
- /**
- * 受令调度台code
- */
- private String disCode;
- /**
- * 收令时间
- */
- private LocalDateTime receivedTime;
- /**
- * 签收状态
- */
- private SignStatus sigState = SignStatus.UNSIGNED;
- /**
- * 签收人
- */
- private String signedBy;
-
- /**
- * 签收时间
- */
- private LocalDateTime time;
- }
- /**
- * 车载受令
- */
- @Data
- public static class DCMDTrainReceiver{
- /**
- * 中转车站
- *
- * 当为Null时,通过GSM-R通信直接发送给机车;
@@ -26,7 +34,100 @@ public class RailDCMDService {
* TDCS2.0车站调度命令管理:请求调度命令、车站调度命令、机车(无线)调度命令
*/
public void dispatcher (Simulation simulation, SimulationMember sender){
+ //todo 将前端发送来的调度命令转换为 RailDCMD
+ DCMD cmd = new DCMD();
}
+ /**
+ * 新建调度命令
+ * @param creator 调度台或车站
+ */
+ public DCMD create(Simulation simulation, SimulationMember creator){
+ CtcRepository ctcRepository = simulation.getCtcRepository();
+ int id = ctcRepository.getDispatchCommandIdGenerator().getAndIncrement();
+ //
+ DCMD cmd = new DCMD();
+ cmd.setId(String.valueOf(id));
+ cmd.setCreator(creator);
+ //
+ cmd.setAllReceivers(new DCMDAllReceiver());
+ cmd.getAllReceivers().setDcmd(cmd);
+ cmd.getAllReceivers().setPosCreate(true);
+ // 默认设置编辑中状态
+ cmd.getAllReceivers().setPosEditing(true);
+ //
+ ctcRepository.getDcmdMap().put(cmd.getId(),cmd);
+ //
+ return cmd;
+ }
+ /**
+ * 调度命令的发送,如果受令方在超过一定时间内没有签收,则要重新发
+ */
+ /**
+ * 列控受令者签收调度命令(前端操作)
+ * @param cmdId 调度命令id
+ * @param tsrCode 列控服务器id
+ * @param signedBy 签收人
+ */
+ public void signForTsr(Simulation simulation,String cmdId,String tsrCode,String signedBy){
+ DCMD cmd = this.findDCMD(simulation,cmdId);
+ DCMDTsrReceiver target=null;
+ for(DCMDTsrReceiver tsrReceiver:cmd.getAllReceivers().getTsrReceivers()){
+ if(tsrCode.equals(tsrReceiver.getTsrCode())){
+ target = tsrReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的TSR列控服务器受令者(tsrCode=%s)不存在",cmdId,tsrCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(this.getSimLocalDateTime());
+ target.setSigState(DCMD.SignStatus.SIGNED);
+ target.setPosSigned(true);
+ }
+ /**
+ * 车站受令者签收调度命令(前端操作)
+ * @param cmdId 调度命令id
+ * @param stationCode 车站code
+ * @param signedBy 签收人
+ */
+ public void signForStation(Simulation simulation,String cmdId,String stationCode,String signedBy){
+ DCMD cmd = this.findDCMD(simulation,cmdId);
+ Station station = this.getSimStation(simulation,stationCode);
+ DCMDStationReceiver target=null;
+ for(DCMDStationReceiver stationReceiver:cmd.getAllReceivers().getStationReceivers()){
+ if(station.getCode().equals(stationReceiver.getReceiver().getCode())){
+ target = stationReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的车站受令者(stationCode=%s)不存在",cmdId,stationCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(this.getSimLocalDateTime());
+ target.setSigState(DCMD.SignStatus.SIGNED);
+ target.setPosSigned(true);
+
+ }
+ private DCMD findDCMD(Simulation simulation,String cmdId){
+ CtcRepository ctcRepository = simulation.getCtcRepository();
+ DCMD cmd= ctcRepository.getDcmdMap().get(cmdId);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
+ return cmd;
+ }
+ /**
+ * 获取仿真当前时间
+ */
+ private LocalDateTime getSimLocalDateTime(){
+ //暂时设置为系统时间
+ return LocalDateTime.now();
+ }
+ private Station getSimStation(Simulation simulation,String stationCode){
+ Station station = simulation.getRepository().getByCode(stationCode, Station.class);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=station,String.format("仿真车站不存在,id=%s",stationCode));
+ return station;
+ }
}
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDAllReceiver.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDAllReceiver.java
new file mode 100644
index 000000000..8750e24f9
--- /dev/null
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDAllReceiver.java
@@ -0,0 +1,32 @@
+package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * 调度命令的创建者编制者对调度命令的管理
+ */
+@Setter
+@Getter
+public class DCMDAllReceiver extends DCMDReceiver {
+ /**
+ * 该调度命令的调度台受令者
+ */
+ private final List
+ * 当为Null时,通过GSM-R通信直接发送给机车;
* 当为Null时,通过GSM-R通信直接发送给机车;
+ * 当机车进入车站400M网络覆盖区时可以发送
+ */
+ private boolean checkSrmCanSendBy400M(Station srmStation, DCMDTrainReceiver dCmdTrain){
+ //todo
+ return true;
+ }
+ ////////////////////////////////////////自律机///////////////////////////////////////////////
+ /**
+ * 车站自律机智能自动转发无线调度命令服务
+ */
+ public void srmAutoSendToTrainSv(Simulation simulation,Station srmStation){
+ CtcRepository ctcRepository = simulation.getCtcRepository();
+ //筛选出车站自律机收令箱中未转发过的调度命令
+ List
* 调度命令分类:
+ * 调度台1->调度台2
+ * 调度命令由车站开始发出:
- * 调度台1->调度台2
- * 调度命令由车站开始发出:
+ * 监控调度命令签收情况;综合分析后向前端推送通知
*/
- public void dCmdMonitor(Simulation simulation){
+ public void monitor(Simulation simulation){
CtcRepository ctcRepository = simulation.getCtcRepository();
- }
-
- ///////////////////////////////////////////////////最终受令端签收调度命令,开始//////////////////////////////////////////
- /**
- * 列控受令者签收调度命令(前端操作)
- * @param cmdId 调度命令id
- * @param tsrCode 列控服务器id
- * @param signedBy 签收人
- * @param signType 签收类型:签收、代签
- */
- public void signForTsr(Simulation simulation,String cmdId,String tsrCode,String signedBy,DCMD.SignStatus signType){
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
- DCMD cmd = this.findDCMD(simulation,cmdId);
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
- DCMDTsrReceiver target=null;
- for(DCMDTsrReceiver tsrReceiver:cmd.getReceiversManager().getTsrReceivers()){
- if(tsrCode.equals(tsrReceiver.getTsrCode())){
- target = tsrReceiver;
- break;
- }
- }
- //
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的TSR列控服务器受令者(tsrCode=%s)不存在",cmdId,tsrCode));
- //
- target.setSignedBy(signedBy);
- target.setSignedTime(this.getSimLocalDateTime());
- target.setSigState(signType);
- switch (signType){
- case PROXY:target.setPosProxySigned(true);break;
- case SIGNED:target.setPosSigned(true);break;
- }
}
- /**
- * 车站受令者签收调度命令(前端操作)
- * @param cmdId 调度命令id
- * @param stationCode 车站code
- * @param signedBy 签收人
- * @param signType 签收类型:签收、代签
- */
- public void signForStation(Simulation simulation,String cmdId,String stationCode,String signedBy,DCMD.SignStatus signType){
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
- DCMD cmd = this.findDCMD(simulation,cmdId);
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
- DCMDStationReceiver target=null;
- for(DCMDStationReceiver stationReceiver:cmd.getReceiversManager().getStationReceivers()){
- if(stationCode.equals(stationReceiver.getStationCode())){
- target = stationReceiver;
- break;
- }
- }
- //
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的车站受令者(stationCode=%s)不存在",cmdId,stationCode));
- //
- target.setSignedBy(signedBy);
- target.setSignedTime(this.getSimLocalDateTime());
- target.setSigState(signType);
- switch (signType){
- case PROXY:target.setPosProxySigned(true);break;
- case SIGNED:target.setPosSigned(true);break;
- }
- }
- /**
- * 调度台受令者签收调度命令(前端操作)
- * @param cmdId 调度命令id
- * @param disCode 调度台code
- * @param signedBy 签收人
- * @param signType 签收类型:签收、代签
- */
- public void signForDispatcher(Simulation simulation,String cmdId,String disCode,String signedBy,DCMD.SignStatus signType){
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
- DCMD cmd = this.findDCMD(simulation,cmdId);
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
- DCMDDisReceiver target=null;
- for(DCMDDisReceiver disReceiver:cmd.getReceiversManager().getDisReceivers()){
- if(disCode.equals(disReceiver.getDisCode())){
- target = disReceiver;
- break;
- }
- }
- //
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的调度台受令者(disCode=%s)不存在",cmdId,disCode));
- //
- target.setSignedBy(signedBy);
- target.setSignedTime(this.getSimLocalDateTime());
- target.setSigState(signType);
- switch (signType){
- case PROXY:target.setPosProxySigned(true);break;
- case SIGNED:target.setPosSigned(true);break;
- }
- }
- /**
- * 无线受令者签收调度命令(前端操作-车载终端)
- * @param cmdId 调度命令id
- * @param trainNum 车次号
- * @param trainCode 机车号
- * @param signedBy 签收人
- * @param signType 签收类型:签收、代签
- */
- public void signForTrain(Simulation simulation,String cmdId,String trainNum,String trainCode,String signedBy,DCMD.SignStatus signType){
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
- DCMD cmd = this.findDCMD(simulation,cmdId);
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
- DCMDTrainReceiver target=null;
- for(DCMDTrainReceiver trainReceiver:cmd.getReceiversManager().getTrainReceivers()){
- if(trainNum.equals(trainReceiver.getTrainNum())&&trainCode.equals(trainReceiver.getTrainCode())){
- target = trainReceiver;
- break;
- }
- }
- //
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的无线受令者(车次号=%s , 机车号=%s)不存在",cmdId,trainNum,trainCode));
- //
- target.setSignedBy(signedBy);
- target.setSignedTime(this.getSimLocalDateTime());
- target.setSigState(signType);
- switch (signType){
- case PROXY:target.setPosProxySigned(true);break;
- case SIGNED:target.setPosSigned(true);break;
- }
- if(target.isSendViaSRM()){//如果是车站自律机转发的
- target.setPosSrmSigned(true);
- }
- }
- ///////////////////////////////////////////////////最终受令端签收调度命令,结束/////////////////////////////////////////////////////////////////////
- private DCMD findDCMD(Simulation simulation,String cmdId){
+ ////////////////////////////////////公共工具方法///////////////////////////////////////////////
+ public DCMD findDCMD(Simulation simulation,String cmdId){
CtcRepository ctcRepository = simulation.getCtcRepository();
DCMD cmd= ctcRepository.getDcmdMap().get(cmdId);
return cmd;
@@ -321,11 +80,11 @@ public class RailDCMDService {
/**
* 获取仿真当前时间
*/
- private LocalDateTime getSimLocalDateTime(){
+ public LocalDateTime getSimLocalDateTime(){
//暂时设置为系统时间
return LocalDateTime.now();
}
- private Station getSimStation(Simulation simulation,String stationCode){
+ public Station getSimStation(Simulation simulation,String stationCode){
Station station = simulation.getRepository().getByCode(stationCode, Station.class);
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=station,String.format("仿真车站不存在,id=%s",stationCode));
return station;
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDSignService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDSignService.java
new file mode 100644
index 000000000..42192793f
--- /dev/null
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDSignService.java
@@ -0,0 +1,140 @@
+package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd;
+
+import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDDisReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDStationReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDTrainReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDTsrReceiver;
+import club.joylink.rtss.simulation.cbtc.Simulation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 调度命令签收相关服务
+ */
+@Component
+public class RailDCMDSignService {
+ @Autowired
+ private RailDCMDService dCmdService;
+ /**
+ * 列控受令者签收调度命令(前端操作)
+ * @param cmdId 调度命令id
+ * @param tsrCode 列控服务器id
+ * @param signedBy 签收人
+ * @param signType 签收类型:签收、代签
+ */
+ public void signForTsr(Simulation simulation, String cmdId, String tsrCode, String signedBy, DCMD.SignStatus signType){
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType), String.format("调度命令(id=%s)签收类型(%s)不支持", cmdId, signType));
+ DCMD cmd = dCmdService.findDCMD(simulation,cmdId);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
+ DCMDTsrReceiver target=null;
+ for(DCMDTsrReceiver tsrReceiver:cmd.getReceiversManager().getTsrReceivers()){
+ if(tsrCode.equals(tsrReceiver.getTsrCode())){
+ target = tsrReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的TSR列控服务器受令者(tsrCode=%s)不存在",cmdId,tsrCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(dCmdService.getSimLocalDateTime());
+ target.setSigState(signType);
+ switch (signType){
+ case PROXY:target.setPosProxySigned(true);break;
+ case SIGNED:target.setPosSigned(true);break;
+ }
+
+ }
+ /**
+ * 车站受令者签收调度命令(前端操作)
+ * @param cmdId 调度命令id
+ * @param stationCode 车站code
+ * @param signedBy 签收人
+ * @param signType 签收类型:签收、代签
+ */
+ public void signForStation(Simulation simulation,String cmdId,String stationCode,String signedBy,DCMD.SignStatus signType){
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
+ DCMD cmd = dCmdService.findDCMD(simulation,cmdId);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
+ DCMDStationReceiver target=null;
+ for(DCMDStationReceiver stationReceiver:cmd.getReceiversManager().getStationReceivers()){
+ if(stationCode.equals(stationReceiver.getStationCode())){
+ target = stationReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的车站受令者(stationCode=%s)不存在",cmdId,stationCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(dCmdService.getSimLocalDateTime());
+ target.setSigState(signType);
+ switch (signType){
+ case PROXY:target.setPosProxySigned(true);break;
+ case SIGNED:target.setPosSigned(true);break;
+ }
+ }
+ /**
+ * 调度台受令者签收调度命令(前端操作)
+ * @param cmdId 调度命令id
+ * @param disCode 调度台code
+ * @param signedBy 签收人
+ * @param signType 签收类型:签收、代签
+ */
+ public void signForDispatcher(Simulation simulation,String cmdId,String disCode,String signedBy,DCMD.SignStatus signType){
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
+ DCMD cmd = dCmdService.findDCMD(simulation,cmdId);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
+ DCMDDisReceiver target=null;
+ for(DCMDDisReceiver disReceiver:cmd.getReceiversManager().getDisReceivers()){
+ if(disCode.equals(disReceiver.getDisCode())){
+ target = disReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的调度台受令者(disCode=%s)不存在",cmdId,disCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(dCmdService.getSimLocalDateTime());
+ target.setSigState(signType);
+ switch (signType){
+ case PROXY:target.setPosProxySigned(true);break;
+ case SIGNED:target.setPosSigned(true);break;
+ }
+ }
+ /**
+ * 无线受令者签收调度命令(前端操作-车载终端)
+ * @param cmdId 调度命令id
+ * @param trainNum 车次号
+ * @param trainCode 机车号
+ * @param signedBy 签收人
+ * @param signType 签收类型:签收、代签
+ */
+ public void signForTrain(Simulation simulation,String cmdId,String trainNum,String trainCode,String signedBy,DCMD.SignStatus signType){
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=signType&&!DCMD.SignStatus.UNSIGNED.equals(signType),String.format("调度命令(id=%s)签收类型(%s)不支持",cmdId,signType));
+ DCMD cmd = dCmdService.findDCMD(simulation,cmdId);
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",cmdId));
+ DCMDTrainReceiver target=null;
+ for(DCMDTrainReceiver trainReceiver:cmd.getReceiversManager().getTrainReceivers()){
+ if(trainNum.equals(trainReceiver.getTrainNum())&&trainCode.equals(trainReceiver.getTrainCode())){
+ target = trainReceiver;
+ break;
+ }
+ }
+ //
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=target,String.format("调度命令(id=%s)的无线受令者(车次号=%s , 机车号=%s)不存在",cmdId,trainNum,trainCode));
+ //
+ target.setSignedBy(signedBy);
+ target.setSignedTime(dCmdService.getSimLocalDateTime());
+ target.setSigState(signType);
+ switch (signType){
+ case PROXY:target.setPosProxySigned(true);break;
+ case SIGNED:target.setPosSigned(true);break;
+ }
+ if(target.isSendViaSRM()){//如果是车站自律机转发的
+ target.setPosSrmSigned(true);
+ }
+ }
+}
+ * 当不为空时,通过车站自律机智能中转;
+ */
+ private Station disStation;
+ /**
+ * 调度命令流转状态(对应中转车站)
+ */
+ private FlowStatus flowStatusWithStation = FlowStatus.INIT;
+ /**
+ * 车次号
+ */
+ private String trainNum;
+ /**
+ * 机车号
+ */
+ private VirtualRealityTrain train;
+ /**
+ * 调度命令流转状态(对应机车)
+ */
+ private FlowStatus flowStatusWithTrain = FlowStatus.INIT;
+ /**
+ * 收令时间
+ */
+ private LocalDateTime receivedTime;
+ /**
+ * 签收状态
+ */
+ private SignStatus sigState = SignStatus.UNSIGNED;
+ /**
+ * 签收人
+ */
+ private String signedBy;
+
+ /**
+ * 签收时间
+ */
+ private LocalDateTime time;
+ }
+ /**
+ * 车站受令
+ */
+ @Data
+ public static class DCMDStationReceiver {
+ /**
+ * 调度命令流转状态
+ */
+ private FlowStatus flowStatus = FlowStatus.INIT;
+ /**
+ * 受令人
+ */
+ private Station receiver;
+
+ /**
+ * 收令时间
+ */
+ private LocalDateTime receivedTime;
+ /**
+ * 签收状态
+ */
+ private SignStatus sigState = SignStatus.UNSIGNED;
+ /**
+ * 签收人
+ */
+ private String signedBy;
+
+ /**
+ * 签收时间
+ */
+ private LocalDateTime time;
+ }
+
+ /**
+ * 签收状态
+ */
+ public enum SignStatus {
+ /**
+ *未签收
+ */
+ UNSIGNED,
+ /**
+ * 签收
+ */
+ SIGNED,
+ /**
+ * 代签
+ */
+ PROXY,
+ /**
+ * 拒签
+ */
+ REFUSE,
+ ;
+ }
+ /**
+ * 流转状态
+ */
+ public enum FlowStatus{
+ /**
+ * 初始未知
+ */
+ INIT,
+ /**
+ * 编辑中
+ */
+ EDITING,
+ /**
+ * 缓存(草稿箱中)
+ */
+ CACHE,
+ /**
+ * 已经接收(收件箱中)
+ */
+ RECEIVED,
+ /**
+ * 已经发送(发件箱中)
+ */
+ SEND,
+ ;
+ }
+ /**
+ * 调度命令类型
+ */
+ public enum Type {
+ /**
+ * 正常调度命令
+ */
+ NORMAL,
+ /**
+ * 请求调度命令
+ */
+ REQUEST,;
+ }
+
+}
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
new file mode 100644
index 000000000..7a7724918
--- /dev/null
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
@@ -0,0 +1,32 @@
+package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd;
+
+import club.joylink.rtss.simulation.cbtc.Simulation;
+import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 调度命令数据流控制
+ *
+ * 普通调度命令、施工调度命令、转发调度命令、请求调度命令、长效调度命令、班计划调度命令
+ */
+@Slf4j
+public class RailDCMDService {
+
+ /**
+ * 调度命令由调度台开始发出:
+ *
+ * 调度台->车站车务终端
+ * 无线调度命令立即发送:调度台->(通过GSM-R)车载终端
+ * 无线调度命令智能发送:调度台->(中转)车站自律机->(通过无线通信)车载终端
+ * 列控调度命令:调度台->TSR列控限速服务器
+ *
+ * TDCS2.0车站调度命令管理:请求调度命令、车站调度命令、机车(无线)调度命令
+ */
+ public void dispatcher (Simulation simulation, SimulationMember sender){
+
+ }
+
+}
From 6922e2630eb78c86e60d6fdd6c91d5965bd653d8 Mon Sep 17 00:00:00 2001
From: xzb <223@qq.com>
Date: Thu, 1 Sep 2022 18:09:38 +0800
Subject: [PATCH 2/9] =?UTF-8?q?=E5=A4=A7=E9=93=81=E8=B0=83=E5=BA=A6?=
=?UTF-8?q?=E5=91=BD=E4=BB=A4=E6=95=B0=E6=8D=AE=E6=B5=81=E8=BD=AC=E5=AE=9E?=
=?UTF-8?q?=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../cbtc/CTC/data/CtcRepository.java | 7 +-
.../simulation/cbtc/CTC/rail/dcmd/DCMD.java | 126 ++++++++
.../cbtc/CTC/rail/dcmd/DCMDReceipt.java | 46 +++
.../cbtc/CTC/rail/dcmd/RailDCMD.java | 302 ------------------
.../cbtc/CTC/rail/dcmd/RailDCMDService.java | 101 ++++++
.../rail/dcmd/receiver/DCMDAllReceiver.java | 32 ++
.../rail/dcmd/receiver/DCMDDisReceiver.java | 14 +
.../CTC/rail/dcmd/receiver/DCMDReceiver.java | 60 ++++
.../dcmd/receiver/DCMDStationReceiver.java | 15 +
.../rail/dcmd/receiver/DCMDTrainReceiver.java | 42 +++
.../rail/dcmd/receiver/DCMDTsrReceiver.java | 15 +
11 files changed, 457 insertions(+), 303 deletions(-)
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMD.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMDReceipt.java
delete mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMD.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDAllReceiver.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDDisReceiver.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDReceiver.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDStationReceiver.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDTrainReceiver.java
create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDTsrReceiver.java
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java
index 61168d1ba..39feb3071 100644
--- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java
@@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO;
import club.joylink.rtss.simulation.cbtc.CTC.param.CtcRunPlanParam;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.DCMD;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
@@ -112,7 +113,11 @@ public class CtcRepository {
* 调度命令id生成器
*/
private AtomicInteger dispatchCommandIdGenerator = new AtomicInteger(0);
-
+ /**
+ * 新版调度命令
+ * k - 调度命令id
+ */
+ private final Map
- * 当不为空时,通过车站自律机智能中转;
- */
- private Station disStation;
- /**
- * 调度命令流转状态(对应中转车站)
- */
- private FlowStatus flowStatusWithStation = FlowStatus.INIT;
- /**
- * 车次号
- */
- private String trainNum;
- /**
- * 机车号
- */
- private VirtualRealityTrain train;
- /**
- * 调度命令流转状态(对应机车)
- */
- private FlowStatus flowStatusWithTrain = FlowStatus.INIT;
- /**
- * 收令时间
- */
- private LocalDateTime receivedTime;
- /**
- * 签收状态
- */
- private SignStatus sigState = SignStatus.UNSIGNED;
- /**
- * 签收人
- */
- private String signedBy;
-
- /**
- * 签收时间
- */
- private LocalDateTime time;
- }
- /**
- * 车站受令
- */
- @Data
- public static class DCMDStationReceiver {
- /**
- * 调度命令流转状态
- */
- private FlowStatus flowStatus = FlowStatus.INIT;
- /**
- * 受令人
- */
- private Station receiver;
-
- /**
- * 收令时间
- */
- private LocalDateTime receivedTime;
- /**
- * 签收状态
- */
- private SignStatus sigState = SignStatus.UNSIGNED;
- /**
- * 签收人
- */
- private String signedBy;
-
- /**
- * 签收时间
- */
- private LocalDateTime time;
- }
-
- /**
- * 签收状态
- */
- public enum SignStatus {
- /**
- *未签收
- */
- UNSIGNED,
- /**
- * 签收
- */
- SIGNED,
- /**
- * 代签
- */
- PROXY,
- /**
- * 拒签
- */
- REFUSE,
- ;
- }
- /**
- * 流转状态
- */
- public enum FlowStatus{
- /**
- * 初始未知
- */
- INIT,
- /**
- * 编辑中
- */
- EDITING,
- /**
- * 缓存(草稿箱中)
- */
- CACHE,
- /**
- * 已经接收(收件箱中)
- */
- RECEIVED,
- /**
- * 已经发送(发件箱中)
- */
- SEND,
- ;
- }
- /**
- * 调度命令类型
- */
- public enum Type {
- /**
- * 正常调度命令
- */
- NORMAL,
- /**
- * 请求调度命令
- */
- REQUEST,;
- }
-
-}
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
index 7a7724918..9037bb048 100644
--- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
@@ -1,9 +1,17 @@
package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd;
+import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
+import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDAllReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDStationReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDTsrReceiver;
import club.joylink.rtss.simulation.cbtc.Simulation;
+import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.extern.slf4j.Slf4j;
+import java.time.LocalDateTime;
+
/**
* 调度命令数据流控制
*
+ * 当不为空时,通过车站自律机智能中转;
+ */
+ private Station disStation;
+ /**
+ * 车次号
+ */
+ private String trainNum;
+ /**
+ * 机车号
+ */
+ private VirtualRealityTrain train;
+ //////////////车站自律机对无线调度命令处理状态/////////
+ /**
+ * 收令箱
+ */
+ private Boolean posReceive=false;
+ /**
+ * 发令箱
+ */
+ private Boolean posSend=false;
+ /**
+ * 签收完成箱
+ */
+ private Boolean posSigned=false;
+}
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDTsrReceiver.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDTsrReceiver.java
new file mode 100644
index 000000000..c4a3d3864
--- /dev/null
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/DCMDTsrReceiver.java
@@ -0,0 +1,15 @@
+package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class DCMDTsrReceiver extends DCMDReceiver{
+
+ /**
+ * 受令列控服务器code
+ */
+ private String tsrCode;
+
+}
From 8d195c5367b1317d7095e5309c76bfa562aa204a Mon Sep 17 00:00:00 2001
From: weizhihong
* 当不为空时,通过车站自律机智能中转;
*/
- private Station disStation;
+ private String disStationCode;
/**
* 车次号
*/
- private String trainNum;
+ private String trainNum;
/**
- * 机车号
+ * 机车号(train code)
*/
- private VirtualRealityTrain train;
+ private String trainCode;
//////////////车站自律机对无线调度命令处理状态/////////
/**
- * 收令箱
+ * 自律机收令箱
*/
- private Boolean posReceive=false;
+ private Boolean posSrmReceive = false;
/**
- * 发令箱
+ * 自律机发令箱
*/
- private Boolean posSend=false;
+ private Boolean posSrmSend = false;
/**
- * 签收完成箱
+ * 自律机签收完成箱
*/
- private Boolean posSigned=false;
+ private Boolean posSrmSigned = false;
+ ////////////////////////////////////////////
+ /**
+ * 直接通过手机移动网络直接发送给机车
+ */
+ public boolean isSendViaGSM(){
+ return !isSendViaSRM();
+ }
+ /**
+ * 通过车站自律机中转发送给机车
+ */
+ public boolean isSendViaSRM(){
+ return null!=disStationCode&&disStationCode.trim().length()>0;
+ }
}
From 43898ba1f2aaf31c52e50dbae25fc5799b30e983 Mon Sep 17 00:00:00 2001
From: xzb <223@qq.com>
Date: Mon, 5 Sep 2022 09:24:12 +0800
Subject: [PATCH 8/9] =?UTF-8?q?=E5=A4=A7=E9=93=81=E8=B0=83=E5=BA=A6?=
=?UTF-8?q?=E5=91=BD=E4=BB=A4-receiversManager?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../simulation/cbtc/CTC/rail/dcmd/DCMD.java | 8 +++---
.../cbtc/CTC/rail/dcmd/RailDCMDService.java | 28 +++++++++----------
...eceiver.java => DCMDReceiversManager.java} | 11 ++------
3 files changed, 21 insertions(+), 26 deletions(-)
rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/receiver/{DCMDAllReceiver.java => DCMDReceiversManager.java} (81%)
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMD.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMD.java
index 74ad5a6d4..ed92cb442 100644
--- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMD.java
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/DCMD.java
@@ -1,6 +1,6 @@
package club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd;
-import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDAllReceiver;
+import club.joylink.rtss.simulation.cbtc.CTC.rail.dcmd.receiver.DCMDReceiversManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Getter;
import lombok.Setter;
@@ -83,11 +83,11 @@ public class DCMD {
/**
* 调度命令正文
*/
- private String content;
+ private String content;
/**
- * 调度命令的受令者
+ * 调度命令的受令者管理
*/
- private DCMDAllReceiver allReceivers;
+ private DCMDReceiversManager receiversManager;
//////////////////////////////////////////////////////////////////////////
/**
diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
index a98b2f480..40e444861 100644
--- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
+++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/rail/dcmd/RailDCMDService.java
@@ -50,10 +50,10 @@ public class RailDCMDService {
cmd.setId(String.valueOf(id));
cmd.setCreator(creator);
//
- cmd.setAllReceivers(new DCMDAllReceiver());
- cmd.getAllReceivers().setDcmd(cmd);
+ cmd.setReceiversManager(new DCMDReceiversManager());
+ cmd.getReceiversManager().setDcmd(cmd);
// 默认设置编辑中状态
- cmd.getAllReceivers().setPosEditing(true);
+ cmd.getReceiversManager().setPosEditing(true);
//
ctcRepository.getDcmdMap().put(cmd.getId(),cmd);
//
@@ -71,25 +71,25 @@ public class RailDCMDService {
//
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",dCmdId));
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(creator.getId().equals(cmd.getId()),String.format("调度命令(id=%s)的创建平台(SimulationMember.id=%s)校验失败",dCmdId,creator.getId()));
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(cmd.getAllReceivers().getPosSend(),String.format("调度命令(id=%s)被创建者(id=%s)重复发送",dCmdId,creator.getId()));
+ BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(cmd.getReceiversManager().getPosSend(),String.format("调度命令(id=%s)被创建者(id=%s)重复发送",dCmdId,creator.getId()));
//发送给车站受令者
- cmd.getAllReceivers().getStationReceivers().forEach(stationReceiver->{
+ cmd.getReceiversManager().getStationReceivers().forEach(stationReceiver->{
this.sendToStationByCreator(simulation,stationReceiver);
});
//发送给列控服务器受令者
- cmd.getAllReceivers().getTsrReceivers().forEach(tsrReceiver->{
+ cmd.getReceiversManager().getTsrReceivers().forEach(tsrReceiver->{
this.sendToTsrByCreator(simulation,tsrReceiver);
});
//发送给调度台受令者
- cmd.getAllReceivers().getDisReceivers().forEach(disReceiver->{
+ cmd.getReceiversManager().getDisReceivers().forEach(disReceiver->{
this.sendToDisByCreator(simulation,disReceiver);
});
//发送给无线受令者
- cmd.getAllReceivers().getTrainReceivers().forEach(trainReceiver->{
+ cmd.getReceiversManager().getTrainReceivers().forEach(trainReceiver->{
this.sendToTrainByCreator(simulation,trainReceiver);
});
//至此该调度命令发送完,则该调度命令进入该创建者的 发令箱
- cmd.getAllReceivers().setPosSend(true);
+ cmd.getReceiversManager().setPosSend(true);
}
/**
* 发送给车站
@@ -154,7 +154,7 @@ public class RailDCMDService {
//筛选出车站自律机收令箱中未转发过的调度命令
List
* 普通调度命令、施工调度命令、转发调度命令、请求调度命令、长效调度命令、班计划调度命令
+ * 调度命令由调度台开始发出:
+ *
+ * 调度台->车站车务终端
+ * 无线调度命令立即发送:调度台->(通过GSM-R)车载终端
+ * 无线调度命令智能发送:调度台->(中转)车站自律机->(通过无线通信)车载终端
+ * 列控调度命令:调度台->TSR列控限速服务器
+ *
+ * TDCS2.0车站调度命令管理:请求调度命令、车站调度命令、机车(无线)调度命令
*/
@Slf4j
+@Component
public class RailDCMDService {
- /**
- * 调度命令由调度台开始发出:
- *
- * 调度台->车站车务终端
- * 无线调度命令立即发送:调度台->(通过GSM-R)车载终端
- * 无线调度命令智能发送:调度台->(中转)车站自律机->(通过无线通信)车载终端
- * 列控调度命令:调度台->TSR列控限速服务器
- *
- * TDCS2.0车站调度命令管理:请求调度命令、车站调度命令、机车(无线)调度命令
- */
- public void dispatcher (Simulation simulation, SimulationMember sender){
- //todo 将前端发送来的调度命令转换为 RailDCMD
- DCMD cmd = new DCMD();
-
- }
/**
* 新建调度命令
* @param creator 调度台或车站
@@ -59,261 +52,27 @@ public class RailDCMDService {
//
return cmd;
}
- /////////////////////////////发送调度命令相关///////////////////////////////////////////////////////////////////////////
/**
- * 创建者(调度台或车站)发送调度命令
- * @param creator 调度命令的创建平台
- * @param dCmdId 调度命令的id
+ * 保存或缓存调度命令
+ * @param creator 调度台或车站
+ * @param dCmdId 调度命令id
+ * @param simulation 当前仿真
*/
- public void sendByCreator(Simulation simulation, SimulationMember creator,String dCmdId){
- CtcRepository ctcRepository = simulation.getCtcRepository();
- DCMD cmd = ctcRepository.getDcmdMap().get(dCmdId);
- //
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null!=cmd,String.format("调度命令不存在,id=%s",dCmdId));
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(creator.getId().equals(cmd.getId()),String.format("调度命令(id=%s)的创建平台(SimulationMember.id=%s)校验失败",dCmdId,creator.getId()));
- BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(cmd.getReceiversManager().getPosSend(),String.format("调度命令(id=%s)被创建者(id=%s)重复发送",dCmdId,creator.getId()));
- //发送给车站受令者
- cmd.getReceiversManager().getStationReceivers().forEach(stationReceiver->{
- this.sendToStationByCreator(simulation,stationReceiver);
- });
- //发送给列控服务器受令者
- cmd.getReceiversManager().getTsrReceivers().forEach(tsrReceiver->{
- this.sendToTsrByCreator(simulation,tsrReceiver);
- });
- //发送给调度台受令者
- cmd.getReceiversManager().getDisReceivers().forEach(disReceiver->{
- this.sendToDisByCreator(simulation,disReceiver);
- });
- //发送给无线受令者
- cmd.getReceiversManager().getTrainReceivers().forEach(trainReceiver->{
- this.sendToTrainByCreator(simulation,trainReceiver);
- });
- //至此该调度命令发送完,则该调度命令进入该创建者的 发令箱
- cmd.getReceiversManager().setPosSend(true);
- }
- /**
- * 发送给车站
- */
- private void sendToStationByCreator(Simulation simulation,DCMDStationReceiver stationReceiver){
- //发送到收令箱
- if(!stationReceiver.getPosReceive()){
- stationReceiver.setPosReceive(true);
- stationReceiver.setReceivedTime(this.getSimLocalDateTime());
- }
- //todo 向前端发送收令通知
- }
- /**
- * 发送给列控服务器
- */
- private void sendToTsrByCreator(Simulation simulation,DCMDTsrReceiver tsrReceiver){
- //发送到收令箱
- if(!tsrReceiver.getPosReceive()){
- tsrReceiver.setPosReceive(true);
- tsrReceiver.setReceivedTime(this.getSimLocalDateTime());
- }
- //todo 向前端发送收令通知
- }
- /**
- * 发送给调度台
- */
- private void sendToDisByCreator(Simulation simulation,DCMDDisReceiver disReceiver){
- //发送到收令箱
- if(!disReceiver.getPosReceive()){
- disReceiver.setPosReceive(true);
- disReceiver.setReceivedTime(this.getSimLocalDateTime());
- }
- //todo 向前端发送收令通知
- }
- /**
- * 发送给无线机车
- */
- private void sendToTrainByCreator(Simulation simulation,DCMDTrainReceiver trainReceiver){
- //通过GSM移动网络,发送到机车收令箱
- if(trainReceiver.isSendViaGSM()){
- if(!trainReceiver.getPosReceive()){
- trainReceiver.setPosReceive(true);
- trainReceiver.setReceivedTime(this.getSimLocalDateTime());
- //todo 向前端发送收令通知
- }
- }
- //车站自律机通过400M专有网络转发到机车收令箱
- //此时先发送到车站自律机收令箱
- if(trainReceiver.isSendViaSRM()){
- if(!trainReceiver.getPosSrmReceive()){
- trainReceiver.setPosSrmReceive(true);
- //待自律机根据转发策略发送到机车
- }
- }
- }
- ////////////////////////////////////////自律机///////////////////////////////////////////////
- /**
- * 车站自律机智能自动转发无线调度命令服务
- */
- public void srmAutoSendToTrainSv(Simulation simulation,Station srmStation){
- CtcRepository ctcRepository = simulation.getCtcRepository();
- //筛选出车站自律机收令箱中未转发过的调度命令
- List