示例#1
0
        public void Start(out string errMsg)
        {
            errMsg = "";
            if (IsRuning)
            {
                return;
            }

            try
            {
                // Pump-OPC通信服务
                if (opcPumpService != null)
                {
                    opcPumpService.Stop();
                }
                opcPumpService = new OPCPumpService(Config.projectConfigPath);
                opcPumpService.Start(out errMsg);
                if (opcPumpService.IsRuning)
                {
                    TraceManagerForOPC.AppendDebug("Pump-OPC通信服务已经打开");
                }
                else
                {
                    errMsg = "Pump-OPC通信服务打开失败";
                    Stop();
                    return;
                }
            }
            catch (Exception e)
            {
                errMsg = e.Message;
                Stop();
                return;
            }
            IsRuning = true;
        }
示例#2
0
        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;
        }