AlertSnap.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System;
  2. using System.ComponentModel;
  3. using System.ComponentModel.DataAnnotations.Schema;
  4. using System.Drawing;
  5. using System.Runtime.CompilerServices;
  6. using System.Runtime.Serialization;
  7. namespace GDNXFD.Data
  8. {
  9. // CREATE TABLE "SA"."ALERTSNAP"
  10. // ( "ID" VARCHAR2(50) NOT NULL ENABLE,
  11. //"STATIONID" VARCHAR2(50) NOT NULL ENABLE,
  12. //"PROJECTID" VARCHAR2(50),
  13. //"LINEID" VARCHAR2(50),
  14. //"WINDTURBINEID" VARCHAR2(50),
  15. //"ALERTVALUE" NUMBER NOT NULL ENABLE,
  16. //"CATEGORY1" VARCHAR2(50) NOT NULL ENABLE,
  17. //"CATEGORY2" VARCHAR2(50),
  18. //"CATEGORY3" VARCHAR2(50),
  19. //"RANK" VARCHAR2(50) DEFAULT 1 NOT NULL ENABLE,
  20. //"ISOPENED" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE,
  21. //"ISCONFIRMED" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE,
  22. //"CONFIRMTIME" DATE,
  23. //"CONFIRMPERSON" VARCHAR2(50),
  24. //"LASTUPDATETIME" DATE,
  25. //"LASTUPDATEPERSON" VARCHAR2(50),
  26. //"STATIONNAME" VARCHAR2(50),
  27. //"PROJECTNAME" VARCHAR2(50),
  28. //"LINENAME" VARCHAR2(50),
  29. //"WINDTURBINENAME" VARCHAR2(50),
  30. //"ALERTTEXT" VARCHAR2(400),
  31. //"MODELID" VARCHAR2(50)
  32. // ) SEGMENT CREATION IMMEDIATE
  33. // PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  34. // STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  35. // PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  36. // TABLESPACE "USERS" ;
  37. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ISCONFIRMED" NOT NULL ENABLE);
  38. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ISOPENED" NOT NULL ENABLE);
  39. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("RANK" NOT NULL ENABLE);
  40. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("CATEGORY1" NOT NULL ENABLE);
  41. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ALERTVALUE" NOT NULL ENABLE);
  42. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("STATIONID" NOT NULL ENABLE);
  43. // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ID" NOT NULL ENABLE);
  44. // COMMENT ON COLUMN "SA"."ALERTSNAP"."STATIONID" IS '场站ID';
  45. // COMMENT ON COLUMN "SA"."ALERTSNAP"."PROJECTID" IS '工程ID';
  46. // COMMENT ON COLUMN "SA"."ALERTSNAP"."LINEID" IS '线路ID';
  47. // COMMENT ON COLUMN "SA"."ALERTSNAP"."WINDTURBINEID" IS '风机/逆变器ID';
  48. // COMMENT ON COLUMN "SA"."ALERTSNAP"."ALERTVALUE" IS '报警值,对应EDNAVALUE';
  49. // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY1" IS '分类,对应warningclassfy表,追加自定义报警、电气报警';
  50. // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY2" IS '分类2、对应自定义报警的分类';
  51. // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY3" IS '分类3、冗余备用';
  52. // COMMENT ON COLUMN "SA"."ALERTSNAP"."RANK" IS '报警级别';
  53. // COMMENT ON COLUMN "SA"."ALERTSNAP"."ISOPENED" IS '状态:0-关闭;1-打开';
  54. // COMMENT ON COLUMN "SA"."ALERTSNAP"."ISCONFIRMED" IS '确认状态:0-未确认;1-已确认';
  55. // COMMENT ON COLUMN "SA"."ALERTSNAP"."CONFIRMTIME" IS '确认时间';
  56. // COMMENT ON COLUMN "SA"."ALERTSNAP"."CONFIRMPERSON" IS '确认人';
  57. // COMMENT ON COLUMN "SA"."ALERTSNAP"."LASTUPDATETIME" IS '最后更新时间';
  58. // COMMENT ON COLUMN "SA"."ALERTSNAP"."LASTUPDATEPERSON" IS '最后更新人';
  59. // COMMENT ON COLUMN "SA"."ALERTSNAP"."STATIONNAME" IS '场站名称';
  60. // COMMENT ON COLUMN "SA"."ALERTSNAP"."PROJECTNAME" IS '工程名称';
  61. // COMMENT ON COLUMN "SA"."ALERTSNAP"."LINENAME" IS '线路名称';
  62. // COMMENT ON COLUMN "SA"."ALERTSNAP"."WINDTURBINENAME" IS '风机名称';
  63. // COMMENT ON COLUMN "SA"."ALERTSNAP"."ALERTTEXT" IS '报警内容文本';
  64. // COMMENT ON COLUMN "SA"."ALERTSNAP"."MODELID" IS '风机类型ID';
  65. [DataContract]
  66. [Table("ALARMSNAP")]
  67. public class AlertSnap : INotifyPropertyChanged
  68. {
  69. [DataMember]
  70. [Column("ID")]
  71. public long Id { get; set; }
  72. [DataMember]
  73. [Column("STATIONID")]
  74. public string StationId { get; set; }
  75. [DataMember]
  76. [Column("PROJECTID")]
  77. public string ProjectId { get; set; }
  78. [DataMember]
  79. [Column("LINEID")]
  80. public string LineId { get; set; }
  81. [DataMember]
  82. [Column("WINDTURBINEID")]
  83. public string WindturbineId { get; set; }
  84. [DataMember]
  85. [Column("ALERTVALUE")] //报警对应故障编码
  86. public long AlertValue { get; set; }
  87. [DataMember]
  88. [Column("RANK")] //报警级别
  89. public string Rank { get; set; }
  90. [DataMember]
  91. [Column("CATEGORY1")]
  92. public string Category1 { get; set; }
  93. [DataMember]
  94. [Column("CATEGORY2")]
  95. public string Category2 { get; set; }
  96. [DataMember]
  97. [Column("CATEGORY3")]
  98. public string Category3 { get; set; }
  99. [DataMember]
  100. [Column("ISOPENED")]
  101. public bool IsOpened { get; set; }
  102. [DataMember]
  103. [Column("ISCONFIRMED")]
  104. public bool IsConfirmed { get; set; }
  105. [DataMember]
  106. [Column("CONFIRMTIME")]
  107. public DateTime? ConfirmTime { get; set; }
  108. [DataMember]
  109. [Column("CONFIRMPERSON")]
  110. public string ConfirmPerson { get; set; }
  111. [DataMember]
  112. [Column("LASTUPDATETIME")]
  113. public DateTime? LastUpdateTime { get; set; }
  114. [DataMember]
  115. [Column("LASTUPDATEPERSON")]
  116. public string LastUpdatePerson { get; set; }
  117. [DataMember]
  118. [Column("LASTCLOSETIME")]
  119. public DateTime? LastCloseTime { get; set; }
  120. [DataMember]
  121. [Column("LASTCLOSEPERSON")]
  122. public string LastClosePerson { get; set; }
  123. [DataMember]
  124. [Column("STATIONNAME")]
  125. public string StationName { get; set; }
  126. [DataMember]
  127. [Column("PROJECTNAME")]
  128. public string ProjectName { get; set; }
  129. [DataMember]
  130. [Column("LINENAME")]
  131. public string LineName { get; set; }
  132. [DataMember]
  133. [Column("WINDTURBINENAME")]
  134. public string WindturbineName { get; set; }
  135. [DataMember]
  136. [Column("ALERTTEXT")]
  137. public string AlertText { get; set; }
  138. [DataMember]
  139. [Column("MODELID")]
  140. public string ModelId { get; set; }
  141. [DataMember]
  142. [Column("TESTINGPOINTKEY")]
  143. public string TestingPointKey { get; set; }
  144. [DataMember]
  145. [Column("IFIXPICTURE")]
  146. public string IFixPicture { get; set; }
  147. [DataMember]
  148. [Column("IFIXTAG")]
  149. public string IFixTag { get; set; }
  150. [DataMember]
  151. [Column("DATAINFO")]
  152. public string DataInfo { get; set; }
  153. /// <summary>
  154. /// Property changed event
  155. /// </summary>
  156. public event PropertyChangedEventHandler PropertyChanged;
  157. private void RaisePropertyChanged([CallerMemberName] string caller = "")
  158. {
  159. if (PropertyChanged != null)
  160. {
  161. PropertyChanged(this, new PropertyChangedEventArgs(caller));
  162. }
  163. }
  164. public string ObjectName
  165. {
  166. get
  167. {
  168. if (Category1 == "custom")
  169. {
  170. switch (Category2)
  171. {
  172. case "1":
  173. return WindturbineName;
  174. case "2":
  175. return StationName;
  176. case "3":
  177. return ProjectName;
  178. case "4":
  179. return LineName;
  180. case "5":
  181. return StationName;
  182. default:
  183. return "未知";
  184. }
  185. }
  186. else if (Category1 == "windturbine")
  187. return WindturbineName;
  188. else
  189. return StationName;
  190. }
  191. }
  192. public string ObjectId
  193. {
  194. get
  195. {
  196. if (Category1 == "custom")
  197. {
  198. switch (Category2)
  199. {
  200. case "1":
  201. return WindturbineId;
  202. case "2":
  203. return StationId;
  204. case "3":
  205. return ProjectId;
  206. case "4":
  207. return LineId;
  208. case "5":
  209. return StationId;
  210. default:
  211. return "";
  212. }
  213. }
  214. else if (Category1 == "windturbine")
  215. return WindturbineId;
  216. else
  217. return StationId;
  218. }
  219. }
  220. public string RankName
  221. {
  222. get
  223. {
  224. switch(Rank)
  225. {
  226. case "1":
  227. return "低";
  228. case "2":
  229. return "中低";
  230. case "3":
  231. return "中";
  232. case "4":
  233. return "中高";
  234. case "5":
  235. return "高";
  236. default:
  237. return "低";
  238. }
  239. }
  240. }
  241. public string CategoryName
  242. {
  243. get
  244. {
  245. switch (Category1)
  246. {
  247. case "custom":
  248. return "自定义";
  249. case "windturbine":
  250. return "风机";
  251. case "SYZ":
  252. return "升压站";
  253. case "GF":
  254. return "光伏";
  255. default:
  256. return "未知";
  257. }
  258. }
  259. }
  260. public string BackColor
  261. {
  262. get
  263. {
  264. if (IsOpened == true && IsConfirmed == false)
  265. {
  266. if (Rank == "4")
  267. return "#FFFF00";
  268. else if (Rank == "5")
  269. return "#FF0000";
  270. else
  271. return null;
  272. }
  273. else
  274. return null;
  275. }
  276. }
  277. public Color getBackGroundColor()
  278. {
  279. if (IsOpened == true && IsConfirmed == false)
  280. {
  281. if (Rank == "5")
  282. return Color.Red;
  283. else
  284. return Color.FromArgb(0xff7e66);
  285. }
  286. else
  287. return Color.FromArgb(0xff7e66);
  288. }
  289. public string ControlName {
  290. get
  291. {
  292. if (CategoryName == "自定义")
  293. return "停机";
  294. else if (CategoryName == "风机")
  295. return "复位";
  296. else
  297. return "";
  298. }
  299. }
  300. public string ConfirmName {
  301. get { return "确认"; }
  302. }
  303. }
  304. }