Exemple #1
0
 // 调度过来的命令
 public void ReceiveCommand(RequestCommand command)
 {
     // TraceManagerForOPC.AppendInfo("SCADA-OPC子服务当前任务条目数:" + this.queue.Count.ToString());
     //写值操作
     if (command.sonServerType == CommandServerType.SCADA_OPC && command.operType == CommandOperType.Write)
     {
         TakeOutCollectCommand();
         this.Append(StationCommand.CreateWriteCommand(this.opcClientManager, command));
         //命令记录
         TraceManagerForCommand.AppendDebug(string.Format("命令ID:{0}开始执行SensorID:{1},设定值{2}操作", command.ID, command.sensorID, command.value));
         return;
     }
     // OPC_Pump--重载请求
     if (command.sonServerType == CommandServerType.SCADA_OPC && command.operType == CommandOperType.ReLoadData)
     {
         TakeOutCollectCommand();
         this.Append(StationCommand.CreateReloadCommand(this.opcClientManager, command));
         //命令记录
         TraceManagerForCommand.AppendDebug(string.Format("命令ID:{0}开始执行SCADA-OPC重载站点数据操作:", command.ID));
         return;
     }
     // 错误请求
     CommandManager.MakeFail("错误的请求类型", ref command);
     CommandManager.CompleteCommand(command);
     TraceManagerForCommand.AppendErrMsg(command.message);
     return;
 }
Exemple #2
0
 public void Append(StationCommand command)
 {
     if (!IsRuning)
     {
         return;
     }
     if (queue.IsAddingCompleted)
     {
         return;
     }
     if (queue.Count > 4096)
     {
         TraceManagerForOPC.AppendErrMsg("SCADA-命令消费队列到达上限无法插入");
         return;
     }
     queue.Add(command);
 }
Exemple #3
0
 // 命令消费-设定超时功能
 private void Excute(StationCommand command)
 {
     command.Excute();
 }
Exemple #4
0
 // 定时的执行体
 private void Excute()
 {
     this.stationCommandConsumer.Append(StationCommand.CreateCollectCommand(this.opcClientManager));
 }