/// <summary>
        /// 查询平台切换客户的列表
        /// </summary>
        /// <param name="tenantCode"></param>
        /// <returns></returns>
        public List<ChangeCusWithOMViewModel> GetChangeCusOfPlat(string tenantCode)
        {
            List<ChangeCusWithOMViewModel> list = new List<ChangeCusWithOMViewModel>();
            try
            {
                IList<EMTenant> ltTenantAll = new EMTenantService().GetGrandChildren(tenantCode);
                if (ltTenantAll.IsNullOrEmpty())
                    return list;

                string lastTenantCode = string.Empty;
                Dictionary<string, int> dicVehicleCount = null; //客户的车辆总数
                IList<EMVehicleGroup> ltVehGroups = null; //终端用户车辆组
                var ltAllCus = ltTenantAll.Where(s => s.TenantType == EnumTenantType.EndCustomer && !string.IsNullOrEmpty(s.TenantName));
                if (ltAllCus.Count() > 0)
                { // 处理终端用户车辆总数和分组
                    List<string> ltCusTenantCode = ltAllCus.Select(o => o.TenantCode).ToList();

                    // 客户的车辆总数
                    dicVehicleCount = new EMVehicleService().SelectVehicleCount(ltCusTenantCode);

                    // 终端用户车辆组
                    //ltVehGroups = new EMVehicleGroupService().SelectListByTenantCodes(ltCusTenantCode);

                    EMTenant lastCreateTenant = ltAllCus.OrderByDescending(s => s.CreateTime).ElementAt(0);
                    lastTenantCode = lastCreateTenant.TenantCode;
                }

                //递归处理租户树形数据结构
                IList<ChangeCusWithOMViewModel> ltChildren = GetChildren(tenantCode, lastTenantCode, ltTenantAll, dicVehicleCount, ltVehGroups);
                if (!ltChildren.IsNullOrEmpty())
                    list.AddRange(ltChildren);
            }
            catch (Exception ex)
            {
                Logger.Error("OperateManagerWCFService.GetChangeCusOfPlat(string tenantCode) 异常:" + ex.Message, ex);
            }
            return list;
        }
        public List<ChangeCusCarWithOMViewModel> GetChangeCusCarOfPlat(string tenantCode, string iconSkin)
        {
            List<ChangeCusCarWithOMViewModel> list = new List<ChangeCusCarWithOMViewModel>();
            try
            {
                IList<EMTenant> ltTenantAll = new EMTenantService().GetGrandChildren(tenantCode);
                if (ltTenantAll.IsNullOrEmpty())
                    return list;

                var ltAllCus = ltTenantAll.Where(s => s.TenantType == EnumTenantType.EndCustomer && !string.IsNullOrEmpty(s.TenantName));
                if (ltAllCus.Count() == 0) return list;

                List<string> ltCusTenantCode = ltAllCus.Select(o => o.TenantCode).ToList();
                EMVehicleService vehicleServ = new EMVehicleService();
                //客户和客户的车辆总数
                Dictionary<string, int> dicVehicleCount = vehicleServ.SelectVehicleCount(ltCusTenantCode);
               
                EMTenant lastCreateTenant = ltAllCus.OrderByDescending(s => s.CreateTime).ElementAt(0);

                IList<ChangeCusCarWithOMViewModel> ltChildren = GetCarChildren(tenantCode, lastCreateTenant.TenantCode, ltTenantAll, dicVehicleCount);
                if (!ltChildren.IsNullOrEmpty())
                    list.AddRange(ltChildren);

                List<ChangeCusCarWithOMViewModel> vechileList = null;
                for (int j = 0; j < list.Count; j++)
                {
                    if (list[j].Children.Count == 0)
                    {
                        string stenantCode = list[j].TenantCode;

                        List<EMVehicle> veList = new VehicleDAL().GetVehicleListByTenantCode(stenantCode);
                        if (veList != null&&veList.Count>0)
                        {
                            vechileList = new List<ChangeCusCarWithOMViewModel>();
                            for (int a = 0; a < veList.Count; a++)
                            {
                                ChangeCusCarWithOMViewModel ve = new ChangeCusCarWithOMViewModel();
                                ve.TenantCode = veList[a].VehicleCode.ToString();
                                ve.TenantName = veList[a].LicenceNumber;
                                ve.iconSkin = "CarDeviceNo";
                                 
                                vechileList.Add(ve);
                            }
                            list[j].iconSkin = iconSkin;// 值为CarDeviceNo表示是车辆的上一级可以选中,为空表示车辆的上一级不可以选中
                            list[j].Children.AddRange(vechileList);
                        }
                    }
                    else
                    {
                        for (int k = 0; k < list[j].Children.Count; k++)
                        {
                            string stenantCode = list[j].Children[k].TenantCode;
                            vechileList = new List<ChangeCusCarWithOMViewModel>();
                            List<EMVehicle> veList = new VehicleDAL().GetVehicleListByTenantCode(stenantCode);
                            if (veList != null&&veList.Count>0)
                            {
                                for (int a = 0; a < veList.Count; a++)
                                {
                                    ChangeCusCarWithOMViewModel ve = new ChangeCusCarWithOMViewModel();
                                    ve.TenantCode = veList[a].VehicleCode.ToString();
                                    ve.TenantName = veList[a].LicenceNumber;
                                   
                                    ve.iconSkin = "CarDeviceNo";
                                    vechileList.Add(ve);

                                }
                                list[j].Children[k].iconSkin = iconSkin;
                                list[j].Children[k].Children.AddRange(vechileList);
                            }
                        }
                    }
                }

                return list;
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                return list;
            }
             
        }