增加箱差出库单信息

This commit is contained in:
18942506660
2023-12-18 11:43:06 +08:00
parent d4c9bedd24
commit 347d12736e
3 changed files with 56 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core;
using WMS.Web.Core.Dto;
using WMS.Web.Core.Dto.Erp;
using WMS.Web.Core.Dto.OutStock;
using WMS.Web.Core.Help;
@@ -320,5 +321,34 @@ namespace WMS.Web.Repositories
{
return await GetListAsync(dto);
}
public async Task<List<BoxDetailResponse>> GetDetailsByBoxId(int boxId)
{
var res = await _context.OutStock
.Include(s => s.Details).ThenInclude(s => s.ErpDetails)
.Include(s => s.Details).ThenInclude(s => s.BoxsDetails.Where(w => w.BoxId == boxId))
.Where(f => f.Details.SelectMany(s => s.BoxsDetails).Where(w => w.BoxId == boxId).Any())
.OrderByDescending(o => o.Id)
.FirstAsync();
List<BoxDetailResponse> details = new List<BoxDetailResponse>();
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
return new List<BoxDetailResponse>();
var materials = materials_result.Data.ToList();
foreach (var d in res.Details)
{
BoxDetailResponse detail = new BoxDetailResponse();
detail.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, detail.MaterialId);
detail.MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, detail.MaterialId);
detail.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, detail.MaterialId);
detail.SerialNumbers = d.SerialNumbers;
detail.MaterialId = d.MaterialId;
detail.Qty = d.BoxsDetails.FirstOrDefault(f => f.BoxId == boxId)?.Qty ?? 0;
details.Add(detail);
}
return details;
}
}
}