Example #1
0
        private List<EMileage> GetReportTimeSpanListMileage(EHistoryDataStoreConfig config, List<Guid> vehicleCodeList, List<DateTime[]> timeSpanList, string TenantCode, bool getPostition)
        {
            IMapService mapService = new PES.GPS.MapService.MapSearchService.MapService();
            List<EMileage> list = new List<EMileage>();
            List<EGPSHistoryInfo> firstList = objReportServer.GetFirstRecordList(config, vehicleCodeList, timeSpanList, true);
            List<EGPSHistoryInfo> lastList = objReportServer.GetLastRecordList(config, vehicleCodeList, timeSpanList, true);
            if (firstList == null || firstList.Count == 0
                || lastList == null || lastList.Count == 0)
                return list;
            foreach (Guid vehicleCode in vehicleCodeList)
            {
                foreach (DateTime[] timeSpan in timeSpanList)
                {
                    EMileage Model = new EMileage();
                    Model.VehicleCode = vehicleCode;
                    Model.QueryBeginTime = timeSpan[0];
                    Model.QueryEndTime = timeSpan[1];
                    var first = firstList.Where(o => o.ReportTime >= timeSpan[0] && o.ReportTime <= timeSpan[1] && o.VehicleCode == vehicleCode).FirstOrDefault();
                    var last = lastList.Where(o => o.ReportTime >= timeSpan[0] && o.ReportTime <= timeSpan[1] && o.VehicleCode == vehicleCode).FirstOrDefault();

                    if (first == null || last == null)
                        continue;
                    Model.BeginTime = first.ReportTime;
                    if (getPostition)
                    {
                        Model.BeginLocation = InverseGeocoding(mapService, first.Latitude, first.Longitude);
                    }
                    Model.EndTime = last.ReportTime;
                    if (getPostition)
                    {
                        Model.EndLocation = InverseGeocoding(mapService, last.Latitude, last.Longitude);
                    }
                    Model.BeginMileage = decimal.Round((first.StarkMileage / 1000), 2);
                    Model.EndMileage = decimal.Round((last.StarkMileage / 1000), 2);
                    Model.TotalMileage += decimal.Round((last.StarkMileage / 1000 - first.StarkMileage / 1000), 2);
                    list.Add(Model);
                }
            }
            return list;
        }
Example #2
0
        /// <summary>
        /// 获取同一个历史数据配置,多台车辆,指定时间段内,里程汇总数据
        /// </summary>
        /// <param name="config">历史数据配置</param>
        /// <param name="vehicleList">车辆序列</param>
        /// <param name="beginTime">起始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns></returns>
        private List<EMileage> GetReportTimeSpanMileage(EHistoryDataStoreConfig config, List<Guid> vehicleList, DateTime beginTime, DateTime endTime, bool getPostition)
        {
            IMapService mapService = new PES.GPS.MapService.MapSearchService.MapService();
            List<EMileage> ModelList = new List<EMileage>();
            List<EGPSHistoryInfo> firstList = objReportServer.GetFirstRecordList(config, vehicleList, beginTime, endTime, true);
            List<EGPSHistoryInfo> lastList = objReportServer.GetLastRecordList(config, vehicleList, beginTime, endTime, true);

            if (firstList != null && lastList != null)
            {
                foreach (Guid vehicle in vehicleList)
                {
                    EMileage Model = new EMileage();
                    Model.VehicleCode = vehicle;
                    Model.QueryBeginTime = beginTime;
                    Model.QueryEndTime = endTime;

                    EGPSHistoryInfo first = firstList.Where(f => f.VehicleCode == vehicle).FirstOrDefault();
                    EGPSHistoryInfo last = lastList.Where(f => f.VehicleCode == vehicle).FirstOrDefault();

                    if (first == null || last == null)
                        continue;

                    Model.BeginTime = first.ReportTime;
                    Model.EndTime = last.ReportTime;
                    if (getPostition)
                    {
                        Model.BeginLocation = InverseGeocoding(mapService, first.Latitude, first.Longitude);
                        Model.EndLocation = InverseGeocoding(mapService, last.Latitude, last.Longitude);
                    }

                    Model.BeginMileage = decimal.Round((first.StarkMileage / 1000), 2);
                    Model.EndMileage = decimal.Round((last.StarkMileage / 1000), 2);
                    Model.TotalMileage += decimal.Round((last.StarkMileage / 1000 - first.StarkMileage / 1000), 2);

                    ModelList.Add(Model);
                }
            }

            return ModelList;
        }
Example #3
0
        //这里设为公有,是提供给其他WCF服务调用
        private EMileage GetReportTimeSpanMileage(Guid vehicleCode, DateTime StartTime, DateTime EndTime, bool getPostition)
        {
            EMileage Model = new EMileage();
            Model.VehicleCode = vehicleCode;
            Model.QueryBeginTime = StartTime;
            Model.QueryEndTime = EndTime;
            EHistoryDataStoreConfig config = tableConfigSev.GetVehicleStoreTableConfig(vehicleCode);
            IMapService mapService = new PES.GPS.MapService.MapSearchService.MapService();
            var first = objReportServer.GetFirstRecord(config, StartTime, EndTime, true);
            var last = objReportServer.GetLastRecord(config, StartTime, EndTime, true);

            if (first == null || last == null)
                return Model;
            Model.BeginTime = first.ReportTime;
            if (getPostition)
            {
                Model.BeginLocation = InverseGeocoding(mapService, first.Latitude, first.Longitude);
            }
            Model.EndTime = last.ReportTime;
            if (getPostition)
            {
                Model.EndLocation = InverseGeocoding(mapService, last.Latitude, last.Longitude);
            }
            Model.BeginMileage = decimal.Round((first.StarkMileage / 1000), 2);
            Model.EndMileage = decimal.Round((last.StarkMileage / 1000), 2);
            Model.TotalMileage += decimal.Round((last.StarkMileage / 1000 - first.StarkMileage / 1000), 2);
            return Model;
        }