【实训道岔定反、单锁解、转动联动验证处理】
This commit is contained in:
parent
0a817bdb82
commit
382d28ca31
@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.*;
|
|||||||
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
||||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService;
|
import club.joylink.rtss.simulation.cbtc.conversation.ConversationManagerService;
|
||||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.event.SimulationOperationEvent;
|
import club.joylink.rtss.simulation.cbtc.event.SimulationOperationEvent;
|
||||||
@ -70,6 +71,15 @@ public class Training2Service {
|
|||||||
Operation.Type.Conversation_Chat_Audio_Base64.name()
|
Operation.Type.Conversation_Chat_Audio_Base64.name()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实训步骤执行道岔联动元素存在当前步骤元素
|
||||||
|
*/
|
||||||
|
private static final List<String> CHECK_SWITCH_STATUS_LIST = Arrays.asList(
|
||||||
|
Operation.Type.Switch_Turn.name(),
|
||||||
|
Operation.Type.Switch_Normal_Position.name(), Operation.Type.Switch_Reverse_Position.name(),
|
||||||
|
Operation.Type.Switch_Single_Lock.name(), Operation.Type.Switch_Single_Unlock.name()
|
||||||
|
);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AtsOperationDispatcher atsOperationDispatcher;
|
private AtsOperationDispatcher atsOperationDispatcher;
|
||||||
|
|
||||||
@ -392,11 +402,14 @@ public class Training2Service {
|
|||||||
if (CONVERSATION_LIST.contains(simCommand2.getOperationType().name()) && CONVERSATION_LIST.contains(event.getOperate())) {
|
if (CONVERSATION_LIST.contains(simCommand2.getOperationType().name()) && CONVERSATION_LIST.contains(event.getOperate())) {
|
||||||
checkSimOperationConversation(simCommand2, simulation, step, event.getOperate());
|
checkSimOperationConversation(simCommand2, simulation, step, event.getOperate());
|
||||||
startFlag = Boolean.TRUE;
|
startFlag = Boolean.TRUE;
|
||||||
|
|
||||||
} else if (simCommand2.getOperationType().name().equals(event.getOperate()) && compareParams(event.getParams(), simCommand2.getParams())) {
|
} else if (simCommand2.getOperationType().name().equals(event.getOperate()) && compareParams(event.getParams(), simCommand2.getParams())) {
|
||||||
simCommand2.doOperated(); // 标识已操作过
|
simCommand2.doOperated(); // 标识已操作过
|
||||||
simCommand2.doCompletion();
|
simCommand2.doCompletion();
|
||||||
startFlag = Boolean.TRUE;
|
startFlag = Boolean.TRUE;
|
||||||
|
} else if (checkSwitchLinkOperation(simulation, simCommand2, event)) {
|
||||||
|
simCommand2.doOperated(); // 标识已操作过
|
||||||
|
simCommand2.doCompletion();
|
||||||
|
startFlag = Boolean.TRUE;
|
||||||
}
|
}
|
||||||
// 指令执行后启动仿真
|
// 指令执行后启动仿真
|
||||||
if (simulation.isPause() && startFlag) {
|
if (simulation.isPause() && startFlag) {
|
||||||
@ -757,6 +770,30 @@ public class Training2Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否是道岔联动操作
|
||||||
|
* @param simulation
|
||||||
|
* @param event
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean checkSwitchLinkOperation(Simulation simulation, Operation2.SimCommand2 simCommand2, SimulationOperationEvent event) {
|
||||||
|
boolean flag = CHECK_SWITCH_STATUS_LIST.contains(simCommand2.getOperationType().name()) && CHECK_SWITCH_STATUS_LIST.contains(event.getOperate());
|
||||||
|
if (flag) {
|
||||||
|
flag = simCommand2.getParams() != null && event.getParams() != null;
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
String eventSwitchCode = event.getParams().getOrDefault("switchCode", "").toString();
|
||||||
|
Switch aSwitch = simulation.getRepository().getByCode(eventSwitchCode, Switch.class);
|
||||||
|
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
|
||||||
|
flag = Objects.nonNull(linkedSwitch);
|
||||||
|
if (flag) {
|
||||||
|
String simComSwitchCode = simCommand2.getParams().getOrDefault("switchCode", "").toString();
|
||||||
|
flag = Objects.equals(simComSwitchCode, linkedSwitch.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对比事件与操作参数
|
* 对比事件与操作参数
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user