调整列表查询

This commit is contained in:
18942506660
2023-10-28 14:56:59 +08:00
parent 8abdbd9746
commit f5cc13f422
4 changed files with 26 additions and 17 deletions

View File

@@ -68,14 +68,16 @@ namespace WMS.Web.Repositories
/// <returns></returns>
public async Task<(List<TakeStockQueryInfoResponse> list, int total)> GetListAsync(TakeStockQueryRequest dto)
{
var query = _context.TakeStock
.OrderByDescending(o => o.Id)
var query = _context.TakeStockDetails
.GroupJoin(_context.TakeStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.OrderByDescending(o => o.order.Id)
.Where(adv => 1 == 1);
if (dto.DateBeginDate != null)
query = query.Where(w => w.Date >= dto.DateBeginDate);
query = query.Where(w => w.order.Date >= dto.DateBeginDate);
if (dto.DateEndDate != null)
query = query.Where(w => w.Date <= dto.DateEndDate);
query = query.Where(w => w.order.Date <= dto.DateEndDate);
//组装
int total = await query.CountAsync();
var list = await query.Select(s => new TakeStockQueryInfoResponse()
@@ -92,8 +94,8 @@ namespace WMS.Web.Repositories
ResultType="",
Remark="",
Creator = "",
Date = s.Date.DateToStringSeconds(),
SuccessSync=s.SuccessSync
Date = s.order.Date.DateToStringSeconds(),
SuccessSync=s.order.SuccessSync
#endregion
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();