判断OPCUAServer状态时增加tryCatch
This commit is contained in:
@@ -409,13 +409,17 @@ public class CollectDeviceCore : DisposableObject
|
||||
}
|
||||
else if (deviceMedsVariableFailedNum != 0 || deviceSourceVariableFailedNum != 0)
|
||||
{
|
||||
if (_driver.IsConnected().IsSuccess)
|
||||
var oper = _driver.IsConnected();
|
||||
|
||||
if (oper.IsSuccess)
|
||||
{
|
||||
Device.DeviceStatus = DeviceStatusEnum.OnLineButNoInitialValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.DeviceStatus = DeviceStatusEnum.OffLine;
|
||||
Device.DeviceOffMsg = oper.Message;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -284,13 +284,15 @@ public class UploadDeviceCore : DisposableObject
|
||||
|
||||
if (StoppingToken.IsCancellationRequested)
|
||||
return ThreadRunReturn.Break;
|
||||
if (_driver.IsConnected().IsSuccess)
|
||||
var oper = _driver.IsConnected();
|
||||
if (oper.IsSuccess)
|
||||
{
|
||||
Device.DeviceStatus = DeviceStatusEnum.OnLine;
|
||||
}
|
||||
else
|
||||
{
|
||||
Device.DeviceStatus = (Device.DeviceStatus == DeviceStatusEnum.OnLine || Device.DeviceStatus == DeviceStatusEnum.OnLineButNoInitialValue) ? DeviceStatusEnum.OffLine : Device.DeviceStatus;
|
||||
Device.DeviceOffMsg = oper.Message;
|
||||
}
|
||||
return ThreadRunReturn.None;
|
||||
|
||||
|
Reference in New Issue
Block a user