非采购入库-优化
This commit is contained in:
@@ -2005,6 +2005,11 @@
|
||||
物料Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest.SupplierId">
|
||||
<summary>
|
||||
供应商
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest.Qty">
|
||||
<summary>
|
||||
入库数量
|
||||
|
||||
@@ -521,7 +521,7 @@
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Entitys.InStock.Details">
|
||||
<member name="P:WMS.Web.Domain.Entitys.InStock.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace WMS.Web.Core.Dto.InStock
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "供应商不能为空")]
|
||||
public int SupplierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入库数量
|
||||
///</summary>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<InStockDetails> Details = new List<InStockDetails>();
|
||||
public List<InStockDetails> Details { get; set; } = new List<InStockDetails>();
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
|
||||
@@ -286,10 +286,8 @@ namespace WMS.Web.Domain.Services
|
||||
item.BoxId = box.BoxId;
|
||||
item.SubStockId = dto.SubStockId;
|
||||
item.StockCode = dto.StockCode;
|
||||
item.OrgCode = dto.OrgCode;
|
||||
var taskDet = task.Details.Where(x => x.MaterialId == item.MaterialId).FirstOrDefault();
|
||||
item.SupplierId = taskDet.SupplierId;
|
||||
item.OrgId = taskDet.OrgId;
|
||||
item.OrgCode = dto.OrgCode;
|
||||
item.OrgId = task.Details.Select(x=>x.OrgId).FirstOrDefault();
|
||||
});
|
||||
//3.3添加到临时集合中
|
||||
temps.AddRange(dets);
|
||||
@@ -299,11 +297,45 @@ namespace WMS.Web.Domain.Services
|
||||
//4.创建
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
|
||||
//序列号集:箱里面的
|
||||
var serialNumbers = await _serialNumbersRepositories.GetEntityListByBoxIds(dto.Boxs.GroupBy(x => x.BoxId).Select(x => x.Key).ToList());
|
||||
if (dto.ShelfMethod == (int)ShelfMethod.Box)
|
||||
{
|
||||
//赋值序列号
|
||||
entity.Details.ForEach(x =>
|
||||
{
|
||||
var current_box_serNums = serialNumbers.Where(t => t.BoxId == x.BoxId).ToList();
|
||||
if (current_box_serNums != null)
|
||||
{
|
||||
var current_box_mat_serNums = current_box_serNums.Where(t => t.MaterialId == x.MaterialId).Select(t => t.SerialNumber).ToList();
|
||||
x.SerialNumbers.AddRange(current_box_mat_serNums);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//5.1保存入库单信息
|
||||
entity = await _inStockRepositories.Add(entity, isTransaction);
|
||||
if (entity == null)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
//同步金蝶后,反写任务单的已交数量
|
||||
if (task != null)
|
||||
{
|
||||
task.Details.ForEach(x =>
|
||||
{
|
||||
var current_entityDet_matQty = entity.Details.Where(t => t.MaterialId == x.MaterialId && t.SupplierId == x.SupplierId).Sum(t => t.Qty);
|
||||
if (x.AccruedQty > current_entityDet_matQty) {
|
||||
x.ReceiveQty = x.ReceiveQty + current_entityDet_matQty;
|
||||
x.DeliveredQty = x.ReceiveQty;
|
||||
}
|
||||
});
|
||||
task.NoPurchaseShelf(loginInfo.UserInfo.StaffId);
|
||||
task = await _inStockTaskRepositories.Update(task, isTransaction);
|
||||
if (task == null)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
|
||||
//6.当按产品上架:就要调用改箱的操作;
|
||||
if (dto.ShelfMethod == (int)ShelfMethod.Product)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user