Exemplo n.º 1
0
 /// <summary>
 /// 报警
 /// </summary>
 /// <returns></returns>
 private void AlarmHandler()
 {
     try
     {
         if (apiRunDataResultDic.Count > 0)
         {
             Dictionary <string, JTYResultModel> tempDic = new Dictionary <string, JTYResultModel>();
             //防止冲突,对apiRunDataResultDic进行拷贝
             tempDic = Clone <Dictionary <string, JTYResultModel> >(apiRunDataResultDic);
             foreach (string key in tempDic.Keys)
             {
                 JTYResultModel result = tempDic[key];
                 if (result.issuccess)
                 {
                     dynamic d             = JsonConvert.DeserializeObject(result.para);
                     string  errorCodeType = d.ErrorCodeType;
                     string  errorCodeMean = d.ErrorCodeMean;
                     bool    forHelp       = d.ForHelp;
                     bool    trapped       = d.Trapped;
                     _alarm.AlarmJudge(key, errorCodeType, errorCodeMean, forHelp, trapped);
                 }
             }
         }
     }
     catch (Exception e)
     {
         if (ShowMsg != null)
         {
             ShowMsg("电梯运行监控AlarmHandler:原因如下:" + e.Message);
         }
         LogHelper.Dbbug("电梯运行监控AlarmHandler:原因如下:" + e.Message);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 视频
 /// </summary>
 /// <returns></returns>
 private bool CacheVideo()
 {
     try
     {
         List <MODEL.ElevatorInfoModel> list = Clone <List <MODEL.ElevatorInfoModel> >(elevatorList);
         foreach (MODEL.ElevatorInfoModel model in list)
         {
             JTYResultModel video = JTYApiHelp.GetLiftVideo(model.registrationCode);
             if (ShowMsg != null)
             {
                 ShowMsg(string.Format("电梯视频缓存,{0},{1}", model.registrationCode, video.head));
             }
             Thread.Sleep(15000);
         }
         return(true);
     }
     catch (Exception e)
     {
         if (ShowMsg != null)
         {
             ShowMsg("缓存电梯error:原因如下:" + e.Message);
         }
         LogHelper.Dbbug("缓存电梯error:原因如下:" + e.Message);
         return(false);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 保持实时监控
 /// </summary>
 private bool SetApiRunDataResultDic()
 {
     try
     {
         List <MODEL.ElevatorInfoModel> list = Clone <List <MODEL.ElevatorInfoModel> >(elevatorList);
         List <string> registrationCodes     = new List <string>();
         for (int i = 0, n = 1; i < list.Count; i++, n++)
         {
             registrationCodes.Add(list[i].registrationCode);
             if (n % 50 == 0 || i == list.Count - 1)
             {
                 n = 0;
                 //调用api
                 JTYResultModel resultModel = JTYApiHelp.GetLiftRunData(registrationCodes.ToArray());
                 if (resultModel.issuccess)
                 {
                     //成功数据处理
                     dynamic d = JsonConvert.DeserializeObject(resultModel.para);
                     foreach (string registrationCode in registrationCodes)
                     {
                         JTYResultModel model = new JTYResultModel()
                         {
                             issuccess = true,
                             head      = "",
                             para      = JsonConvert.SerializeObject(d[registrationCode])
                         };
                         //结果插入dic
                         if (apiRunDataResultDic.ContainsKey(registrationCode))
                         {
                             apiRunDataResultDic[registrationCode] = model;
                         }
                         else
                         {
                             apiRunDataResultDic.Add(registrationCode, model);
                         }
                     }
                 }
                 else
                 {
                     if (ShowMsg != null)
                     {
                         ShowMsg(string.Format("电梯运行监控,api调用失败{0};时间:{1}", resultModel.head, DateTime.Now));
                     }
                 }
                 registrationCodes.Clear();
             }
         }
         return(true);
     }
     catch (Exception e)
     {
         if (ShowMsg != null)
         {
             ShowMsg("电梯运行监控SetApiRunDataResultDic:原因如下:" + e.Message);
         }
         LogHelper.Dbbug("电梯运行监控SetApiRunDataResultDic:原因如下:" + e.Message);
         return(false);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 电梯视频
        /// </summary>
        /// <param name="registercode"></param>
        /// <returns></returns>
        public string GetLiftVideo(string registercode)
        {
            JTYResultModel model = JTYApiHelp.GetLiftVideo(registercode);
            var            jr    = new MODEL.JsonResultModel <string>()
            {
                IsSucceed   = model.issuccess,
                Data        = model.para,
                Msg         = model.head,
                RedirectUrl = string.Empty
            };

            return(JsonConvert.SerializeObject(jr));
        }