/// <summary> /// 停止服务 /// </summary> private void Stop() { FlowAdapter flowAdapter = _serviceProvider.GetRequiredService <FlowAdapter>(); flowAdapter.Stop(); FixedJobTask fixedJobTask = _serviceProvider.GetRequiredService <FixedJobTask>(); fixedJobTask.Stop(); }
/// <summary> /// 重置服务 /// </summary> private void Reset() { List <FlowDevice> devices = InitCache(); _logger.LogInformation((int)LogEvent.系统, "重置数据适配"); FlowAdapter flowAdapter = _serviceProvider.GetRequiredService <FlowAdapter>(); flowAdapter.Reset(devices); FlowBranchBlock flowBranchBlock = _serviceProvider.GetRequiredService <FlowBranchBlock>(); flowBranchBlock.Reset(devices); }
/// <summary> /// 初始化缓存 /// </summary> /// <param name="devices">设备集合</param> private void InitAdapter(List <FlowDevice> devices) { _logger.LogInformation((int)LogEvent.系统, "初始化数据适配"); DateTime minTime = TimePointConvert.CurrentTimePoint(BranchDbConvert.DateLevel, DateTime.Now); DateTime maxTime = TimePointConvert.NextTimePoint(BranchDbConvert.DateLevel, minTime); FlowAdapter flowAdapter = _serviceProvider.GetRequiredService <FlowAdapter>(); FlowBranchBlock flowBranchBlock = _serviceProvider.GetRequiredService <FlowBranchBlock>(); VideoBranchBlock videoBranchBlock = _serviceProvider.GetRequiredService <VideoBranchBlock>(); flowBranchBlock.Open(devices, minTime, maxTime); videoBranchBlock.Open(minTime, maxTime); flowAdapter.Start(devices, flowBranchBlock, videoBranchBlock); }