仓储
This commit is contained in:
@@ -103,36 +103,19 @@ namespace WMS.Web.Repositories
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<BoxInventoryResponse> GetInfoBy(string boxBillNo)
|
public async Task<BoxInventoryResponse> GetInfoBy(string boxBillNo)
|
||||||
{
|
{
|
||||||
////1.获取物料集合和组织集合
|
|
||||||
//var materials_result = await _erpService.BillQueryForMaterial();
|
|
||||||
//if (!materials_result.IsSuccess)
|
|
||||||
// return new List<BoxInventoryDetailsResponse>();
|
|
||||||
//var materials = materials_result.Data.ToList();
|
|
||||||
|
|
||||||
var entity=await _context.BoxInventory.Include(x=>x.Details)
|
var entity=await _context.BoxInventory.Include(x=>x.Details)
|
||||||
.GroupJoin(_context.Box, t => t.BoxId, box => box.Id, (boxinvent, ts) => new { boxinvent, ts })
|
.GroupJoin(_context.Box, t => t.BoxId, box => box.Id, (boxinvent, ts) => new { boxinvent, ts })
|
||||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.boxinvent, box })
|
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.boxinvent, box })
|
||||||
.Where(x => 1 == 1 && x.box.BoxBillNo==boxBillNo).Select(x=>x.boxinvent).FirstOrDefaultAsync();
|
.Where(x => 1 == 1 && x.box.BoxBillNo==boxBillNo).Select(x=>x.boxinvent).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var response = _mapper.Map<BoxInventoryResponse>(entity);
|
var response = _mapper.Map<BoxInventoryResponse>(entity);
|
||||||
if (response != null)
|
if (response != null)
|
||||||
{
|
{
|
||||||
//var serialNumbs = await _context.SerialNumbers.Where(x => x.BoxId == response.BoxId).ToListAsync();
|
|
||||||
|
|
||||||
response.Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, response.StockCode + response.OrgCode);
|
response.Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, response.StockCode + response.OrgCode);
|
||||||
response.SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, response.SubStockId);
|
response.SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, response.SubStockId);
|
||||||
response.Details = _mapper.Map<List<BoxInventoryDetailsResponse>>(entity.Details);
|
response.Details = _mapper.Map<List<BoxInventoryDetailsResponse>>(entity.Details);
|
||||||
//if (response.Details != null && response.Details.Count != 0)
|
|
||||||
//{
|
|
||||||
// response.Details.ForEach(x =>
|
|
||||||
// {
|
|
||||||
// x.SerialNumbers = serialNumbs.Where(t => t.MaterialId == x.MaterialId).Select(t=>t.SerialNumber).ToList();
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
|
|
||||||
response.TotalQty = response.Details.Sum(x=>x.Qty);
|
response.TotalQty = response.Details.Sum(x=>x.Qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +139,7 @@ namespace WMS.Web.Repositories
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<BoxInventory> Get(int id)
|
public async Task<BoxInventory> Get(int id)
|
||||||
{
|
{
|
||||||
return await _context.BoxInventory.Include(x => x.Details).Where(x => x.Id==id).FirstOrDefaultAsync();
|
return await _context.BoxInventory.Include(x => x.Details).Where(x => x.BoxId== id).FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user