123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- 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;
- }
- /// <summary>
- /// 缓存当前页面所存储的风机信息,包含实时测点数据
- /// </summary>
- public static IList<WindturbinePointData> CacheWindturbineDataList = new List<WindturbinePointData>();
- /// <summary>
- /// 缓存当前页面所存储的风机信息,包含实时测点数据
- /// </summary>
- public static Dictionary<string, WindturbinePointData> CacheWindturbineDataDic = new Dictionary<string, WindturbinePointData>();
- /// <summary>
- /// 缓存当前页面所存储的风机测点名称
- /// </summary>
- public static IList<WindturbineTagName> CacheWindturbineTagNameList = new List<WindturbineTagName>();
- /// <summary>
- /// 缓存风场风机
- /// </summary>
- public static IList<windturbine_uniform_code> CacheUniformCodeList = new List<windturbine_uniform_code>();
- /// <summary>
- /// 缓存被挂牌的风机编号,key为风场编号,value为挂牌风机Id集合
- /// </summary>
- public static Dictionary<string,IList<string>> LockWindturbineDic=new Dictionary<string, IList<string>>();
- /// <summary>
- /// 缓存已经发送过操作指令的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合
- /// </summary>
- public static Dictionary<string, IList<WindturbineCmdInfo>> controlDic = new Dictionary<string, IList<WindturbineCmdInfo>>();
- /// <summary>
- /// 缓存操作结束的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合,该集合包含成功与未成功风机
- /// </summary>
- public static Dictionary<string, IList<WindturbineCmdInfo>> controlOverDic = new Dictionary<string, IList<WindturbineCmdInfo>>();
- /// <summary>
- /// 根据风场获取缓存中的风机
- /// </summary>
- /// <param name="stationId"></param>
- /// <returns></returns>
- public static IList<WindturbinePointData> GetDataByStation(string stationId)
- {
- IList<WindturbinePointData> cacheList = CacheWindturbineDataList.Where(s => s.StationId == stationId).ToList();
- return cacheList;
- }
- /// <summary>
- /// 根据风机编号获取风机
- /// </summary>
- /// <param name="windturbiuneName"></param>
- /// <returns></returns>
- public static IList<WindturbinePointData> GetDataByWindturbineName(string windturbiuneName)
- {
- IList<WindturbinePointData> cacheList = CacheWindturbineDataList.Where(s => s.WindturbineName == windturbiuneName).ToList();
- return cacheList;
- }
- public static IList<WindturbinePointData> 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<windturbine_uniform_code> list =
- ctx.windturbine_uniform_code.Where(s => s.station_id == stationCode).ToList();
- CacheInfo.CacheUniformCodeList = CacheInfo.CacheUniformCodeList.Union(list).ToList();
- }
- }
- }
- /// <summary>
- /// 全选
- /// </summary>
- public static void CheckAll()
- {
- for (int i = 0; i < CacheWindturbineDataList.Count; i++)
- {
- CacheWindturbineDataList[i].IsCheck = true;
- }
- }
- /// <summary>
- /// 反选
- /// </summary>
- 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;
- }
- }
- }
- }
|