//获取客户的车辆
        public JsonResult GetCarList(string tenantCode, int rows, int pageSize)
        {
            int pageIndex = (rows - 1) * pageSize;
            string TenantCode = Microsoft.JScript.GlobalObject.unescape(Request["tenantCode"].ToString());
            PagedDataList<DeviceManageViewModel> list = _OperationsService.GetSelfDeviceManageViewModel(TenantCode, pageIndex, pageSize);
            if (list == null)
            {
                return null;
            }

            PositionRequestViewModel param = new PositionRequestViewModel();
            param.VehicleCodes = list.Datas.Select(f => f.VehicleCode).ToList();
            param.MapType = EnumMapType.MapBar;
            List<CurrentInfoViewModel> currentInfoList = this._PositioningWCFService.GetCurrentShortInfoListWithVehicle(param);
            for (int i = 0; i < list.Datas.Count; i++)
            {
                DeviceManageViewModel entity = list.Datas[i];
                entity.Remarkably = string.Empty;
                entity.DeviceState = string.Empty;
                if (entity.ExpireTime != null && entity.ExpireTime < DateTime.Now)
                {
                    entity.Remarkably = "已过期";
                    entity.DeviceState = "已过期";
                }
                else
                {
                    if (entity.IsStop)
                    {
                        entity.Remarkably = "已停用";
                        entity.DeviceState = "已停用";
                    }
                    else
                    {
                        CurrentInfoViewModel info = currentInfoList.FirstOrDefault(f => f.VehicleCode == entity.VehicleCode);
                        entity.DeviceState = VehicleBusinessHelper.GetVehicleFullStateStr(info);
                        if (entity.DeviceState == "离线")
                        {
                            entity.Remarkably = "离线";
                        }
                    }
                }

            }
            return Json(list, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        /// <summary>
        /// 获取车辆当前信息
        /// </summary>
        /// <param name="vehicleCode">车辆编号</param>
        /// <param name="isNeedRevise">是否需要修订经纬度</param>
        /// <returns>车辆当前信息对象</returns>
        private CurrentInfoViewModel GetCurrentInfo(Guid vehicleCode, bool isNeedRevise)
        {
            List<Guid> ltCode = new Guid[] { vehicleCode }.ToList();
            PositionRequestViewModel requestVM = new PositionRequestViewModel()
            {
                VehicleCodes = ltCode,
                IsNeedRevise = isNeedRevise
            };
            var list = GetCurrentInfoList(requestVM);

            CurrentInfoViewModel viewModel = list.FirstOrDefault();

            return viewModel;
        }
Beispiel #3
0
        public List<CurrentInfoViewModel> GetCurrentInfoList(PositionRequestViewModel requestVM)
        {

            IPositionService currentInfoServ = new PositionService();
            IList<EGPSCurrentInfo> ltEGPSCurrentInfo = currentInfoServ.GetCurrentInfoList(requestVM.VehicleCodes);
            return ConvertToViewModel(ltEGPSCurrentInfo, requestVM.IsNeedRevise);

        }
 public List<MonitorVehicleEntity> GetWithMonitorVehicleList(PositionRequestViewModel requestVM)
 {
     var ltVehicle = "'" + requestVM.VehicleCodes.JoinToString("','") + "'";
     return new VehicleDAL().GetWithMonitorVehicleList(ltVehicle, requestVM.MapType);
 }