refactor:完成重构设备的添加,删除,更新。
This commit is contained in:
@@ -20,7 +20,7 @@ namespace DMS.Infrastructure.Services.S7
|
||||
private readonly IEventService _eventService;
|
||||
private readonly IDataProcessingService _dataProcessingService;
|
||||
private readonly IAppCenterService _appCenterService;
|
||||
private readonly IAppStorageService _appStorageService;
|
||||
private readonly IAppDataService _appDataService;
|
||||
private readonly IS7ServiceFactory _s7ServiceFactory;
|
||||
private readonly ConcurrentDictionary<int, S7DeviceContext> _deviceContexts;
|
||||
private readonly SemaphoreSlim _semaphore;
|
||||
@@ -31,7 +31,7 @@ namespace DMS.Infrastructure.Services.S7
|
||||
IEventService eventService,
|
||||
IDataProcessingService dataProcessingService,
|
||||
IAppCenterService appCenterService,
|
||||
IAppStorageService appStorageService,
|
||||
IAppDataService appStorageService,
|
||||
IS7ServiceFactory s7ServiceFactory)
|
||||
{
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
@@ -40,7 +40,7 @@ namespace DMS.Infrastructure.Services.S7
|
||||
= dataProcessingService ?? throw new ArgumentNullException(nameof(dataProcessingService));
|
||||
_appCenterService
|
||||
= appCenterService ?? throw new ArgumentNullException(nameof(appCenterService));
|
||||
_appStorageService = appStorageService;
|
||||
_appDataService = appStorageService;
|
||||
_s7ServiceFactory = s7ServiceFactory ?? throw new ArgumentNullException(nameof(s7ServiceFactory));
|
||||
_deviceContexts = new ConcurrentDictionary<int, S7DeviceContext>();
|
||||
_semaphore = new SemaphoreSlim(10, 10); // 默认最大并发连接数为10
|
||||
@@ -54,7 +54,7 @@ namespace DMS.Infrastructure.Services.S7
|
||||
// if (_deviceContexts.TryGetValue(e.DeviceId, out var s7DeviceContext))
|
||||
// {
|
||||
|
||||
// var variables = _appStorageService.Variables.Values.Where(v => e.VariableIds.Contains(v.Id))
|
||||
// var variables = _appDataService.Variables.Values.Where(v => e.VariableIds.Contains(v.Id))
|
||||
// .ToList();
|
||||
// foreach (var variable in variables)
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user