Пример #1
0
 private void ExcuteCommand(RequestCommand command)
 {
     if (command.sonServerType == CommandServerType.YL_WEB && command.operType == CommandOperType.ReLoadData)
     {
         if (ExcuteDoing) // 正在采集,等这次采集结束,在采集一次
         {
             DateTime time1 = DateTime.Now;
             while (true)
             {
                 Thread.Sleep(1);
                 if (DateTime.Now - time1 > TimeSpan.FromSeconds(command.timeoutSeconds)) // 超时
                 {
                     CommandManager.MakeTimeout("Scada-WEB-压力监测点 数据更新超时", ref command);
                     CommandManager.CompleteCommand(command);
                     TraceManagerForCommand.AppendInfo(command.message);
                     return;
                 }
                 if (!ExcuteDoing)
                 {
                     break;
                 }
             }
         }
         // 调取之前先重新加载一次缓存
         Excute();
         CommandManager.MakeSuccess("Scada-WEB-压力监测点 数据已更新", ref command);
         CommandManager.CompleteCommand(command);
         TraceManagerForCommand.AppendInfo("Scada-WEB-压力监测点 数据已更新");
         return;
     }
     CommandManager.MakeFail("错误的请求服务类型", ref command);
     CommandManager.CompleteCommand(command);
     TraceManagerForCommand.AppendErrMsg(command.message);
     return;
 }
Пример #2
0
 public void ExcuteReload()
 {
     try
     {
         if (!ExcuteReloadHandle(out string errMsg))
         {
             CommandManager.MakeFail(errMsg, ref requestCommand);
             CommandManager.CompleteCommand(requestCommand);
             TraceManagerForCommand.AppendWarning(requestCommand.message);
             return;
         }
         CommandManager.MakeSuccess("重载站点数据命令成功,SCADA-OPC数据已更新", ref requestCommand);
         CommandManager.CompleteCommand(requestCommand);
         TraceManagerForCommand.AppendInfo("重载站点数据命令成功,SCADA-OPC数据已更新");
     }
     catch (Exception e)
     {
         TraceManagerForOPC.AppendErrMsg("站点主动采集任务执行失败--" + e.Message + "堆栈:" + e.StackTrace);
         SendError("站点主动采集任务执行失败--" + e.Message);
     }
 }
Пример #3
0
 public void ExcuteWrite()
 {
     try
     {
         if (!ExcuteWriteHandle(out string errMsg, out string info))
         {
             CommandManager.MakeFail(errMsg, ref requestCommand);
             CommandManager.CompleteCommand(requestCommand);
             TraceManagerForCommand.AppendErrMsg(requestCommand.message);
             return;
         }
         CommandManager.MakeSuccess(info, ref requestCommand);
         CommandManager.CompleteCommand(requestCommand);
         TraceManagerForCommand.AppendInfo(info);
     }
     catch (Exception e)
     {
         TraceManagerForOPC.AppendErrMsg("站点写值任务执行失败--" + e.Message + "堆栈:" + e.StackTrace);
         SendError("站点写值任务执行失败--" + e.Message);
     }
 }