[修改]成都工业职业技术学院项目设备联动逻辑
This commit is contained in:
parent
aae729b637
commit
5d15ba3240
|
@ -70,6 +70,8 @@ public class WebConfig implements WebMvcConfigurer {
|
|||
whiteList.add("/api/v2/paper/composition/oldData/handle");
|
||||
whiteList.add("/api/user/sync");
|
||||
whiteList.add("/dataHandle");
|
||||
//modbus测试
|
||||
whiteList.add("/api/test/modbus/writeCoil");
|
||||
|
||||
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ import club.joylink.rtss.vo.client.project.UDPClientConfigVO;
|
|||
import club.joylink.rtss.vo.client.project.UDPLowConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.VrIbpConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.VrpsdConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySectionConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgySwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
|
@ -579,7 +581,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
plcGateway.setType(ProjectDeviceType.PLC_GATEWAY.name());
|
||||
plcGateway.setCreator(accountVO.getId());
|
||||
plcGateway.setCreateTime(now);
|
||||
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 16);
|
||||
PlcGatewayConfigVO plcGatewayConfigVO = new PlcGatewayConfigVO(0, 64);
|
||||
plcGateway.setConfig(plcGatewayConfigVO.toJson());
|
||||
list.add(plcGateway);
|
||||
//SIGNAL
|
||||
|
@ -589,7 +591,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
signal1.setType(ProjectDeviceType.SIGNAL.name());
|
||||
signal1.setCreator(accountVO.getId());
|
||||
signal1.setCreateTime(now);
|
||||
signal1.setConfig(new CgySignalConfigVO(null, 2, 3, 4, 11, 12, 13).toJson());
|
||||
signal1.setConfig(new CgySignalConfigVO("S13289", 0, 1, 2, 3, 4, 5, 16, 17, 18, 19).toJson());
|
||||
list.add(signal1);
|
||||
ProjectDevice signal2 = new ProjectDevice();
|
||||
signal2.setProjectCode(projectCode);
|
||||
|
@ -597,7 +599,7 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
signal2.setType(ProjectDeviceType.SIGNAL.name());
|
||||
signal2.setCreator(accountVO.getId());
|
||||
signal2.setCreateTime(now);
|
||||
signal2.setConfig(new CgySignalConfigVO(null, 5, 6, 7, 14, 15, 16).toJson());
|
||||
signal2.setConfig(new CgySignalConfigVO("X44854", 6, 7, 8, 9, 10, 11, 20, 21, 22, 23).toJson());
|
||||
list.add(signal2);
|
||||
//SWITCH
|
||||
ProjectDevice aSwitch = new ProjectDevice();
|
||||
|
@ -606,17 +608,50 @@ public class DeviceServiceImpl implements DeviceService {
|
|||
aSwitch.setType(ProjectDeviceType.SWITCH.name());
|
||||
aSwitch.setCreator(accountVO.getId());
|
||||
aSwitch.setCreateTime(now);
|
||||
aSwitch.setConfig(new CgySwitchConfigVO().toJson());
|
||||
aSwitch.setConfig(new CgySwitchConfigVO("W37779").toJson());
|
||||
list.add(aSwitch);
|
||||
// //SECTION
|
||||
// ProjectDevice section = new ProjectDevice();
|
||||
// section.setProjectCode(projectCode);
|
||||
// section.setCode(prefix + "section");
|
||||
// section.setType(ProjectDeviceType.SECTION.name());
|
||||
// section.setCreator(accountVO.getId());
|
||||
// section.setCreateTime(now);
|
||||
// section.setConfig(new CgySectionConfigVO().toJson());
|
||||
// list.add(section);
|
||||
//PSL
|
||||
ProjectDevice psl = new ProjectDevice();
|
||||
psl.setProjectCode(projectCode);
|
||||
psl.setCode(prefix + "psl");
|
||||
psl.setType(ProjectDeviceType.PSL.name());
|
||||
psl.setCreator(accountVO.getId());
|
||||
psl.setCreateTime(now);
|
||||
psl.setConfig(new CgyPslConfigVO("PF59020_PSL").toJson());
|
||||
list.add(psl);
|
||||
//SECTION
|
||||
ProjectDevice section106 = new ProjectDevice();
|
||||
section106.setProjectCode(projectCode);
|
||||
section106.setCode(prefix + "section106");
|
||||
section106.setType(ProjectDeviceType.SECTION.name());
|
||||
section106.setCreator(accountVO.getId());
|
||||
section106.setCreateTime(now);
|
||||
section106.setConfig(new CgySectionConfigVO(null, 35).toJson());
|
||||
list.add(section106);
|
||||
ProjectDevice section104 = new ProjectDevice();
|
||||
section104.setProjectCode(projectCode);
|
||||
section104.setCode(prefix + "section104");
|
||||
section104.setType(ProjectDeviceType.SECTION.name());
|
||||
section104.setCreator(accountVO.getId());
|
||||
section104.setCreateTime(now);
|
||||
section104.setConfig(new CgySectionConfigVO(null, 36).toJson());
|
||||
list.add(section104);
|
||||
ProjectDevice section101 = new ProjectDevice();
|
||||
section101.setProjectCode(projectCode);
|
||||
section101.setCode(prefix + "section101");
|
||||
section101.setType(ProjectDeviceType.SECTION.name());
|
||||
section101.setCreator(accountVO.getId());
|
||||
section101.setCreateTime(now);
|
||||
section101.setConfig(new CgySectionConfigVO(null, 37).toJson());
|
||||
list.add(section101);
|
||||
ProjectDevice section102 = new ProjectDevice();
|
||||
section102.setProjectCode(projectCode);
|
||||
section102.setCode(prefix + "section102");
|
||||
section102.setType(ProjectDeviceType.SECTION.name());
|
||||
section102.setCreator(accountVO.getId());
|
||||
section102.setCreateTime(now);
|
||||
section102.setConfig(new CgySectionConfigVO(null, 38).toJson());
|
||||
list.add(section102);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -12,14 +12,13 @@ import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
|||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationPslStatusEvent;
|
||||
import club.joylink.rtss.vo.client.psl.PslStatus;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class VirtualRealityPslService implements IVirtualRealityPslService {
|
||||
|
||||
|
@ -51,13 +50,15 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void pressTheButton(Simulation simulation, String standCode, VirtualRealityPsl.Button button) {
|
||||
public void pressTheButton(Simulation simulation, String standCode,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||
VirtualRealityPsl vrPsl = collectStatus(stand);
|
||||
theButtonIsPressed(simulation, vrPsl, button);
|
||||
}
|
||||
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) {
|
||||
private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button) {
|
||||
Stand stand = vrPsl.getStand();
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
|
@ -68,10 +69,12 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey());
|
||||
break;
|
||||
case KM:
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case GM:
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(!vrPsl.isSdButton());
|
||||
|
@ -80,7 +83,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button, boolean on) {
|
||||
public void updateStatus(Simulation simulation, VirtualRealityPsl vrPsl,
|
||||
VirtualRealityPsl.Button button, boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
vrPsl.setYxjzKey(on);
|
||||
|
@ -89,7 +93,10 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
vrPsl.setHsjcKey(on);
|
||||
break;
|
||||
case KM:
|
||||
vrPsl.setKmButton(on);
|
||||
break;
|
||||
case GM:
|
||||
vrPsl.setGmButton(on);
|
||||
break;
|
||||
case SD:
|
||||
vrPsl.setSdButton(on);
|
||||
|
@ -98,7 +105,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
effective(simulation, vrPsl.getStand(), button, on);
|
||||
}
|
||||
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button, boolean on) {
|
||||
private void effective(Simulation simulation, Stand stand, VirtualRealityPsl.Button button,
|
||||
boolean on) {
|
||||
switch (button) {
|
||||
case YXJZ:
|
||||
break;
|
||||
|
@ -106,12 +114,16 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
ciApiService.setOrCancelInterlockRelease(simulation, stand, on);
|
||||
break;
|
||||
case KM:
|
||||
if (on)
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
if (on) {
|
||||
ciApiService.openScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
}
|
||||
break;
|
||||
case GM:
|
||||
if (on)
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL);
|
||||
if (on) {
|
||||
ciApiService.closeScreenDoor(simulation, stand.getCode(),
|
||||
CiStandService.PsdCommandSource.PSL);
|
||||
}
|
||||
break;
|
||||
case SD:
|
||||
break;
|
||||
|
@ -129,8 +141,9 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
Map<String, PslStatus> ibpStatusMap = repository.getPslStatusMap();
|
||||
Map<String, PslStatus> collectionMap = new HashMap<>();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
if (stand.getVrPsl() == null)
|
||||
if (stand.getVrPsl() == null) {
|
||||
continue;
|
||||
}
|
||||
VirtualRealityPsl vrPsl = this.collectStatus(stand);
|
||||
PslStatus pslStatus = ibpStatusMap.get(stand.getCode());
|
||||
if (pslStatus == null) {
|
||||
|
@ -145,7 +158,8 @@ public class VirtualRealityPslService implements IVirtualRealityPslService {
|
|||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(collectionMap)) {
|
||||
applicationContext.publishEvent(new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
applicationContext.publishEvent(
|
||||
new SimulationPslStatusEvent(this, simulation, collectionMap));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,14 @@ import club.joylink.rtss.simulation.cbtc.data.map.Switch;
|
|||
import club.joylink.rtss.simulation.cbtc.data.map.SwitchElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class CiSwitchControlService {
|
||||
|
||||
@Autowired
|
||||
private VirtualRealityDeviceService virtualRealityDeviceService;
|
||||
|
||||
|
@ -99,7 +99,14 @@ public class CiSwitchControlService {
|
|||
*/
|
||||
public SwitchIndication turn(Simulation simulation, Switch aSwitch) {
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
boolean lastTurnToN = vrSwitch.isLastTurnToN();
|
||||
boolean lastTurnToN; //最后转向的方向,主要是为了解决失表的情况下每次转动道岔要向不同方向转动
|
||||
if (vrSwitch.isPosN()) {
|
||||
lastTurnToN = true;
|
||||
} else if (vrSwitch.isPosR()) {
|
||||
lastTurnToN = false;
|
||||
} else {
|
||||
lastTurnToN = vrSwitch.isLastTurnToN();
|
||||
}
|
||||
if (simulation.getRepository().getConfig().isSwitchNRTurnChain()) {
|
||||
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
|
||||
if (Objects.nonNull(linkedSwitch)) {
|
||||
|
@ -133,7 +140,8 @@ public class CiSwitchControlService {
|
|||
return false;
|
||||
}
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch, VirtualRealitySwitch.Operation.NP);
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch,
|
||||
VirtualRealitySwitch.Operation.NP);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -149,7 +157,8 @@ public class CiSwitchControlService {
|
|||
return false;
|
||||
}
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch, VirtualRealitySwitch.Operation.RP);
|
||||
this.virtualRealityDeviceService.control(simulation, vrSwitch,
|
||||
VirtualRealitySwitch.Operation.RP);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -161,20 +170,23 @@ public class CiSwitchControlService {
|
|||
*/
|
||||
private boolean checkTurnCondition(Switch aSwitch) {
|
||||
// 道岔锁闭 或者 道岔占用且无强扳授权,则不能转动
|
||||
return !(aSwitch.isLocked() || (aSwitch.isSectionOccupied() && aSwitch.getForceTurnRemain() <= 0));
|
||||
return !(aSwitch.isLocked() || (aSwitch.isSectionOccupied()
|
||||
&& aSwitch.getForceTurnRemain() <= 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确保道岔位置正确
|
||||
*/
|
||||
public boolean ensureSwitchPosCurrent(Simulation simulation, List<SwitchElement> switchElements, boolean guideSetting) {
|
||||
public boolean ensureSwitchPosCurrent(Simulation simulation, List<SwitchElement> switchElements,
|
||||
boolean guideSetting) {
|
||||
boolean allOn = true;
|
||||
if (switchElements == null) {
|
||||
return true;
|
||||
}
|
||||
for (SwitchElement switchElement : switchElements) {
|
||||
boolean onPos = this.turnRouteSwitch(simulation, switchElement);
|
||||
if (!onPos && !(guideSetting && switchElement.getASwitch().isLoss() && switchElement.getASwitch().isGuideMasterLock())) { //不在正确位置并且不是办理引导进路中的引导总锁的失表道岔
|
||||
if (!onPos && !(guideSetting && switchElement.getASwitch().isLoss()
|
||||
&& switchElement.getASwitch().isGuideMasterLock())) { //不在正确位置并且不是办理引导进路中的引导总锁的失表道岔
|
||||
allOn = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,8 +189,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
Simulation.FunctionalType functionalType) {
|
||||
Objects.requireNonNull(mapId, "地图id不能为空");
|
||||
Objects.requireNonNull(functionalType, "仿真功能类型不能为空");
|
||||
SimulationBuildParams params = this.prepareSimulationParams(loginUserInfoVO, mapId,
|
||||
prdType, functionalType);
|
||||
SimulationBuildParams params = this.prepareSimulationParams(loginUserInfoVO, mapId, prdType,
|
||||
functionalType);
|
||||
String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(),
|
||||
mapId);
|
||||
Simulation simulation = this.simulationLifeCycleService.create(params, group);
|
||||
|
@ -212,17 +212,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
List<RunPlanParkingTimeVO> parkTimeList = this.prepareParkTimeData(mapVO, loginUserInfoVO,
|
||||
mapId);
|
||||
// 获取操作定义数据
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService
|
||||
.queryDefinitionsByLineCode(mapVO.getLineCode());
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService.queryDefinitionsByLineCode(
|
||||
mapVO.getLineCode());
|
||||
SimulationBuildParams.SimulationBuildParamsBuilder builder = SimulationBuildParams.builder();
|
||||
// 都有的属性构造
|
||||
builder.loginUserInfo(loginUserInfoVO)
|
||||
.createTime(LocalDateTime.now())
|
||||
.map(mapVO)
|
||||
.userRunLevelList(runLevelList)
|
||||
.userParkTimeList(parkTimeList)
|
||||
.operationDefinitionList(operationDefinitionList)
|
||||
.prodType(prdType)
|
||||
builder.loginUserInfo(loginUserInfoVO).createTime(LocalDateTime.now()).map(mapVO)
|
||||
.userRunLevelList(runLevelList).userParkTimeList(parkTimeList)
|
||||
.operationDefinitionList(operationDefinitionList).prodType(prdType)
|
||||
.functionalType(functionalType);
|
||||
//运行图选择性构造
|
||||
LocalDate runPlanDate = SimulationConstants.getRunPlanDate();
|
||||
|
@ -236,9 +232,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
schedulingPlanNewVO = this.schedulingService.queryCommonSchedulingPlanOfDay(mapId,
|
||||
runPlanDate);
|
||||
} else {
|
||||
schedulingPlanNewVO = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(),
|
||||
runPlanDate);
|
||||
schedulingPlanNewVO = this.schedulingService.querySchedulingPlanUserFirst(
|
||||
loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(), runPlanDate);
|
||||
}
|
||||
builder.schedulingPlan(schedulingPlanNewVO);
|
||||
}
|
||||
|
@ -294,15 +289,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
// 获取地图数据
|
||||
MapVO mapVO = this.iMapService.getMapDetail(mapId);
|
||||
// 获取操作定义数据
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService
|
||||
.queryDefinitionsByLineCode(mapVO.getLineCode());
|
||||
List<CommandDefinitionVO> operationDefinitionList = this.iCommandService.queryDefinitionsByLineCode(
|
||||
mapVO.getLineCode());
|
||||
SimulationBuildParams.SimulationBuildParamsBuilder builder = SimulationBuildParams.builder();
|
||||
// 都有的属性构造
|
||||
builder.loginUserInfo(loginUserInfoVO)
|
||||
.createTime(LocalDateTime.now())
|
||||
.map(mapVO)
|
||||
.operationDefinitionList(operationDefinitionList)
|
||||
.prodType(prdType)
|
||||
builder.loginUserInfo(loginUserInfoVO).createTime(LocalDateTime.now()).map(mapVO)
|
||||
.operationDefinitionList(operationDefinitionList).prodType(prdType)
|
||||
.functionalType(functionalType);
|
||||
//运行图选择性构造
|
||||
LocalDate runPlanDate = SimulationConstants.getRunPlanDate();
|
||||
|
@ -314,9 +306,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
schedulingPlanNewVO = this.schedulingService.queryCommonSchedulingPlanOfDay(mapId,
|
||||
runPlanDate);
|
||||
} else {
|
||||
schedulingPlanNewVO = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(),
|
||||
runPlanDate);
|
||||
schedulingPlanNewVO = this.schedulingService.querySchedulingPlanUserFirst(
|
||||
loginUserInfoVO.getAccountVO().getId(), runPlanVO.getId(), runPlanDate);
|
||||
}
|
||||
builder.schedulingPlan(schedulingPlanNewVO);
|
||||
}
|
||||
|
@ -368,8 +359,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
confirmHasPermission(loginUserInfoVO.getAccountVO(), mapId, prodCode);
|
||||
|
||||
MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prodCode);
|
||||
Simulation simulation = this.create(loginUserInfoVO, mapId,
|
||||
prdType,
|
||||
Simulation simulation = this.create(loginUserInfoVO, mapId, prdType,
|
||||
Simulation.FunctionalType.SIMULATION);
|
||||
|
||||
if (Objects.equals(MapPrdTypeEnum.BIG_SCREEN, prdType)) {
|
||||
|
@ -573,8 +563,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
|
||||
this.simulationLifeCycleService.checkErrorThrow(simulation);
|
||||
List<TripPlan> tripPlanList = simulation.getRepository().getAllTripPlanList();
|
||||
List<String> tripNumberList = tripPlanList.stream()
|
||||
.map(TripPlan::getTripNumber)
|
||||
List<String> tripNumberList = tripPlanList.stream().map(TripPlan::getTripNumber)
|
||||
.collect(Collectors.toList());
|
||||
return tripNumberList;
|
||||
}
|
||||
|
@ -652,8 +641,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
RunPlanVO runPlan = this.iRunPlanTemplateService.getRunPlan(templateId);
|
||||
// 重新加载运行计划匹配的派班计划
|
||||
Long userId = simulation.getBuildParams().getUser().getId();
|
||||
SchedulingPlanNewVO schedulingPlan = this.schedulingService
|
||||
.querySchedulingPlanUserFirst(userId, templateId, SimulationConstants.getRunPlanDate());
|
||||
SchedulingPlanNewVO schedulingPlan = this.schedulingService.querySchedulingPlanUserFirst(userId,
|
||||
templateId, SimulationConstants.getRunPlanDate());
|
||||
this.simulationLifeCycleService.reloadRunPlan(simulation, runPlan, schedulingPlan);
|
||||
simulation.getRepository().clearChangeTrips(); //清除掉之前的车次计划变化信息
|
||||
}
|
||||
|
@ -673,8 +662,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
ScriptBO scriptBO = iScriptService.getScriptBOById(scriptId, simulation);
|
||||
iScriptSimulationService.scriptCoverSimulation(simulation, scriptBO);
|
||||
SocketMessageVO<Boolean> message = SocketMessageFactory.build(
|
||||
WebSocketMessageType.Simulation_Script_Loaded,
|
||||
simulation.getId(), true);
|
||||
WebSocketMessageType.Simulation_Script_Loaded, simulation.getId(), true);
|
||||
Set<String> userIds = simulation.getSimulationUserIds();
|
||||
stompMessageService.sendToUser(userIds, message);
|
||||
}
|
||||
|
@ -851,11 +839,9 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
@Override
|
||||
public List<SimulationVO> queryJointSimulationByUser(LoginUserInfoVO loginUserInfoVO) {
|
||||
List<Simulation> jointSimulationList = this.groupSimulationCache.queryAllJointSimulation();
|
||||
List<Simulation> userJointSimulationList = jointSimulationList.stream()
|
||||
.filter(simulation ->
|
||||
simulation.isSame(loginUserInfoVO.getProject()) &&
|
||||
simulation.containsUser(loginUserInfoVO.getAccountVO().getId()))
|
||||
.collect(Collectors.toList());
|
||||
List<Simulation> userJointSimulationList = jointSimulationList.stream().filter(
|
||||
simulation -> simulation.isSame(loginUserInfoVO.getProject()) && simulation.containsUser(
|
||||
loginUserInfoVO.getAccountVO().getId())).collect(Collectors.toList());
|
||||
|
||||
List<SimulationVO> simulationVOList = SimulationVO.convert2VOList(userJointSimulationList);
|
||||
return simulationVOList;
|
||||
|
@ -864,13 +850,11 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
@Override
|
||||
public void kickOut(String group, Long userId, AccountVO user) {
|
||||
Simulation simulation = this.getSimulationByGroup(group);
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS
|
||||
.assertTrue(simulation.isAdmin(user));
|
||||
BusinessExceptionAssertEnum.INSUFFICIENT_PERMISSIONS.assertTrue(simulation.isAdmin(user));
|
||||
SimulationUser simulationUser = simulation.querySimulationUserById(userId);
|
||||
if (Objects.nonNull(simulationUser)) {
|
||||
ProjectDeviceVO projectDevice = simulationUser.getProjectDevice();
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED
|
||||
.assertNull(projectDevice);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNull(projectDevice);
|
||||
this.kickOut(simulation, simulationUser);
|
||||
}
|
||||
}
|
||||
|
@ -903,12 +887,12 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
Simulation simulation = this.getSimulationByGroup(group);
|
||||
List<RealDeviceConfig> realDeviceList = simulation.getRealDeviceList();
|
||||
if (!CollectionUtils.isEmpty(realDeviceList)) {
|
||||
Set<ProjectDeviceType> displayDeviceTypes =
|
||||
new HashSet<>(
|
||||
Set<ProjectDeviceType> displayDeviceTypes = new HashSet<>(
|
||||
List.of(ProjectDeviceType.PSD, ProjectDeviceType.SWITCH, ProjectDeviceType.SIGNAL,
|
||||
ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP, ProjectDeviceType.SECTION));
|
||||
realDeviceList = realDeviceList
|
||||
.stream().filter(device -> displayDeviceTypes.contains(device.getDeviceType()))
|
||||
ProjectDeviceType.PLC_GATEWAY, ProjectDeviceType.IBP, ProjectDeviceType.SECTION,
|
||||
ProjectDeviceType.PSL));
|
||||
realDeviceList = realDeviceList.stream()
|
||||
.filter(device -> displayDeviceTypes.contains(device.getDeviceType()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// List<RealDevice> showList = null;
|
||||
|
@ -953,8 +937,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
//校验目标成员类型
|
||||
SimulationMember targetMember = simulation.getSimulationMemberById(
|
||||
initiateVO.getTargetMemberId());
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION
|
||||
.assertEquals(targetMember.getType(), commandType.getMemberType(), "目标成员不正确");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertEquals(targetMember.getType(),
|
||||
commandType.getMemberType(), "目标成员不正确");
|
||||
|
||||
ScriptBO script = simulation.getScript();
|
||||
if (script != null && script.isBgSet()) { //剧本背景已经保存
|
||||
|
@ -1008,15 +992,13 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
public void alarmConfirm(String group, List<String> codes, AccountVO accountVO) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
simulation.getRepository().getAlarmList().stream()
|
||||
.filter(atsAlarm -> codes.contains(atsAlarm.getCode()))
|
||||
.filter(atsAlarm -> {
|
||||
.filter(atsAlarm -> codes.contains(atsAlarm.getCode())).filter(atsAlarm -> {
|
||||
if (atsAlarm.isConfirmed()) {
|
||||
codes.remove(atsAlarm.getCode());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.forEach(atsAlarm -> atsAlarm.confirm(accountVO, simulation.getCorrectSystemTime()));
|
||||
}).forEach(atsAlarm -> atsAlarm.confirm(accountVO, simulation.getCorrectSystemTime()));
|
||||
this.applicationContext.publishEvent(new SimulationAlarmConfirmEvent(this, simulation, codes));
|
||||
}
|
||||
|
||||
|
@ -1057,20 +1039,15 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
int end = pageNum * queryVO.getPageSize();
|
||||
start = Math.min(start, logs.size() - 1);
|
||||
end = Math.min(end, logs.size());
|
||||
logs = logs.stream()
|
||||
.filter(log -> {
|
||||
if (queryVO.getStartTime() != null && log.getTime()
|
||||
.isBefore(queryVO.getStartTime())) {
|
||||
logs = logs.stream().filter(log -> {
|
||||
if (queryVO.getStartTime() != null && log.getTime().isBefore(queryVO.getStartTime())) {
|
||||
return false;
|
||||
}
|
||||
if (queryVO.getEndTime() != null && log.getTime().isAfter(queryVO.getEndTime())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.skip(start)
|
||||
.limit(end - start)
|
||||
.collect(Collectors.toList());
|
||||
}).skip(start).limit(end - start).collect(Collectors.toList());
|
||||
pageVO.setList(logs);
|
||||
} else {
|
||||
pageVO.setPageNum(1);
|
||||
|
@ -1173,23 +1150,21 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
Long mapId, String prdType) {
|
||||
if (accountVO.isThirdChildAccount()) {
|
||||
List<LoginUserInfoVO> loginInfos = this.loginSessionManager.getAllLoginUserInfos();
|
||||
Set<LoginUserInfoVO> thirdLoginList = loginInfos.stream()
|
||||
.filter(loginUserInfoVO -> loginUserInfoVO.getAccountVO().isThirdChildAccount()
|
||||
Set<LoginUserInfoVO> thirdLoginList = loginInfos.stream().filter(
|
||||
loginUserInfoVO -> loginUserInfoVO.getAccountVO().isThirdChildAccount()
|
||||
&& loginUserInfoVO.getAccountVO().getParentAccount()
|
||||
.equals(accountVO.getParentAccount()))
|
||||
.collect(Collectors.toSet());
|
||||
.equals(accountVO.getParentAccount())).collect(Collectors.toSet());
|
||||
Set<String> thirdLoginAccountIdList = thirdLoginList.stream()
|
||||
.map(loginUserInfoVO -> loginUserInfoVO.getAccountVO().getId().toString())
|
||||
.collect(Collectors.toSet());
|
||||
long count = this.simulationManager.getSimulationList().stream()
|
||||
.filter(simulation -> simulation instanceof Simulation)
|
||||
.map(simulation -> ((Simulation) simulation))
|
||||
.filter(simulation -> {
|
||||
.map(simulation -> ((Simulation) simulation)).filter(simulation -> {
|
||||
if (simulation.getBuildParams().getMap().getId().equals(mapId)) {
|
||||
if (!((MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||
MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())) ||
|
||||
(!MapPrdTypeEnum.JOINT.getCode().equals(prdType) &&
|
||||
!MapPrdTypeEnum.JOINT.equals(simulation.getBuildParams().getProdType())))) {
|
||||
if (!((MapPrdTypeEnum.JOINT.getCode().equals(prdType) && MapPrdTypeEnum.JOINT.equals(
|
||||
simulation.getBuildParams().getProdType())) || (
|
||||
!MapPrdTypeEnum.JOINT.getCode().equals(prdType) && !MapPrdTypeEnum.JOINT.equals(
|
||||
simulation.getBuildParams().getProdType())))) {
|
||||
return false;
|
||||
}
|
||||
for (String accountId : simulation.getSimulationUserIds()) {
|
||||
|
@ -1199,11 +1174,8 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
|||
}
|
||||
}
|
||||
return false;
|
||||
})
|
||||
.count();
|
||||
int sum = ups.stream()
|
||||
.mapToInt(userPermissionVO -> userPermissionVO.getRemains())
|
||||
.sum();
|
||||
}).count();
|
||||
int sum = ups.stream().mapToInt(userPermissionVO -> userPermissionVO.getRemains()).sum();
|
||||
if (sum <= count) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,8 @@ import lombok.Setter;
|
|||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealityScreenDoor.Operation> {
|
||||
public class VirtualRealityScreenDoor extends
|
||||
ControllableVrDevice<VirtualRealityScreenDoor.Operation> {
|
||||
|
||||
public boolean isCommandOpen() {
|
||||
return Operation.K.equals(this.getCommand());
|
||||
|
@ -19,9 +20,13 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
* 道岔支持的操作
|
||||
*/
|
||||
public enum Operation {
|
||||
/** 开门 */
|
||||
/**
|
||||
* 开门
|
||||
*/
|
||||
K,
|
||||
/** 关门 */
|
||||
/**
|
||||
* 关门
|
||||
*/
|
||||
G,
|
||||
}
|
||||
|
||||
|
@ -71,8 +76,9 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
|
||||
@Override
|
||||
protected boolean checkConditionBeforeControl(Operation command) {
|
||||
if (command == null)
|
||||
if (command == null) {
|
||||
return false;
|
||||
}
|
||||
switch (command) {
|
||||
case K:
|
||||
return !open2End;
|
||||
|
@ -109,17 +115,19 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
}
|
||||
switch (command) {
|
||||
case K: {
|
||||
if (this.isOpen2End())
|
||||
if (this.isOpen2End()) {
|
||||
setRemain(0);
|
||||
else
|
||||
} else {
|
||||
setClose(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case G: {
|
||||
if (this.isLockAndClose())
|
||||
if (this.isLockAndClose()) {
|
||||
setRemain(0);
|
||||
else
|
||||
} else {
|
||||
setOpen2End(false);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -150,14 +158,16 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
|
||||
public void setClose(boolean close) {
|
||||
if ((Fault.CANNOT_BE_CLOSED.equals(this.fault) && close) ||
|
||||
(Fault.CANNOT_BE_OPENED.equals(this.fault) && !close))
|
||||
(Fault.CANNOT_BE_OPENED.equals(this.fault) && !close)) {
|
||||
return;
|
||||
}
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
public void setLock(boolean lock) {
|
||||
if (Fault.NO_CLOSE_AND_LOCK.equals(this.fault) && lock)
|
||||
if (Fault.NO_CLOSE_AND_LOCK.equals(this.fault) && lock) {
|
||||
return;
|
||||
}
|
||||
this.lock = lock;
|
||||
}
|
||||
|
||||
|
@ -217,16 +227,16 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
CANNOT_BE_CLOSED {
|
||||
@Override
|
||||
public void apply(VirtualRealityScreenDoor door) {
|
||||
door.setFault(null);
|
||||
door.control(Operation.K);
|
||||
// door.setFault(null);
|
||||
// door.control(Operation.K);
|
||||
door.setFault(this);
|
||||
}
|
||||
},
|
||||
CANNOT_BE_OPENED {
|
||||
@Override
|
||||
public void apply(VirtualRealityScreenDoor door) {
|
||||
door.setFault(null);
|
||||
door.control(Operation.G);
|
||||
// door.setFault(null);
|
||||
// door.control(Operation.G);
|
||||
door.setFault(this);
|
||||
}
|
||||
},
|
||||
|
@ -241,8 +251,9 @@ public class VirtualRealityScreenDoor extends ControllableVrDevice<VirtualRealit
|
|||
public abstract void apply(VirtualRealityScreenDoor door);
|
||||
|
||||
public void fix(VirtualRealityScreenDoor vrPSD) {
|
||||
if (this.equals(vrPSD.getFault()))
|
||||
if (this.equals(vrPSD.getFault())) {
|
||||
vrPSD.setFault(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,9 +78,13 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
|||
* 道岔支持的操作
|
||||
*/
|
||||
public enum Operation {
|
||||
/** 定操 */
|
||||
/**
|
||||
* 定操
|
||||
*/
|
||||
NP,
|
||||
/** 反操 */
|
||||
/**
|
||||
* 反操
|
||||
*/
|
||||
RP,
|
||||
}
|
||||
|
||||
|
@ -120,8 +124,9 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
|||
SPLIT {
|
||||
@Override
|
||||
public boolean apply(VirtualRealitySwitch vrSwitch) {
|
||||
if (this.equals(vrSwitch.getFault()))
|
||||
if (this.equals(vrSwitch.getFault())) {
|
||||
return false;
|
||||
}
|
||||
vrSwitch.setFault(this);
|
||||
vrSwitch.setP(SwitchIndication.NO);
|
||||
return true;
|
||||
|
@ -133,8 +138,9 @@ public class VirtualRealitySwitch extends ControllableVrDevice<VirtualRealitySwi
|
|||
SQUEEZE {
|
||||
@Override
|
||||
public boolean apply(VirtualRealitySwitch vrSwitch) {
|
||||
if (this.equals(vrSwitch.getFault()))
|
||||
if (this.equals(vrSwitch.getFault())) {
|
||||
return false;
|
||||
}
|
||||
vrSwitch.setFault(this);
|
||||
vrSwitch.setP(SwitchIndication.EX);
|
||||
return true;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.RealDeviceConfig;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.sdy.SdyPslConfigVO;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class CgyPslConfig extends RealDeviceConfig {
|
||||
|
||||
private CgyPslConfigVO configVO;
|
||||
|
||||
public CgyPslConfig(ProjectDeviceVO projectDevice) {
|
||||
super(projectDevice);
|
||||
if (projectDevice != null) {
|
||||
this.configVO = JsonUtils.read(projectDevice.getConfig(), CgyPslConfigVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return configVO.findDeviceCode();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy;
|
||||
|
||||
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl.Button;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.common.RealDeviceConfig;
|
||||
import club.joylink.rtss.vo.client.project.cgy.CgyPslConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CgyPslServiceImpl implements RealDeviceService {
|
||||
|
||||
@Autowired
|
||||
private PlcGatewayService plcGatewayService;
|
||||
@Autowired
|
||||
private IVirtualRealityPslService virtualRealityPslService;
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
return deviceConfig instanceof CgyPslConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
// PlcGateway plcGateway = simulation.getPlcGateway();
|
||||
// CgyPslConfigVO configVO = ((CgyPslConfig) deviceConfig).getConfigVO();
|
||||
// Channel channel = plcGateway.getChannel();
|
||||
// int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_gm_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_km_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_psl_light(), false, channel);
|
||||
// plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_gbsj_light(), false, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null) {
|
||||
return;
|
||||
}
|
||||
CgyPslConfig config = (CgyPslConfig) deviceConfig;
|
||||
CgyPslConfigVO configVO = config.getConfigVO();
|
||||
if (!StringUtils.hasText(configVO.getPslCode())) {
|
||||
return;
|
||||
}
|
||||
VirtualRealityPsl vrPsl = simulation.getRepository()
|
||||
.getByCode(configVO.getPslCode(), VirtualRealityPsl.class);
|
||||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
|
||||
configVO.getQuantity());
|
||||
boolean r_km_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_km_btn());
|
||||
boolean r_gm_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_gm_btn());
|
||||
boolean r_yxjz_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yxjz_btn());
|
||||
boolean r_hsjc_key = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_hsjc_key());
|
||||
boolean r_xy_btn = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_xy_btn());
|
||||
boolean w_km_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_km_light());
|
||||
boolean w_gm_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_gm_light());
|
||||
boolean w_yxcz_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxcz_light());
|
||||
boolean w_gbsj_light = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_gbsj_light());
|
||||
//向vrPSL同步操作
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.KM, r_km_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.GM, r_gm_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.YXJZ, r_yxjz_btn);
|
||||
virtualRealityPslService.updateStatus(simulation, vrPsl, Button.HSJC, r_hsjc_key);
|
||||
//向实体PSL同步状态
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_km_light(),
|
||||
w_km_light, vrPsl.isKmLight(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gm_light(),
|
||||
w_gm_light, vrPsl.isGmLight(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxcz_light(),
|
||||
w_yxcz_light, vrPsl.isYxjzKey(), channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_gbsj_light(),
|
||||
w_gbsj_light, vrPsl.isQbgmLight(), channel);
|
||||
}
|
||||
}
|
|
@ -46,29 +46,34 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
|||
Channel channel = plcGateway.getChannel();
|
||||
switch (aspect) {
|
||||
case No:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
case R:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
case G:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), true, channel);
|
||||
break;
|
||||
case Y:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
case RY:
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_red(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_green(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yellow(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_ddj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_lxj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_yxj(), true, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_zxj(), false, channel);
|
||||
break;
|
||||
default:
|
||||
log.error("不支持的显示:{}", aspect);
|
||||
|
@ -91,84 +96,82 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
|||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(),
|
||||
configVO.getQuantity());
|
||||
|
||||
boolean r_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_red());
|
||||
boolean r_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_green());
|
||||
boolean r_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yellow());
|
||||
|
||||
SignalAspect aspect = null;
|
||||
if (!r_r && !r_g && !r_y) {
|
||||
aspect = SignalAspect.No;
|
||||
} else if (r_r && !r_g && !r_y) {
|
||||
aspect = SignalAspect.R;
|
||||
} else if (!r_r && r_g && !r_y) {
|
||||
aspect = SignalAspect.G;
|
||||
} else if (!r_r && !r_g && r_y) {
|
||||
aspect = SignalAspect.Y;
|
||||
} else if (r_r && !r_g && r_y) {
|
||||
aspect = SignalAspect.RY;
|
||||
}
|
||||
if (aspect == null) {
|
||||
log.error("未知的信号组合[红:%s][绿:%s][黄:%s]", r_r, r_g, r_y);
|
||||
} else {
|
||||
//同步信号显示
|
||||
SignalAspect aspect = getAspect(deviceStatus, configVO);
|
||||
vrSignal.apply(aspect);
|
||||
}
|
||||
|
||||
//驱动信号显示
|
||||
if (vrSignal.isTurning()) {
|
||||
boolean w_r = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_red());
|
||||
boolean w_g = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_green());
|
||||
boolean w_y = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yellow());
|
||||
boolean w_ddj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_ddj());
|
||||
boolean w_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_lxj());
|
||||
boolean w_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_yxj());
|
||||
boolean w_zxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_zxj());
|
||||
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
SignalAspect command = vrSignal.getCommand();
|
||||
switch (command) {
|
||||
case No:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case R:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case G:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj, true,
|
||||
channel);
|
||||
break;
|
||||
case Y:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
case RY:
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_red(), w_r, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_green(), w_g,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_ddj(), w_ddj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yellow(), w_y,
|
||||
true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_lxj(), w_lxj,
|
||||
false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_yxj(), w_yxj, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_zxj(), w_zxj,
|
||||
false,
|
||||
channel);
|
||||
break;
|
||||
default:
|
||||
|
@ -177,4 +180,22 @@ public class CgySignalServiceImpl implements RealDeviceService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SignalAspect getAspect(ByteBuf deviceStatus, CgySignalConfigVO configVO) {
|
||||
boolean r_ddj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_ddj());
|
||||
boolean r_lxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_lxj());
|
||||
boolean r_yxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_yxj());
|
||||
boolean r_zxj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_zxj());
|
||||
if (r_yxj) {
|
||||
return SignalAspect.RY;
|
||||
} else if (r_lxj && r_zxj) {
|
||||
return SignalAspect.G;
|
||||
} else if (r_lxj) {
|
||||
return SignalAspect.Y;
|
||||
} else if (!r_ddj) {
|
||||
return SignalAspect.R;
|
||||
} else {
|
||||
return SignalAspect.No;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
|||
CgySwitchConfigVO configVO = config.getConfigVO();
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_sj(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_js(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_dc(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_fc(), false, channel);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
|||
boolean r_fb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_fb());
|
||||
vrSwitch.apply(r_db, r_fb);
|
||||
|
||||
//以下操作实体设备的逻辑中,防止继电器长期接通的逻辑将定反操视为技能,共用3秒冷却,技能持续时间也是3秒
|
||||
//以下操作实体设备的逻辑中,防止继电器长期接通的逻辑,将定反操视为技能,共用3秒冷却,技能持续时间也是3秒
|
||||
if (config.isEnd()) { //此判断既可视为操作是否冷却,也可视为持续时间是否耗尽
|
||||
config.sync(r_db, r_fb);
|
||||
release(deviceStatus, baseAddr, configVO, channel); //操作持续时间耗尽后断开所有继电器
|
||||
|
@ -87,10 +87,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
|||
|
||||
private void turnToN(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_sb, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, true,
|
||||
channel);
|
||||
|
@ -100,10 +100,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
|||
|
||||
private void turnToP(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_js = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sb, true,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_js, true,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, false,
|
||||
channel);
|
||||
|
@ -113,10 +113,10 @@ public class CgySwitchServiceImpl implements RealDeviceService {
|
|||
|
||||
private void release(ByteBuf deviceStatus, int baseAddr, CgySwitchConfigVO configVO,
|
||||
Channel channel) {
|
||||
boolean w_sj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sj());
|
||||
boolean w_sj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_js());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_dc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sj(), w_sj, false,
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_js(), w_sj, false,
|
||||
channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_dc(), w_dc, false,
|
||||
channel);
|
||||
|
|
|
@ -10,13 +10,13 @@ import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
|||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TrainTargetUpdateService {
|
||||
|
||||
public static final String Model_Name = "TrainTargetUpdate";
|
||||
public static final int Rate = 5000;
|
||||
|
||||
|
@ -28,10 +28,10 @@ public class TrainTargetUpdateService {
|
|||
SimulationDataRepository repository = simulation.getRepository();
|
||||
List<VirtualRealityTrain> onlineTrain = repository.getOnlineTrainList();
|
||||
for (VirtualRealityTrain train : onlineTrain) {
|
||||
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
|
||||
// if (!trainInfo.isManualTrain()) {
|
||||
// continue;
|
||||
// }
|
||||
TrainInfo trainInfo = repository.findSupervisedTrainByGroup(train.getGroupNumber());
|
||||
if (trainInfo == null) {
|
||||
continue;
|
||||
}
|
||||
Section target = train.getTarget();
|
||||
Section newTarget = this.queryArriveTarget(train, trainInfo);
|
||||
if (newTarget != null && !Objects.equals(target, newTarget)) {
|
||||
|
@ -40,14 +40,16 @@ public class TrainTargetUpdateService {
|
|||
}
|
||||
}
|
||||
|
||||
private Section queryArriveTarget4Manual(VirtualRealityTrain train, TrainInfo trainInfo, Section target) {
|
||||
private Section queryArriveTarget4Manual(VirtualRealityTrain train, TrainInfo trainInfo,
|
||||
Section target) {
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
boolean right = train.isRight();
|
||||
Section newTarget = target;
|
||||
Section temp = headPosition.getSection();
|
||||
for (int i = 0; i < 50; i++) {
|
||||
if (temp == null)
|
||||
if (temp == null) {
|
||||
break;
|
||||
}
|
||||
if (!temp.isFunctionTrack()) {
|
||||
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||
continue;
|
||||
|
@ -55,12 +57,14 @@ public class TrainTargetUpdateService {
|
|||
Signal signal = temp.getSignalOf(right);
|
||||
if (signal != null && !signal.isMainAspect()) {
|
||||
newTarget = temp;
|
||||
if (temp.isFunctionTrack())
|
||||
if (temp.isFunctionTrack()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (temp.isNormalStandTrack() || temp.isTransferTrack()) {
|
||||
if (temp.isNormalStandTrack()) {
|
||||
if (temp.getStandList().stream().anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
||||
if (temp.getStandList().stream()
|
||||
.anyMatch(stand -> stand.isJumpStop(train.getGroupNumber()))) { //该列车应在站台跳停
|
||||
temp = temp.findNextRunningSectionBaseRealSwitch(right);
|
||||
continue;
|
||||
}
|
||||
|
@ -88,8 +92,9 @@ public class TrainTargetUpdateService {
|
|||
private Section queryArriveTarget(VirtualRealityTrain train, TrainInfo trainInfo) {
|
||||
Section newTarget = null;
|
||||
MaService.Ma ma = train.getMa2();
|
||||
if (ma == null)
|
||||
if (ma == null) {
|
||||
return null;
|
||||
}
|
||||
SectionPosition eoaPosition = ma.getEoaPosition();
|
||||
Section eoaSection = eoaPosition.getSection();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
|
|
|
@ -4,6 +4,7 @@ import club.joylink.rtss.constants.ProjectCode;
|
|||
import club.joylink.rtss.constants.ProjectDeviceType;
|
||||
import club.joylink.rtss.entity.ProjectDevice;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgyPslConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySectionConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySignalConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.cgy.CgySwitchConfig;
|
||||
|
@ -175,6 +176,9 @@ public class ProjectDeviceVO {
|
|||
case SECTION:
|
||||
list.add(new CgySectionConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new CgyPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package club.joylink.rtss.vo.client.project.cgy;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CgyPslConfigVO extends RealConfigVO {
|
||||
|
||||
private String pslCode;
|
||||
|
||||
/**
|
||||
* 开门按钮
|
||||
*/
|
||||
private Integer r_km_btn = 32;
|
||||
|
||||
/**
|
||||
* 关门按钮
|
||||
*/
|
||||
private Integer r_gm_btn = 33;
|
||||
|
||||
/**
|
||||
* 就地(允许/禁止)按钮
|
||||
*/
|
||||
private Integer r_yxjz_btn = 34;
|
||||
|
||||
/**
|
||||
* 互锁解除钥匙(true-互锁解除)
|
||||
*/
|
||||
private Integer r_hsjc_key = 46;
|
||||
|
||||
/**
|
||||
* 消音按钮(不知道消的啥音)
|
||||
*/
|
||||
private Integer r_xy_btn = 47;
|
||||
|
||||
/**
|
||||
* 控制-开门指示灯
|
||||
*/
|
||||
private Integer w_km_light = 48;
|
||||
|
||||
/**
|
||||
* 控制-关门指示灯
|
||||
*/
|
||||
private Integer w_gm_light = 49;
|
||||
|
||||
/**
|
||||
* 控制-psl允许操作指示灯
|
||||
*/
|
||||
private Integer w_yxcz_light = 50;
|
||||
|
||||
/**
|
||||
* 控制-关闭锁紧指示灯
|
||||
*/
|
||||
private Integer w_gbsj_light = 55;
|
||||
|
||||
public CgyPslConfigVO(String pslCode) {
|
||||
this();
|
||||
this.pslCode = pslCode;
|
||||
}
|
||||
|
||||
public CgyPslConfigVO() {
|
||||
super(0, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return pslCode;
|
||||
}
|
||||
}
|
|
@ -11,10 +11,16 @@ public class CgySectionConfigVO extends RealConfigVO {
|
|||
/**
|
||||
* 出清
|
||||
*/
|
||||
private Integer r_occupied = 6;
|
||||
private Integer r_occupied;
|
||||
|
||||
public CgySectionConfigVO(String sectionCode, Integer r_occupied) {
|
||||
this();
|
||||
this.sectionCode = sectionCode;
|
||||
this.r_occupied = r_occupied;
|
||||
}
|
||||
|
||||
public CgySectionConfigVO() {
|
||||
super(0, 32);
|
||||
super(0, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,46 +1,62 @@
|
|||
package club.joylink.rtss.vo.client.project.cgy;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 红灯常亮DDJ吸起红灯灭 Lxj吸起黄灯 YxJ红黄 LXJ、ZXJ吸起绿灯
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class CgySignalConfigVO extends RealConfigVO {
|
||||
|
||||
private String signalCode;
|
||||
|
||||
/**
|
||||
* 红
|
||||
*/
|
||||
private Integer r_red;
|
||||
private Integer r_ddj;
|
||||
|
||||
private Integer r_lxj;
|
||||
|
||||
/**
|
||||
* 绿
|
||||
* 主灯丝报警
|
||||
*/
|
||||
private Integer r_green;
|
||||
private Integer r_dj;
|
||||
|
||||
private Integer r_zxj;
|
||||
|
||||
private Integer r_yxj;
|
||||
|
||||
/**
|
||||
* 黄
|
||||
* 副灯丝报警
|
||||
*/
|
||||
private Integer r_yellow;
|
||||
private Integer r_dj2;
|
||||
|
||||
private Integer w_red;
|
||||
private Integer w_ddj;
|
||||
|
||||
private Integer w_green;
|
||||
private Integer w_lxj;
|
||||
|
||||
private Integer w_yellow;
|
||||
private Integer w_zxj;
|
||||
|
||||
public CgySignalConfigVO(String signalCode, Integer r_red,
|
||||
Integer r_green, Integer r_yellow, Integer w_red, Integer w_green, Integer w_yellow) {
|
||||
super(0, 24);
|
||||
private Integer w_yxj;
|
||||
|
||||
public CgySignalConfigVO(String signalCode, Integer r_ddj,
|
||||
Integer r_lxj, Integer r_dj, Integer r_zxj, Integer r_yxj, Integer r_dj2, Integer w_ddj,
|
||||
Integer w_lxj, Integer w_zxj, Integer w_yxj) {
|
||||
this();
|
||||
this.signalCode = signalCode;
|
||||
this.r_red = r_red;
|
||||
this.r_green = r_green;
|
||||
this.r_yellow = r_yellow;
|
||||
this.w_red = w_red;
|
||||
this.w_green = w_green;
|
||||
this.w_yellow = w_yellow;
|
||||
this.r_ddj = r_ddj;
|
||||
this.r_lxj = r_lxj;
|
||||
this.r_dj = r_dj;
|
||||
this.r_zxj = r_zxj;
|
||||
this.r_yxj = r_yxj;
|
||||
this.r_dj2 = r_dj2;
|
||||
this.w_ddj = w_ddj;
|
||||
this.w_lxj = w_lxj;
|
||||
this.w_zxj = w_zxj;
|
||||
this.w_yxj = w_yxj;
|
||||
}
|
||||
|
||||
public CgySignalConfigVO() {
|
||||
|
|
|
@ -10,30 +10,39 @@ public class CgySwitchConfigVO extends RealConfigVO {
|
|||
|
||||
private String switchCode;
|
||||
|
||||
/**
|
||||
* 解锁表示
|
||||
*/
|
||||
private Integer r_js = 12;
|
||||
/**
|
||||
* 定表
|
||||
*/
|
||||
private Integer r_db = 0;
|
||||
private Integer r_db = 13;
|
||||
|
||||
/**
|
||||
* 反表
|
||||
*/
|
||||
private Integer r_fb = 1;
|
||||
private Integer r_fb = 14;
|
||||
|
||||
/**
|
||||
* 锁接
|
||||
* 解锁
|
||||
*/
|
||||
private Integer w_sj = 8;
|
||||
private Integer w_js = 24;
|
||||
|
||||
/**
|
||||
* 定操
|
||||
*/
|
||||
private Integer w_dc = 9;
|
||||
private Integer w_dc = 25;
|
||||
|
||||
/**
|
||||
* 反操
|
||||
*/
|
||||
private Integer w_fc = 10;
|
||||
private Integer w_fc = 26;
|
||||
|
||||
public CgySwitchConfigVO(String switchCode) {
|
||||
this();
|
||||
this.switchCode = switchCode;
|
||||
}
|
||||
|
||||
public CgySwitchConfigVO() {
|
||||
super(0, 32);
|
||||
|
|
Loading…
Reference in New Issue