箱库存

This commit is contained in:
tongfei
2023-11-23 17:52:02 +08:00
parent 4572cbd3a6
commit 2840590e16
2 changed files with 26 additions and 56 deletions

View File

@@ -229,29 +229,10 @@ namespace WMS.Web.Domain.Services
if (!serialNumber_result.IsSuccess)
return serialNumber_result;
//保存成功后:变更箱库存
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
{
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
InventoryInOutType = (int)InventoryInOutType.In,
BoxId = x.Key.BoxId,
StockCode = x.Key.StockCode,
SubStockId = x.Key.SubStockId
}).ToList();
foreach (var item in dto.Details)
{
var current = boxInventoryGenerateDto.Where(x => x.BoxId == item.BoxId).FirstOrDefault();
if (current != null)
{
var detail = new BoxInventoryGenerateDetailsDto();
detail.MaterialId = item.MaterialId;
detail.Qty = item.Qty;
detail.SerialNumbers = item.SerialNumbers;
current.Details.Add(detail);
}
}
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
//箱库存变动
var dtoDatas = new List<InStock>();
dtoDatas.Add(entity);
var boxInventoryResult = await _boxInventoryService.GenerateInStockBox(dtoDatas, isTransaction);
if (!boxInventoryResult.IsSuccess)
return boxInventoryResult;
@@ -335,20 +316,10 @@ namespace WMS.Web.Domain.Services
if (!serialNumber_result.IsSuccess)
return serialNumber_result;
//7.箱库存的变更
//7.1组装头部和明细
var boxInventoryGenerateDto = dto.Boxs.Select(item => new BoxInventoryGenerateDto()
{
InventoryInOutMethod = dto.ShelfMethod == (int)ShelfMethod.Product ? (int)InventoryInOutMethod.Box : (int)InventoryInOutMethod.Product,
InventoryInOutType = (int)InventoryInOutType.In,
BoxId = item.BoxId,
StockCode = dto.StockCode,
SubStockId = dto.SubStockId,
Details = _mapper.Map<List<BoxInventoryGenerateDetailsDto>>(item.Details)
}).ToList();
//7.2执行处理箱库存
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
//箱库存变动
var dtoDatas = new List<InStock>();
dtoDatas.Add(entity);
var boxInventoryResult = await _boxInventoryService.GenerateInStockBox(dtoDatas, isTransaction);
if (!boxInventoryResult.IsSuccess)
return boxInventoryResult;