using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; using System.Drawing; using System.Runtime.CompilerServices; using System.Runtime.Serialization; namespace GDNXFD.Data { // CREATE TABLE "SA"."ALERTSNAP" // ( "ID" VARCHAR2(50) NOT NULL ENABLE, //"STATIONID" VARCHAR2(50) NOT NULL ENABLE, //"PROJECTID" VARCHAR2(50), //"LINEID" VARCHAR2(50), //"WINDTURBINEID" VARCHAR2(50), //"ALERTVALUE" NUMBER NOT NULL ENABLE, //"CATEGORY1" VARCHAR2(50) NOT NULL ENABLE, //"CATEGORY2" VARCHAR2(50), //"CATEGORY3" VARCHAR2(50), //"RANK" VARCHAR2(50) DEFAULT 1 NOT NULL ENABLE, //"ISOPENED" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE, //"ISCONFIRMED" NUMBER(1,0) DEFAULT 0 NOT NULL ENABLE, //"CONFIRMTIME" DATE, //"CONFIRMPERSON" VARCHAR2(50), //"LASTUPDATETIME" DATE, //"LASTUPDATEPERSON" VARCHAR2(50), //"STATIONNAME" VARCHAR2(50), //"PROJECTNAME" VARCHAR2(50), //"LINENAME" VARCHAR2(50), //"WINDTURBINENAME" VARCHAR2(50), //"ALERTTEXT" VARCHAR2(400), //"MODELID" VARCHAR2(50) // ) SEGMENT CREATION IMMEDIATE // PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING // STORAGE(INITIAL 131072 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 // PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) // TABLESPACE "USERS" ; // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ISCONFIRMED" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ISOPENED" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("RANK" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("CATEGORY1" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ALERTVALUE" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("STATIONID" NOT NULL ENABLE); // ALTER TABLE "SA"."ALERTSNAP" MODIFY("ID" NOT NULL ENABLE); // COMMENT ON COLUMN "SA"."ALERTSNAP"."STATIONID" IS '场站ID'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."PROJECTID" IS '工程ID'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."LINEID" IS '线路ID'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."WINDTURBINEID" IS '风机/逆变器ID'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."ALERTVALUE" IS '报警值,对应EDNAVALUE'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY1" IS '分类,对应warningclassfy表,追加自定义报警、电气报警'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY2" IS '分类2、对应自定义报警的分类'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."CATEGORY3" IS '分类3、冗余备用'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."RANK" IS '报警级别'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."ISOPENED" IS '状态:0-关闭;1-打开'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."ISCONFIRMED" IS '确认状态:0-未确认;1-已确认'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."CONFIRMTIME" IS '确认时间'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."CONFIRMPERSON" IS '确认人'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."LASTUPDATETIME" IS '最后更新时间'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."LASTUPDATEPERSON" IS '最后更新人'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."STATIONNAME" IS '场站名称'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."PROJECTNAME" IS '工程名称'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."LINENAME" IS '线路名称'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."WINDTURBINENAME" IS '风机名称'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."ALERTTEXT" IS '报警内容文本'; // COMMENT ON COLUMN "SA"."ALERTSNAP"."MODELID" IS '风机类型ID'; [DataContract] [Table("ALARMSNAP")] public class AlertSnap : INotifyPropertyChanged { [DataMember] [Column("ID")] public long Id { get; set; } [DataMember] [Column("STATIONID")] public string StationId { get; set; } [DataMember] [Column("PROJECTID")] public string ProjectId { get; set; } [DataMember] [Column("LINEID")] public string LineId { get; set; } [DataMember] [Column("WINDTURBINEID")] public string WindturbineId { get; set; } [DataMember] [Column("ALERTVALUE")] //报警对应故障编码 public long AlertValue { get; set; } [DataMember] [Column("RANK")] //报警级别 public string Rank { get; set; } [DataMember] [Column("CATEGORY1")] public string Category1 { get; set; } [DataMember] [Column("CATEGORY2")] public string Category2 { get; set; } [DataMember] [Column("CATEGORY3")] public string Category3 { get; set; } [DataMember] [Column("ISOPENED")] public bool IsOpened { get; set; } [DataMember] [Column("ISCONFIRMED")] public bool IsConfirmed { get; set; } [DataMember] [Column("CONFIRMTIME")] public DateTime? ConfirmTime { get; set; } [DataMember] [Column("CONFIRMPERSON")] public string ConfirmPerson { get; set; } [DataMember] [Column("LASTUPDATETIME")] public DateTime? LastUpdateTime { get; set; } [DataMember] [Column("LASTUPDATEPERSON")] public string LastUpdatePerson { get; set; } [DataMember] [Column("LASTCLOSETIME")] public DateTime? LastCloseTime { get; set; } [DataMember] [Column("LASTCLOSEPERSON")] public string LastClosePerson { get; set; } [DataMember] [Column("STATIONNAME")] public string StationName { get; set; } [DataMember] [Column("PROJECTNAME")] public string ProjectName { get; set; } [DataMember] [Column("LINENAME")] public string LineName { get; set; } [DataMember] [Column("WINDTURBINENAME")] public string WindturbineName { get; set; } [DataMember] [Column("ALERTTEXT")] public string AlertText { get; set; } [DataMember] [Column("MODELID")] public string ModelId { get; set; } [DataMember] [Column("TESTINGPOINTKEY")] public string TestingPointKey { get; set; } [DataMember] [Column("IFIXPICTURE")] public string IFixPicture { get; set; } [DataMember] [Column("IFIXTAG")] public string IFixTag { get; set; } [DataMember] [Column("DATAINFO")] public string DataInfo { get; set; } /// /// Property changed event /// public event PropertyChangedEventHandler PropertyChanged; private void RaisePropertyChanged([CallerMemberName] string caller = "") { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(caller)); } } public string ObjectName { get { if (Category1 == "custom") { switch (Category2) { case "1": return WindturbineName; case "2": return StationName; case "3": return ProjectName; case "4": return LineName; case "5": return StationName; default: return "未知"; } } else if (Category1 == "windturbine") return WindturbineName; else return StationName; } } public string ObjectId { get { if (Category1 == "custom") { switch (Category2) { case "1": return WindturbineId; case "2": return StationId; case "3": return ProjectId; case "4": return LineId; case "5": return StationId; default: return ""; } } else if (Category1 == "windturbine") return WindturbineId; else return StationId; } } public string RankName { get { switch(Rank) { case "1": return "低"; case "2": return "中低"; case "3": return "中"; case "4": return "中高"; case "5": return "高"; default: return "低"; } } } public string CategoryName { get { switch (Category1) { case "custom": return "自定义"; case "windturbine": return "风机"; case "SYZ": return "升压站"; case "GF": return "光伏"; default: return "未知"; } } } public string BackColor { get { if (IsOpened == true && IsConfirmed == false) { if (Rank == "4") return "#FFFF00"; else if (Rank == "5") return "#FF0000"; else return null; } else return null; } } public Color getBackGroundColor() { if (IsOpened == true && IsConfirmed == false) { if (Rank == "5") return Color.Red; else return Color.FromArgb(0xff7e66); } else return Color.FromArgb(0xff7e66); } public string ControlName { get { if (CategoryName == "自定义") return "停机"; else if (CategoryName == "风机") return "复位"; else return ""; } } public string ConfirmName { get { return "确认"; } } } }