|
|
@@ -64,6 +64,7 @@ namespace TeamAAS_VP.Core
|
|
|
ICameraService _cameraService;
|
|
|
IFeederService _feederService;
|
|
|
IPlcService _plcService;
|
|
|
+ ILightManagerService _lightManagerService;
|
|
|
IProductService _productService;
|
|
|
ICalibrationService _calibrationService;
|
|
|
IRemoteCommandService _remoteCommandService;
|
|
|
@@ -168,7 +169,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
public Management(IRegionManager regionManager, IEventAggregator ea, IContainerProvider container, IConfigService configService,
|
|
|
IRobotService robotService, ICameraService cameraService, IFeederService feederService, IPlcService plcService, IProductService productService,
|
|
|
- ICalibrationService calibrationService, IRemoteCommandService remoteCommandService, ISystemDatabaseService systemDatabaseService)
|
|
|
+ ICalibrationService calibrationService, IRemoteCommandService remoteCommandService, ISystemDatabaseService systemDatabaseService, ILightManagerService lightManagerService)
|
|
|
{
|
|
|
_regionManager = regionManager;
|
|
|
_eventAggregator = ea;
|
|
|
@@ -185,6 +186,7 @@ namespace TeamAAS_VP.Core
|
|
|
_productService = productService;
|
|
|
_remoteCommandService = remoteCommandService;
|
|
|
_systemDatabaseService = systemDatabaseService;
|
|
|
+ _lightManagerService = lightManagerService;
|
|
|
}
|
|
|
|
|
|
#region 初始化硬件模块
|
|
|
@@ -354,6 +356,52 @@ namespace TeamAAS_VP.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 初始化光源控制器
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<(bool IsSucceed, string Msg)> InitLightControllers()
|
|
|
+ {
|
|
|
+ var lightcontrollers = _configService.GetAllLightControllers();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ foreach (var item in lightcontrollers)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var lishtCtr= await _lightManagerService.RegisterControllerAsync(item.Id, item);
|
|
|
+ //var lightcontroller = _cameraService.GetLightController(item.Id);
|
|
|
+ //await lightcontroller.ConnectAsync(); //连接光源控制器
|
|
|
+ //SendTaskMessage($"{item.LightControllerName}{Lang.已连接}!", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ //sb.AppendLine($"{item.LightControllerName}:{Lang.断开连接}![{ex.Message}]");
|
|
|
+ //SendTaskMessage($"{item.LightControllerName}{Lang.断开连接}!", MessageLevel.Alarm);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lightcontrollers.Count>0)
|
|
|
+ {
|
|
|
+ var result=await _lightManagerService.ConnectAllAsync();
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ return (true, "");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return (false, "Light Controller Connect Failed!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return (true, "");
|
|
|
+ //if (sb.Length == 0)
|
|
|
+ //{
|
|
|
+ // return (true, "");
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // return (false, sb.ToString());
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 初始化后台TCP服务器通讯
|
|
|
/// </summary>
|