上架的序列号

This commit is contained in:
tongfei
2023-12-11 17:24:40 +08:00
parent 79a4401f9b
commit 20fff099fd
2 changed files with 15 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ namespace WMS.Web.Domain.Services
x.OrgCode = stock.ErpOrgCode; x.OrgCode = stock.ErpOrgCode;
}); });
entity.Create(loginInfo.UserInfo.StaffId); entity.Create(loginInfo.UserInfo.StaffId);
entity = await _backRecordRepositories.Add(entity, isTransaction); entity = await _backRecordRepositories.Add(entity, isTransaction);

View File

@@ -931,6 +931,10 @@ namespace WMS.Web.Domain.Services
//2.获取“箱库存集合” //2.获取“箱库存集合”
var boxIds = dtoDatas.GroupBy(x => x.BoxId).Select(x => x.Key).ToList(); var boxIds = dtoDatas.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
var boxInventorys = await _boxInventoryRepositories.GetList(boxIds); var boxInventorys = await _boxInventoryRepositories.GetList(boxIds);
//box的序列号
var serialNumbers = await _serialNumbersRepositories.GetEntityListByBoxIds(dtoDatas.GroupBy(x => x.BoxId).Select(x => x.Key).ToList());
//3.遍历dto //3.遍历dto
foreach (var dto in dtoDatas) foreach (var dto in dtoDatas)
{ {
@@ -942,9 +946,19 @@ namespace WMS.Web.Domain.Services
if (boxInventory == null) if (boxInventory == null)
{ {
//当前箱的序列号
var current_box_serNums = serialNumbers.Where(t => t.BoxId == dto.BoxId).ToList();
//3.2组装要新增的箱库存信息:箱和明细和序列号 //3.2组装要新增的箱库存信息:箱和明细和序列号
var addEntity = _mapper.Map<BoxInventory>(dto); var addEntity = _mapper.Map<BoxInventory>(dto);
addEntity.Details = _mapper.Map<List<BoxInventoryDetails>>(dto.Details); addEntity.Details = _mapper.Map<List<BoxInventoryDetails>>(dto.Details);
//赋值序列号
addEntity.Details.ForEach(x =>
{
var current_box_mat_serNums=current_box_serNums.Where(m => m.MaterialId == x.MaterialId).Select(t => t.SerialNumber).ToList();
x.SerialNumbers.AddRange(current_box_mat_serNums);
});
add_entitys.Add(addEntity); add_entitys.Add(addEntity);
} }
else else