调整列表查询
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user