示例#1
0
        /// <summary>
        /// 获取实时轨迹中历史轨迹点
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public JsonResult GetRealDataAjax(string phone, string time)
        {
            string            uid     = Request.Params["uid"];//护林员id
            string            maptype = Request.Params["maptype"];
            MessageListObject msg     = null;
            var sw = new T_IPS_REALDATASW();

            sw.PHONE      = phone.Trim();
            sw.searchDate = DateTime.Now.ToString("yyyy-MM-dd");
            sw.HID        = uid;
            if (!string.IsNullOrEmpty(maptype))
            {
                sw.MapType = maptype;//地图类型
            }
            if (!string.IsNullOrEmpty(time))
            {
                sw.DateBegin = Convert.ToDateTime(time).AddSeconds(1).ToString("yyyy-MM-dd HH:mm:ss");
            }
            else
            {
                sw.DateEnd = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            }
            var list = T_IPS_REALDATACls.getModelList(sw);

            if (list.Count() > 0)
            {
                msg = new MessageListObject(true, list);
            }
            return(Json(msg));
        }
示例#2
0
        /// <summary>
        /// 获取历史经纬度(历史轨迹回放)
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="time"></param>
        /// <returns></returns>
        public JsonResult GetHisLogLatAjax(string uid, string time)
        {
            MessageListObject ms = null;

            if (string.IsNullOrEmpty(uid) || string.IsNullOrEmpty(time))
            {
                ms = new MessageListObject(false, null);
                return(Json(ms));
            }
            string maptype   = Request.Params["maptype"];   //地图类型
            string starttime = Request.Params["starttime"]; //开始时分
            string endtime   = Request.Params["endtime"];   //结束时分
            var    model     = new T_IPS_REALDATASW();

            model.HID = uid;
            //model.searchDate = time;
            if (!string.IsNullOrEmpty(starttime.Trim()) && !string.IsNullOrEmpty(endtime.Trim()))//时分参数
            {
                model.DateBegin = time + " " + starttime + ":00";
                model.DateEnd   = time + " " + endtime + ":00";
                if (endtime.Trim() == "23:59")
                {
                    model.DateEnd = time + " " + endtime + ":59";
                }
            }
            if (!string.IsNullOrEmpty(maptype))
            {
                model.MapType = maptype;
            }
            var list = T_IPS_REALDATACls.getModelList(model).ToList();

            if (list.Any())
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (i != 0)
                    {
                        bool bo = ISBetweenInDistance(list[i - 1].LONGITUDE, list[i - 1].LATITUDE, list[i].LONGITUDE, list[i].LATITUDE);//去除在参数设置范围内的经纬度
                        if (bo)
                        {
                            list.Remove(list[i]);
                            --i;
                        }
                    }
                }
                ms = new MessageListObject(true, list);
            }
            return(Json(ms));
        }
示例#3
0
        /// <summary>
        /// 电量查询Html
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public JsonResult GetElectricAjax(string uid, string startTime, string endTime)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<table cellpadding=\"0\" cellspacing=\"0\">");
            sb.AppendFormat("<thead><tr>");
            sb.AppendFormat("<th>序号</th>");
            sb.AppendFormat("<th>单位</th>");
            sb.AppendFormat("<th>姓名</th>");
            sb.AppendFormat("<th>电话号码</th>");
            sb.AppendFormat("<th>时间</th>");
            sb.AppendFormat("<th>电量</th>");
            sb.AppendFormat("</tr></thead>");
            sb.AppendFormat("<tbody>");
            Message ms = null;

            if (string.IsNullOrEmpty(uid))
            {
                ms = new Message(false, "", "");
                return(Json(ms));
            }
            var sw = new T_IPS_REALDATASW();

            sw.HID       = uid;
            sw.DateBegin = startTime + " 0:00:00";
            sw.DateEnd   = endTime + " 23:59:59";
            var list = T_IPS_REALDATACls.getElectricModelList(sw).Take(500);//获取电量列表

            if (list.Any())
            {
                if (list.Count() <= 500)
                {
                    int i = 0;
                    foreach (var item in list)
                    {
                        sb.AppendFormat("<tr>");
                        sb.AppendFormat("<td>{0}</td>", ++i);
                        sb.AppendFormat("<td>{0}</td>", item.ORGNAME);
                        sb.AppendFormat("<td>{0}</td>", item.HNAME);
                        sb.AppendFormat("<td>{0}</td>", item.PHONE);
                        sb.AppendFormat("<td>{0}</td>", item.SBTIME);
                        sb.AppendFormat("<td>{0}</td>", item.ELECTRIC);
                        sb.AppendFormat("</tr>");
                    }
                }
                else
                {
                    sb.AppendFormat("<tr>");
                    sb.AppendFormat("<td colspan=\"6\">暂无电量信息</td>");
                    sb.AppendFormat("</tr>");
                    ms = new Message(false, sb.ToString(), "检索的数据量过大,请缩短时间间隔或减少查询护林员数量!");
                    return(Json(ms));
                }
            }
            else
            {
                sb.AppendFormat("<tr>");
                sb.AppendFormat("<td colspan=\"6\">暂无电量信息</td>");
                sb.AppendFormat("</tr>");
            }
            sb.AppendFormat("</tbody>");
            sb.AppendFormat("</table>");
            ms = new Message(true, sb.ToString(), "");
            return(Json(ms));
        }