fix: 导入配置后报错
This commit is contained in:
parent
f218dfc738
commit
74cb50bf62
@ -101,11 +101,8 @@ namespace IoTGateway.ViewModel.BasicData
|
|||||||
myMqttClient.StartClientAsync().Wait();
|
myMqttClient.StartClientAsync().Wait();
|
||||||
|
|
||||||
//重新启动采集
|
//重新启动采集
|
||||||
foreach (var device in devices.Where(x => x.DeviceTypeEnum == DeviceTypeEnum.Device && x.DriverId != null))
|
deviceService.CreateDeviceThreads();
|
||||||
{
|
|
||||||
device.Driver = _drivers.FirstOrDefault(x => x.ID == device.DriverId);
|
|
||||||
deviceService.CreateDeviceThread(device);
|
|
||||||
}
|
|
||||||
导入结果 =
|
导入结果 =
|
||||||
$"成功导入{devices.Count(x => x.DeviceTypeEnum == DeviceTypeEnum.Device)}个设备,{devices.Count(x => x.DeviceTypeEnum == DeviceTypeEnum.Group)}个组";
|
$"成功导入{devices.Count(x => x.DeviceTypeEnum == DeviceTypeEnum.Device)}个设备,{devices.Count(x => x.DeviceTypeEnum == DeviceTypeEnum.Group)}个组";
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,12 @@ namespace Plugin
|
|||||||
_myMqttClient = myMqttClient;
|
_myMqttClient = myMqttClient;
|
||||||
//_uAService = uAService;
|
//_uAService = uAService;
|
||||||
_mqttServer = mqttServer ?? throw new ArgumentNullException(nameof(mqttServer));
|
_mqttServer = mqttServer ?? throw new ArgumentNullException(nameof(mqttServer));
|
||||||
|
|
||||||
|
CreateDeviceThreads();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateDeviceThreads()
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var dc = new DataContext(_connnectSetting, _dbType))
|
using (var dc = new DataContext(_connnectSetting, _dbType))
|
||||||
|
Loading…
Reference in New Issue
Block a user