Exemplo n.º 1
0
        public ActionResult GetRealTimeRectangleVehicles(GetRectangleRealTimeSingalsModel model)
        {
            List <RealTimeSignalModel> list;

            // 默认模式
            if (base.VehicleViewMode)
            {
                list = SignalBLL.GetDefaultRealTimeSingalsByRectangle(model, base.CurrentStrucID);
            }
            else
            {
                list = SignalBLL.GetRealTimeSingalsByRectangle(model, base.CurrentUserID);
            }
            if (list == null)
            {
                list = new List <RealTimeSignalModel>();
            }

            List <dynamic> resultList = new List <dynamic>();

            foreach (var item in list)
            {
                resultList.Add(new
                {
                    VID         = item.VID,
                    VN          = item.VehicleName,
                    SN          = item.StrucName,
                    Speed       = item.Speed,
                    VIN         = item.VIN,
                    SignalTime  = item.SignalDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    Icon        = item.Icon,
                    Address     = item.Address == null ? string.Empty : item.Address,
                    Latitude    = item.Latitude,
                    Longitude   = item.Longitude,
                    Direction   = GetDirection(item.Direction),
                    Angle       = item.Direction,
                    IsOnline    = item.IsOnline == 1,
                    IsRunning   = item.IsRunning == 1,
                    Mileage     = item.Mileage,
                    OilHeight   = item.OilHeight,
                    Temperature = item.Temperature,
                    ACCState    = item.ACCState == true ? "ON" : "OFF",
                    RollerState = item.RollerState,
                    PlateColor  = item.PlateColor,
                    VehicleType = item.VehicleType,
                    FlagState   = (item.PressureFlag == true ? @DisplayText.PressureUnloading + "," : "") + (item.DoorsensorFlag == true ? @DisplayText.DoorOpen : ""),
                });
            }
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult GetRealTimePolygonVehicles(string points)
        {
            List <RealTimePolygonVehiclesPoints> pointList = JsonConvert.DeserializeObject <List <RealTimePolygonVehiclesPoints> >(points);
            //过滤出包含多边形 最小正方形包含的数据
            int    count  = pointList.Count;
            double minLat = double.Parse(pointList[0].lat.ToString());
            double minLng = double.Parse(pointList[0].lng.ToString());
            double maxLat = minLat;
            double maxLng = minLng;

            for (int i = 0; i < count; i++)
            {
                double tmpLat = double.Parse(pointList[i].lat.ToString());
                double tmpLng = double.Parse(pointList[i].lng.ToString());
                if (tmpLat < minLat)
                {
                    minLat = tmpLat;
                }
                if (tmpLng < minLng)
                {
                    minLng = tmpLng;
                }
                if (tmpLat > maxLat)
                {
                    maxLat = tmpLat;
                }
                if (tmpLng > maxLng)
                {
                    maxLng = tmpLng;
                }
            }

            List <RealTimeSignalModel> list;

            // 默认模式
            if (base.VehicleViewMode)
            {
                list = SignalBLL.GetDefaultRealTimeSingalsByRectangle(new GetRectangleRealTimeSingalsModel()
                {
                    LatMax = maxLat,
                    LatMin = minLat,
                    LngMax = maxLng,
                    LngMin = minLng
                }, base.CurrentStrucID);
            }
            else
            {
                list = SignalBLL.GetRealTimeSingalsByRectangle(new GetRectangleRealTimeSingalsModel()
                {
                    LatMax = maxLat,
                    LatMin = minLat,
                    LngMax = maxLng,
                    LngMin = minLng
                }, base.CurrentUserID);
            }
            if (list == null)
            {
                list = new List <RealTimeSignalModel>();
            }
            List <dynamic> resultList = new List <dynamic>();

            foreach (var item in list)
            {
                resultList.Add(new
                {
                    VID         = item.VID,
                    VN          = item.VehicleName,
                    SN          = item.StrucName,
                    Speed       = item.Speed,
                    VIN         = item.VIN,
                    SignalTime  = item.SignalDateTime.ToString("yyyy-MM-dd HH:mm:ss"),
                    Icon        = item.Icon,
                    Address     = item.Address == null ? string.Empty : item.Address,
                    Latitude    = item.Latitude,
                    Longitude   = item.Longitude,
                    Direction   = GetDirection(item.Direction),
                    Angle       = item.Direction,
                    IsOnline    = item.IsOnline == 1,
                    IsRunning   = item.IsRunning == 1,
                    Mileage     = item.Mileage,
                    OilHeight   = item.OilHeight,
                    Temperature = item.Temperature,
                    ACCState    = item.ACCState == true ? "ON" : "OFF",
                    RollerState = item.RollerState,
                    PlateColor  = item.PlateColor,
                    VehicleType = item.VehicleType,
                    FlagState   = (item.PressureFlag == true ? @DisplayText.PressureUnloading + "," : "") + (item.DoorsensorFlag == true ? @DisplayText.DoorOpen : ""),
                });
            }
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }