CacheInfo.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using EntityDataSet;
  6. using IntelligentControlForsx.Service.WindturbineControl.Domain;
  7. using IntelligentControlForsx.Service.WindturbineControl.Domain.Cmd;
  8. namespace Gyee_Control.Svc.Cache
  9. {
  10. public class CacheInfo
  11. {
  12. private static CacheInfo cacheObject = new CacheInfo();
  13. private CacheInfo()
  14. {
  15. }
  16. public static CacheInfo GetCacheInfo()
  17. {
  18. return cacheObject;
  19. }
  20. /// <summary>
  21. /// 缓存当前页面所存储的风机信息,包含实时测点数据
  22. /// </summary>
  23. public static IList<WindturbinePointData> CacheWindturbineDataList = new List<WindturbinePointData>();
  24. /// <summary>
  25. /// 缓存当前页面所存储的风机信息,包含实时测点数据
  26. /// </summary>
  27. public static Dictionary<string, WindturbinePointData> CacheWindturbineDataDic = new Dictionary<string, WindturbinePointData>();
  28. /// <summary>
  29. /// 缓存当前页面所存储的风机测点名称
  30. /// </summary>
  31. public static IList<WindturbineTagName> CacheWindturbineTagNameList = new List<WindturbineTagName>();
  32. /// <summary>
  33. /// 缓存风场风机
  34. /// </summary>
  35. public static IList<windturbine_uniform_code> CacheUniformCodeList = new List<windturbine_uniform_code>();
  36. /// <summary>
  37. /// 缓存被挂牌的风机编号,key为风场编号,value为挂牌风机Id集合
  38. /// </summary>
  39. public static Dictionary<string,IList<string>> LockWindturbineDic=new Dictionary<string, IList<string>>();
  40. /// <summary>
  41. /// 缓存已经发送过操作指令的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合
  42. /// </summary>
  43. public static Dictionary<string, IList<WindturbineCmdInfo>> controlDic = new Dictionary<string, IList<WindturbineCmdInfo>>();
  44. /// <summary>
  45. /// 缓存操作结束的风机信息,键:guid,为唯一编号,由发送按钮事件生成,值:为操控风机集合,该集合包含成功与未成功风机
  46. /// </summary>
  47. public static Dictionary<string, IList<WindturbineCmdInfo>> controlOverDic = new Dictionary<string, IList<WindturbineCmdInfo>>();
  48. /// <summary>
  49. /// 根据风场获取缓存中的风机
  50. /// </summary>
  51. /// <param name="stationId"></param>
  52. /// <returns></returns>
  53. public static IList<WindturbinePointData> GetDataByStation(string stationId)
  54. {
  55. IList<WindturbinePointData> cacheList = CacheWindturbineDataList.Where(s => s.StationId == stationId).ToList();
  56. return cacheList;
  57. }
  58. /// <summary>
  59. /// 根据风机编号获取风机
  60. /// </summary>
  61. /// <param name="windturbiuneName"></param>
  62. /// <returns></returns>
  63. public static IList<WindturbinePointData> GetDataByWindturbineName(string windturbiuneName)
  64. {
  65. IList<WindturbinePointData> cacheList = CacheWindturbineDataList.Where(s => s.WindturbineName == windturbiuneName).ToList();
  66. return cacheList;
  67. }
  68. public static IList<WindturbinePointData> GetDataAll()
  69. {
  70. return CacheWindturbineDataList;
  71. }
  72. public static void StationChange(string stationCode)
  73. {
  74. int count = CacheInfo.CacheUniformCodeList.Where(s => s.station_id == stationCode).ToList().Count;
  75. if (count <= 0)
  76. {
  77. using (wisdom_cs_entity ctx = new wisdom_cs_entity())
  78. {
  79. IList<windturbine_uniform_code> list =
  80. ctx.windturbine_uniform_code.Where(s => s.station_id == stationCode).ToList();
  81. CacheInfo.CacheUniformCodeList = CacheInfo.CacheUniformCodeList.Union(list).ToList();
  82. }
  83. }
  84. }
  85. /// <summary>
  86. /// 全选
  87. /// </summary>
  88. public static void CheckAll()
  89. {
  90. for (int i = 0; i < CacheWindturbineDataList.Count; i++)
  91. {
  92. CacheWindturbineDataList[i].IsCheck = true;
  93. }
  94. }
  95. /// <summary>
  96. /// 反选
  97. /// </summary>
  98. public static void InverseCheck()
  99. {
  100. for (int i = 0; i < CacheWindturbineDataList.Count; i++)
  101. {
  102. if (CacheWindturbineDataList[i].IsCheck)
  103. CacheWindturbineDataList[i].IsCheck = false;
  104. else
  105. CacheWindturbineDataList[i].IsCheck = true;
  106. }
  107. }
  108. }
  109. }