/// <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;
        }
 public List<Model.TN_CoalsAlarm> GetAllCoals()
 {
     List<Model.TN_CoalsAlarm> coals = new List<Model.TN_CoalsAlarm>();
     BLL.TN_QueryCondition qc = new BLL.TN_QueryCondition();
     DataSet ds = qc.GetAllCoals();
     if (ds != null)
     {
         int rows = ds.Tables[0].Rows.Count;
         for (int i = 0; i < rows; i++)
         {
             Model.TN_CoalsAlarm c = new Model.TN_CoalsAlarm
             {
                 CoalCode = ds.Tables[0].Rows[i]["coalcode"].ToString(),
                 CoalName = ds.Tables[0].Rows[i]["coalname"].ToString(),
                 IsSetWarning = true
             };
             coals.Add(c);
         }
     }
     return coals;
 }
 /// <summary>
 /// 获取实时报警数据
 /// </summary>
 /// <returns></returns>
 List<TDTK.IndustryPlatform.SafetyMonitor.Model.TN_CoalsAlarm> IGetAlarm.GetCoalsAlarmList()
 {
     List<Model.TN_CoalsAlarm> calsAlarm = new List<Model.TN_CoalsAlarm>();
     BLL.TN_Cache.UpLoadState ulInstance = BLL.TN_Cache.UpLoadState.GetUpLoadStateInstance();
     List<Model.TN_UpLoadState> ulStateList = ulInstance.GetUpLoadState();
     BLL.TN_Cache.Rtm rtmInstance = BLL.TN_Cache.Rtm.GetInstance();
     //
     List<Model.TN_Rtm> rtmList = rtmInstance.GetRealRtmList();
     //
     string UserDefine = string.Empty;
     int Coals = ulStateList.Count;
     for (int i = 0; i < Coals; i++)
     {
         Model.TN_CoalsAlarm itemAlarm = null;
         if (ulStateList[i].UpLoadState != "正常")
         {
             itemAlarm = new Model.TN_CoalsAlarm
             {
                 CoalCode = ulStateList[i].CoalCode,
                 CoalName = ulStateList[i].CoalName,
                 UPLState = ulStateList[i].UpLoadState,
                 NetState = ulStateList[i].NetState,
                 UserDefine = "中断",
                 DurationTime = CalculateTime((DateTime.Parse(ulStateList[i].RealTime) - DateTime.Parse(ulStateList[i].StartTime)).TotalSeconds),
                 RealTime = DateTime.Parse(ulStateList[i].RealTime)
             };
         }
         else
         {
             Model.TN_Rtm rtmAlarm = rtmList.Find(r => r.CoalCode == ulStateList[i].CoalCode && int.Parse(r.DevState) > 0 && int.Parse(r.DevState) <= 128);
             if (rtmAlarm != null)
             {
                 if (int.Parse(rtmAlarm.DevState) > 4)
                     UserDefine = "故障";
                 else if (int.Parse(rtmAlarm.DevState) > 0 && int.Parse(rtmAlarm.DevState) < 4)
                     UserDefine = "报警";
                 else UserDefine = "正常";
                 itemAlarm = new Model.TN_CoalsAlarm
                 {
                     CoalCode = rtmAlarm.CoalCode,
                     CoalName = rtmAlarm.CoalName,
                     DevState = int.Parse(rtmAlarm.DevState),
                     UPLState = "正常",
                     UserDefine = UserDefine,
                     NetState = rtmAlarm.DevState,
                     RealTime = DateTime.Parse(rtmAlarm.RealTime),
                     DevAddress=rtmAlarm.DevAddress,
                     DurationTime = CalculateTime((DateTime.Parse(rtmAlarm.RealTime) - DateTime.Parse(rtmAlarm.ChageStateTime)).TotalSeconds)
                 };
             }
         }
         if (itemAlarm != null)
             calsAlarm.Add(itemAlarm);
     }
     return calsAlarm;
 }