public override void Start(out string errMsg) { errMsg = ""; if (IsRuning) { return; } WEBSoapCommand.CreateInitSensorRealData(param).Execute(); //初始化实时表 timer = new System.Timers.Timer(); timer.Interval = this.param.collectInterval * 1000; timer.Elapsed += (o, e) => { try { Excute(); } catch (Exception ee) { TraceManagerForProject.AppendErrMsg("WEB-SOAP-兴国定时任务执行失败:" + ee.Message); } }; timer.Enabled = true; // 控制器服务 if (commandCustomer != null) { commandCustomer.Stop(); } commandCustomer = new CommandConsumer(ConsumerCommand); commandCustomer.Start(); if (commandCustomer.IsRuning) { TraceManagerForProject.AppendDebug("WEB-SOAP-兴国控制器服务已经打开"); } else { TraceManagerForProject.AppendErrMsg("WEB-SOAP-兴国控制器服务打开失败"); Stop(); return; } IsRuning = true; // 开始异步执行一次-防止启动卡死 Action action = Excute; action.BeginInvoke(null, null); }
private void ExcuteHandle() { // 报警维护 WEBSoapCommand.CreateCollectAndSaveScadaSensors(param).Execute(); }