AlertService.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System.Collections.Generic;
  2. using GDNXFD.Data;
  3. using GDNXFD.Data.Repositories;
  4. using System.Linq;
  5. using System;
  6. using System.Text;
  7. namespace GDNXFD.WcfService
  8. {
  9. public class AlertService : IAlertService
  10. {
  11. public string GetData(int value)
  12. {
  13. return string.Format("You entered: {0}", value);
  14. }
  15. #region 报警模块
  16. public IList<AlertInfo> GetAlertInfosPage(string filter, int pageIndex, int pageSize, ref int total)
  17. {
  18. return AlertSnapRepository.GetAlertInfosPage(filter, pageIndex, pageSize, ref total);
  19. }
  20. public IList<IFixBJTestingPointDI> GetIFixBjPage(string filter, int pageIndex, int pageSize, ref int total)
  21. {
  22. return AlertSnapRepository.GetIFixBjPage(filter, pageIndex, pageSize, ref total);
  23. }
  24. public IList<AlertInfo> GetAlertInfos()
  25. {
  26. return AlertSnapRepository.GetRealTimeAlertInfos();
  27. }
  28. public IList<AlertSnap> GetAlertSnaps()
  29. {
  30. return AlertSnapRepository.GetRealTimeAlertSnaps();//.GetTop1000Snaps();
  31. }
  32. public IList<AlertSnap> GetLatestAlertSnaps(int count)
  33. {
  34. return AlertSnapRepository.GetLatestAlertSnaps(count);
  35. }
  36. public IList<ShutdownEvent> GetLatestShutdownEvents()
  37. {
  38. return AlertSnapRepository.GetLatestShutdownEvents();
  39. }
  40. public IList<AlertSnap> GetClosedAlertSnaps()
  41. {
  42. return AlertSnapRepository.GetTop1000ClosedSnaps();
  43. }
  44. public IList<AlertSnap> GetAlertSnaps2(string stationId, string rank, string category, string category2, string filter, string status)
  45. {
  46. return AlertSnapRepository.GetAlertSnaps(stationId, rank, category, category2, filter, status);
  47. }
  48. public void ConfirmAlert(long alertResultId)
  49. {
  50. AlertSnapRepository.ConfirmAlert(alertResultId);
  51. }
  52. public void ConfirmAlertPage(string[] ids)
  53. {
  54. AlertSnapRepository.ConfirmAlertPage(ids);
  55. }
  56. public void ConfirmAllAlert()
  57. {
  58. AlertSnapRepository.ConfirmAll();
  59. }
  60. public IList<DictItem> GetDataDictionary()
  61. {
  62. return WindPowerStationRepository.GetDataDictionary();
  63. }
  64. public IList<RankingModel> GetStationPieChartData()
  65. {
  66. return CustomRepository.GetStationPieChartData();
  67. }
  68. public IList<RankingModel> GetRankListData()
  69. {
  70. return CustomRepository.GetRankListData();
  71. }
  72. public IList<AlertInfo> GetWindturbineAlertInfoByPage(string filter, int pageIndex, int pageSize, ref int total)
  73. {
  74. return AlertSnapRepository.GetWindturbineAlertInfoByPage(filter, pageIndex, pageSize, ref total);
  75. }
  76. #endregion
  77. #region 故障fault
  78. public IList<FaultInfo> GetRealTimeFaultInfos()
  79. {
  80. return FaultSnapRepository.GetRealTimeFaultInfos();
  81. }
  82. public IList<FaultInfo> GetLatestFaultInfos(int count)
  83. {
  84. return FaultSnapRepository.GetLatestFaultInfos(count);
  85. }
  86. public IList<FaultInfo> GetFaultInfosByIdList(IList<long> idList)
  87. {
  88. return FaultSnapRepository.GetFaultInfoByIdList(idList);
  89. }
  90. public IList<FaultSnap> GetFaultSnapByIdList(IList<long> snapIdList) {
  91. return FaultSnapRepository.GetFaultSnapByIdList(snapIdList);
  92. }
  93. public IList<FaultSnap> GetRealTimeFaultSnaps()
  94. {
  95. return FaultSnapRepository.GetRealTimeFaultSnaps();
  96. }
  97. public IList<FaultInfo> GetFaultInfosPage(string filter, int pageIndex, int pageSize, ref int total)
  98. {
  99. return FaultSnapRepository.GetFaultInfosPage(filter, pageIndex, pageSize, ref total);
  100. }
  101. //1-确认 2-复位 3-生成缺陷单
  102. public void ConfirmFault(long snapId, int confirmType, string confirmPerson, long alertSnapId)
  103. {
  104. FaultSnapRepository.ConfirmFault(snapId, confirmType, confirmPerson,alertSnapId);
  105. }
  106. public IList<Warning> getUnabledResetWarning()
  107. {
  108. return FaultSnapRepository.getUnabledResetWarning();
  109. }
  110. #endregion
  111. #region 通用
  112. public IList<WindTurbine> GetFDCWindturbinies()
  113. {
  114. return WindTurbineRepository.GetFDCWindTurbinies();
  115. }
  116. public IList<WindPowerStation> GetWindPowerStations()
  117. {
  118. return WindPowerStationRepository.GetWindPowerStations();
  119. }
  120. public IList<Project> GetProjects()
  121. {
  122. return WindPowerStationRepository.GetProjects();
  123. }
  124. public IList<Line> GetLines()
  125. {
  126. return WindPowerStationRepository.GetLines();
  127. }
  128. public IList<PointMapModel> GetTestingPoints(PointType ptype, string[] uniformcodes)
  129. {
  130. IList<PointMapModel> ret = new List<PointMapModel>();
  131. if (ptype == PointType.Windturbine)
  132. {
  133. var lstAI = WindTurbineRepository.GetWindTurbineAIPoints(uniformcodes);
  134. if (lstAI != null && lstAI.Count > 0)
  135. {
  136. foreach (var obj in lstAI)
  137. {
  138. PointMapModel pmm = new PointMapModel();
  139. pmm.ObjectId = obj.WindturbineId;
  140. pmm.ObjectType = PointType.Windturbine;
  141. pmm.DataType = PointDataType.AI;
  142. pmm.UniformCode = obj.UniformCode;
  143. pmm.PointId = CommonMethod.BuildPointId(obj.Id);
  144. if (!ret.Contains(pmm))
  145. ret.Add(pmm);
  146. }
  147. }
  148. var lstDI = WindTurbineRepository.GetWindTurbineDIPoints(uniformcodes);
  149. if (lstDI != null && lstDI.Count > 0)
  150. {
  151. foreach (var obj in lstDI)
  152. {
  153. PointMapModel pmm = new PointMapModel();
  154. pmm.ObjectId = obj.WindturbineId;
  155. pmm.ObjectType = PointType.Windturbine;
  156. pmm.DataType = PointDataType.DI;
  157. pmm.UniformCode = obj.UniformCode;
  158. pmm.PointId = CommonMethod.BuildPointId(obj.Id);
  159. if (!ret.Contains(pmm))
  160. ret.Add(pmm);
  161. }
  162. }
  163. }
  164. else if (ptype == PointType.Station)
  165. {
  166. var lstP = WindPowerStationRepository.GetStationTestingPoints(uniformcodes);
  167. if (lstP != null && lstP.Count > 0)
  168. {
  169. foreach (var obj in lstP)
  170. {
  171. PointMapModel pmm = new PointMapModel();
  172. pmm.ObjectId = obj.StationId;
  173. pmm.ObjectType = PointType.Station;
  174. pmm.DataType = PointDataType.AI;
  175. pmm.UniformCode = obj.UniformCode;
  176. pmm.PointId = CommonMethod.BuildPointId(obj.Id);
  177. if (!ret.Contains(pmm))
  178. ret.Add(pmm);
  179. }
  180. }
  181. }
  182. else
  183. {
  184. }
  185. return ret;
  186. }
  187. #endregion
  188. }
  189. }