static QueryCacheDataToGateway()
 {
     _DeviceDefineService       = ServiceFactory.Create <IDeviceDefineService>();
     _PointDefineService        = ServiceFactory.Create <IAllSystemPointDefineService>();
     _NetworkModuleService      = ServiceFactory.Create <INetworkModuleService>();
     _ManualCrossControlService = ServiceFactory.Create <IManualCrossControlService>();
 }
 public RegionOutageConfigService(IRegionOutageConfigRepository _Repository,
                                  ILargeDataAnalysisConfigCacheService largeDataAnalysisConfigCacheService,
                                  IManualCrossControlService manualCrossControlService,
                                  IPointDefineCacheService pointDefineCacheService)
 {
     this._Repository = _Repository;
     this.largeDataAnalysisConfigCacheService = largeDataAnalysisConfigCacheService;
     this.manualCrossControlService           = manualCrossControlService;
     this.pointDefineCacheService             = pointDefineCacheService;
 }
 public LargedataAnalysisConfigService(ILargedataAnalysisConfigRepository _Repository,
                                       ISetAnalysisModelPointRecordRepository _AnalysisModelPointRecordRepository,
                                       IAnalysisTemplateRepository _AnalysisTemplateRepository,
                                       ISetAnalysisModelPointRecordService _AnalysisModelPointRecordService,
                                       ILargeDataAnalysisConfigCacheService _LargeDataAnalysisConfigCacheService,
                                       IAlarmNotificationPersonnelConfigService _AlarmNotificationPersonnelConfigService,
                                       IRegionOutageConfigService _RegionOutageConfigService,
                                       IPointDefineCacheService pointDefineCacheService,
                                       IAlarmHandleService alarmHandleService,
                                       IManualCrossControlService manualCrossControlService)
 {
     this._Repository = _Repository;
     this._AnalysisModelPointRecordRepository      = _AnalysisModelPointRecordRepository;
     this._AnalysisTemplateRepository              = _AnalysisTemplateRepository;
     this._AnalysisModelPointRecordService         = _AnalysisModelPointRecordService;
     this._LargeDataAnalysisConfigCacheService     = _LargeDataAnalysisConfigCacheService;
     this._AlarmNotificationPersonnelConfigService = _AlarmNotificationPersonnelConfigService;
     this._RegionOutageConfigService = _RegionOutageConfigService;
     this.pointDefineCacheService    = pointDefineCacheService;
     this.alarmHandleService         = alarmHandleService;
     this.manualCrossControlService  = manualCrossControlService;
 }
예제 #4
0
        private void OpenThreadToDoWork()
        {
            IManualCrossControlService manualCrossControlService = ServiceFactory.Create <IManualCrossControlService>();
            //数据分析线程
            var startDataAnalysisThread = new Thread(new ThreadStart(() =>
            {
                do
                {
                    try
                    {
                        StartDataAnalysis();//开始数据分析
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Error(string.Format("分析出现错误! 错误消息:{0}", ex.StackTrace));
                    }
                    finally
                    {
                        Thread.Sleep(5000);
                    }
                } while (IsRunning);
            }));

            startDataAnalysisThread.IsBackground = true;
            startDataAnalysisThread.Start();

            //分析结果处理线程
            var asyncAnalysisHandlerThread = new Thread(new ThreadStart(() =>
            {
                do
                {
                    var analysisConfigInfoList = AnalysisModelCache.Instance.Query();
                    for (int i = 0; IsRunning && null != analysisConfigInfoList && i < analysisConfigInfoList.Count; i++)
                    {
                        if (AnalysisReulstHandlerEvent != null)
                        {
                            try
                            {
                                AnalysisReulstHandlerEvent(new AnalysisChangedEventArgs()
                                {
                                    AnalysisConfig = analysisConfigInfoList[i]
                                });
                            }
                            catch (Exception ex)
                            {
                                LogHelper.Error(string.Format("处理分析模型:{0}的输出出错. 错误消息:{1}", analysisConfigInfoList[i].Name, ex.StackTrace));
                            }
                        }
                        Thread.Sleep(100);
                    }
                    try
                    {
                        //判断,如果分级报警交叉控制中存在已删除的模型,则解除控制  20180919
                        //删除已经结束的分级报警传感器  20180919
                        List <Jc_JcsdkzInfo> updatejckzinfos        = new List <Jc_JcsdkzInfo>();
                        List <Jc_JcsdkzInfo> manualCrossControlList = manualCrossControlService.GetAllManualCrossControl().Data.FindAll(a => a.Upflag != "0");
                        foreach (Jc_JcsdkzInfo manualCrossControl in manualCrossControlList)
                        {
                            bool isInanalysisConfigInfo = false;
                            if (analysisConfigInfoList.FindAll(a => a.Id == manualCrossControl.ZkPoint).Count > 0)
                            {
                                isInanalysisConfigInfo = true;
                            }
                            if (!isInanalysisConfigInfo)//如果模型已经删除,则解除传感器分级报警  20180919
                            {
                                manualCrossControl.Upflag = "0";
                                updatejckzinfos.Add(manualCrossControl);
                            }
                        }
                        if (updatejckzinfos.Count > 0)
                        {
                            ManualCrossControlsRequest updaterequest = new ManualCrossControlsRequest();
                            updaterequest.ManualCrossControlInfos    = updatejckzinfos;
                            manualCrossControlService.UpdateManualCrossControls(updaterequest);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    Thread.Sleep(500);
                } while (IsRunning);
            }));

            asyncAnalysisHandlerThread.IsBackground = true;
            asyncAnalysisHandlerThread.Start();
        }
 private ManualCrossControlCache()
 {
     manualCrossControlService = ServiceFactory.Create <IManualCrossControlService>();
 }