【实训背景设置修改】
This commit is contained in:
parent
473446cef0
commit
cd344bc3f0
@ -68,7 +68,7 @@ public class Training2RuleService {
|
|||||||
publishedTraining2Example.createCriteria().andMapIdEqualTo(mapId).andCreatorIdEqualTo(0L);
|
publishedTraining2Example.createCriteria().andMapIdEqualTo(mapId).andCreatorIdEqualTo(0L);
|
||||||
publishedTraining2DAO.deleteByExample(publishedTraining2Example);
|
publishedTraining2DAO.deleteByExample(publishedTraining2Example);
|
||||||
// 生成新数据
|
// 生成新数据
|
||||||
ruleList.forEach(rule -> {
|
for (RtsTraining2RuleWithBLOBs rule : ruleList) {
|
||||||
Training2Rule training2Rule = new Training2Rule(rule);
|
Training2Rule training2Rule = new Training2Rule(rule);
|
||||||
List<MapNamedElement> deviceList = training2Rule.getDeviceRule().filterMapDeviceList(simulation);
|
List<MapNamedElement> deviceList = training2Rule.getDeviceRule().filterMapDeviceList(simulation);
|
||||||
List<PublishedTraining2WithBLOBs> training2WithBLOBs = new ArrayList<>(deviceList.size());
|
List<PublishedTraining2WithBLOBs> training2WithBLOBs = new ArrayList<>(deviceList.size());
|
||||||
@ -79,7 +79,7 @@ public class Training2RuleService {
|
|||||||
}
|
}
|
||||||
// 新数据入库
|
// 新数据入库
|
||||||
publishedTraining2DAO.insertList(training2WithBLOBs);
|
publishedTraining2DAO.insertList(training2WithBLOBs);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -35,6 +35,14 @@ public enum BgSceneStatusRule {
|
|||||||
/**
|
/**
|
||||||
* 设置进路背景blockade
|
* 设置进路背景blockade
|
||||||
*/
|
*/
|
||||||
|
ROUTE_SET_BG_SCENE("排列进路背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Route route = (Route) mapElement;
|
||||||
|
route.getSwitchList().forEach(switchElement -> switchElement.getASwitch().setSingleLock(false));
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
ROUTE_CANCEL_BG_SCENE("取消进路背景") {
|
ROUTE_CANCEL_BG_SCENE("取消进路背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
@ -91,6 +99,14 @@ public enum BgSceneStatusRule {
|
|||||||
/**
|
/**
|
||||||
* 道岔单解背景:将道岔设置为封锁
|
* 道岔单解背景:将道岔设置为封锁
|
||||||
*/
|
*/
|
||||||
|
SWITCH_SINGLE_BLOCK_BG_SCENE("道岔单锁背景") {
|
||||||
|
@Override
|
||||||
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
Switch iSwitch = (Switch) mapElement;
|
||||||
|
iSwitch.setSingleLock(false);
|
||||||
|
return getBgScene(simulation);
|
||||||
|
}
|
||||||
|
},
|
||||||
SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") {
|
SWITCH_SINGLE_UNBLOCK_BG_SCENE("道岔单解背景") {
|
||||||
@Override
|
@Override
|
||||||
public String doHandle(Simulation simulation, MapElement mapElement) {
|
public String doHandle(Simulation simulation, MapElement mapElement) {
|
||||||
|
@ -70,6 +70,10 @@ public enum MapDeviceRule {
|
|||||||
if (route.isGuide()) { // 引导进路跳过
|
if (route.isGuide()) { // 引导进路跳过
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// 排除道岔默认单锁的进路
|
||||||
|
if (route.getSwitchList().stream().anyMatch(switchElement -> switchElement.getASwitch().isSingleLock())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (railway) {
|
if (railway) {
|
||||||
if (route.isPassRoute() || route.isLongShuntingRoute() ||
|
if (route.isPassRoute() || route.isLongShuntingRoute() ||
|
||||||
!(Route.Type.RECEIVING.equals(route.getType()) || Route.Type.DEPARTURE.equals(route.getType()))) {
|
!(Route.Type.RECEIVING.equals(route.getType()) || Route.Type.DEPARTURE.equals(route.getType()))) {
|
||||||
@ -84,10 +88,16 @@ public enum MapDeviceRule {
|
|||||||
SWITCH_LIST("道岔列表") {
|
SWITCH_LIST("道岔列表") {
|
||||||
@Override
|
@Override
|
||||||
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
public List<Switch> filterMapDeviceList(Simulation simulation) {
|
||||||
List<Station> stationList = STATION_LIST.filterMapDeviceList(simulation);
|
|
||||||
Station station = stationList.get(0);
|
|
||||||
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
|
List<Switch> switchList = simulation.getRepository().getSwitchList().stream()
|
||||||
.filter(aSwitch -> station.equals(aSwitch.getDeviceStation())).collect(Collectors.toList());
|
.filter(aSwitch -> {
|
||||||
|
if (aSwitch.getDeviceStation() != null && aSwitch.getDeviceStation().isDepot())
|
||||||
|
return false;
|
||||||
|
if (aSwitch.isSingleLock()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
aSwitch.setSingleLock(false);
|
||||||
|
return true;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
return generateRandomElement(switchList, 1);
|
return generateRandomElement(switchList, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user