using OrpaonEMS.Core.EventHandMsg; using OrpaonEMS.Core.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OrpaonEMS.App.Models { /// /// PCS故障单元 /// public class PcsAlarmCell { public PcsAlarmCell() { CurTimeInfo = new AlarmTimeInfo(); } /// /// 发布报警信息 /// public event EventHandler PubPcsAlarmEventHandler; /// /// 报警内容 /// public string Content { get; set; } /// /// Bit位置 /// public ushort BitIndex { get; set; } private bool _State; /// /// 报警状态 /// public bool State { get { return _State; } set { if (_State != value && value == true)//报警发生 { _State = value; CurTimeInfo.StartTime = DateTime.Now; //发布报警 PubPcsAlarmEventHandler(this, new PcsAlarmCellEventHandMsg() { State = true, Content = Content, Level = 3, CurTimeInfo = CurTimeInfo }); } else if (_State != value && value == false)//报警消失 { _State = value; CurTimeInfo.EndTime = DateTime.Now; //发布报警 PubPcsAlarmEventHandler(this, new PcsAlarmCellEventHandMsg() { State = false, Content = Content, Level = 3, CurTimeInfo = CurTimeInfo }); } } } /// /// 报警时间信息 /// public AlarmTimeInfo CurTimeInfo { get; set; } ///// ///// 报警状态 ///// //public bool State { get; set; } } }