调整列表查询

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

@@ -69,14 +69,16 @@ namespace WMS.Web.Repositories
/// <returns></returns>
public async Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto)
{
var query = _context.OutStock
.OrderByDescending(o => o.Id)
var query = _context.OutStockDetails
.GroupJoin(_context.OutStock, 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.CreateBeginDate != null)
query = query.Where(w => w.CreateTime >= dto.CreateBeginDate);
query = query.Where(w => w.order.CreateTime >= dto.CreateBeginDate);
if (dto.CreateEndDate != null)
query = query.Where(w => w.CreateTime <= dto.CreateEndDate);
query = query.Where(w => w.order.CreateTime <= dto.CreateEndDate);
//组装
int total = await query.CountAsync();
var list = await query.Select(s => new OutStockQueryInfoResponse()
@@ -86,8 +88,8 @@ namespace WMS.Web.Repositories
Status = "",
Type = "",
Creator = "",
CreateTime=s.CreateTime.DateToStringSeconds(),
SuccessSync = s.SuccessSync,
CreateTime=s.order.CreateTime.DateToStringSeconds(),
SuccessSync = s.order.SuccessSync,
Stock = "",
SourceBillNo="",
SaleBillNo = "",