Exemple #1
0
        public List<OverSpeedReportViewModel> GetOverSpeedDetailViewModel(OverSpeedReportWCFPara para)
        {
            List<OverSpeedReportViewModel> list = new List<OverSpeedReportViewModel>();

            Guid[] VehicleCodeList = para.VehicleCodeList;//车辆序列
            string[] LicenceNumberList = para.LicenceNumberList;//车牌号码序列

            ReportService ser = new ReportService();
            //获取超速行驶报警报表记录
            List<EOverSpeedDetailAlertReport> reportList = ser.GetOverSpeedDetailReportRecord(VehicleCodeList, para.BeginTime, para.EndTime);

            if (!reportList.IsNullOrEmpty())
            {
                for (int i = 0; i < reportList.Count; i++)
                {
                    if (reportList[i].AlertState == 1)
                    {
                        if (i > 0 && reportList[i - 1].AlertState == 0)
                        {
                            list.Add(new OverSpeedReportViewModel()
                            {
                                VehicleCode = reportList[i].VehicleCode,
                                LicenceNumber = reportList[i].LicenceNumber,
                                GPSReporttime = reportList[i-1].GPSReportTime.ToString("yyyy-MM-dd HH:mm"),
                                VehicleSpeed = reportList[i-1].VehicleSpeed,
                                VehiclePosition = reportList[i-1].VehiclePosition
                            });
                        }
                    }
                }
            }
            list = list.OrderBy(f => f.LicenceNumber).ToList();
            return list;
        }
Exemple #2
0
        public List<OverSpeedReportViewModel> GetOverSpeedReportViewModel(OverSpeedReportWCFPara para)
        {
            List<OverSpeedReportViewModel> list = new List<OverSpeedReportViewModel>();

            Guid[] VehicleCodeList = para.VehicleCodeList;//车辆序列
            string[] LicenceNumberList = para.LicenceNumberList;//车牌号码序列

            IReportService ser = new ReportService();
            //获取超速行驶报警报表记录
            List<EOverSpeedAlertReport> reportList = ser.GetOverSpeedAlertReportRecord(VehicleCodeList, para.BeginTime, para.EndTime);
            //循环车辆序列,统计每辆车的超速次数笥超速时长
            for (int i = 0, i_count = VehicleCodeList.Length; i < i_count; i++)
            {
                //从报表记录中筛选当前车辆的报警记录
                List<EOverSpeedAlertReport> tempList = reportList.Where(f => f.VehicleCode == VehicleCodeList[i]).ToList();
                if (tempList.Count > 0)
                {
                    //如果AlertState值为0,代表当前正在超速行驶,那么记录中AlertState值为0的记录数即是当前车辆的超速总次数
                    //int OverSpeedCount = tempList.Where(f => f.AlertState == 0).Count();
                    int OverSpeedCount = 0;
                    TimeSpan OverSpeedDuration = new TimeSpan();
                    for (int j = 0, j_count = tempList.Count; j < j_count; j++)
                    {
                        //如果AlertState值为1,代表当前已经由超速行驶转为正常行驶,那么该记录减去前一条记录的时间就是该次超速的行驶时间
                        if (tempList[j].AlertState == 1)
                        {
                            //当前记录至少为第2条记录,前且前一条记录的必须为超速行驶记录
                            if (j > 0 && tempList[j - 1].AlertState == 0)
                            {
                                //累计超速时间
                                OverSpeedDuration += tempList[j].GPSReportTime - tempList[j - 1].GPSReportTime;
                                OverSpeedCount++;
                            }
                        }
                    }
                    list.Add(new OverSpeedReportViewModel() { VehicleCode = VehicleCodeList[i], LicenceNumber = LicenceNumberList[i], OverSpeedDuration = OverSpeedDuration, OverSpeedCount = OverSpeedCount });
                }
                else//报表中找不到当前车辆的记录时,次数与时长都为0
                    list.Add(new OverSpeedReportViewModel() { VehicleCode = VehicleCodeList[i], LicenceNumber = LicenceNumberList[i], OverSpeedDuration = new TimeSpan(), OverSpeedCount = 0 });
            }

            list = list.OrderBy(f => f.LicenceNumber).ToList();
            return list;
        }
Exemple #3
0
 public List<ESmsHistory> GetSmsHistoryList(SMSHistoryPara param)
 {
     try
     {
         ReportService report = new ReportService();
         return report.GetSMSHistoryList(param.TenantCode, param.licenceNumbers, param.startDataTime, param.endDataTime);
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message);
         return null;
     }
 }
Exemple #4
0
        public List<AreaReportDetailViewModel> GetAreaReportDetailViewModel(AreaReportWCFPara para)
        {
            List<AreaReportDetailViewModel> list = new List<AreaReportDetailViewModel>();

            Guid[] VehicleCodeList = para.VehicleCodeList;//车辆序列
            string[] LicenceNumberList = para.LicenceNumberList;//车牌号码序列

            IReportService ser = new ReportService();
            //获取区域进入报警报表记录
            List<EAreaAlertDetailReport> reportList = ser.GetAreaAlertReportDetail(VehicleCodeList, para.BeginTime, para.EndTime);
            Guid InAreaid = Guid.NewGuid();
            Guid BackRecordId = Guid.NewGuid();
            AreaReportDetailViewModel entity = new AreaReportDetailViewModel();

            for (int i = 0; i < reportList.Count; i++)
            {
                if (reportList[i].IsInArea)
                {
                    entity = new AreaReportDetailViewModel();
                    entity.VehicleCode = reportList[i].VehicleCode;
                    entity.LicenceNumber = reportList[i].LicenceNumber;
                    entity.AreaName = reportList[i].AreaName;
                    entity.InAreaDate = reportList[i].GPSReportTime;
                }

                if (reportList[i].InAreaID.HasValue)
                {
                    InAreaid = reportList[i].InAreaID.Value;
                }

                // 出区域时所对应的进区域记录
                if (InAreaid.Equals(BackRecordId) && !reportList[i].IsInArea)
                {
                    entity.OutAreaDate = reportList[i].GPSReportTime;
                    entity.AreaDuration = new TimeSpan(reportList[i].StayTime);
                    list.Add(entity);
                }

                BackRecordId = reportList[i].RecordID;
            }

            list = list.OrderBy(f => f.LicenceNumber).ToList();
            return list;
        }
Exemple #5
0
        public List<AreaReportViewModel> GetAreaReportViewModel(AreaReportWCFPara para)
        {
            List<AreaReportViewModel> list = new List<AreaReportViewModel>();

            Guid[] VehicleCodeList = para.VehicleCodeList;//车辆序列
            string[] LicenceNumberList = para.LicenceNumberList;//车牌号码序列

            IReportService ser = new ReportService();
            //获取区域进入报警报表记录
            List<EAreaAlertReport> reportList = ser.GetAreaAlertReportRecord(VehicleCodeList, para.BeginTime, para.EndTime);
            //循环车辆序列,统计每辆车的区域进入次数与停留时长
            for (int i = 0, i_count = VehicleCodeList.Length; i < i_count; i++)
            {
                //从报表记录中筛选当前车辆的报警记录
                List<EAreaAlertReport> tempList = reportList.Where(f => f.VehicleCode == VehicleCodeList[i]).ToList();
                if (tempList.Count > 0)
                {
                    //如果IsInArea值为1,代表当前进入区域,那么记录中IsInArea值为1的记录数即是当前车辆的区域进入总次数
                    int AreaCount = tempList.Where(f => f.IsInArea).Count();
                    TimeSpan AreaDuration = new TimeSpan(tempList.Where(f => !f.IsInArea).Sum(f => f.StayTime));

                    int tmpHour = 0, tmpMinutes = 0;
                    for (int j = 0, j_count = tempList.Count; j < j_count; j++)
                    {
                        // 汇总的时长和明细的时长一样,2012-2-9与徐斌确认
                        if (!tempList[j].IsInArea)
                        {
                            TimeSpan tmpTS = new TimeSpan(tempList[j].StayTime);
                            if (tmpTS.Hours > 0) {
                                tmpHour += tmpTS.Hours;
                            }
                            if (tmpTS.Minutes > 0) {
                                tmpMinutes += tmpTS.Minutes;
                            }
                        }
                    }
                    // 明细的秒会被四舍五入掉的,所以在这里记为0
                    AreaDuration = new TimeSpan(tmpHour, tmpMinutes, 0);
                    list.Add(new AreaReportViewModel() { VehicleCode = VehicleCodeList[i], LicenceNumber = LicenceNumberList[i], AreaDuration = AreaDuration, AreaCount = AreaCount });
                }
                else//报表中找不到当前车辆的记录时,次数与时长都为0
                    list.Add(new AreaReportViewModel() { VehicleCode = VehicleCodeList[i], LicenceNumber = LicenceNumberList[i], AreaDuration = new TimeSpan(), AreaCount = 0 });
            }

            list = list.OrderBy(f => f.LicenceNumber).ToList();
            return list;
        }
        private Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>> GetDictionary(Guid vehicleCode, DateTime beginTime, DateTime endTime,int size)
        {
            IReportService reportService = new ReportService();

            var dic = new Dictionary<VGPSInstallationInfo, IList<EGPSHistoryInfo>>();
            IList<VGPSInstallationInfo> gpsCodeList = reportService.GetGpsRelationListForLocus(vehicleCode, beginTime, endTime);
            return GetDictionary(vehicleCode, gpsCodeList,size);
        }
 public IList<EGPSHistoryInfo> Get(Guid vehicleCode, DateTime beginTime, DateTime endTime)
 {
     var tableConfig = GetVehicleStoreTableConfig(vehicleCode);
     List<EGPSHistoryInfo> totalHistoryInfo = new List<EGPSHistoryInfo>();
     IReportService reportService = new ReportService();
     IList<VGPSInstallationInfo> installationList = reportService.GetGpsRelationListForLocus(vehicleCode, beginTime, endTime);
     foreach (VGPSInstallationInfo installation in installationList)
     {
         List<EGPSHistoryInfo> currentHistoryInfo = GetGPSHistoryInfoList(vehicleCode, installation, tableConfig);
         if (currentHistoryInfo != null && currentHistoryInfo.Count > 0)
         {
             totalHistoryInfo.AddRange(currentHistoryInfo);
         }
     }
     return totalHistoryInfo;
 }
        /// <summary>
        /// 返回总里程,单位(千米)
        /// </summary>
        /// <param name="vehicleCode"></param>
        /// <param name="StartTime"></param>
        /// <param name="EndTime"></param>
        /// <returns></returns>
        private decimal GetTotalMileage(Guid vehicleCode, DateTime StartTime, DateTime EndTime)
        {
            EMileage Model = new EMileage();
            IReportService objReportServer = new ReportService();
            IList<VGPSInstallationInfo> installationInfoList = objReportServer.GetGpsRelationList(vehicleCode, StartTime, EndTime);
            EHistoryDataStoreConfig config = objReportServer.GetVehicleStoreTableConfig(vehicleCode);
            if (installationInfoList == null || installationInfoList.Count == 0)
            {
                return 0;
            }

            for (int i = 0, i_Count = installationInfoList.Count(); i < i_Count; i++)
            {
                VGPSInstallationInfo installInfo = installationInfoList[i];
                DateTime bTime = installInfo.CreateDate > StartTime ? installInfo.CreateDate : StartTime;
                DateTime eTime = EndTime;
                if (installInfo.StopDate.HasValue)
                {
                    if (installInfo.StopDate.Value < EndTime)
                    {
                        eTime = installInfo.StopDate.Value;
                    }
                }
                var first = objReportServer.GetFirstRecordInDay(config, installInfo.GpsCode, bTime, eTime, true);
                var last = objReportServer.GetLastRecordInDay(config, installInfo.GpsCode, bTime, eTime, true);
                if (first == null || last == null)
                    continue;

                Model.TotalMileage += decimal.Round((last.StarkMileage / 1000 - first.StarkMileage / 1000), 2);
            }
            return Model.TotalMileage;
        }
        private double GetTotalMileageByVehicle(Guid vehicleCode, DateTime StartTime, DateTime EndTime)
        {
            EMileage Model = new EMileage();
            IReportService objReportServer = new ReportService();
            IList<VGPSInstallationInfo> installationInfoList = objReportServer.GetGpsRelationList(vehicleCode, StartTime, EndTime);
            EHistoryDataStoreConfig config = objReportServer.GetVehicleStoreTableConfig(vehicleCode);
            if (installationInfoList == null || installationInfoList.Count == 0)
            {
                Logger.Trace(string.Format("车辆编号为:{0}在时间{1}到{2}内未找到对应的GPS关联", vehicleCode, StartTime, EndTime));
                return 0;
            }
            IMapService mapService = new PES.MapService.MapSearchService.MapService();

            for (int i = 0, i_Count = installationInfoList.Count(); i < i_Count; i++)
            {
                VGPSInstallationInfo installInfo = installationInfoList[i];
                DateTime bTime = installInfo.CreateDate > StartTime ? installInfo.CreateDate : StartTime;
                DateTime eTime = EndTime;
                if (installInfo.StopDate.HasValue)
                {
                    if (installInfo.StopDate.Value < EndTime)
                    {
                        eTime = installInfo.StopDate.Value;
                    }
                }
                var first = objReportServer.GetFirstRecordInDay(config, installInfo.GpsCode, bTime, eTime, true);
                var last = objReportServer.GetLastRecordInDay(config, installInfo.GpsCode, bTime, eTime, true);
                if (first == null || last == null)
                    continue;

                Model.TotalMileage += decimal.Round((last.StarkMileage / 1000 - first.StarkMileage / 1000), 2);
            }
            return (double)Model.TotalMileage;
        }