/// <summary> /// 预约试驾车型数据 /// </summary> /// <returns></returns> public List<CarInfoModel> GetAptDriveCarList() { var list = new List<CarInfoModel>(); var newList = new List<CarInfoModel>(); var buInfo = _mdmBuMstrRepository.Get(AbpSession.ORG_NO); if (buInfo != null) { if (string.IsNullOrEmpty(buInfo.CARBRAND_IDS)) { throw new Exception("尚未设置门店经营品牌!"); } string msg = ""; List<CarInfoModel> carlist = CarHelper.GetCarInfo(AbpSession.BG_NO, 1, ref msg);//所有品牌信息 List<string> brandIds = buInfo.CARBRAND_IDS.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); List<CarInfoModel> carbrandList = carlist.Where(m => brandIds.Contains(m.CLASS_ID)).ToList(); list.AddRange(carbrandList); List<CarInfoModel> carclassList = CarHelper.GetCarInfo(AbpSession.BG_NO, 2, ref msg, buInfo.CARBRAND_IDS); list.AddRange(carclassList); var classIds = (from item in carclassList select item.CLASS_ID).ToList(); List<CarInfoModel> cartypeList = CarHelper.GetCarInfo(AbpSession.BG_NO, 3, ref msg); cartypeList = cartypeList.Where(m => classIds.Contains(m.PARENT_ID)).ToList(); list.AddRange(cartypeList); var typeIds = (from item in cartypeList select item.CLASS_ID).ToArray(); List<CarInfoModel> carsubtypeList = CarHelper.GetCarInfo(AbpSession.BG_NO, 4, ref msg); carsubtypeList = carsubtypeList.Where(m => typeIds.Contains(m.PARENT_ID)).ToList(); list.AddRange(carsubtypeList); //处理选中的车型 List<AptDriveConfig> driveList = _aptDriveConfigRepository.GetAllList(m => m.BU_NO == AbpSession.ORG_NO); if (driveList.Count>0) { foreach (var item in driveList) { var config = carsubtypeList.Where(c => c.CLASS_ID == item.SUBTYPE_ID).FirstOrDefault(); if (config != null) config.IsCheck = true; } } foreach (var item in carbrandList) { var result = GetCarInfos(item, list); newList.Add(result); } } else { throw new Exception("暂未查到该门店!"); } return newList; }
public ActionResult GetCarInfo(int level, string parentids = "", string ids = "") { string msg = ""; try { var result = CarHelper.GetCarInfo(AbpSession.BG_NO, level, ref msg, parentids, ids); return(Success("获取成功", result)); } catch (Exception ex) { return(Fail("获取车型数据失败:" + ex.Message)); } }