This commit is contained in:
tongfei
2024-04-19 09:32:31 +08:00
parent d7be459dc6
commit 19a98126a0
4 changed files with 29 additions and 9 deletions

View File

@@ -584,6 +584,9 @@ namespace WMS.Web.Domain.Services
if (taskBoxList != null && taskBoxList.Count != 0)
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
//序列号
var serialNumbs= await _serialNumbersRepositories.GetEntityListByBoxIds(dto_boxIds);
//3.组装绑定关系表,要添加的集合
var boxEntitys = await _boxRepositories.GetEntityList(dto_boxIds);
var taskBoxAdd = new List<InStockTaskBox>();
@@ -592,9 +595,15 @@ namespace WMS.Web.Domain.Services
var taskBox = _mapper.Map<InStockTaskBox>(item);
taskBox.TaskId = entity.Id;
taskBox.Receiver(staffId);
var currentBox_serialNumbs= serialNumbs.Where(s => s.BoxId == taskBox.BoxId).ToList();
var current_dto_box_dets = boxEntitys.Where(x => x.Id == item.BoxId).SelectMany(x => x.Details).ToList();
taskBox.Details = _mapper.Map<List<InStockTaskBoxDetails>>(current_dto_box_dets);
taskBox.Details.ForEach(x => { x.ErpDetailId = item.ErpDetailId; });
taskBox.Details.ForEach(x =>
{
x.ErpDetailId = item.ErpDetailId;
x.SerialNumbers= currentBox_serialNumbs.Where(s => s.MaterialNumber == x.MaterialNumber).Select(s => s.SerialNumber).ToList();
});
taskBoxAdd.Add(taskBox);
}
var isSuccess = await _inStockTaskBoxRepositories.AddRange(taskBoxAdd, isTransaction);