调整
This commit is contained in:
parent
72c163b9a0
commit
cec85ded93
@ -94,14 +94,14 @@ public class InterLockData extends AbstractData {
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, axleCode);
|
||||
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||
} else if (builder instanceof Switch.Builder switchs) {
|
||||
MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
||||
this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
||||
// MessageOrBuilder section = LineGraphicDataRepository.getDeviceByCode(lineId, switchs.getId());
|
||||
// this.put(section, alertType, AlertDeviceType.DEVICE_TYPE_SWITCH, interlockArea, min, max, rtuId);
|
||||
//获取对应的道岔物理区段
|
||||
// String sectionCode = LineGraphicDataRepository.findSectionFromLogicCode(lineId, switchs.getId());
|
||||
// if (StringUtils.isNotEmpty(sectionCode)) {
|
||||
// MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||
// this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||
// }
|
||||
String sectionCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineId, switchs.getId());
|
||||
if (StringUtils.isNotEmpty(sectionCode)) {
|
||||
MessageOrBuilder switchSection = LineGraphicDataRepository.getDeviceByCode(lineId, sectionCode);
|
||||
this.put(switchSection, alertType, AlertDeviceType.DEVICE_TYPE_TRACK, interlockArea, min, max, rtuId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,22 +115,23 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
List<TrackOccupiedStatus> warnResultList = Lists.newArrayList();
|
||||
for (Integer deviceLayoutId : deviceLayoutIds) {
|
||||
MessageOrBuilder mb = LineGraphicDataRepository.getDeviceByCode(lineIdInt, deviceLayoutId.toString());
|
||||
if (mb instanceof Section section) {
|
||||
/* if (mb instanceof Section section) {
|
||||
boolean result = this.checkTrackOccupiedSectionStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
||||
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
||||
} else if (mb instanceof Turnout turnout) {
|
||||
String dgCode = LineGraphicDataRepository.findTurnoutSectionFromTurnoutCode(lineIdInt, turnout.getCode());
|
||||
boolean result = this.checkTrackOccupiedTurnoutStatus(alertType, turnout, deviceStatusData, trainDataSource);
|
||||
warnResultList.add(new TrackOccupiedStatus(dgCode, result, turnout.getCommon().getId()));
|
||||
}
|
||||
/*if (mb instanceof Section section) {
|
||||
}*/
|
||||
if (mb instanceof Section section) {
|
||||
boolean result = this.checkTrackOccupiedStatus(alertType, section, lineIdInt, deviceStatusData, trainDataSource);
|
||||
warnResultList.add(new TrackOccupiedStatus(section.getCode(), result, section.getCommon().getId()));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return warnResultList;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private boolean checkTrackOccupiedTurnoutStatus(AlertType alertType, Turnout turnout, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||
|
||||
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||
@ -148,6 +149,7 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private boolean checkTrackOccupiedSectionStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||
List<Boolean> alertList = Lists.newArrayList();
|
||||
if (section.getSectionType() == SectionType.Physical) {
|
||||
@ -170,30 +172,14 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
}/* else if (section.getSectionType() == SectionType.TurnoutPhysical) {
|
||||
Integer turnoutId = section.getChildren(0);
|
||||
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, turnoutId.toString(), Turnout.class);
|
||||
|
||||
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
|
||||
if (deviceStatus instanceof Switch.Builder switchBuild) {
|
||||
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
|
||||
if (alertType == AlertType.AXLE_LED_RED) {
|
||||
alertList.add(ledRed);
|
||||
} else {
|
||||
alertList.add(orange);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
if (CollectionUtils.isEmpty(alertList)) {
|
||||
return false;
|
||||
}
|
||||
return alertList.stream().allMatch(d -> d);
|
||||
}
|
||||
|
||||
/* @Deprecated
|
||||
|
||||
private boolean checkTrackOccupiedStatus(AlertType alertType, Section section, Integer lineId, DeviceStatusData deviceStatusData, TrainDataSource trainDataSource) {
|
||||
List<Boolean> alertList = Lists.newArrayList();
|
||||
if (section.getSectionType() == SectionType.Physical) {
|
||||
@ -217,27 +203,28 @@ public class AxleLedInterlockTask implements AlertMonitoringTask {
|
||||
}
|
||||
}
|
||||
} else if (section.getSectionType() == SectionType.TurnoutPhysical) {
|
||||
Integer turnoutId = section.getChildren(0);
|
||||
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, turnoutId.toString(), Turnout.class);
|
||||
|
||||
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
|
||||
if (deviceStatus instanceof Switch.Builder switchBuild) {
|
||||
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
|
||||
if (alertType == AlertType.AXLE_LED_RED) {
|
||||
alertList.add(ledRed);
|
||||
} else {
|
||||
alertList.add(orange);
|
||||
List<Boolean> turnoutOccLList = Lists.newArrayListWithCapacity(section.getChildrenList().size());
|
||||
for (Integer refTuronoutId : section.getChildrenList()) {
|
||||
Turnout turnout = LineGraphicDataRepository.getDeviceByCode(lineId, refTuronoutId.toString(), Turnout.class);
|
||||
MessageOrBuilder deviceStatus = deviceStatusData.getDeviceBuild(Switch.getDescriptor().getName(), turnout.getCode());
|
||||
String trainGroupId = trainDataSource.findTrainForDeviceName(section.getCode());
|
||||
if (deviceStatus instanceof Switch.Builder switchBuild) {
|
||||
boolean ledRed = switchBuild.getIpSingleSwitchStusCiOccupied() && !switchBuild.getIpSingleSwitchStusCbtcOccupied() && Objects.isNull(trainGroupId);
|
||||
boolean orange = switchBuild.getIpSingleSwitchStusAtcInvalid();
|
||||
if (alertType == AlertType.AXLE_LED_RED) {
|
||||
turnoutOccLList.add(ledRed);
|
||||
} else {
|
||||
turnoutOccLList.add(orange);
|
||||
}
|
||||
}
|
||||
}
|
||||
alertList.add(turnoutOccLList.stream().anyMatch(d -> d));
|
||||
}
|
||||
if (CollectionUtils.isEmpty(alertList)) {
|
||||
return false;
|
||||
}
|
||||
return alertList.stream().allMatch(d -> d);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
|
Loading…
Reference in New Issue
Block a user