开关机功能增加设备参数校验

This commit is contained in:
zq
2026-01-08 17:16:24 +08:00
parent 1eee07e040
commit 31fe793e97

View File

@ -10,6 +10,7 @@ import com.xzzn.common.core.modbus.domain.DeviceConfig;
import com.xzzn.common.core.modbus.domain.WriteTagConfig; import com.xzzn.common.core.modbus.domain.WriteTagConfig;
import com.xzzn.common.core.redis.RedisCache; import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.DeviceCategory; import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.common.enums.DeviceType;
import com.xzzn.common.enums.PointType; import com.xzzn.common.enums.PointType;
import com.xzzn.common.enums.SiteEnum; import com.xzzn.common.enums.SiteEnum;
import com.xzzn.common.enums.WorkStatus; import com.xzzn.common.enums.WorkStatus;
@ -523,6 +524,14 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
if (device == null) { if (device == null) {
throw new ServiceException("未找到对应设备配置信息"); throw new ServiceException("未找到对应设备配置信息");
} }
if (DeviceType.TCP.name().equals(device.getDeviceType())) {
if (device.getSlaveId() == null) {
throw new ServiceException("设备未配置从站地址");
}
if (device.getIpPort() == null) {
throw new ServiceException("设备未配置端口号");
}
}
// 查询设备的开关机配置 // 查询设备的开关机配置
EmsPcsSetting pcsSetting = emsPcsSettingMapper.selectEmsPcsSettingByDeviceId(device.getId()); EmsPcsSetting pcsSetting = emsPcsSettingMapper.selectEmsPcsSettingByDeviceId(device.getId());
if (pcsSetting == null) { if (pcsSetting == null) {