Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-01-26 18:39:22 +08:00
commit 927b5bb83c
4 changed files with 39 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.map.MapVO;
@ -144,6 +145,18 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
if (!planRunlevelService.isExisted(l)) { if (!planRunlevelService.isExisted(l)) {
Section startSection = (Section) deviceMap.get(l.getStartSectionCode()); Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
Section endSection = (Section) deviceMap.get(l.getEndSectionCode()); Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
if((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())){
Float distance;
try{
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
}catch (SimulationException e){
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
}
l.setDistance(distance);
l.generateDefaultRunLevel();
planRunlevelService.createUserRunlevel(l);
return;
}
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight()); Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
l.setDistance(distance); l.setDistance(distance);
l.generateDefaultRunLevel(); l.generateDefaultRunLevel();

View File

@ -18,6 +18,7 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -155,15 +156,32 @@ public interface GeneratorNew {
// 添加步骤 // 添加步骤
List<TrainingStepVO> steps = new ArrayList<>(stepList.size()); List<TrainingStepVO> steps = new ArrayList<>(stepList.size());
stepList.forEach(operateStepVO -> { stepList.forEach(operateStepVO -> {
TrainingStepVO stepVO = new TrainingStepVO(operateStepVO); TrainingStepVO stepVO = new TrainingStepVO(operateStepVO);
// if(StringUtils.hasText(stepVO.getCode()) && MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) { // if(StringUtils.hasText(stepVO.getCode()) && MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) {
// stepVO.setCode(((Route)mapDevice).getStart().getCode()); // stepVO.setCode(((Route)mapDevice).getStart().getCode());
// } // }
if (containPlaceholder(stepVO.getTip())) { if (containPlaceholder(stepVO.getTip())) {
stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap())); if (StringUtils.hasText(operateStepVO.getCodeType())) {
TrainingConsts.CodeType codeType = TrainingConsts.CodeType.valueOf(operateStepVO.getCodeType());
MapElement operSignal = null;
if (Objects.nonNull(codeType) && MapElement.DeviceType.ROUTE.equals(mapDevice.getDeviceType())) {
if (codeType == TrainingConsts.CodeType.START_SIGNAL) {
operSignal = ((Route) mapDevice).getStart();
} else if (codeType == TrainingConsts.CodeType.END_SIGNAL) {
operSignal = ((Route) mapDevice).getDestination();
} else if (codeType == TrainingConsts.CodeType.SIGNAL) {
operSignal = ((Route) mapDevice).getStart();
}
}
stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, Objects.isNull(operSignal) ? mapDevice : operSignal, simulation.getBuildParams().getMap()));
} else {
stepVO.setTip(replacePlaceholder(stepVO.getTip(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap()));
}
} }
if (containPlaceholder(stepVO.getVal())) { if (containPlaceholder(stepVO.getVal())) {
stepVO.setVal(replacePlaceholder(stepVO.getVal(), placeholderVOMap, mapDevice, simulation.getBuildParams().getMap())); stepVO.setVal(replacePlaceholder(stepVO.getVal(), placeholderVOMap,mapDevice, simulation.getBuildParams().getMap()));
} }
steps.add(stepVO); steps.add(stepVO);
}); });

View File

@ -76,8 +76,12 @@ public class SectionGeneratorNew implements GeneratorNew {
case Section_Fault_Unlock: case Section_Fault_Unlock:
// 设置区段故障锁闭这只是区故解的一种情况后面再补其他情况 // 设置区段故障锁闭这只是区故解的一种情况后面再补其他情况
section.setFaultLock(true); section.setFaultLock(true);
section.setRouteLock(true);
if (section.isShowLogic()) { if (section.isShowLogic()) {
section.getLogicList().forEach(s -> s.setFaultLock(true)); section.getLogicList().forEach(s -> {
s.setFaultLock(true);
s.setRouteLock(true);
});
} }
break; break;
case Section_Axis_Pre_Reset: case Section_Axis_Pre_Reset:

View File

@ -200,7 +200,7 @@ public class SignalGeneratorNew implements GeneratorNew {
signal.setBlockade(true); signal.setBlockade(true);
break; break;
} }
case Signal_Open_Auto_Setting: { case Signal_Open_Auto_Setting: {
// 查询进路列表背景为进路人工控 // 查询进路列表背景为进路人工控
if (!CollectionUtils.isEmpty(routeList)) { if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1 || operateDefinitionVO.onlyOperateSignal()) { if (routeLikeHa1 || operateDefinitionVO.onlyOperateSignal()) {