箱号查询

This commit is contained in:
18942506660
2023-10-31 10:25:31 +08:00
parent b25c814b16
commit c3fe21ffa8
4 changed files with 103 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core.Dto;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService.Public;
@@ -36,8 +37,33 @@ namespace WMS.Web.Repositories
}
public async Task<Box> Get(string BoxBillNo)
{
return await _context.Box.Include(x=>x.Details)
.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
return await _context.Box.Include(x => x.Details)
.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
}
/// <summary>
/// 根据箱号查询物料信息
/// </summary>
/// <param name="BoxBillNo"></param>
/// <returns></returns>
public async Task<List<BoxDetailResponse>> GetDetails(string BoxBillNo)
{
return await _context.BoxDetails
.GroupJoin(_context.Box, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.Where(w => w.order.BoxBillNo.Equals(BoxBillNo))
.Select(s => new BoxDetailResponse()
{
Fid = s.detail.Fid,
BoxId = s.order.OpsBoxId,
MaterialId = s.detail.MaterialId,
MaterialName = "",
MaterialNumber = "",
Specifications = "",
SerialNumbers = s.detail.SerialNumbers,
SupplierId = s.detail.SupplierId,
Qty = s.detail.Qty
})
.ToListAsync();
}
}
}