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

@@ -1141,6 +1141,11 @@
收货数量 收货数量
</summary> </summary>
</member> </member>
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBoxDetails.SerialNumbers">
<summary>
序列号集
</summary>
</member>
<member name="T:WMS.Web.Domain.Entitys.InStockTaskDetails"> <member name="T:WMS.Web.Domain.Entitys.InStockTaskDetails">
<summary> <summary>
erp入库任务明细表 erp入库任务明细表

View File

@@ -34,5 +34,10 @@ namespace WMS.Web.Domain.Entitys
/// 收货数量 /// 收货数量
/// </summary> /// </summary>
public decimal ReceiveQty { get; set; } public decimal ReceiveQty { get; set; }
/// <summary>
/// 序列号集
/// </summary>
public List<string> SerialNumbers { get; set; } = new List<string>();
} }
} }

View File

@@ -584,6 +584,9 @@ namespace WMS.Web.Domain.Services
if (taskBoxList != null && taskBoxList.Count != 0) if (taskBoxList != null && taskBoxList.Count != 0)
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData); return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
//序列号
var serialNumbs= await _serialNumbersRepositories.GetEntityListByBoxIds(dto_boxIds);
//3.组装绑定关系表,要添加的集合 //3.组装绑定关系表,要添加的集合
var boxEntitys = await _boxRepositories.GetEntityList(dto_boxIds); var boxEntitys = await _boxRepositories.GetEntityList(dto_boxIds);
var taskBoxAdd = new List<InStockTaskBox>(); var taskBoxAdd = new List<InStockTaskBox>();
@@ -592,9 +595,15 @@ namespace WMS.Web.Domain.Services
var taskBox = _mapper.Map<InStockTaskBox>(item); var taskBox = _mapper.Map<InStockTaskBox>(item);
taskBox.TaskId = entity.Id; taskBox.TaskId = entity.Id;
taskBox.Receiver(staffId); 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(); 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 = _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); taskBoxAdd.Add(taskBox);
} }
var isSuccess = await _inStockTaskBoxRepositories.AddRange(taskBoxAdd, isTransaction); var isSuccess = await _inStockTaskBoxRepositories.AddRange(taskBoxAdd, isTransaction);

View File

@@ -190,7 +190,8 @@ namespace WMS.Web.Repositories
ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "", Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "",
Qty = x.detail.ReceiveQty, Qty = x.detail.ReceiveQty,
ReceiveQty = x.detail.ReceiveQty ReceiveQty = x.detail.ReceiveQty,
SerialNumbers= (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
}).ToListAsync(); }).ToListAsync();
if (boxList != null && boxList.Count != 0) if (boxList != null && boxList.Count != 0)
@@ -218,14 +219,14 @@ namespace WMS.Web.Repositories
}); });
} }
//序列号 ////序列号
var materNumbs = boxList.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList(); //var materNumbs = boxList.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
var serialNumbList = _context.SerialNumbers.Where(x => materNumbs.Contains(x.MaterialNumber)).ToList(); //var serialNumbList = _context.SerialNumbers.Where(x => materNumbs.Contains(x.MaterialNumber)).ToList();
boxList.ForEach(x => //boxList.ForEach(x =>
{ //{
x.SerialNumbers = (string.Join(",", serialNumbList.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).Select(t => t.SerialNumber).ToList())).TrimEnd(','); // x.SerialNumbers = (string.Join(",", serialNumbList.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).Select(t => t.SerialNumber).ToList())).TrimEnd(',');
}); //});
} }