private string GetAlarmData() { StringBuilder strBui = new StringBuilder(); //BLL.TN_Cache.Rtm rtmInstance = BLL.TN_Cache.Rtm.GetInstance(); //List<Model.TN_Rtm> rtmList = rtmInstance.GetRealRtmList(); //List<Model.TN_Rtm> rtmAlarmList = rtmList.FindAll(r => int.Parse(r.DevState) > 0 && int.Parse(r.DevState) <= 128); BLL.DisplayAlarm rtAlarm = new TDTK.IndustryPlatform.SafetyMonitor.BLL.DisplayAlarm(); List<Model.TN_Rtm> rtmAlarmList = rtAlarm.UnManageAlarm(); BLL.TN_Cache.UpLoadState ulInstance = BLL.TN_Cache.UpLoadState.GetUpLoadStateInstance(); List<Model.TN_UpLoadState> ulStateList = ulInstance.GetUpLoadState(); string UserDefine = string.Empty; int Coals = ulStateList.Count; for (int i = 0; i < Coals; i++) { if (ulStateList[i].UpLoadState != "正常") { strBui.Append(ulStateList[i].CoalName + "煤矿," + "网络" + ulStateList[i].NetState + "," + "上传" + ulStateList[i].UpLoadState + "。"); } } foreach (Model.TN_Rtm r in rtmAlarmList) { strBui.Append(r.CoalName + "煤矿," + r.DevAddress+","+r.DevCode + ","+ r.DevName+ r.DevStatus + ";");// } return strBui.ToString(); }
/// <summary> /// 获取实时传感器报警数据 /// </summary> /// <returns></returns> List<TDTK.IndustryPlatform.SafetyMonitor.Model.TN_CoalsAlarm> IGetAlarm.GetCoalsDevAlarmList() { List<Model.TN_CoalsAlarm> calsAlarm = new List<Model.TN_CoalsAlarm>(); //BLL.TN_Cache.Rtm rtmInstance = BLL.TN_Cache.Rtm.GetInstance(); //List<Model.TN_Rtm> rtmList = rtmInstance.GetRealRtmList(); //List<Model.TN_Rtm> rtmAlarmList = rtmList.FindAll(r => int.Parse(r.DevState) > 0 && int.Parse(r.DevState) <= 128 ); BLL.DisplayAlarm rtAlarm = new TDTK.IndustryPlatform.SafetyMonitor.BLL.DisplayAlarm(); List<Model.TN_Rtm> rtmAlarmList = rtAlarm.UnManageAlarm(); string UserDefine = string.Empty; int CoalsDev = rtmAlarmList.Count; for (int i = 0; i < CoalsDev; i++) { Model.TN_CoalsAlarm itemAlarm = null; if (rtmAlarmList!= null) { if (int.Parse(rtmAlarmList[i].DevState) > 4) UserDefine = "故障"; else if (int.Parse(rtmAlarmList[i].DevState) > 0 && int.Parse(rtmAlarmList[i].DevState)<4) UserDefine = "报警"; else UserDefine = "正常"; itemAlarm = new Model.TN_CoalsAlarm { CoalCode = rtmAlarmList[i].CoalCode, CoalName = rtmAlarmList[i].CoalName, DevState = int.Parse(rtmAlarmList[i].DevState), UPLState = "正常", UserDefine = UserDefine, NetState = rtmAlarmList[i].DevState, RealTime = DateTime.Parse(rtmAlarmList[i].RealTime), DevAddress = rtmAlarmList[i].DevAddress, DurationTime =CalculateTime((DateTime.Parse(rtmAlarmList[i].RealTime) - DateTime.Parse(rtmAlarmList[i].ChageStateTime)).TotalSeconds), }; } if (itemAlarm != null) { calsAlarm.Add(itemAlarm); UploadAlarmCount++; } } return calsAlarm; }