/// <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; }
private VGPSHistorySection GetSection(List<EGPSHistoryInfo> list, DateTime endTime, int size) { VGPSHistorySection section = new VGPSHistorySection(); if (list.Count < size) { section.IsNext = false; section.NextBegin = endTime; section.NextEnd = endTime; } else { section.IsNext = true; section.NextBegin = list.Last().ReportTime; section.NextEnd = endTime; } return section; }
/// <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; }