|
@ -115,6 +115,7 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
log.info("label97_123"); |
|
|
log.info("label97_123"); |
|
|
long begin = System.currentTimeMillis(); |
|
|
long begin = System.currentTimeMillis(); |
|
|
Map<Item, ItemState> itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0])); |
|
|
Map<Item, ItemState> itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0])); |
|
|
|
|
|
log.info("{}读取到的itemStatus结果为:", itemStatus); |
|
|
long end = System.currentTimeMillis(); |
|
|
long end = System.currentTimeMillis(); |
|
|
log.info("{} 开始记时{}", tag, DateUtil.now()); |
|
|
log.info("{} 开始记时{}", tag, DateUtil.now()); |
|
|
long duration = end - begin; |
|
|
long duration = end - begin; |
|
@ -130,6 +131,7 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
} |
|
|
} |
|
|
boolean valueAllNotNull = false; |
|
|
boolean valueAllNotNull = false; |
|
|
Set<Item> items = itemStatus.keySet(); |
|
|
Set<Item> items = itemStatus.keySet(); |
|
|
|
|
|
log.info("items值为:", items); |
|
|
Iterator var18 = items.iterator(); |
|
|
Iterator var18 = items.iterator(); |
|
|
|
|
|
|
|
|
while (true) { |
|
|
while (true) { |
|
@ -153,16 +155,16 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
random *= 1000; |
|
|
random *= 1000; |
|
|
if (this.all_null < 3) { |
|
|
if (this.all_null < 3) { |
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 5000 + random); |
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 5000 + random); |
|
|
ThreadUtl.sleep((long)(5000 + random)); |
|
|
ThreadUtl.sleep((long) (5000 + random)); |
|
|
} else if (this.all_null < 6) { |
|
|
} else if (this.all_null < 6) { |
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 30000 + random); |
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 30000 + random); |
|
|
ThreadUtl.sleep((long)(30000 + random)); |
|
|
ThreadUtl.sleep((long) (30000 + random)); |
|
|
} else if (this.all_null < 12) { |
|
|
} else if (this.all_null < 12) { |
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, '\uea60' + random); |
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, '\uea60' + random); |
|
|
ThreadUtl.sleep((long)('\uea60' + random)); |
|
|
ThreadUtl.sleep((long) ('\uea60' + random)); |
|
|
} else { |
|
|
} else { |
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, 120000 + random); |
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, 120000 + random); |
|
|
ThreadUtl.sleep((long)(120000 + random)); |
|
|
ThreadUtl.sleep((long) (120000 + random)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
++this.all_null; |
|
|
++this.all_null; |
|
@ -174,14 +176,17 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
} |
|
|
} |
|
|
log.info("label97A----"); |
|
|
log.info("label97A----"); |
|
|
item = (Item) var18.next(); |
|
|
item = (Item) var18.next(); |
|
|
|
|
|
log.info("读取到item:{}", item); |
|
|
ItemState itemState = (ItemState) itemStatus.get(item); |
|
|
ItemState itemState = (ItemState) itemStatus.get(item); |
|
|
|
|
|
log.info("读取到itemState:{}", itemState); |
|
|
|
|
|
log.info("开始根据item,itemState读取信号值:{},{}", item, itemState); |
|
|
value = OpcUtl.getValue(item, itemState); |
|
|
value = OpcUtl.getValue(item, itemState); |
|
|
|
|
|
log.info("根据item,itemState读取到信号值为:{}", value); |
|
|
if (value != null) { |
|
|
if (value != null) { |
|
|
valueAllNotNull = true; |
|
|
valueAllNotNull = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
his = accessor_value.getValue(item.getId()); |
|
|
his = accessor_value.getValue(item.getId()); |
|
|
|
|
|
log.info("读取到旧的信号值:{}", his); |
|
|
if (!ObjectUtil.equal(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) { |
|
|
if (!ObjectUtil.equal(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) { |
|
|
log.warn("opc 值不健康 item: {}, 状态: {}", item.getId(), itemState.getQuality()); |
|
|
log.warn("opc 值不健康 item: {}, 状态: {}", item.getId(), itemState.getQuality()); |
|
|
} |
|
|
} |
|
|