diff --git a/src/ThingsGateway.Web.Foundation/Wokers/Collect/CollectDeviceCore.cs b/src/ThingsGateway.Web.Foundation/Wokers/Collect/CollectDeviceCore.cs index ec73f9e66..54ac089e3 100644 --- a/src/ThingsGateway.Web.Foundation/Wokers/Collect/CollectDeviceCore.cs +++ b/src/ThingsGateway.Web.Foundation/Wokers/Collect/CollectDeviceCore.cs @@ -212,6 +212,8 @@ public class CollectDeviceCore : DisposableObject if (_driver != null) { InitDriver(client); + Device.SourceVariableNum = DeviceVariableSourceReads.Count; + Device.MethodVariableNum = DeviceVariableMedReads.Count; } else { @@ -227,8 +229,7 @@ public class CollectDeviceCore : DisposableObject Device.ActiveTime = DateTime.UtcNow; await _driver?.BeforStartAsync(); } - Device.SourceVariableNum = DeviceVariableSourceReads.Count; - Device.MethodVariableNum = DeviceVariableMedReads.Count; + } catch (Exception ex) {