| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.Linq;
 
- using WCS.Entity;
 
- namespace WCS.Core
 
- {
 
-     public abstract class EntityEx<T>
 
-     {
 
-         public T Entity
 
-         {
 
-             get; private set;
 
-         }
 
-         /// <summary>
 
-         /// 执行中的设备
 
-         /// </summary>
 
-         public static List<string> ExDevice { get; set; } = new List<string>();
 
-         /// <summary>
 
-         /// 操作锁
 
-         /// </summary>
 
-         private static readonly object Operateobj = new object();
 
-         /// <summary>
 
-         /// 操作进行种的设备
 
-         /// </summary>
 
-         /// <param name="e"></param>
 
-         public static void OperateExDevice(string e)
 
-         {
 
-             lock (Operateobj)
 
-             {
 
-                 if (ExDevice.Any(v => v == e))
 
-                 {
 
-                     ExDevice.Remove(e);
 
-                 }
 
-                 else
 
-                 {
 
-                     ExDevice.Add(e);
 
-                 }
 
-             }
 
-         }
 
-         public EntityEx(T entity)
 
-         {
 
-             this.Entity = entity;
 
-         }
 
-         public virtual DateTime UpdateTime { get; set; }
 
-         public double Times
 
-         {
 
-             get
 
-             {
 
-                 return (DateTime.Now - UpdateTime).TotalMilliseconds;
 
-             }
 
-         }
 
-         public override string ToString()
 
-         {
 
-             return Entity.ToString();
 
-         }
 
-     }
 
-     public class Device<T> : EntityEx<WCS_DEVICE> where T : IProtocol
 
-     {
 
-         public T Data { get; private set; }
 
-         public Device(WCS_DEVICE entity) : base(entity)
 
-         {
 
-             Data = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T).AssemblyQualifiedName).Single().Data<T>();
 
-         }
 
-     }
 
-     public class Device<T, T2> : Device<T> where T : IProtocol where T2 : IProtocol
 
-     {
 
-         public T2 Data2 { get; private set; }
 
-         public Device(WCS_DEVICE entity) : base(entity)
 
-         {
 
-             Data2 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T2).AssemblyQualifiedName).Single().Data<T2>();
 
-         }
 
-     }
 
-     public class Device<T, T2, T3> : Device<T, T2> where T : IProtocol where T2 : IProtocol where T3 : IProtocol
 
-     {
 
-         public T3 Data3 { get; private set; }
 
-         public Device(WCS_DEVICE entity) : base(entity)
 
-         {
 
-             Data3 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T3).AssemblyQualifiedName).Single().Data<T3>();
 
-         }
 
-     }
 
-     public class Device<T, T2, T3, T4> : Device<T, T2, T3> where T : IProtocol where T2 : IProtocol where T3 : IProtocol where T4 : IProtocol
 
-     {
 
-         public T4 Data4 { get; private set; }
 
-         public Device(WCS_DEVICE entity) : base(entity)
 
-         {
 
-             Data4 = entity.PROTOCOLS.Where(v => v.DB.PROTOCOL == typeof(T4).AssemblyQualifiedName).Single().Data<T4>();
 
-         }
 
-     }
 
-     public class Group<T> : EntityEx<WCS_DEVICE> where T : EntityEx<WCS_DEVICE>
 
-     {
 
-         public IEnumerable<T> Items { get; private set; }
 
-         public Group(WCS_DEVICE entity) : base(entity)
 
-         {
 
-             Items = entity.DEVICEGROUP.Select(v => Activator.CreateInstance(typeof(T), v.MEMBER)).OfType<T>().OrderBy(p => p.Entity.CODE).ToList();
 
-         }
 
-     }
 
-     public class DeviceGroup<T> : Group<Device<T>> where T : IProtocol
 
-     {
 
-         public DeviceGroup(WCS_DEVICE entity) : base(entity)
 
-         {
 
-         }
 
-     }
 
-     public class DeviceGroup<T, T2> : Group<Device<T, T2>> where T : IProtocol where T2 : IProtocol
 
-     {
 
-         public DeviceGroup(WCS_DEVICE entity) : base(entity)
 
-         {
 
-         }
 
-     }
 
-     public class DeviceGroup<T, T2, T3> : Group<Device<T, T2, T3>> where T : IProtocol where T2 : IProtocol where T3 : IProtocol
 
-     {
 
-         public DeviceGroup(WCS_DEVICE entity) : base(entity)
 
-         {
 
-         }
 
-     }
 
- }
 
 
  |