|
|
@ -18,10 +18,12 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
|
List<OpcItemDto> protocols; |
|
|
|
OpcServerManageDto OpcServer; |
|
|
|
int error_num; |
|
|
|
int all_null; |
|
|
|
String message; |
|
|
|
|
|
|
|
public DeviceOpcProtocolRunable() { |
|
|
|
this.error_num = 0; |
|
|
|
this.all_null = 0; |
|
|
|
this.message = null; |
|
|
|
} |
|
|
|
|
|
|
@ -125,7 +127,7 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
|
} else { |
|
|
|
time_out = false; |
|
|
|
} |
|
|
|
|
|
|
|
boolean valueAllNotNull = false; |
|
|
|
Set<Item> items = itemStatus.keySet(); |
|
|
|
Iterator var18 = items.iterator(); |
|
|
|
|
|
|
@ -145,12 +147,38 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
|
this.error_num = 0; |
|
|
|
this.message = null; |
|
|
|
} |
|
|
|
if (!valueAllNotNull) { |
|
|
|
int random = (new Random()).nextInt(10) + 1; |
|
|
|
random *= 1000; |
|
|
|
if (this.all_null < 3) { |
|
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 5000 + random); |
|
|
|
ThreadUtl.sleep((long)(5000 + random)); |
|
|
|
} else if (this.all_null < 6) { |
|
|
|
log.warn("{} 所有内容都为空,暂定{}s", tag, 30000 + random); |
|
|
|
ThreadUtl.sleep((long)(30000 + random)); |
|
|
|
} else if (this.all_null < 12) { |
|
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, '\uea60' + random); |
|
|
|
ThreadUtl.sleep((long)('\uea60' + random)); |
|
|
|
} else { |
|
|
|
log.warn("{} 所有内容都为空,暂定{}ms", tag, 120000 + random); |
|
|
|
ThreadUtl.sleep((long)(120000 + random)); |
|
|
|
} |
|
|
|
|
|
|
|
++this.all_null; |
|
|
|
} else { |
|
|
|
this.all_null = 0; |
|
|
|
} |
|
|
|
continue label97; |
|
|
|
} |
|
|
|
|
|
|
|
item = (Item) var18.next(); |
|
|
|
ItemState itemState = (ItemState) itemStatus.get(item); |
|
|
|
value = OpcUtl.getValue(item, itemState); |
|
|
|
|
|
|
|
if (value != null) { |
|
|
|
valueAllNotNull = true; |
|
|
|
} |
|
|
|
|
|
|
|
his = accessor_value.getValue(item.getId()); |
|
|
|
if (!ObjectUtil.equal(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) { |
|
|
|
log.warn("opc 值不健康 item: {}, 状态: {}", item.getId(), itemState.getQuality()); |
|
|
@ -178,6 +206,8 @@ public class DeviceOpcProtocolRunable implements Runnable { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
System.out.println("opc线程停止。。。"); |
|
|
|
return; |
|
|
|
} catch (Exception var30) { |
|
|
|
if (!DeviceOpcSynchronizeAutoRun.isRun) { |
|
|
|
System.out.println("opc线程停止2。。。"); |
|
|
|