public void Stop() { try { // 历史抽稀服务 if (this.pumpHisVacuate != null) { this.pumpHisVacuate.Stop(); this.pumpHisVacuate = null; TraceManagerForHisVacuate.AppendDebug("Pump历史抽稀服务停止成功"); } if (this.scadaHisVacuate != null) { this.scadaHisVacuate.Stop(); this.scadaHisVacuate = null; TraceManagerForHisVacuate.AppendDebug("Scada历史抽稀服务停止成功"); } IsRuning = false; } catch (Exception e) { TraceManagerForHisVacuate.AppendErrMsg("Scada历史抽稀服务停止异常" + e.Message + "堆栈:" + e.StackTrace); } }
public void Start(out string errMsg) { errMsg = ""; if (IsRuning) { return; } if (!Check(out errMsg)) { return; } try { if (config.ScadaIsNeedRun) { scadaHisVacuate = new ScadaHisVacuate(config.EndTime); scadaHisVacuate.Start(out errMsg); if (!scadaHisVacuate.IsRuning || !string.IsNullOrWhiteSpace(errMsg)) { TraceManagerForHisVacuate.AppendErrMsg("Scada历史抽稀服务启动失败:" + errMsg); Stop(); return; } TraceManagerForHisVacuate.AppendDebug("Scada历史抽稀服务启动成功"); } if (config.PumpIsNeedRun) { pumpHisVacuate = new PumpHisVacuate(config.EndTime); pumpHisVacuate.Start(out errMsg); if (!pumpHisVacuate.IsRuning || !string.IsNullOrWhiteSpace(errMsg)) { TraceManagerForHisVacuate.AppendErrMsg("Pump历史抽稀服务启动失败:" + errMsg); Stop(); return; } TraceManagerForHisVacuate.AppendDebug("Pump历史抽稀服务启动成功"); } } catch (Exception e) { TraceManagerForHisVacuate.AppendErrMsg("历史抽稀服务启动异常:" + e.Message + "堆栈:" + e.StackTrace); Stop(); return; } IsRuning = true; }
public void Excute() { string sql = @"merge into SCADA_SensorDayHistory as t using (select * from( select row_number() over(partition by SensorID order by PT asc) nRow ,* from SCADA_SensorHistory s1 where s1.PT >cast(convert(varchar(10),getdate(),120)+' 00:00:00' as datetime)) s2 where s2.nRow=1) as s on t.PT >cast(convert(varchar(10),getdate(),120)+' 00:00:00' as datetime) and t.SensorID=s.SensorID when not matched then insert values (s.SensorID,s.PV,s.PT,s.Date);"; DBUtil.ExecuteNonQuery(sql, out string err); if (!string.IsNullOrWhiteSpace(err)) { TraceManagerForHisVacuate.AppendWarning("Scada天表缓存任务执行失败:" + err); } else { TraceManagerForHisVacuate.AppendInfo("Scada天表缓存任务执行成功"); } }
public void Start(out string errMsg) { // 子服务启动失败,应该不影响其他子服务 errMsg = ""; try { // Pump-OPC通信子服务 if (Config.configInfo.confSonOPCPumpDataService != null && Config.configInfo.confSonOPCPumpDataService.IsNeedRun) { opcPumpService = new OPCPumpService(Config.configInfo.confSonOPCPumpDataService); opcPumpService.Start(out errMsg); if (opcPumpService.IsRuning) { TraceManagerForOPC.AppendInfo("Pump-OPC通信子服务已经启动"); } else { errMsg = "Pump-OPC通信子服务启动失败:" + errMsg; TraceManagerForOPC.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForOPC.AppendErrMsg("Pump-OPC通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // Scada-OPC通信子服务 if (Config.configInfo.confSonOPCScadaDataService != null && Config.configInfo.confSonOPCScadaDataService.IsNeedRun) { opcScadaService = new OPCScadaService(Config.configInfo.confSonOPCScadaDataService); opcScadaService.Start(out errMsg); if (opcScadaService.IsRuning) { TraceManagerForOPC.AppendInfo("Scada-OPC通信子服务已经启动"); } else { errMsg = "Scada-OPC通信子服务启动失败:" + errMsg; TraceManagerForOPC.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForOPC.AppendErrMsg("Scada-OPC通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 二供WEB-pump通信子服务 if (Config.configInfo.confSonWebPandaPumpDataService != null && Config.configInfo.confSonWebPandaPumpDataService.IsNeedRun) { webPandaPumpService = new WEBPandaPumpService(Config.configInfo.confSonWebPandaPumpDataService); webPandaPumpService.Start(out errMsg); if (webPandaPumpService.IsRuning) { TraceManagerForWeb.AppendInfo("二供WEB通信子服务已经启动"); } else { errMsg = "二供WEB通信子服务启动失败:" + errMsg; TraceManagerForWeb.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("二供WEB通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // WEB-pump-Scada 通信子服务 if (Config.configInfo.confSonWebPandaPumpScadaDataService != null && Config.configInfo.confSonWebPandaPumpScadaDataService.IsNeedRun) { webPandaPumpScadaService = new WEBPandaPumpSCADAService(Config.configInfo.confSonWebPandaPumpScadaDataService); webPandaPumpScadaService.Start(out errMsg); if (webPandaPumpScadaService.IsRuning) { TraceManagerForWeb.AppendInfo("WEB-pandaPump_Scada 通信子服务已经启动"); } else { errMsg = "WEB-pandaPump_Scada 通信子服务启动失败:" + errMsg; TraceManagerForWeb.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("WEB-pandaPump_Scada 通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // SACADA—WEB-监测点通信子服务 if (Config.configInfo.confSonWebPandaYLDataService != null && Config.configInfo.confSonWebPandaYLDataService.IsNeedRun) { webPandaYLScadaService = new WEBPandaYLSacdaService(Config.configInfo.confSonWebPandaYLDataService); webPandaYLScadaService.Start(out errMsg); if (webPandaYLScadaService.IsRuning) { TraceManagerForWeb.AppendInfo("SACADA—WEB-监测点通信子服务已经启动"); } else { errMsg = "SACADA—WEB-监测点通信子服务启动失败:" + errMsg; TraceManagerForWeb.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("SACADA—WEB-监测点通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // SACADA—WEB-综合测点通信子服务 if (Config.configInfo.confSonWebPandaZHCDDataService != null && Config.configInfo.confSonWebPandaZHCDDataService.IsNeedRun) { webPandaZHCDScadaServcice = new WEBPandaZHCDSacdaService(Config.configInfo.confSonWebPandaZHCDDataService); webPandaZHCDScadaServcice.Start(out errMsg); if (webPandaZHCDScadaServcice.IsRuning) { TraceManagerForWeb.AppendInfo("SACADA—WEB-综合测点通信子服务已经启动"); } else { errMsg = "SACADA—WEB-综合测点通信子服务启动失败:" + errMsg; TraceManagerForWeb.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("SACADA—WEB-综合测点通信子服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 二供报警服务 if (Config.configInfo.confSonCityIoTPumpAlarm != null && Config.configInfo.confSonCityIoTPumpAlarm.IsNeedRun) { pumpAlarmService = new PumpAlarmService(Config.configInfo.confSonCityIoTPumpAlarm); pumpAlarmService.Start(out errMsg); if (pumpAlarmService.IsRuning) { TraceManagerForPumpAlarm.AppendInfo("二供报警服务已经启动"); } else { errMsg = "二供报警服务启动失败:" + errMsg; TraceManagerForPumpAlarm.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForPumpAlarm.AppendErrMsg("二供报警服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 历史抽稀服务 if (Config.configInfo.confSonHisVacuateService != null && Config.configInfo.confSonHisVacuateService.IsNeedRun) { hisVacuate = new HisVacuate(Config.configInfo.confSonHisVacuateService); hisVacuate.Start(out errMsg); if (hisVacuate.IsRuning) { TraceManagerForHisVacuate.AppendInfo("历史抽稀服务已经启动"); } else { errMsg = "历史抽稀服务启动失败:" + errMsg; TraceManagerForHisVacuate.AppendErrMsg(errMsg); } } } catch (Exception e) { TraceManagerForHisVacuate.AppendErrMsg("历史抽稀服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 特殊项目子服务 if (Config.configInfo.confSonProjectDataService != null && Config.configInfo.confSonProjectDataService.IsNeedRun) { if (!Config.configInfo.confSonProjectDataService.EnvIsOkay) { TraceManagerForProject.AppendErrMsg("特殊项目动态库环境配置异常:" + Config.configInfo.confSonProjectDataService.ErrMsg); } else { caseManagerInjection = Interface.GetInjection(Config.configInfo.confSonProjectDataService.DllPath); caseManagerInjection.Start(out errMsg); if (caseManagerInjection.IsRuning) { TraceManagerForProject.AppendInfo(Config.configInfo.confSonProjectDataService.ProjectName + "服务已经启动"); } else { errMsg = Config.configInfo.confSonProjectDataService.ProjectName + "服务启动失败:" + errMsg; TraceManagerForProject.AppendErrMsg(errMsg); } } } } catch (Exception e) { TraceManagerForProject.AppendErrMsg(Config.configInfo.confSonProjectDataService.ProjectName + "服务启动失败:" + e.Message + "堆栈:" + e.StackTrace); } IsRuning = true; }
public void Stop() { try { // 特殊项目子服务 if (this.caseManagerInjection != null) { this.caseManagerInjection.Stop(); if (this.caseManagerInjection.IsRuning) { TraceManagerForProject.AppendErrMsg(Config.configInfo.confSonProjectDataService.ProjectName + "服务停止失败"); } else { TraceManagerForProject.AppendInfo(Config.configInfo.confSonProjectDataService.ProjectName + "服务已经全部停止"); } this.caseManagerInjection = null; } } catch (Exception e) { TraceManagerForProject.AppendErrMsg(Config.configInfo.confSonProjectDataService.ProjectName + "服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 历史抽稀服务 if (this.hisVacuate != null) { this.hisVacuate.Stop(); if (this.hisVacuate.IsRuning) { TraceManagerForHisVacuate.AppendErrMsg("历史抽稀服务停止失败"); } else { TraceManagerForHisVacuate.AppendInfo("历史抽稀服务已经全部停止"); } this.hisVacuate = null; } } catch (Exception e) { TraceManagerForHisVacuate.AppendErrMsg("历史抽稀服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 二供报警服务 if (this.pumpAlarmService != null) { this.pumpAlarmService.Stop(); if (this.pumpAlarmService.IsRuning) { TraceManagerForPumpAlarm.AppendErrMsg("二供报警服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("二供报警服务已经全部停止"); } this.pumpAlarmService = null; } } catch (Exception e) { TraceManagerForPumpAlarm.AppendErrMsg("二供报警服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // SACADA—WEB-综合测点通信子服务 if (this.webPandaZHCDScadaServcice != null) { this.webPandaZHCDScadaServcice.Stop(); if (this.webPandaZHCDScadaServcice.IsRuning) { TraceManagerForWeb.AppendErrMsg("SACADA-WEB-综合测点通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("SACADA—WEB-综合测点通信子服务已经全部停止"); } this.webPandaZHCDScadaServcice = null; } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("SACADA—WEB-综合测点通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // SACADA—WEB-监测点通信子服务 if (this.webPandaYLScadaService != null) { this.webPandaYLScadaService.Stop(); if (this.webPandaYLScadaService.IsRuning) { TraceManagerForWeb.AppendErrMsg("SACADA—WEB-监测点通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("SACADA—WEB-监测点通信子服务已经全部停止"); } this.webPandaYLScadaService = null; } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("SACADA—WEB-监测点通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // WEB-pandaPump_Scada 通信子服务 if (this.webPandaPumpScadaService != null) { this.webPandaPumpScadaService.Stop(); if (this.webPandaPumpScadaService.IsRuning) { TraceManagerForWeb.AppendErrMsg("二供WEB通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("二供WEB通信子服务已经全部停止"); } this.webPandaPumpScadaService = null; } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("二供WEB通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // 二供WEB通信子服务 if (this.webPandaPumpService != null) { this.webPandaPumpService.Stop(); if (this.webPandaPumpService.IsRuning) { TraceManagerForWeb.AppendErrMsg("二供WEB通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("二供WEB通信子服务已经全部停止"); } this.webPandaPumpService = null; } } catch (Exception e) { TraceManagerForWeb.AppendErrMsg("二供WEB通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // Scada-OPC通信子服务 if (this.opcScadaService != null) { this.opcScadaService.Stop(); if (this.opcScadaService.IsRuning) { TraceManagerForOPC.AppendErrMsg("Scada-OPC通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("Scada-OPC通信子服务已经全部停止"); } this.opcScadaService = null; } } catch (Exception e) { TraceManagerForOPC.AppendErrMsg("Scada-OPC通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } try { // Pump-OPC通信子服务 if (this.opcPumpService != null) { this.opcPumpService.Stop(); if (this.opcPumpService.IsRuning) { TraceManagerForOPC.AppendErrMsg("Pump-OPC通信子服务停止失败"); } else { TraceManagerForPumpAlarm.AppendInfo("Pump-OPC通信子服务已经全部停止"); } this.opcPumpService = null; } } catch (Exception e) { TraceManagerForOPC.AppendErrMsg("Pump-OPC通信子服务停止失败:" + e.Message + "堆栈:" + e.StackTrace); } IsRuning = false; }
public void Excute() { string sql = @"merge into PumpHisDayData as t using (select * from( select row_number() over(partition by BASEID order by TempTime asc) nRow ,* from PumpHisData s1 where s1.TempTime >cast(convert(varchar(10),getdate(),120)+' 00:00:00' as datetime)) s2 where s2.nRow=1) as s on t.TempTime >cast(convert(varchar(10),getdate(),120)+' 00:00:00' as datetime) and t.BASEID=s.BASEID when not matched then insert values ( s.[FCreateDate] ,s.[TempTime] ,s.[BASEID] ,s.[F40001] ,s.[F40002] ,s.[F40003] ,s.[F40004] ,s.[F40005] ,s.[F40006_0_0] ,s.[F40006_0_1] ,s.[F40006_0_2] ,s.[F40006_0_3] ,s.[F40006_0_4] ,s.[F40006_0_5] ,s.[F40006_0_6] ,s.[F40006_0_7] ,s.[F40006_1_0] ,s.[F40006_1_1] ,s.[F40006_1_2] ,s.[F40006_1_3] ,s.[F40006_1_4] ,s.[F40006_1_5] ,s.[F40006_1_6] ,s.[F40006_1_7] ,s.[F40007_0_0] ,s.[F40007_0_1] ,s.[F40007_0_2] ,s.[F40007_0_3] ,s.[F40007_0_4] ,s.[F40007_0_5] ,s.[F40007_0_6] ,s.[F40007_0_7] ,s.[F40007_1_0] ,s.[F40007_1_1] ,s.[F40007_1_2] ,s.[F40007_1_3] ,s.[F40007_1_4] ,s.[F40007_1_5] ,s.[F40007_1_6] ,s.[F40007_1_7] ,s.[F40008_0_0] ,s.[F40008_0_1] ,s.[F40008_0_2] ,s.[F40008_0_3] ,s.[F40008_0_4] ,s.[F40008_0_5] ,s.[F40008_0_6] ,s.[F40008_0_7] ,s.[F40008_1_0] ,s.[F40008_1_1] ,s.[F40008_1_2] ,s.[F40008_1_3] ,s.[F40008_1_4] ,s.[F40008_1_5] ,s.[F40008_1_6] ,s.[F40008_1_7] ,s.[F40009] ,s.[F40010] ,s.[F40011] ,s.[F40014] ,s.[F40015] ,s.[F40016] ,s.[F40017] ,s.[F40020] ,s.[F40021] ,s.[F40024] ,s.[F40025] ,s.[F40026] ,s.[F40027] ,s.[F40028] ,s.[F40029] ,s.[F40030] ,s.[F40031] ,s.[F40032] ,s.[F40033] ,s.[F40034] ,s.[F40035] ,s.[F40036] ,s.[F40037] ,s.[F40038] ,s.[F40039] ,s.[F40040] ,s.[F40041] ,s.[F40042] ,s.[F40043] ,s.[F40044] ,s.[F40045] ,s.[F40046] ,s.[F40047] ,s.[F40048] ,s.[F40049] ,s.[F40050] ,s.[F40051] ,s.[F40052] ,s.[F40053] ,s.[F40054] ,s.[F40055] ,s.[F40056] ,s.[F40057] ,s.[F40058] ,s.[F40059] ,s.[F40060] ,s.[F40061] ,s.[F40062] ,s.[F40063] ,s.[F40064] ,s.[F40065] ,s.[F40066] ,s.[F40067] ,s.[F40068] ,s.[F40069] ,s.[F40070] ,s.[F40071] ,s.[F40072] ,s.[F40073] ,s.[F40074] ,s.[F40075] ,s.[F40076] ,s.[F40077] ,s.[F40078] ,s.[F40079] ,s.[F40080] ,s.[F40081] ,s.[F40082] ,s.[F40083] ,s.[F40084] ,s.[F40085] ,s.[F40086] ,s.[F40087] ,s.[F40088] ,s.[F40089] ,s.[F40090] ,s.[F40091] ,s.[F40092] ,s.[F40093] ,s.[F40094] ,s.[F40095] ,s.[F40096] ,s.[F40097] ,s.[F40098] ,s.[F40099] ,s.[F40100] ,s.[F40101] ,s.[F40102] ,s.[F40103] ,s.[F40104] ,s.[F40105] ,s.[F40106] ,s.[F40107] ,s.[F40108] ,s.[F40109] ,s.[F40110] ,s.[F40111] ,s.[F40112] ,s.[F40113] ,s.[F40114] ,s.[F40115] ,s.[F40116] ,s.[F40117] ,s.[F40118] ,s.[F40119] ,s.[F40120] ,s.[F40121] ,s.[F40122] ,s.[F40123] ,s.[F40124] ,s.[F40125] ,s.[F40126] ,s.[F40127] ,s.[F40128] ,s.[F40129] ,s.[F40130] ,s.[F40131] ,s.[F40132] ,s.[F40133] ,s.[F40134] ,s.[F40135] ,s.[F40136] ,s.[F40137] ,s.[F40140] ,s.[F40141] ,s.[F40142] ,s.[F40143] ,s.[F40144] ,s.[F40145] ,s.[F40146] ,s.[F40147] ,s.[F40148] ,s.[F40149] ,s.[F40150] ,s.[F40250] ,s.[F40249] ,s.[F40248] ,s.[F40247] ,s.[F40246] ,s.[F40245] ,s.[F40244] ,s.[F40243] ,s.[F40242] ,s.[F40241] ,s.[F40240] ,s.[F40239] ,s.[F40238] ,s.[F40237] ,s.[F40236] ,s.[F40235] ,s.[F40234] ,s.[F40233] ,s.[F40232] ,s.[F40231] ,s.[F40230] ,s.[F40229] ,s.[F40228] ,s.[F40227] ,s.[F40226] ,s.[F40225] ,s.[F40224] ,s.[F40223] ,s.[F40222] ,s.[F40221] ,s.[F40220] ,s.[F40219] ,s.[F40218] ,s.[F40217] ,s.[F40216] ,s.[F40215] ,s.[F40214] ,s.[F40213] ,s.[F40212] ,s.[F40211] ,s.[F40210] ,s.[F40209] ,s.[F40208] ,s.[F40207] ,s.[F40206] ,s.[F40205] ,s.[F40204] ,s.[F40203] ,s.[F40202] ,s.[F40201] ,s.[F40200] ,s.[F40199_0_0] ,s.[F40199_0_1] ,s.[F40199_0_2] ,s.[F40199_0_3] ,s.[F40199_0_4] ,s.[F40199_0_5] ,s.[F40199_0_6] ,s.[F40199_0_7] ,s.[F40199_1_0] ,s.[F40199_1_1] ,s.[F40199_1_2] ,s.[F40199_1_3] ,s.[F40199_1_4] ,s.[F40199_1_5] ,s.[F40199_1_6] ,s.[F40199_1_7] );"; DBUtil.ExecuteNonQuery(sql, out string err); if (!string.IsNullOrWhiteSpace(err)) { TraceManagerForHisVacuate.AppendWarning("Pump天表缓存任务执行失败:" + err); } else { TraceManagerForHisVacuate.AppendInfo("Pump天表缓存任务执行成功"); } }