Browse Source

采加热区状态判空

master
王梦远 2 months ago
parent
commit
9014d7a359
  1. 31
      src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java

31
src/main/java/com/iflytop/sgs/app/service/device/DeviceSensorService.java

@ -34,7 +34,9 @@ public class DeviceSensorService {
}; };
return deviceStatusService.getInputState(deviceSensorCode.name()); return deviceStatusService.getInputState(deviceSensorCode.name());
} else { } else {
if(heatModuleCode.equals(HeatModuleCode.heat_module_04)){return false;}
if (heatModuleCode.equals(HeatModuleCode.heat_module_04)) {
return false;
}
return true; return true;
} }
@ -107,32 +109,59 @@ public class DeviceSensorService {
*/ */
public void collectSensorState() throws HardwareException { public void collectSensorState() throws HardwareException {
HeatModuleState heat_module_01 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_01); HeatModuleState heat_module_01 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_01);
if (heat_module_01 != null) {
heat_module_01.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_1_EXIST)); heat_module_01.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_1_EXIST));
}else{
log.error("Heat module 01 not found");
}
HeatModuleState heat_module_02 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_02); HeatModuleState heat_module_02 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_02);
if (heat_module_02 != null) {
heat_module_02.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_2_EXIST)); heat_module_02.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_2_EXIST));
}else{
log.error("Heat module 02 not found");
}
HeatModuleState heat_module_03 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_03); HeatModuleState heat_module_03 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_03);
if (heat_module_03 != null) {
heat_module_03.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_3_EXIST)); heat_module_03.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_3_EXIST));
}else{
log.error("Heat module 03 not found");
}
HeatModuleState heat_module_04 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_04); HeatModuleState heat_module_04 = deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_04);
if (heat_module_04 != null) {
heat_module_04.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_4_EXIST)); heat_module_04.setTrayStatus(this.getSensorStatus(DeviceSensorCode.HEATER_TRAY_4_EXIST));
}else{
log.error("Heat module 04 not found");
}
SolutionModuleState solutionModuleState = deviceStateService.getDeviceState().getSolutionModule(); SolutionModuleState solutionModuleState = deviceStateService.getDeviceState().getSolutionModule();
if (solutionModuleState != null) {
solutionModuleState.setFeedAreaTrayStatus(this.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST)); solutionModuleState.setFeedAreaTrayStatus(this.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST));
}
SolutionContainerState container_01 = solutionModuleState.getContainerStateByCode(ContainerCode.container_01); SolutionContainerState container_01 = solutionModuleState.getContainerStateByCode(ContainerCode.container_01);
if (container_01 != null) {
container_01.setEmpty(this.getSensorStatus(DeviceSensorCode.THIN_LOW_LEVEL)); container_01.setEmpty(this.getSensorStatus(DeviceSensorCode.THIN_LOW_LEVEL));
}
SolutionContainerState container_02 = solutionModuleState.getContainerStateByCode(ContainerCode.container_02); SolutionContainerState container_02 = solutionModuleState.getContainerStateByCode(ContainerCode.container_02);
if (container_02 != null) {
container_02.setEmpty(this.getSensorStatus(DeviceSensorCode.THICK_LOW_LEVEL)); container_02.setEmpty(this.getSensorStatus(DeviceSensorCode.THICK_LOW_LEVEL));
}
SolutionContainerState container_03 = solutionModuleState.getContainerStateByCode(ContainerCode.container_03); SolutionContainerState container_03 = solutionModuleState.getContainerStateByCode(ContainerCode.container_03);
if (container_03 != null) {
container_03.setEmpty(this.getSensorStatus(DeviceSensorCode.WATER_LOW_LEVEL)); container_03.setEmpty(this.getSensorStatus(DeviceSensorCode.WATER_LOW_LEVEL));
}
SolutionContainerState container_04 = solutionModuleState.getContainerStateByCode(ContainerCode.container_04); SolutionContainerState container_04 = solutionModuleState.getContainerStateByCode(ContainerCode.container_04);
if (container_04 != null) {
container_04.setFull(this.getSensorStatus(DeviceSensorCode.WASTE_HIGH_LEVEL)); container_04.setFull(this.getSensorStatus(DeviceSensorCode.WASTE_HIGH_LEVEL));
}
} }

Loading…
Cancel
Save