rev 更新驱动字符串读取

This commit is contained in:
USER-20220102CG\noblelift
2024-01-24 16:56:38 +08:00
parent f2fb475e2e
commit 686e3d33ae
3 changed files with 3 additions and 6 deletions

View File

@@ -190,7 +190,7 @@ public interface OpcDeviceDriver extends DeviceDriver {
* @return * @return
*/ */
default String getStringValue(String protocol) { default String getStringValue(String protocol) {
return this.getOpcValueAccessor().getValue(this.getItem(protocol)).toString(); return (String) this.getOpcValueAccessor().getValue(this.getItem(protocol));
} }
/** /**

View File

@@ -153,7 +153,7 @@ public class ItemProtocol {
} else { } else {
return value; return value;
} }
return "0"; return "";
} }
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {

View File

@@ -207,10 +207,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
if (!UnifiedDataAppService.isEquals(value, his)) { if (!UnifiedDataAppService.isEquals(value, his)) {
OpcItemDto itemDto = this.getItem(itemId); OpcItemDto itemDto = this.getItem(itemId);
if (true) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
}
if (!ObjectUtil.isEmpty(value)) { if (!ObjectUtil.isEmpty(value)) {
this.logItemChanged(itemId, accessor_value, value, itemDto);
accessor_value.setValue(itemId, value); accessor_value.setValue(itemId, value);
} }
} }
@@ -436,7 +434,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value())); String.valueOf(itemDto.getHis_item_value()), String.valueOf(itemDto.getItem_value()));
luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc()); luceneLogDto.setLogType(LogTypeEnum.DEVICE_LOG.getDesc());
log.info("{}", JSON.toJSONString(luceneLogDto)); log.info("{}", JSON.toJSONString(luceneLogDto));
} }
} else { } else {
if(his instanceof int[]){ if(his instanceof int[]){