示例#1
0
        /// <summary>
        /// 车辆的相关信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RVehicleInfo> GetVehicleInfo(PSearchVehicleInfo param)
        {
            AndroidData<RVehicleInfo> result = new AndroidData<RVehicleInfo>() { Message = "车辆编号不存在!", ResultCode = (int)ResultCodeEnum.Fail };
            try
            {
                PositioningWCFService service = new PositioningWCFService();
                var res = service.GetVehicleDetailInfo(param.VehicleCode, (EnumMapType)param.MapType);

                if (res != null)
                {
                    if (res.Lng.HasValue && res.Lat.HasValue)
                    {
                        PES.GPS.MapService.Entity.LatLon _marLatLon = null;
                        try
                        {
                            switch ((EnumMapType)param.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;
                            Logger.Error("地图服务Http请求解析失败," + ex.Message, ex);
                        }
                        if (_marLatLon != null)
                        {
                            res.Lng = _marLatLon.Longitude;
                            res.Lat = _marLatLon.Latitude;
                        }
                        _marLatLon = null;
                    }

                    RVehicleInfo resultData = new RVehicleInfo()
                    {
                        VehicleCode = res.VehicleCode.ToGuid(),
                        LicenceNumber = res.LicenceNumber,
                        Longitude = res.Lng,
                        Latitude = res.Lat,
                        Location = string.IsNullOrEmpty(res.Location) ? " " : res.Location,
                        City = string.IsNullOrEmpty(res.City) ? " " : res.City,
                        RoadName = string.IsNullOrEmpty(res.RoadName) ? " " : res.RoadName,
                        Acc = res.Acc,
                        Speed = res.Speed,
                        ReportTime = res.ReportTime.HasValue ? res.ReportTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : " "
                    };

                    result.Message = string.Empty;
                    result.ResultCode = (int)ResultCodeEnum.Success;
                    result.ResultData = resultData;
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetMobileGuestList]:" + ex.Message, ex);
            }
            return result;
        }
示例#2
0
        /// <summary>
        /// 获取客户下车辆分页
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<RPage<List<RVehicleInfo>>> GetPageVehicleList(PPage<PSearchVehicleData> param)
        {
            AndroidData<RPage<List<RVehicleInfo>>> result = new AndroidData<RPage<List<RVehicleInfo>>>() { Message = "此客户暂无车辆数据!", ResultCode = (int)ResultCodeEnum.Fail };
            try
            {
                int rowCount = 0;
                EMVehicleService service = new EMVehicleService();
                IList<EMVehicle> vehicleList = service.SelectAll(new List<string>() { param.PageSearchEntity.TenantCode }, param.RowIndex, param.PageSize, ref rowCount);

                if (vehicleList.IsNullOrEmpty())
                    return result;

                List<RVehicleInfo> RList = new List<RVehicleInfo>();
                foreach (EMVehicle vehicle in vehicleList)
                {
                    RVehicleInfo info = new RVehicleInfo();
                    info.VehicleCode = vehicle.VehicleCode;
                    info.LicenceNumber = vehicle.LicenceNumber;

                    RList.Add(info);
                }

                RPage<List<RVehicleInfo>> rPageLIstInfo = new RPage<List<RVehicleInfo>>() {
                     PageList = RList,
                     RowCount = rowCount
                };
                result.Message = string.Empty;
                result.ResultCode = (int)ResultCodeEnum.Success;
                result.ResultData = rPageLIstInfo;
                //Logger.Info("[GetPageVehicleList]:" + param.PageSearchEntity.TenantCode);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetPageVehicleList]:" + ex.Message, ex);
            }
            return result;
        }
示例#3
0
        /// <summary>
        /// 客户的车辆列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public AndroidData<List<RVehicleInfo>> GetVehicleList(PSearchVehicleData param)
        {
            AndroidData<List<RVehicleInfo>> result = new AndroidData<List<RVehicleInfo>>() { Message = "此客户暂无车辆数据!", ResultCode = (int)ResultCodeEnum.Fail };
            try
            {
                EMVehicleService service = new EMVehicleService();
                IList<EMVehicle> vehicleList = service.SelectAll(param.TenantCode);
                if (vehicleList.IsNullOrEmpty())
                    return result;
                List<RVehicleInfo> RList = new List<RVehicleInfo>();
                foreach (EMVehicle vehicle in vehicleList)
                {
                    RVehicleInfo info = new RVehicleInfo();
                    info.VehicleCode = vehicle.VehicleCode;
                    info.LicenceNumber = vehicle.LicenceNumber;

                    RList.Add(info);
                }
                result.Message = string.Empty;
                result.ResultCode = (int)ResultCodeEnum.Success;
                result.ResultData = RList;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                result.ResultCode = (int)ResultCodeEnum.Fail;
                Logger.Error("[GetMobileGuestList]:"+ex.Message,ex);
            }
            return result;
        }