| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 | 
							- using System.Collections.Generic;
 
- using System.Linq;
 
- using Aitex.Core.RT.Routine;
 
- using MECF.Framework.Common.Equipment;
 
- using Venus_Core;
 
- namespace Venus_RT.Modules
 
- {
 
-     public class EntityTaskBase
 
-     {
 
-         protected Queue<IRoutine> QueueRoutine
 
-         {
 
-             get { return _routine; }
 
-         }
 
-         private Queue<IRoutine> _routine = new Queue<IRoutine>();
 
-         public RState Start(IRoutine routine)
 
-         {
 
-             QueueRoutine.Clear();
 
-             QueueRoutine.Enqueue(routine);
 
-             return QueueRoutine.Peek().Start();
 
-         }
 
-         public RState TaskStart()
 
-         {
 
-             if (_routine.Count == 0)
 
-                 return RState.End;
 
-             RState ret = RState.End;
 
-             var lst = _routine.ToList();
 
-             for (int i = 0; i < lst.Count; i++)
 
-             {
 
-                 ret = lst[i].Start();
 
-                 if (ret == RState.End)
 
-                 {
 
-                     _routine.Dequeue();
 
-                     continue;
 
-                 }
 
-                 else
 
-                 {
 
-                     break;
 
-                 }
 
-             }
 
-             return RState.Running;
 
-         }
 
-         public RState TaskMonitor()
 
-         {
 
-             if (_routine.Count == 0)
 
-                 return RState.End;
 
-             IRoutine routine = _routine.Peek();
 
-             RState ret = routine.Monitor();
 
-             if (ret == RState.End)
 
-             {
 
-                 _routine.Dequeue();
 
-                 var lst = _routine.ToList();
 
-                 for (int i = 0; i < lst.Count; i++)
 
-                 {
 
-                     ret = lst[i].Start();
 
-                     if (ret == RState.End)
 
-                     {
 
-                         _routine.Dequeue();
 
-                         continue;
 
-                     }
 
-                     else
 
-                     {
 
-                         break;
 
-                     }
 
-                 }
 
-             }
 
-             return ret;
 
-         }
 
-         public void Abort()
 
-         {
 
-             if (_routine != null)
 
-             {
 
-                 _routine.Peek().Abort();
 
-                 _routine.Clear();
 
-             }
 
-         }
 
-     }
 
- }
 
- namespace Venus_RT
 
- {
 
-     abstract class ActionBase
 
-     {
 
-         private static ushort _id = 100;
 
-         //---------------------------------Properties------------------------------------
 
-         // 
 
-         public ushort ID { get; }
 
-         public ModuleName Module { get; protected set; }
 
-         public virtual ActionStatus Status { get; set; }
 
-         public virtual bool IsReady { get; set; }
 
-         public bool IsBackground { get; set; }
 
-         //--------------------------------Constructor------------------------------------
 
-         // 
 
-         protected ActionBase(ModuleName mod)
 
-         {
 
-             this.ID = _id++;
 
-             this.Module = mod;
 
-             this.Status = ActionStatus.Pending;
 
-         }
 
-         public virtual void Execute()
 
-         {
 
-             this.Status = ActionStatus.SendCmd;
 
-         }
 
-         protected virtual void OnPreWork() {  }
 
-         public virtual void OnPostWork(string data = null) { }
 
-         public virtual void OnError(string data = null) { }
 
-     }
 
- }
 
 
  |