Ejemplo n.º 1
0
        /// <summary>
        /// 查询车辆历史数据(全部轨迹,分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isRevise"></param>
        /// <returns></returns>
        public VGPSHistorySection GetAllHistorySection(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType)
        {
            VGPSHistorySection section = this.SearchHistorySection(vehicleCode, beginTime, endTime, mapType, int.MaxValue);

            List<VGPSHistoryRunInfo> listViewModel = section.CurrentHistoryInfos.Select(o => new VGPSHistoryRunInfo()
            {
                Latitude = o.Latitude,
                Longitude = o.Longitude,
                ReportTime = o.ReportTime,
                Speed = o.Speed,
                Direction = o.Direction,
                Mileage = o.Mileage,
                StopTime = o.StopTime
            }).ToList<VGPSHistoryRunInfo>();

            VGPSHistorySection viewModel = new VGPSHistorySection()
            {
                IsNext = section.IsNext,
                NextBegin = section.NextBegin,
                NextEnd = section.NextEnd,
                CurrentHistoryInfos = listViewModel,
                LastPointIsStop = section.LastPointIsStop,
                LastStopTime = section.LastStopTime
            };

            return viewModel;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取历史轨迹(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public VGPSHistorySection GetHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType, int size)
        {
            EHistoryDataStoreConfig tableConfig = DataStoreConfigSev.GetVehicleStoreTableConfig(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(tableConfig, beginTime, endTime, size);

            VGPSHistorySection section = GetSection(currentHistoryInfo, endTime, size);

            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            //if (ltHistoryInfo_All == null || ltHistoryInfo_All.Count == 0)
            //{
            //    return null;
            //}
            List<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryRunInfo(ltHistoryInfo_All);

            //ConvertLatLonHelper.ConvertToWebLatLonBatch(ltHistoryRunInfo, mapType);


            //若没有历史数据,则再查询一次
            section.CurrentHistoryInfos = ltHistoryRunInfo;
            if (ltHistoryRunInfo.Count == 0 && section.IsNext)
            {
                section = GetHistoryLocus(vehicleCode, section.NextBegin, section.NextEnd, mapType, size);
            }
            return section;
        }
Ejemplo n.º 3
0
 public CoordsDistributor(EnumMapType type)
 {
     Type   = type;
     coords = new List <Coordinate>();
     if (type == EnumMapType.small)
     {
         coords.AddRange(new List <Coordinate>
         {
             new Coordinate(0, 0, EnumCoordinateType.Harbour, EnumHarbourDirection.downright), new Coordinate(0, 1, EnumCoordinateType.Sea), new Coordinate(0, 2, EnumCoordinateType.Harbour, EnumHarbourDirection.downleft), new Coordinate(0, 3, EnumCoordinateType.Sea),
             new Coordinate(1, 0, EnumCoordinateType.Sea), new Coordinate(1, 1, EnumCoordinateType.Land), new Coordinate(1, 2, EnumCoordinateType.Land), new Coordinate(1, 3, EnumCoordinateType.Land), new Coordinate(1, 4, EnumCoordinateType.Harbour, EnumHarbourDirection.downleft),
             new Coordinate(2, 0, EnumCoordinateType.Harbour, EnumHarbourDirection.right), new Coordinate(2, 1, EnumCoordinateType.Land), new Coordinate(2, 2, EnumCoordinateType.Land), new Coordinate(2, 3, EnumCoordinateType.Land), new Coordinate(2, 4, EnumCoordinateType.Land), new Coordinate(2, 5, EnumCoordinateType.Sea),
             new Coordinate(3, 0, EnumCoordinateType.Sea), new Coordinate(3, 1, EnumCoordinateType.Land), new Coordinate(3, 2, EnumCoordinateType.Land), new Coordinate(3, 3, EnumCoordinateType.Land), new Coordinate(3, 4, EnumCoordinateType.Land), new Coordinate(3, 5, EnumCoordinateType.Land), new Coordinate(3, 6, EnumCoordinateType.Harbour, EnumHarbourDirection.left),
             new Coordinate(4, 1, EnumCoordinateType.Harbour, EnumHarbourDirection.right), new Coordinate(4, 2, EnumCoordinateType.Land), new Coordinate(4, 3, EnumCoordinateType.Land), new Coordinate(4, 4, EnumCoordinateType.Land), new Coordinate(4, 5, EnumCoordinateType.Land), new Coordinate(4, 6, EnumCoordinateType.Sea),
             new Coordinate(5, 2, EnumCoordinateType.Sea), new Coordinate(5, 3, EnumCoordinateType.Land), new Coordinate(5, 4, EnumCoordinateType.Land), new Coordinate(5, 5, EnumCoordinateType.Land), new Coordinate(5, 6, EnumCoordinateType.Harbour, EnumHarbourDirection.topleft),
             new Coordinate(6, 3, EnumCoordinateType.Harbour, EnumHarbourDirection.topright), new Coordinate(6, 4, EnumCoordinateType.Sea), new Coordinate(6, 5, EnumCoordinateType.Harbour, EnumHarbourDirection.topleft), new Coordinate(6, 6, EnumCoordinateType.Sea),
         });
     }
     if (type == EnumMapType.big)
     {
         coords.AddRange(new List <Coordinate>
         {
             new Coordinate(0, 0, EnumCoordinateType.Harbour, EnumHarbourDirection.downright), new Coordinate(0, 1, EnumCoordinateType.Sea), new Coordinate(0, 2, EnumCoordinateType.Harbour, EnumHarbourDirection.downleft), new Coordinate(0, 3, EnumCoordinateType.Sea),
             new Coordinate(1, 0, EnumCoordinateType.Sea), new Coordinate(1, 1, EnumCoordinateType.Land), new Coordinate(1, 2, EnumCoordinateType.Land), new Coordinate(1, 3, EnumCoordinateType.Land), new Coordinate(1, 4, EnumCoordinateType.Harbour, EnumHarbourDirection.downleft),
             new Coordinate(2, 0, EnumCoordinateType.Harbour, EnumHarbourDirection.downright), new Coordinate(2, 1, EnumCoordinateType.Land), new Coordinate(2, 2, EnumCoordinateType.Land), new Coordinate(2, 3, EnumCoordinateType.Land), new Coordinate(2, 4, EnumCoordinateType.Land), new Coordinate(2, 5, EnumCoordinateType.Sea),
             new Coordinate(3, 0, EnumCoordinateType.Sea), new Coordinate(3, 1, EnumCoordinateType.Land), new Coordinate(3, 2, EnumCoordinateType.Land), new Coordinate(3, 3, EnumCoordinateType.Land), new Coordinate(3, 4, EnumCoordinateType.Land), new Coordinate(3, 5, EnumCoordinateType.Land), new Coordinate(3, 6, EnumCoordinateType.Harbour, EnumHarbourDirection.left),
             new Coordinate(4, 0, EnumCoordinateType.Harbour, EnumHarbourDirection.right), new Coordinate(4, 1, EnumCoordinateType.Land), new Coordinate(4, 2, EnumCoordinateType.Land), new Coordinate(4, 3, EnumCoordinateType.Land), new Coordinate(4, 4, EnumCoordinateType.Land), new Coordinate(4, 5, EnumCoordinateType.Land), new Coordinate(4, 6, EnumCoordinateType.Land), new Coordinate(4, 7, EnumCoordinateType.Sea),
             new Coordinate(5, 1, EnumCoordinateType.Sea), new Coordinate(5, 2, EnumCoordinateType.Land), new Coordinate(5, 3, EnumCoordinateType.Land), new Coordinate(5, 4, EnumCoordinateType.Land), new Coordinate(5, 5, EnumCoordinateType.Land), new Coordinate(5, 6, EnumCoordinateType.Land), new Coordinate(5, 7, EnumCoordinateType.Harbour, EnumHarbourDirection.left),
             new Coordinate(6, 2, EnumCoordinateType.Harbour, EnumHarbourDirection.topright), new Coordinate(6, 3, EnumCoordinateType.Land), new Coordinate(6, 4, EnumCoordinateType.Land), new Coordinate(6, 5, EnumCoordinateType.Land), new Coordinate(6, 6, EnumCoordinateType.Land), new Coordinate(6, 7, EnumCoordinateType.Sea),
             new Coordinate(7, 3, EnumCoordinateType.Sea), new Coordinate(7, 4, EnumCoordinateType.Land), new Coordinate(7, 5, EnumCoordinateType.Land), new Coordinate(7, 6, EnumCoordinateType.Land), new Coordinate(7, 7, EnumCoordinateType.Harbour, EnumHarbourDirection.topleft),
             new Coordinate(8, 4, EnumCoordinateType.Harbour, EnumHarbourDirection.topright), new Coordinate(8, 5, EnumCoordinateType.Sea), new Coordinate(8, 6, EnumCoordinateType.Harbour, EnumHarbourDirection.topleft), new Coordinate(8, 7, EnumCoordinateType.Sea),
         });
     }
 }
Ejemplo n.º 4
0
        public Map(EnumMapType maptype)
        {
            tiles        = new List <ITile>();
            this.maptype = maptype;

            TileDistributor   = new TileDistributor(maptype);
            NumberDistributor = new NumberDistributor(maptype);
            CoordsDistributor = new CoordsDistributor(maptype);
            createtiles(maptype);
        }
Ejemplo n.º 5
0
 public TileDistributor(EnumMapType type)
 {
     Tiletypes = new List <ITileType>();
     if (type == EnumMapType.small)
     {
         SetTileTypes();
     }
     if (type == EnumMapType.big)
     {
         SetLargeTileTypes();
     }
     shuffleTileList();
 }
Ejemplo n.º 6
0
 public void createtiles(EnumMapType type)
 {
     if (type == EnumMapType.small)
     {
         tiles.Add(CreateDesertTile());
     }
     if (type == EnumMapType.big)
     {
         tiles.Add(CreateDesertTile());
         tiles.Add(CreateDesertTile());
     }
     CreateLandTilesFor6And8();
     tiles.AddRange(CreateRemainingNumbersForTiles());
     tiles.AddRange(CreateHarbourTiles());
     tiles.AddRange(CreateSeaTiles());
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 查询车辆历史数据(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isRevise"></param>
        /// <returns></returns>
        public GPSHistorySectionViewModel GetSectionHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime, TimeSpan overTime, TimeSpan? lastStopTime, int RecordNum, EnumMapType mapType)
        {
            HistoryLocusService service = new HistoryLocusService();

            if (RecordNum < 1)
                RecordNum = _VehicleLocusSize;

            VGPSHistorySection section = service.GetHistoryLocus(vehicleCode, beginTime, endTime, mapType, RecordNum, overTime, lastStopTime);

            GPSHistorySectionViewModel res = new GPSHistorySectionViewModel();
            res.IsNext = section.IsNext;
            res.NextBegin = section.NextBegin;
            res.NextEnd = section.NextEnd;
            res.PlayKey = Guid.Empty;
            res.LastPointIsStop = section.LastPointIsStop;
            res.LastStopTime = section.LastStopTime;

            if (!section.CurrentHistoryInfos.IsNullOrEmpty())
            {
                res.CurrentHistoryInfos = new List<HistoryLocusViewModel>();
                foreach (var item in section.CurrentHistoryInfos)
                {
                    res.CurrentHistoryInfos.Add(new HistoryLocusViewModel
                    {
                        Latitude = item.Latitude,
                        Longitude = item.Longitude,
                        EncodeLatLon = item.EncodeLatLon,
                        ReportTime = item.ReportTime,
                        Speed = item.Speed,
                        Direction = item.Direction,
                        Mileage = item.Mileage,
                        StarkMileage = item.StarkMileage,
                        StopTime = item.StopTime,
                        StopTimeBegin = item.StopTimeBegin,
                        StopTimeEnd = item.StopTimeEnd,
                        Description = item.Description,
                        IsNotSureStop = item.IsNotSureStop,
                        IsStop = item.IsStop,
                        IsPoweOff = item.IsPoweOff,
                        IsRob = item.IsRob
                    });
                }
            }

            return res;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 标记列表分页
 /// </summary>
 public MapElementCollectionsViewModel MapElementList(string tenantCode, int searchType, int pageIndex, int pageSize, EnumMapType mapType)
 {
     try
     {
         if (searchType == 1)
         {
             return LoadMarkAndArea(tenantCode, pageIndex, pageSize, mapType);
         }
         else if (searchType == 2)
         {
             return LoadMark(tenantCode, pageIndex, pageSize, mapType);
         }
         else
         {
             return LoadArea(tenantCode, pageIndex, pageSize, mapType);
         }
     }
     catch (Exception ex)
     {
         Logger.Error("MapElementList" + ex.Message, ex);
     }
     return new MapElementCollectionsViewModel();
 }
Ejemplo n.º 9
0
        private VMarkElement ConvertMarkElementEntityToViewModel(EMapMark entity, EnumMapType mapType)
        {
            VMarkElement returnValue = new VMarkElement();
            returnValue.RecordID = entity.RecordID.ToString();
            returnValue.Name = entity.Name;
            returnValue.TenantCode = entity.TenantCode;
            returnValue.UserCode = entity.UserCode;
            returnValue.Description = entity.Description;
            returnValue.Type = entity.Type;
            returnValue.Zoom = entity.Zoom;
            returnValue.Lon = entity.Longitude;
            returnValue.Lat = entity.Latitude;
            returnValue.EncodeLatLon = new PES.GPSExpressEdition.MapService.MapSearchService.MapService().Encode(returnValue.Lat.ToString(), returnValue.Lon.ToString());

            return returnValue;
        }
Ejemplo n.º 10
0
        public VCurrentInfo GetSingleCurrentInfoList(Guid vehicleCode, EnumMapType mapType)
        {
            VMonitorVehicle vehicleDetailInfo = DACFacade.Movo.VehicleDAC.Select(vehicleCode, mapType);

            VCurrentInfo vm = new VCurrentInfo();
            vm.LicenceNumber = vehicleDetailInfo.LicenceNumber;
            vm.Direction = vehicleDetailInfo.Direction;
            vm.Latitude = vehicleDetailInfo.Lat;
            vm.Longitude = vehicleDetailInfo.Lng;
            vm.ReportTime = vehicleDetailInfo.ReportTime;
            vm.VehicleCode = vehicleCode;
            vm.GPSCode = vehicleDetailInfo.GPSCode;
            vm.Speed = vehicleDetailInfo.Speed;
            if (vehicleDetailInfo.ReportTime.HasValue)
            {
                vm.RunningOrOffTime = DACFacade.Gps.GPSHistoryDAC.GetRunngingOrOffTime(vehicleCode, vehicleDetailInfo.ReportTime.Value, vehicleDetailInfo.Acc);
            }
            vm.Acc = vehicleDetailInfo.Acc;
            vm.TotalMileage = GetTotalMileage(vehicleCode, vehicleDetailInfo.ReportTime.Value);
            vm.Location = vehicleDetailInfo.Location;
            vm.RoadName = vehicleDetailInfo.RoadName;
            vm.City = vehicleDetailInfo.City;
            vm.GPSTypeName = vehicleDetailInfo.GPSTypeName;
            vm.IsStop = vehicleDetailInfo.IsStop;
            vm.IsOverdue = vehicleDetailInfo.IsOverdue;
            vm.IsWarning = vehicleDetailInfo.IsWarning;
            if (vm.GPSTypeName.Contains("GT06") || vm.GPSTypeName.Contains("BuBiao") || vm.GPSTypeName.Contains("MOVO HB A5"))
            {
                if (vm.Acc == 1)
                {
                    vm.ACCState = "点火";
                }
                else
                {
                    vm.ACCState = "熄火";
                }
            }
            else
            {
                vm.ACCState = "-";
            }
            return vm;
        }
Ejemplo n.º 11
0
        public List<MonitorVehicleEntity> GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType, string vehGroupID)
        {
            if (string.IsNullOrEmpty(userCode) || string.IsNullOrEmpty(tenantCode))
            {
                Logger.Info("PositioningWCFService/GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType),参数(userCode 或 tenantCode)为空。");
                return null;
            }

            try
            {
                var res = new VehicleDAL().GetMonitorVehicleList(userCode, tenantCode, mapType, vehGroupID);
                return res;
            }
            catch (Exception ex)
            {
                Logger.Error("PositioningWCFService/GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType)," + ex.Message, ex);
                return null;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 查询历史轨迹(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isRevise"></param>
        /// <param name="size"></param>
        /// <param name="overTime">停车时长</param>
        /// <param name="lastStopTime">最后一个停止点与本段数据最后一个点的时间间隔</param>
        /// <returns></returns>
        public VGPSHistorySection SearchHistorySection(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType, int size, TimeSpan overTime, TimeSpan? lastStopTime)
        {
            bool? lastPointIsStop = null;
            if (lastStopTime != null)
                lastPointIsStop = false;

            EHistoryDataStoreConfig tableConfig = DACFacade.Gps.HistoryDataStoreConfigDAC.Select(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(tableConfig, beginTime, endTime, size);

            // 计算size后面是否还有记录
            VGPSHistorySection section = GetSection(currentHistoryInfo, endTime, size);

            // 处理漂移数据和补传数据
            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            //获得轨迹点和停车点信息
            List<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryWithStopInfo(ltHistoryInfo_All, overTime, ref lastStopTime, ref lastPointIsStop);
            section.LastStopTime = lastStopTime;
            section.LastPointIsStop = lastPointIsStop;

            if (mapType == EnumMapType.MapBar)
                LatLonModel.EncodeMapbarLatLon(ltHistoryRunInfo); //加密经纬度
            else
                LatLonModel.ConvertToWebLatLonBatch(ltHistoryRunInfo, mapType);

            //若没有历史数据,则再查询一次
            section.CurrentHistoryInfos = ltHistoryRunInfo;
            //chenhuan
            //if (ltHistoryRunInfo.Count == 0 && section.IsNext)
            //{
            //    section = SearchHistorySection(vehicleCode, section.NextBegin, section.NextEnd, mapType, size, overTime, lastStopTime);
            //}

            return section;
        }
Ejemplo n.º 13
0
        public NumberDistributor(EnumMapType maptype)
        {
            Shuffler shuffler = new Shuffler();

            if (maptype == EnumMapType.small)
            {
                numberlist.Add(2);
                numberlist.Add(3);
                numberlist.Add(3);
                numberlist.Add(4);
                numberlist.Add(4);
                numberlist.Add(5);
                numberlist.Add(5);
                numberlist.Add(6);
                numberlist.Add(6);
                numberlist.Add(7);
                numberlist.Add(8);
                numberlist.Add(8);
                numberlist.Add(9);
                numberlist.Add(9);
                numberlist.Add(10);
                numberlist.Add(10);
                numberlist.Add(11);
                numberlist.Add(11);
                numberlist.Add(12);
            }
            if (maptype == EnumMapType.big)
            {
                numberlist.Add(2);
                numberlist.Add(2);
                numberlist.Add(3);
                numberlist.Add(3);
                numberlist.Add(3);
                numberlist.Add(4);
                numberlist.Add(4);
                numberlist.Add(4);
                numberlist.Add(5);
                numberlist.Add(5);
                numberlist.Add(5);
                numberlist.Add(6);
                numberlist.Add(6);
                numberlist.Add(6);
                numberlist.Add(7);
                numberlist.Add(7);
                numberlist.Add(8);
                numberlist.Add(8);
                numberlist.Add(8);
                numberlist.Add(9);
                numberlist.Add(9);
                numberlist.Add(9);
                numberlist.Add(10);
                numberlist.Add(10);
                numberlist.Add(10);
                numberlist.Add(11);
                numberlist.Add(11);
                numberlist.Add(11);
                numberlist.Add(12);
                numberlist.Add(12);
            }
            shuffler.Shuffle(numberlist);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 获取历史轨迹
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IList<VGPSHistoryRunInfo> SearchHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType)
        {
            EHistoryDataStoreConfig tableConfig = DACFacade.Gps.HistoryDataStoreConfigDAC.Select(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = DACFacade.Gps.GPSHistoryDAC.SelectList(tableConfig, beginTime, endTime);

            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            if (ltHistoryInfo_All == null || ltHistoryInfo_All.Count == 0)
            {
                return null;
            }
            IList<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryRunInfo(ltHistoryInfo_All);
            LatLonModel.ConvertToWebLatLonBatch(ltHistoryRunInfo, mapType);

            return ltHistoryRunInfo;
        }
Ejemplo n.º 15
0
        private VMapElementCollections LoadMark(string tenantCode, int pageIndex, int pageSize, EnumMapType mapType)
        {
            VMapElementCollections returnValue = new VMapElementCollections();
            int total = 0;
            IList<EMapMark> ltMarkEntity = DACFacade.Gps.MapMarkDAC.SelectList(tenantCode, pageIndex, pageSize, out total);
            if (ltMarkEntity != null)
            {
                LatLonModel.ConvertToWebLatLon<EMapMark>(ltMarkEntity, mapType);

                returnValue.MapElementCount = total;
                foreach (var e in ltMarkEntity)
                {
                    returnValue.MapElementCollections.Add(ConvertEMapMarkForBind(e));
                }
            }
            return returnValue;
        }
Ejemplo n.º 16
0
        private VMapElementCollections LoadMarkAndArea(string tenantCode, int pageIndex, int pageSize, EnumMapType mapType)
        {
            VMapElementCollections returnValue = new VMapElementCollections();
            int markTotal = 0;
            List<BaseMapElement> ltBaseEle = new List<BaseMapElement>();

            IList<EMapMark> markEntity = DACFacade.Gps.MapMarkDAC.SelectList(tenantCode, 0, 50000, out markTotal);
            if (markEntity != null && markEntity.Count > 0)
            {
                foreach (var item in markEntity)
                {
                    ltBaseEle.Add(item);
                }
            }
            int areaTotal = 0;
            IList<EMapArea> areaEntity = DACFacade.Gps.MapAreaDAC.SelectList(tenantCode, 0, 50000, out areaTotal);
            if (areaEntity != null && areaEntity.Count > 0)
            {
                foreach (var item in areaEntity)
                {
                    ltBaseEle.Add(item);
                }
            }
            ltBaseEle = ltBaseEle.OrderByDescending(o => o.CreateTime).ToList();
            if (ltBaseEle.Count >= pageSize)
            {
                int pageCount = ((ltBaseEle.Count - 1) / pageSize + 1);//总的页数
                if (pageCount > 0 && pageIndex >= pageCount)
                    pageIndex = pageCount - 1;

                ltBaseEle = ltBaseEle.Skip(pageIndex * pageSize).ToList();
                if (ltBaseEle.Count > pageSize)
                {
                    ltBaseEle = ltBaseEle.Take(pageSize).ToList();
                }
            }
            returnValue.MapElementCollections = ConvertMapElementVM(ltBaseEle, mapType);

            returnValue.MapElementCount = markTotal + areaTotal;
            return returnValue;
        }
Ejemplo n.º 17
0
        private IList<VMapElementModelByBind> ConvertMapElementVM(IList<BaseMapElement> listSub, EnumMapType mapType)
        {
            IList<EMapMark> ltMark = new List<EMapMark>();
            IList<EMapArea> ltArea = new List<EMapArea>();

            foreach (var item in listSub)
            {
                if (item is EMapArea)
                {
                    ltMark.Add(item as EMapMark);
                }
                else
                {
                    ltArea.Add(item as EMapArea);
                }
            }

            LatLonModel.ConvertToWebLatLon<EMapMark>(ltMark, mapType);

            LatLonModel.ConvertToWebLatLon<EMapArea>(ltArea, mapType);

            List<VMapElementModelByBind> ltVM = new List<VMapElementModelByBind>();
            foreach (var item in ltMark)
            {
                ltVM.Add(ConvertEMapMarkForBind(item));
            }
            foreach (var item in ltArea)
            {
                ltVM.Add(ConvertEMapAreaForBind(item));
            }
            return ltVM.OrderByDescending(s => s.CreateDate).ToList();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 新增标记查询转换
        /// </summary>
        /// <param name="listSub"></param>
        /// <param name="mapType"></param>
        /// <returns></returns>
        private IList<VMapElementModelByBind> ConvertMarkSearchVM(IList<EMapArea> listSub, EnumMapType mapType)
        {
            List<VMapElementModelByBind> ltVM = new List<VMapElementModelByBind>();

            foreach (var item in listSub)
            {
                if (item.MarkType.Equals(VMapElementModelByBind.Area_Type))
                {
                    List<LatLon> oldLatLonList = new List<LatLon>();
                    var latLngStrList = item.Points.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var latLngStritem in latLngStrList)
                    {
                        var latlngstr = latLngStritem.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        oldLatLonList.Add(new LatLon
                        {
                            Latitude = Convert.ToDouble(latlngstr[0]),
                            Longitude = Convert.ToDouble(latlngstr[1])
                        });
                    }
                    var newLatLonList = LatLonModel.GetWebLatLon(oldLatLonList, mapType);
                    StringBuilder ssLatLon = new StringBuilder();
                    foreach (var newLatLonitem in newLatLonList)
                    {
                        ssLatLon.AppendFormat("{0},{1};", newLatLonitem.Latitude, newLatLonitem.Longitude);
                    }
                    ltVM.Add(new VMapElementModelByBind
                    {
                        RecordID = item.RecordID.ToString(),
                        Name = item.Name,
                        Description = item.Description,
                        MarkType = VMapElementModelByBind.Area_Type,
                        Lat = item.Latitude,
                        Lon = item.Longitude,
                        CreateDate = item.CreateTime,
                        Zoom = item.Zoom,
                        Points = ssLatLon.ToString()
                    });
                }
                else
                {
                    var singeLatlng = LatLonModel.GetWebLatLon(new List<LatLon> { new LatLon { Latitude = item.Latitude, Longitude = item.Longitude } }, mapType);
                    ltVM.Add(new VMapElementModelByBind
                    {
                        RecordID = item.RecordID.ToString(),
                        Name = item.Name,
                        Description = item.Description,
                        MarkType = VMapElementModelByBind.Mark_Type,
                        Lat = singeLatlng[0].Latitude,
                        Lon = singeLatlng[0].Longitude,
                        CreateDate = item.CreateTime,
                        Zoom = item.Zoom,
                        Points = item.Points
                    });
                }
            }

            return ltVM;
        }
Ejemplo n.º 19
0
        public VMapElementCollections MapMarkerSearchList(string userCode, string tenantCode, string markName, int pageIndex, int pageSize, ref int pageCount, string orderBy, EnumMapType mapType, int markType)
        {
            VMapElementCollections returnValue = new VMapElementCollections();

            //查询数据库获取标记List
            List<EMapArea> lsMarkArea = new List<EMapArea>();
            lsMarkArea = DACFacade.Gps.MapAreaDAC.SelectList(Convert.ToUInt64(userCode), Convert.ToUInt64(tenantCode), markName, pageIndex, pageSize, orderBy, ref pageCount, markType);
            if (lsMarkArea != null)
            {
                //ConvertMarkSearchVM转换返回
                returnValue.MapElementCollections = ConvertMarkSearchVM(lsMarkArea, mapType);
            }
            returnValue.MapElementCount = pageCount;
            return returnValue;
        }
Ejemplo n.º 20
0
 /// <summary>
 /// 标记列表分页
 /// </summary>
 public VMapElementCollections MapElementList(string tenantCode, int searchType, int pageIndex, int pageSize, EnumMapType mapType)
 {
     if (searchType == 1)
     {
         return LoadMarkAndArea(tenantCode, pageIndex, pageSize, mapType);
     }
     else if (searchType == 2)
     {
         return LoadMark(tenantCode, pageIndex, pageSize, mapType);
     }
     else
     {
         return LoadArea(tenantCode, pageIndex, pageSize, mapType);
     }
 }
Ejemplo n.º 21
0
        public List<VMonitorVehicle> GetWithMonitorVehicleList(EnumMapType mapType, List<Guid> vehicleCodes)
        {
            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(vehicleCodes, mapType);
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            foreach (var item in list)
            {
                if (item.ExpireTime.HasValue && item.ExpireTime.Value.Date < DateTime.Now.Date)
                {
                    item.IsOverdue = true;
                }
                if (item.AlarmType != null)
                {
                    item.IsWarning = true;
                }
                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    switch (mapType)
                    {
                        case EnumMapType.GoogleCN:
                            latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                            break;

                        case EnumMapType.BaiduMap:
                            latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                            break;
                    }
                    if (latlon != null)
                    {
                        item.Lng = latlon.Longitude;
                        item.Lat = latlon.Latitude;
                    }
                }
            }

            return list;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 获取历史轨迹
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public IList<VGPSHistoryRunInfo> GetHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime,EnumMapType mapType)
        {
            EHistoryDataStoreConfig tableConfig = DataStoreConfigSev.GetVehicleStoreTableConfig(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(tableConfig, beginTime, endTime);

            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            if (ltHistoryInfo_All == null || ltHistoryInfo_All.Count == 0)
            {
                return null;
            }
            IList<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryRunInfo(ltHistoryInfo_All);
            ConvertLatLonHelper.ConvertToWebLatLonBatch(ltHistoryRunInfo, mapType);

            return ltHistoryRunInfo;
        }
Ejemplo n.º 23
0
        private void SetWebLatLon(List<VCurrentInfo> list, EnumMapType mapType)
        {
            List<LatLon> ltLatLon = new List<LatLon>();
            foreach (var item in list)
            {
                if (!item.Longitude.HasValue || !item.Latitude.HasValue)
                    continue;
                ltLatLon.Add(new LatLon() { Latitude = item.Latitude.Value, Longitude = item.Longitude.Value });
            }

            IList<LatLon> ltWebLatLon = LatLonModel.GetWebLatLon(ltLatLon, mapType);

            int ide = 0;
            for (int i = 0; i < list.Count; i++)
            {
                if (!list[i].Longitude.HasValue || !list[i].Latitude.HasValue)
                    continue;
                list[i].Latitude = ltWebLatLon[ide].Latitude;
                list[i].Longitude = ltWebLatLon[ide].Longitude;
                ide++;
            }
        }
Ejemplo n.º 24
0
        private VAreaElement ConvertAreaElementEntityToViewModel(EMapArea entity, EnumMapType mapType)
        {
            VAreaElement returnValue = new VAreaElement();

            returnValue.RecordID = entity.RecordID.ToString();
            returnValue.Name = entity.Name;
            returnValue.UserCode = entity.UserCode.ToString();
            returnValue.TenantCode = entity.TenantCode.ToString();
            returnValue.Description = entity.Description;
            returnValue.Type = entity.Type;
            returnValue.Points = entity.Points;

            returnValue.Acreage = entity.Acreage;
            returnValue.ShapeType = entity.ShapeType;
            returnValue.BorderColor = entity.BorderColor;
            returnValue.Length = entity.Length;
            returnValue.Width = entity.Width;
            returnValue.Radius = entity.Radius;
            returnValue.Zoom = entity.Zoom;
            return returnValue;
        }
Ejemplo n.º 25
0
        private void SetWebLatLon(List<CurrentInfoViewModel> list, EnumMapType mapType)
        {
            try
            {
                if (!list.IsNullOrEmpty())
                {
                    List<LatLon> ltLatLon = new List<LatLon>();
                    foreach (var item in list)
                    {
                        if (!item.Longitude.HasValue || !item.Latitude.HasValue)
                            continue;
                        ltLatLon.Add(new LatLon() { Latitude = item.Latitude.Value, Longitude = item.Longitude.Value });
                    }

                    IList<LatLon> ltWebLatLon = ConvertLatLonHelper.GetWebLatLon(ltLatLon, mapType);

                    if (!ltWebLatLon.IsNullOrEmpty())
                    {
                        int ide = 0;
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (!list[i].Longitude.HasValue || !list[i].Latitude.HasValue)
                                continue;
                            list[i].Latitude = ltWebLatLon[ide].Latitude;
                            list[i].Longitude = ltWebLatLon[ide].Longitude;
                            ide++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error("SetWebLatLon" + ex.Message, ex);
            }
        }
Ejemplo n.º 26
0
        public VCurrentInfo GetSingleCurrentInfoList(Guid vehicleCode, EnumMapType mapType)
        {
            var vehicleDetailInfo = DACFacade.Movo.VehicleDAC.Select(vehicleCode, mapType);

            VCurrentInfo vm = new VCurrentInfo();
            vm.LicenceNumber = vehicleDetailInfo.LicenceNumber;
            vm.Direction = vehicleDetailInfo.Direction;
            vm.Latitude = vehicleDetailInfo.Lat;
            vm.Longitude = vehicleDetailInfo.Lng;
            vm.ReportTime = vehicleDetailInfo.ReportTime;
            vm.VehicleCode = vehicleCode;
            vm.GPSCode = vehicleDetailInfo.GPSCode;
            vm.Speed = vehicleDetailInfo.Speed;
            if (vehicleDetailInfo.ReportTime.HasValue)
            {
                vm.RunningOrOffTime = DACFacade.Gps.GPSHistoryDAC.GetRunngingOrOffTime(vehicleCode, vehicleDetailInfo.ReportTime.Value, vehicleDetailInfo.Acc);
            }
            vm.Acc = vehicleDetailInfo.Acc;

            DateTime endTime = vehicleDetailInfo.ReportTime.Value;
            DateTime beginTime = new DateTime(endTime.Year, endTime.Month, 1);
            EMileage em = ModelFacade.Report.ReportSummaryModel.GetTimeSpanMileageReportList(vehicleCode, beginTime, endTime, false);

            vm.TotalMileage = (double)em.TotalMileage;
            vm.Location = vehicleDetailInfo.Location;
            vm.RoadName = vehicleDetailInfo.RoadName;
            vm.City = vehicleDetailInfo.City;
            vm.GPSTypeName = vehicleDetailInfo.GPSTypeName;
            vm.IsStop = vehicleDetailInfo.IsStop;
            vm.IsOverdue = vehicleDetailInfo.IsOverdue;
            vm.IsWarning = vehicleDetailInfo.IsWarning;
            if (vm.GPSTypeName.Contains("GT06"))
            {
                if (vm.Acc == 1)
                {
                    vm.ACCState = "点火";
                }
                else
                {
                    vm.ACCState = "熄火";
                }
            }
            else
            {
                vm.ACCState = "-";
            }
            return vm;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 获取车辆详细信息
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="mapType"></param>
        /// <returns></returns>
        public MonitorVehicleDetailEntity GetVehicleDetailEntity(Guid vehicleCode, EnumMapType mapType)
        {
            string cmdText = string.Format(@"SELECT v.VehicleCode, v.LicenceNumber, v.ExpireTime, v.IsStop, v.IconType, v.GPSTypeName,
c.GPSCode, c.Longitude, c.Latitude, c.ACCState, c.Speed, c.ReportTime, c.Direction, vrs.State, vrs.AlarmType 
 FROM movo_vehicle v 
      LEFT JOIN gps_currentinfo c ON v.VehicleCode = c.VehicleCode 
      LEFT JOIN gps_vehiclerunningstate vrs ON v.VehicleCode = vrs.VehicleCode 
WHERE v.VehicleCode='{0}'", vehicleCode);

            MonitorVehicleDetailEntity res = null;
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
            {
                if (sdr != null)
                {
                    if (sdr.Read())
                    {
                        res = new MonitorVehicleDetailEntity();
                        res.VehicleCode = sdr.GetStringExt(0);
                        res.LicenceNumber = sdr.GetStringExt(1);
                        res.ExpireTime = sdr.GetDateTimeNull(2);
                        res.IsStop = sdr.GetShort(3) == 1;
                        res.IconType = (EnumVehicleType)(sdr.GetInt(4));
                        res.GPSTypeName = sdr.GetStringExt(5);
                        res.GPSCode = sdr.GetStringExt(6);
                        res.Lng = sdr.GetDoubleNull(7);
                        res.Lat = sdr.GetDoubleNull(8);
                        res.Acc = sdr.GetInt(9);
                        res.Speed = sdr.GetDoubleExt(10);
                        res.ReportTime = sdr.GetDateTimeNull(11);
                        res.TotalMileage = 0;
                        res.Direction = sdr.GetDoubleExt(12);
                        res.AlarmType = sdr.GetIntNull(14);
                        res.City = string.Empty;
                        res.RoadName = string.Empty;
                        res.Location = string.Empty;
                        res.IsOverdue = false;
                        if (res.ExpireTime.HasValue && res.ExpireTime.Value.Date < DateTime.Now.Date)
                        {
                            res.IsOverdue = true;
                        }

                        res.IsWarning = false;
                        int? alarmState = sdr.GetIntNull(13);
                        if (alarmState.HasValue && alarmState.Value == 1)
                        {
                            res.IsWarning = true;
                        }
                    }
                    sdr.Close();
                    /*
                    if (res.Lng.HasValue && res.Lat.HasValue)
                    {
                        PES.GPS.MapService.Entity.LatLon _marLatLon = null;
                        try
                        {
                            switch (mapType)
                            {
                                case EnumMapType.GoogleCN:
                                    _marLatLon = gMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = res.Lng.Value, Latitude = res.Lat.Value });
                                    var googleLocation = gMapSrv.LatLngToAddr(_marLatLon);
                                    res.City = googleLocation.City;
                                    res.Location = googleLocation.Address;
                                    res.RoadName = googleLocation.RoadName;
                                    break;
                                case EnumMapType.BaiduMap:
                                    _marLatLon = bMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = res.Lng.Value, Latitude = res.Lat.Value });
                                    var baiduLocation = bMapSrv.LatLngToAddr(_marLatLon);
                                    res.City = baiduLocation.City;
                                    res.Location = baiduLocation.Address;
                                    res.RoadName = baiduLocation.RoadName;
                                    break;
                            }
                        }
                        catch (Exception ex)
                        {
                            res.City = string.Empty;
                            res.Location = string.Empty;
                            res.RoadName = string.Empty;
                            Log.Error("地图服务Http请求解析失败," + ex.Message, ex);
                        }
                        if (_marLatLon != null)
                        {
                            res.Lng = _marLatLon.Longitude;
                            res.Lat = _marLatLon.Latitude;
                        }
                        _marLatLon = null;
                    }*/
                }
            }
            return res;
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 获取历史轨迹(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <returns></returns>
        public VGPSHistorySection SearchHistorySection(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType, int size)
        {
            EHistoryDataStoreConfig tableConfig = DACFacade.Gps.HistoryDataStoreConfigDAC.Select(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(tableConfig, beginTime, endTime, size);

            VGPSHistorySection section = GetSection(currentHistoryInfo, endTime, size);

            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            List<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryRunInfo(ltHistoryInfo_All);

            //若没有历史数据,则再查询一次
            section.CurrentHistoryInfos = ltHistoryRunInfo;
            if (ltHistoryRunInfo.Count == 0 && section.IsNext)
            {
                section = SearchHistorySection(vehicleCode, section.NextBegin, section.NextEnd, mapType, size);
            }
            return section;
        }
Ejemplo n.º 29
0
        public List<MonitorVehicleEntity> GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType, string vehGroupID)
        {
            string cmdText = string.Format(@"SELECT v.VehicleCode, v.LicenceNumber, v.ExpireTime, v.IsStop, v.IconType,
c.Longitude, c.Latitude, c.ACCState, c.Speed, c.ReportTime, c.Direction, vrs.State, vrs.AlarmType 
 FROM movo_vehicle v 
      LEFT JOIN gps_currentinfo c ON v.VehicleCode = c.VehicleCode 
      LEFT JOIN gps_vehiclerunningstate vrs ON v.VehicleCode = vrs.VehicleCode 
WHERE v.TenantCode='{0}'{1}", tenantCode, (string.IsNullOrEmpty(vehGroupID) ? "" : " and v.GroupID=" + vehGroupID));

            List<MonitorVehicleEntity> res = null;
            try
            {
                using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
                {
                    if (sdr != null)
                    {
                        res = new List<MonitorVehicleEntity>();
                        MonitorVehicleEntity _tmpEntity = null;
                        while (sdr.Read())
                        {
                            _tmpEntity = new MonitorVehicleEntity();

                            _tmpEntity.VehicleCode = sdr.GetStringExt(0);
                            _tmpEntity.LicenceNumber = sdr.GetStringExt(1);
                            _tmpEntity.ExpireTime = sdr.GetDateTimeNull(2);
                            _tmpEntity.IsStop = sdr.GetInt16(3) == 1;
                            _tmpEntity.IconType = (EnumVehicleType)(sdr.GetInt16(4));
                            _tmpEntity.Lng = sdr.GetDoubleNull(5);
                            _tmpEntity.Lat = sdr.GetDoubleNull(6);
                            _tmpEntity.Acc = sdr.GetInt(7);
                            _tmpEntity.Speed = sdr.GetDoubleExt(8);
                            _tmpEntity.ReportTime = sdr.GetDateTimeNull(9);
                            _tmpEntity.Direction = sdr.GetDoubleExt(10);
                            _tmpEntity.IsWarning = false;
                            _tmpEntity.IsOverdue = false;
                            _tmpEntity.AlarmType = sdr.GetIntNull(12);
                            _tmpEntity.OrderByType = 0;

                            if (_tmpEntity.ExpireTime.HasValue && _tmpEntity.ExpireTime.Value.Date < DateTime.Now.Date)
                            {
                                _tmpEntity.IsOverdue = true;
                            }
                            if (_tmpEntity.AlarmType != null)
                            {
                                _tmpEntity.IsWarning = true;
                            }
                            res.Add(_tmpEntity);
                        }
                        sdr.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Info(ex.StackTrace + ",连接字符串:" + MySqlDB.ConnString);
                throw;
            }
            return res;
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 查询车辆历史数据(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isRevise"></param>
        /// <returns></returns>
        public VGPSHistorySection SearchHistorySection(Guid vehicleCode, DateTime beginTime, DateTime endTime, TimeSpan overTime, TimeSpan? lastStopTime, int RecordNum, EnumMapType mapType)
        {
            if (RecordNum < 1)
                RecordNum = 100;

            VGPSHistorySection section = this.SearchHistorySection(vehicleCode, beginTime, endTime, mapType, RecordNum, overTime, lastStopTime);

            VGPSHistorySection res = new VGPSHistorySection();
            res.IsNext = section.IsNext;
            res.NextBegin = section.NextBegin;
            res.NextEnd = section.NextEnd;
            res.PlayKey = Guid.Empty;
            res.LastPointIsStop = section.LastPointIsStop;
            res.LastStopTime = section.LastStopTime;

            if (!section.CurrentHistoryInfos.IsEmpty())
            {
                res.CurrentHistoryInfos = section.CurrentHistoryInfos;
                //chenhuan
                //res.CurrentHistoryInfos = new List<VGPSHistoryRunInfo>();
                //foreach (var item in section.CurrentHistoryInfos)
                //{
                //    res.CurrentHistoryInfos.Add(new VGPSHistoryRunInfo
                //    {
                //        Latitude = item.Latitude,
                //        Longitude = item.Longitude,
                //        EncodeLatLon = item.EncodeLatLon,
                //        ReportTime = item.ReportTime,
                //        Speed = item.Speed,
                //        Direction = item.Direction,
                //        Mileage = item.Mileage,
                //        StarkMileage = item.StarkMileage,
                //        StopTime = item.StopTime,
                //        StopTimeBegin = item.StopTimeBegin,
                //        StopTimeEnd = item.StopTimeEnd,
                //        Description = item.Description,
                //        IsNotSureStop = item.IsNotSureStop,
                //        IsStop = item.IsStop,
                //        IsPoweOff = item.IsPoweOff,
                //        IsRob = item.IsRob
                //    });
                //}
            }

            return res;
        }
Ejemplo n.º 31
0
        public List<MonitorVehicleEntity> GetWithMonitorVehicleList(string vehicleCodes, EnumMapType mapType)
        {
            if (string.IsNullOrEmpty(vehicleCodes))
            {
                vehicleCodes = "''";
            }
            string cmdText = string.Format(@"SELECT v.VehicleCode, v.LicenceNumber, v.ExpireTime, v.IsStop, v.IconType,
c.Longitude, c.Latitude, c.ACCState, c.Speed, c.ReportTime, c.Direction, vrs.State, vrs.AlarmType
 FROM movo_vehicle v 
      LEFT JOIN gps_currentinfo c ON v.VehicleCode = c.VehicleCode 
      LEFT JOIN gps_vehiclerunningstate vrs ON v.VehicleCode = vrs.VehicleCode 
WHERE v.VehicleCode in({0})", vehicleCodes);

            using (DbDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
            {
                if (sdr != null)
                {
                    List<MonitorVehicleEntity> res = new List<MonitorVehicleEntity>();
                    MonitorVehicleEntity _tmpEntity = null;
                    PES.GPS.MapService.Entity.LatLon _marLatLon = null;
                    while (sdr.Read())
                    {
                        _tmpEntity = new MonitorVehicleEntity
                        {
                            VehicleCode = sdr["VehicleCode"].ToString(),
                            LicenceNumber = sdr["LicenceNumber"].ToString(),
                            ExpireTime = sdr["ExpireTime"].ToDateTimeNull(),
                            IsStop = sdr["IsStop"].ToBoolean(),
                            IconType = (EnumVehicleType)(sdr["IconType"].ToInt()),
                            Lng = sdr["Longitude"].ToDoubleNull(),
                            Lat = sdr["Latitude"].ToDoubleNull(),
                            Acc = sdr["ACCState"].ToInt(),
                            Speed = sdr["Speed"].ToDouble(),
                            ReportTime = sdr["ReportTime"].ToDateTimeNull(),
                            Direction = sdr["Direction"].ToDouble(),
                            IsWarning = false,
                            IsOverdue = false,
                            AlarmType = sdr["AlarmType"].ToIntNull(),
                            OrderByType = 0
                        };
                        if (_tmpEntity.ExpireTime.HasValue && _tmpEntity.ExpireTime.Value.Date < DateTime.Now.Date)
                        {
                            _tmpEntity.IsOverdue = true;
                        }
                        if (_tmpEntity.AlarmType != null)
                        {
                            _tmpEntity.IsWarning = true;
                        }
                        if (_tmpEntity.Lng.HasValue && _tmpEntity.Lat.HasValue)
                        {
                            switch (mapType)
                            {
                                case EnumMapType.GoogleCN:
                                    _marLatLon = gMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = _tmpEntity.Lng.Value, Latitude = _tmpEntity.Lat.Value });
                                    break;
                                case EnumMapType.BaiduMap:
                                    _marLatLon = bMapSrv.LatLonToMar(new PES.GPS.MapService.Entity.LatLon { Longitude = _tmpEntity.Lng.Value, Latitude = _tmpEntity.Lat.Value });
                                    break;
                            }
                            if (_marLatLon != null)
                            {
                                _tmpEntity.Lng = _marLatLon.Longitude;
                                _tmpEntity.Lat = _marLatLon.Latitude;
                            }
                        }
                        res.Add(_tmpEntity);
                        _marLatLon = null;
                    }
                    sdr.Close();
                    return res;
                }
            }
            return null;
        }
Ejemplo n.º 32
0
 public MonitorVehicleDetailEntity GetVehicleDetailInfo(Guid vehicleCode, EnumMapType mapType)
 {
     return _VehicleDAL.GetVehicleDetailEntity(vehicleCode, mapType);
 }
Ejemplo n.º 33
0
        /// <summary>
        /// 查询历史轨迹(分页)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="isRevise"></param>
        /// <param name="size"></param>
        /// <param name="overTime">停车时长</param>
        /// <param name="lastStopTime">最后一个停止点与本段数据最后一个点的时间间隔</param>
        /// <returns></returns>
        public VGPSHistorySection GetHistoryLocus(Guid vehicleCode, DateTime beginTime, DateTime endTime, EnumMapType mapType, int size, TimeSpan overTime, TimeSpan? lastStopTime)
        {
            bool? lastPointIsStop = null;
            if (lastStopTime != null)
                lastPointIsStop = false;

            EHistoryDataStoreConfig tableConfig = DataStoreConfigDal.GetVehicleStoreTableConfig(vehicleCode);
            List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(tableConfig, beginTime, endTime, size);

            // 计算size后面是否还有记录
            VGPSHistorySection section = GetSection(currentHistoryInfo, endTime, size);

            // 处理漂移数据和补传数据
            IList<EGPSHistoryInfo> ltHistoryInfo_All = GetUpdateMileageHistory(currentHistoryInfo);

            //获得轨迹点和停车点信息
            List<VGPSHistoryRunInfo> ltHistoryRunInfo = GetHistoryWithStopInfo(ltHistoryInfo_All, overTime, ref lastStopTime, ref lastPointIsStop);
            section.LastStopTime = lastStopTime;
            section.LastPointIsStop = lastPointIsStop;

            // 添加报警点信息
            if (ltHistoryRunInfo.Count > 0)
            {
                AddAlertPoint(vehicleCode, beginTime, ltHistoryRunInfo);
            }
             
            //ConvertLatLonHelper.ConvertToWebLatLonBatch(ltHistoryRunInfo,mapType);
            if (mapType == EnumMapType.MapBar)
                ConvertLatLonHelper.EncodeMapbarLatLon(ltHistoryRunInfo); //加密经纬度
            else
                ConvertLatLonHelper.ConvertToWebLatLonBatch(ltHistoryRunInfo, mapType);

            //若没有历史数据,则再查询一次
            section.CurrentHistoryInfos = ltHistoryRunInfo;
            if (ltHistoryRunInfo.Count == 0 && section.IsNext)
            {
                section = GetHistoryLocus(vehicleCode, section.NextBegin, section.NextEnd, mapType, size, overTime, lastStopTime);
            }
            
            return section;
        }
Ejemplo n.º 34
0
        public List<VMonitorVehicle> GetMonitorVehicleList(string vehicleCode, EnumMapType mapType)
        {

            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(vehicleCode, mapType);
            list = list.OrderBy(p => p.OrderByType).ToList();
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            foreach (var item in list)
            {
                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    if (mapType == EnumMapType.GoogleCN)
                    {
                        latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                        if (latlon != null)
                        {
                            item.Lng = latlon.Longitude;
                            item.Lat = latlon.Latitude;
                        }
                    }
                }
            }
            return list;
        }
Ejemplo n.º 35
0
        public List<VMonitorVehicle> GetMonitorVehicleList(string userCode, string tenantCode, EnumMapType mapType, string vehGroupID,
            bool? isMonitorVehicles,out string rightTabHtmlAll, out string rightTabHtmlOnline, out int onlineNum)
        {
            onlineNum = 0;
            rightTabHtmlAll = string.Empty;
            rightTabHtmlOnline = string.Empty;
            List<VMonitorVehicle> list = DACFacade.Movo.VehicleDAC.SelectListByVehicleCodes(userCode, tenantCode, mapType, vehGroupID);
            list = list.OrderBy(p => p.OrderByType).ToList();
            LatLon latlon = null;
            GoogleMapService gms = new GoogleMapService();
            StringBuilder sbTabHtmlAll = new StringBuilder();
            StringBuilder sbTabHtmlOnline = new StringBuilder();

            foreach (var item in list)
            {

                EFortifyAlertsetting fortifyAlertsetting = DACFacade.Gps.FortifyAlertSettingDAC.SelectByVehicleCode(new Guid(item.VehicleCode));
                //设防按钮
                string fortifysHtml = string.Empty;
                if (fortifyAlertsetting != null && fortifyAlertsetting.Enable)
                {
                    item.IsFortify = true;
                    fortifysHtml = "<a href='#' class='al-lock' onclick='MonitorUnFortify(\"{0}\");'>取消设防</a>";
                }
                else
                {
                    fortifysHtml = "<a href='#' class='al-unlock' onclick='MonitorFortify(\"{0}\");'>设防</a>";
                }
                //obd按钮
                string obdHtml = string.Empty;
                if (item.MachineType == 1)
                {
                    obdHtml = "<a href='#' class='aLinkMonitor al-obd' onclick='OpenMonitorOBDInfo(\"{0}\")'>OBD</a>";
                }

                if (item.Lng.HasValue && item.Lat.HasValue)
                {
                    if (mapType == EnumMapType.GoogleCN)
                    {
                        latlon = gms.LatLonToMar(new LatLon { Longitude = item.Lng.Value, Latitude = item.Lat.Value });
                        if (latlon != null)
                        {
                            item.Lng = latlon.Longitude;
                            item.Lat = latlon.Latitude;
                        }
                    }
                }

                string _cssName = (item.Lng.HasValue && item.Lat.HasValue ? string.Empty : " c9");
                string checkHtml = "<div ";
                if (isMonitorVehicles != null && isMonitorVehicles.Value)
                {
                    checkHtml = "<div style='padding-top: 8px;padding-left: 4px; float: left;'><input id='chkVehicle_{0}' type='checkbox'></div><div style='width: auto;' ";
                }
                if (item.IsOverdue) // 过期
                {
                    //item.OrderByType = 3;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>过期</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName);

                    if (item.StateName != "OffLine")
                    {
                        onlineNum++;
                        sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>过期</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName);
                    }
                }
                else if (item.IsStop) // 停用
                {
                    //item.OrderByType = 4;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>停用</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    if (item.StateName != "OffLine")
                    {
                        onlineNum++;
                        sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='true' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam red'><span>{1}</span>停用</p><p class='car-fun{7}'>跟踪<a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' onclick='MonitorZoomIn();'>放大</a></p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                    }
                }
                else if (item.StateName == EnumVehicleState.Run.ToString()) // 行驶
                {

                    //item.OrderByType = 1;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>行驶</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                            item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>行驶</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);


                }
                else if (item.StateName == EnumVehicleState.Stop.ToString()) // 停止
                {
                    //item.OrderByType = 2;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>停止</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>停止</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                }
                else if (item.StateName == EnumVehicleState.OffLine.ToString()) // 离线
                {
                    //item.OrderByType = 5;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam{7}'><span>{1}</span>离线</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                }
                else if (item.StateName == EnumVehicleState.Warning.ToString()) //报警
                {
                    //item.OrderByType = 1;
                    sbTabHtmlAll.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>报警</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);

                    onlineNum++;
                    sbTabHtmlOnline.AppendFormat("<li id='LiVehicle_{0}' VehicleCode='{0}' LicenceNumber='{1}' IsOverdue='{8}' IsStop={2} Lon='{3}' Lat='{4}'>" + checkHtml + " class='car-img'><img id='ImgVehicle_{0}' src='/Content/WeChat/images/Cars/IconCar/{5}_{6}_West.png'/></div><p class='car-nam gre'><span>{1}</span>报警</p><p class='car-fun{7}'>" + obdHtml + "<a href='#' class='aLinkMonitor al-fol' onclick='OpenMonitorTrack(\"{0}\")'>跟踪</a><a class='al-tra' href='#' onclick=\"PlayHistoricalTrack('{0}');\">历史轨迹</a><a href='#' class='al-mag' onclick='MonitorZoomIn();'>放大</a>" + fortifysHtml + "</p></li>",
                        item.VehicleCode, item.LicenceNumber, item.IsStop, item.Lng, item.Lat, item.IconTypeName, item.StateName, _cssName, item.IsOverdue);
                }
            }

            if (sbTabHtmlAll.Length > 0)
                rightTabHtmlAll = sbTabHtmlAll.ToString();

            if (sbTabHtmlOnline.Length > 0)
                rightTabHtmlOnline = sbTabHtmlOnline.ToString();

            return list;
        }