Esempio n. 1
0
        private RVehicleCurrentInfo ConvertToVehicleCurrentInfo(CurrentInfoViewModel viewModel)
        {
            RVehicleCurrentInfo currentInfo = new RVehicleCurrentInfo();
            currentInfo.VehicleCode = viewModel.VehicleCode;
            currentInfo.LicenceNumber = viewModel.LicenceNumber;
            currentInfo.OrganizeRecordID = viewModel.OrganizeRecordID;
            currentInfo.GPSCode = viewModel.GPSCode;
            currentInfo.Direction = viewModel.Direction;
            currentInfo.Longitude = viewModel.Longitude;
            currentInfo.Latitude = viewModel.Latitude;
            currentInfo.Location = viewModel.Location;
            currentInfo.City = viewModel.City;
            currentInfo.RoadName = viewModel.RoadName;
            currentInfo.Acc = viewModel.Acc;
            currentInfo.Speed = viewModel.Speed;
            currentInfo.RunningOrOffTime = viewModel.RunningOrOffTime.HasValue ? viewModel.RunningOrOffTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
            currentInfo.ReportTime = viewModel.ReportTime.HasValue ? viewModel.ReportTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
            currentInfo.TotalMileage = viewModel.TotalMileage;
            currentInfo.IsWarning = viewModel.IsWarning;
            currentInfo.Warning = viewModel.Warning;

            return currentInfo;
        }
Esempio n. 2
0
 private CurrentInfoViewModel ConvertToViewModel(EGPSCurrentInfo eGPSCurrentInfo, DateTime? runningOrOffTime)
 {
     CurrentInfoViewModel vm = new CurrentInfoViewModel();
     vm.Direction = eGPSCurrentInfo.Direction;
     vm.Latitude = eGPSCurrentInfo.Latitude;
     vm.Longitude = eGPSCurrentInfo.Longitude;
     vm.VehicleCode = eGPSCurrentInfo.VehicleCode.Value;
     vm.GPSCode = eGPSCurrentInfo.GPSCode;
     vm.Speed = eGPSCurrentInfo.Speed;
     vm.ReportTime = eGPSCurrentInfo.ReportTime;
     vm.RunningOrOffTime = runningOrOffTime;
     vm.Acc = eGPSCurrentInfo.ACCState;
     vm.TotalMileage = GetTotalMileage(eGPSCurrentInfo.VehicleCode.Value, eGPSCurrentInfo.ReportTime);
     return vm;
 }
Esempio n. 3
0
        //public List<AreaElementViewModel> QueryArea(string tenantCode, string name, EnumMapType mapType)
        //{
        //    IMapElementService service = new MapElementService();
        //    IList<EAreaElement> areaEntity = service.Search<EAreaElement>(tenantCode, name);
        //    List<AreaElementViewModel> list = new List<AreaElementViewModel>();
        //    if (areaEntity != null)
        //    {
        //        foreach (var e in areaEntity)
        //        {
        //            list.Add(ConvertAreaElementEntityToViewModel(e, mapType));
        //        }
        //    }
        //    return list;
        //}

        #endregion MapElementList 查询地图元素

        #region GetCurrentInfoList

        public CurrentInfoViewModel GetSingleCurrentInfoList(Guid vehicleCode, EnumMapType mapType)
        {
            var vehicleDetailInfo = _VehicleDAL.GetVehicleDetailEntity(vehicleCode, mapType);

            CurrentInfoViewModel vm = new CurrentInfoViewModel();
            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 = new HistoryLocusService().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"))
            {
                if (vm.Acc == 1)
                {
                    vm.ACCState = "点火";
                }
                else
                {
                    vm.ACCState = "熄火";
                }
            }
            else
            {
                vm.ACCState = "-";
            }
            return vm;
            /*
            List<Guid> ltCode = new Guid[] { vehicleCode }.ToList();
            PositionRequestViewModel requestVM = new PositionRequestViewModel()
            {
                VehicleCodes = ltCode,
                MapType = mapType
            };
            var list = GetCurrentInfoList(requestVM);
            if (list.IsNullOrEmpty())
            {
                return null;
            }
            else
            {
                EMVehicleService vehicleService = new EMVehicleService();
                EMVehicle emVehicle = vehicleService.Select(vehicleCode);
                CurrentInfoViewModel mode = list[0];
                mode.IconType = emVehicle.IconType;
                return mode;
            }*/
        }