public IActionResult List(WeighRequestPayload payload)
 {
     using (_dbContext)
     {
         var query = from a in _dbContext.GrabageWeighting
                     //join u in _dbContext.GrabageRoom
                     //on a.GrabageRoomId equals u.GarbageRoomUuid
                     where  a.RecordType == "车辆称重" &&
                     a.IsDelete != "1" &&
                     a.Weight != "0"
                     //&& u.IsDelete != "1"
                     select new
         {
             a.GrabageWeighingRecordUuid,
             a.CarNumber,
             //u.Ljname,
             a.Weight,
             a.AddTime,
             a.Type,
             GrabType = a.CarUu.GrabType == "0"?"其他垃圾": a.CarUu.GrabType == "1"?"易腐垃圾": a.CarUu.GrabType == "2" ? "有害垃圾" : a.CarUu.GrabType == "3" ? "可回收垃圾" : "",
             WingID   = a.GrabageRoom.WingId,
             //u.VillageId,
             a.CarUu.Company,
             a.WeightTime,
             a.CarUu.CarType
         };
         //车牌号筛选
         if (!string.IsNullOrEmpty(payload.Kw))
         {
             query = query.Where(x => x.CarNumber.Contains(payload.Kw));
         }
         //注册时间筛选
         if (!string.IsNullOrEmpty(payload.kw2[0]) && !string.IsNullOrEmpty(payload.kw2[1]))
         {
             var date1 = Convert.ToDateTime(payload.kw2[0]).ToString("yyyy-MM-dd HH:mm:ss");
             var date2 = Convert.ToDateTime(payload.kw2[1]).ToString("yyyy-MM-dd HH:mm:ss");
             query = query.Where(x => x.AddTime.CompareTo(date1) >= 0 && x.AddTime.CompareTo(date2) <= 0);
         }
         if (payload.FirstSort != null)
         {
             query = query.OrderByDescending(x => x.WeightTime);
         }
         //分页
         var list       = query.Paged(payload.CurrentPage, payload.PageSize).ToList();
         var totalCount = query.Count();
         var response   = ResponseModelFactory.CreateResultInstance;
         response.SetData(list, totalCount);
         return(Ok(response));
     }
 }
 public IActionResult List(WeighRequestPayload payload)
 {
     using (_dbContext)
     {
         var query = from view in _dbContext.CarWeightView
                     select new
         {
             view.CarNumber,
             view.CarUuid,
             GrabType = view.GrabType == "0" ? "其他垃圾" : view.GrabType == "1" ? "易腐垃圾" : view.GrabType == "2" ? "有害垃圾" : view.GrabType == "3" ? "可回收垃圾" : "",
             view.Street,
             view.Weight,
             view.Wtime
         };
         //车牌号筛选
         if (!string.IsNullOrEmpty(payload.Kw))
         {
             query = query.Where(x => x.CarNumber.Contains(payload.Kw));
         }
         //类型筛选
         if (!string.IsNullOrEmpty(payload.kw1))
         {
             query = query.Where(x => x.GrabType.ToString() == payload.kw1);
         }
         //街道筛选
         if (!string.IsNullOrEmpty(payload.kw3))
         {
             query = query.Where(x => x.Street == payload.kw3);
         }
         if (payload.FirstSort != null)
         {
             query = query.OrderByDescending(x => x.Wtime);
         }
         //分页
         var list       = query.Paged(payload.CurrentPage, payload.PageSize).ToList();
         var totalCount = query.Count();
         var response   = ResponseModelFactory.CreateResultInstance;
         response.SetData(list, totalCount);
         return(Ok(response));
     }
 }