采购查询接口优化

This commit is contained in:
tongfei
2023-11-09 16:12:29 +08:00
parent db9a3d25a3
commit d386e4aa41
10 changed files with 161 additions and 86 deletions

View File

@@ -223,12 +223,27 @@ namespace WMS.Web.Repositories
return entitys;
}
/// <summary>
/// 列表-根据来源单号模糊搜索
/// </summary>
/// <param name="sourceBillNos"></param>
/// <returns></returns>
public async Task<List<InStockTask>> GetListBy(string sourceBillNos)
{
var entitys = await _context.InStockTask
.Include(s => s.Details)
.Where(w => EF.Functions.Like(w.SourceBillNo, "%" + sourceBillNos + "%"))
.ToListAsync();
return entitys;
}
/// <summary>
/// 列表-根据来源单号模糊
/// </summary>
/// <param name="sourceBillNo"></param>
/// <returns></returns>
public async Task<List<InStockTaskBillNoQueryResponse>> GetListBy(string sourceBillNo, InstockType? type=null)
public async Task<List<InStockTaskBillNoQueryResponse>> GetListBy(InStockTaskBillNoQueryRequest dto)
{
//1.获取物料集合
var materials_result = await _erpService.BillQueryForMaterial();
@@ -240,10 +255,10 @@ namespace WMS.Web.Repositories
var query = _context.InStockTaskDetails
.GroupJoin(_context.InStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + sourceBillNo + "%") && (w.order.Status== InstockStatus.Part || w.order.Status==InstockStatus.Wait));
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.order.Status== InstockStatus.Part || w.order.Status==InstockStatus.Wait));
if(type.HasValue)
query = query.Where(w => w.order.Type == type.Value);
if(dto.Type.HasValue)
query = query.Where(w => (int)w.order.Type == dto.Type.Value);
var list = await query.Select(s => new InStockTaskBillNoQueryResponse()
{