箱库存-结构
This commit is contained in:
@@ -2244,6 +2244,14 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IBoxInventoryService.GenerateOutStockBox(WMS.Web.Domain.Entitys.OutStock,System.Boolean)">
|
||||
<summary>
|
||||
出库单-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoData"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.IChangeMoveBoxService">
|
||||
<summary>
|
||||
改箱 移箱服务
|
||||
@@ -3365,6 +3373,22 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateOutStockBox(WMS.Web.Domain.Entitys.OutStock,System.Boolean)">
|
||||
<summary>
|
||||
出库单-箱库存变更
|
||||
</summary>
|
||||
<param name="dtoData"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateOutStockBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
出库单-箱库存变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.HandlBoxInventory(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
处理箱库存变更:出入库
|
||||
|
||||
@@ -64,10 +64,10 @@ namespace WMS.Web.Domain.IService
|
||||
/// <summary>
|
||||
/// 出库单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="dtoData"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> GenerateOutStockBox(List<OutStock> dtoDatas, bool isTransaction);
|
||||
Task<Result> GenerateOutStockBox(OutStock dtoData, bool isTransaction);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1013,36 +1013,38 @@ namespace WMS.Web.Domain.Services
|
||||
/// <summary>
|
||||
/// 出库单-箱库存变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="dtoData"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateOutStockBox(List<OutStock> dtoDatas, bool isTransaction)
|
||||
public async Task<Result> GenerateOutStockBox(OutStock dtoData, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
if (dtoData == null)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
#region 按箱
|
||||
//2.组装-按箱入库
|
||||
var dtoDatas_details_Method_box = dtoDatas.Where(x => x.Method == InventoryInOutMethod.Box).SelectMany(x => x.Details).ToList();
|
||||
var generateDtoList_Metod_Box = dtoDatas_details_Method_box.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
//2.组装
|
||||
var generateDtoList = dtoData.Details.SelectMany(x => x.BoxsDetails).GroupBy(x => new { x.BoxId, x.SubStockId })
|
||||
.Select(x => new BoxInventoryGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
OrgCode = dtoData.OrgCode,
|
||||
StockCode = dtoData.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
InventoryInOutMethod = (int)dtoData.Method,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
|
||||
//2.1.遍历:组装明细
|
||||
generateDtoList_Metod_Box.ForEach(x =>
|
||||
}).ToList();
|
||||
//3.组装明细
|
||||
generateDtoList.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas_details_Method_box)
|
||||
//3.1先通过中间层的明细的箱明细找到中间层明细的IDS
|
||||
var current_materialDetails_ids = dtoData.Details.SelectMany(t => t.BoxsDetails).Where(t => t.BoxId == x.BoxId).GroupBy(t => t.DetailId).Select(t => t.Key).ToList();
|
||||
//3.2再通过找到的IDS获取中间层的明细
|
||||
var current_materialDetails = dtoData.Details.Where(t => current_materialDetails_ids.Contains(t.Id)).ToList();
|
||||
//3.3遍历-组装箱库存要的dto明细
|
||||
if (current_materialDetails != null && current_materialDetails.Count != 0)
|
||||
{
|
||||
//2.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
foreach (var detItem in current_materialDetails)
|
||||
{
|
||||
//2.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
@@ -1053,45 +1055,6 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region 按产品
|
||||
//3.组装-按产品入库
|
||||
var dtoDatas_details_Method_Product = dtoDatas.Where(x => x.Method == InventoryInOutMethod.Box).SelectMany(x => x.Details).ToList();
|
||||
var generateDtoList_Metod_Product = dtoDatas_details_Method_Product.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
.Select(x => new BoxInventoryGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)InventoryInOutMethod.Product,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
//3.1.遍历:组装明细
|
||||
generateDtoList_Metod_Product.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas_details_Method_Product)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
|
||||
//整合一起
|
||||
var generateDtoList = new List<BoxInventoryGenerateDto>();
|
||||
generateDtoList.AddRange(generateDtoList_Metod_Box);
|
||||
generateDtoList.AddRange(generateDtoList_Metod_Product);
|
||||
|
||||
//提交处理
|
||||
return await this.GenerateOutStockBox(generateDtoList, isTransaction);
|
||||
|
||||
Reference in New Issue
Block a user