1
This commit is contained in:
@@ -8,6 +8,8 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.opc.Device;
|
||||
import org.nl.acs.opc.OpcItemDto;
|
||||
import org.nl.modules.udw.UnifiedDataAccessor;
|
||||
import org.nl.utils.RedisUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -74,7 +76,9 @@ public interface OpcDeviceDriver extends DeviceDriver {
|
||||
}
|
||||
|
||||
default Object getValue(String protocol) {
|
||||
return this.getOpcValueAccessor().getValue(this.getItem(protocol));
|
||||
// return this.getOpcValueAccessor().getValue(this.getItem(protocol));
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
return redisUtils.get(this.getItem(protocol));
|
||||
}
|
||||
|
||||
default String getItem(String item) {
|
||||
|
||||
@@ -6,6 +6,8 @@ import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.udw.UnifiedDataAccessor;
|
||||
import org.nl.modules.udw.UnifiedDataAccessorFactory;
|
||||
import org.nl.utils.RedisUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.openscada.opc.lib.da.Group;
|
||||
import org.openscada.opc.lib.da.Item;
|
||||
import org.openscada.opc.lib.da.ItemState;
|
||||
@@ -150,7 +152,10 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
item = (Item) var18.next();
|
||||
ItemState itemState = (ItemState) itemStatus.get(item);
|
||||
value = OpcUtl.getValue(item, itemState);
|
||||
his = accessor_value.getValue(item.getId());
|
||||
// his = accessor_value.getValue(item.getId());
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
his=redisUtils.get(item.getId());
|
||||
|
||||
if (!ObjectUtil.equal(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
||||
log.warn("opc 值不健康 item: {}, 状态: {}", item.getId(), itemState.getQuality());
|
||||
}
|
||||
@@ -173,7 +178,10 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
|
||||
}
|
||||
//设置值
|
||||
accessor_value.setValue(item.getId(), value);
|
||||
// accessor_value.setValue(item.getId(), value);
|
||||
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
|
||||
redisUtils.set(item.getId(), value);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user