using System; using System.Collections; using System.Collections.Generic; using System.Linq; using EntityDataSet; using IntelligentControlForsx.Service.WindturbineControl.Domain; using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd; namespace Gyee_Control.Svc.Cache { public class CacheInfo { private static CacheInfo cacheObject = new CacheInfo(); private CacheInfo() { } public static CacheInfo GetCacheInfo() { return cacheObject; } /// /// 缓存当前页面所存储的风机信息,包含实时测点数据 /// public static IList CacheWindturbineDataList = new List(); /// /// 缓存当前页面所存储的风机信息,包含实时测点数据 /// public static Dictionary CacheWindturbineDataDic = new Dictionary(); /// /// 缓存当前页面所存储的风机测点名称 /// public static IList CacheWindturbineTagNameList = new List(); /// /// 缓存风场风机 /// public static IList CacheUniformCodeList = new List(); /// /// 缓存被挂牌的风机编号,key为风场编号,value为挂牌风机Id集合 /// public static Dictionary> LockWindturbineDic=new Dictionary>(); /// /// 缓存已经发送过操作指令的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合 /// public static Dictionary> controlDic = new Dictionary>(); /// /// 缓存操作结束的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合,该集合包含成功与未成功风机 /// public static Dictionary> controlOverDic = new Dictionary>(); /// /// 根据风场获取缓存中的风机 /// /// /// public static IList GetDataByStation(string stationId) { IList cacheList = CacheWindturbineDataList.Where(s => s.StationId == stationId).ToList(); return cacheList; } /// /// 根据风机编号获取风机 /// /// /// public static IList GetDataByWindturbineName(string windturbiuneName) { IList cacheList = CacheWindturbineDataList.Where(s => s.WindturbineName == windturbiuneName).ToList(); return cacheList; } public static IList GetDataAll() { return CacheWindturbineDataList; } public static void StationChange(string stationCode) { int count = CacheInfo.CacheUniformCodeList.Where(s => s.station_id == stationCode).ToList().Count; if (count <= 0) { using (wisdom_cs_entity ctx = new wisdom_cs_entity()) { IList list = ctx.windturbine_uniform_code.Where(s => s.station_id == stationCode).ToList(); CacheInfo.CacheUniformCodeList = CacheInfo.CacheUniformCodeList.Union(list).ToList(); } } } /// /// 全选 /// public static void CheckAll() { for (int i = 0; i < CacheWindturbineDataList.Count; i++) { CacheWindturbineDataList[i].IsCheck = true; } } /// /// 反选 /// public static void InverseCheck() { for (int i = 0; i < CacheWindturbineDataList.Count; i++) { if (CacheWindturbineDataList[i].IsCheck) CacheWindturbineDataList[i].IsCheck = false; else CacheWindturbineDataList[i].IsCheck = true; } } } }