箱库存的优化
This commit is contained in:
@@ -3293,14 +3293,6 @@
|
||||
即时库存-服务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateChangeBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryChangeGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
改箱-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateChangeBox(System.Collections.Generic.List{WMS.Web.Domain.Entitys.ChangeBoxRecord},System.Boolean)">
|
||||
<summary>
|
||||
改箱-箱库存的变更
|
||||
@@ -3309,14 +3301,6 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateMoveBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryMoveGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
移箱-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateMoveBox(System.Collections.Generic.List{WMS.Web.Domain.Entitys.MoveBoxRecord},System.Boolean)">
|
||||
<summary>
|
||||
移箱-箱库存的变更
|
||||
@@ -3325,14 +3309,6 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateBackBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryBackGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
入库回退上下架-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateBackBox(System.Collections.Generic.List{WMS.Web.Domain.Entitys.BackRecord},System.Boolean)">
|
||||
<summary>
|
||||
入库回退上下架-箱库存的变更
|
||||
@@ -3349,14 +3325,6 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateTakeBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryTakeGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
盘点单-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateInStockBox(System.Collections.Generic.List{WMS.Web.Domain.Entitys.InStock},System.Boolean)">
|
||||
<summary>
|
||||
入库单-箱库存的变更
|
||||
@@ -3365,14 +3333,6 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.GenerateInStockBox(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.GenerateOutStockBox(WMS.Web.Domain.Entitys.OutStock,System.Boolean)">
|
||||
<summary>
|
||||
出库单-箱库存变更
|
||||
@@ -3381,7 +3341,47 @@
|
||||
<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)">
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.ExeChangeBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryChangeGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
改箱-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.ExeMoveBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryMoveGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
移箱-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.ExeBackBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryBackGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
入库回退上下架-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.ExeTakeBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryTakeGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
盘点单-箱库存的变更
|
||||
</summary>
|
||||
<param name="dtoDatas"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BoxInventoryService.ExeInStockBox(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.ExeOutStockBox(System.Collections.Generic.List{WMS.Web.Core.Dto.Inventory.BoxInventoryGenerateDto},System.Boolean)">
|
||||
<summary>
|
||||
出库单-箱库存变更
|
||||
</summary>
|
||||
|
||||
@@ -35,13 +35,403 @@ namespace WMS.Web.Domain.Services
|
||||
_boxInventoryRepositories = boxInventoryRepositories;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 改箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateChangeBox(List<BoxInventoryChangeGenerateDto> dtoDatas, bool isTransaction)
|
||||
public async Task<Result> GenerateChangeBox(List<ChangeBoxRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.原来箱库存集合
|
||||
var boxIds = dtoDatas.Where(x => x.SrcBoxId != 0).GroupBy(x => x.SrcBoxId).Select(x => x.Key).ToList();
|
||||
var sourceBoxInventorys = await _boxInventoryRepositories.GetList(boxIds);
|
||||
|
||||
//2.1目标箱库存集合
|
||||
var targetBoxIds = dtoDatas.GroupBy(x => x.DestBoxId).Select(x => x.Key).ToList();
|
||||
var targetBoxInventorys = await _boxInventoryRepositories.GetList(targetBoxIds);
|
||||
|
||||
//2.2组合要生成的dto
|
||||
var generateDtos = dtoDatas.GroupBy(x => new { x.SrcBoxId, x.DestBoxId, x.DestStockCode, x.DestSubStockId, x.DestBoxOrgCode }).Select(x => new BoxInventoryChangeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.SrcBoxId,
|
||||
TargetBoxId = x.Key.DestBoxId,
|
||||
StockCode = x.Key.DestStockCode,
|
||||
SubStockId = x.Key.DestSubStockId,
|
||||
TargetBoxOrgCode = x.Key.DestBoxOrgCode
|
||||
|
||||
}).ToList();
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtos.ForEach(x =>
|
||||
{
|
||||
foreach (var item in dtoDatas)
|
||||
{
|
||||
//3.1原箱和目标箱是当前的
|
||||
if (item.SrcBoxId == x.BoxId && item.DestBoxId == x.TargetBoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryDetailsChangeGenerateDto();
|
||||
det.MaterialId = item.MaterialId;
|
||||
det.Qty = item.Qty;
|
||||
det.SerialNumbers = item.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
//4.开始处理
|
||||
return await this.ExeChangeBox(generateDtos, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateMoveBox(List<MoveBoxRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.箱库存集合
|
||||
var boxIds = dtoDatas.Where(x => x.BoxId != 0 && x.Type == MoveBoxType.Down).GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var boxInventorys = await _boxInventoryRepositories.GetList(boxIds);
|
||||
|
||||
//2.1箱基本信息
|
||||
var boxs = await _boxRepositories.GetEntityList(boxIds);
|
||||
|
||||
//2.2组合要生成的dto
|
||||
var generateDtoList = new List<BoxInventoryMoveGenerateDto>();
|
||||
foreach (var item in dtoDatas)
|
||||
{
|
||||
var generateDto = new BoxInventoryMoveGenerateDto();
|
||||
generateDto.BoxId = item.BoxId;
|
||||
generateDto.OrgCode = item.OrgCode;
|
||||
generateDto.StockCode = item.StockCode;
|
||||
generateDto.SubStockId = item.Type == MoveBoxType.Up ? item.DestSubStockId : item.SrcSubStockId;
|
||||
generateDto.InventoryInOutType = item.Type == MoveBoxType.Down ? (int)InventoryInOutType.Out : (int)InventoryInOutType.In;
|
||||
generateDtoList.Add(generateDto);
|
||||
|
||||
}
|
||||
//4.开始处理
|
||||
return await this.ExeMoveBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退上下架-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateBackBox(List<BackRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
var generateDtoList = new List<BoxInventoryBackGenerateDto>();
|
||||
|
||||
#region 入库组装
|
||||
//入库的明细
|
||||
var dtoDetails_in = dtoDatas.Where(x => x.Type == BackRecordType.OutstockOn).SelectMany(x => x.Details).ToList();
|
||||
|
||||
//2.1组织:头部
|
||||
var generateDtoList_in = dtoDetails_in.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
.Select(x => new BoxInventoryBackGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDetails_in)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryBackDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region 出库组装
|
||||
//出库的明细
|
||||
var dtoDetails_out = dtoDatas.Where(x => x.Type == BackRecordType.InstockOff).SelectMany(x => x.Details).ToList();
|
||||
|
||||
//2.1组织:头部
|
||||
var generateDtoList_out = dtoDetails_out.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
.Select(x => new BoxInventoryBackGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
}).ToList();
|
||||
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtoList_out.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDetails_out)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryBackDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
generateDtoList.AddRange(generateDtoList_in);
|
||||
generateDtoList.AddRange(generateDtoList_out);
|
||||
//4.提交处理
|
||||
return await this.ExeBackBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateTakeBox(List<TakeStock> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.组装:入库数据
|
||||
var generateDtoList_in = dtoDatas.Where(x => x.ResultType == TakeStockType.Profit).GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryTakeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
//2.1.遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryTakeDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.FinalQty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//3.组装:出库数据
|
||||
var generateDtoList_out = dtoDatas.Where(x => x.ResultType == TakeStockType.Loss).GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryTakeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
}).ToList();
|
||||
|
||||
//3.1遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryTakeDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.FinalQty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//整合一起
|
||||
var generateDtoList = new List<BoxInventoryTakeGenerateDto>();
|
||||
generateDtoList.AddRange(generateDtoList_in);
|
||||
generateDtoList.AddRange(generateDtoList_out);
|
||||
//提交处理
|
||||
return await this.ExeTakeBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateInStockBox(List<InStock> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
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 })
|
||||
.Select(x => new BoxInventoryGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
//2.1.遍历:组装明细
|
||||
generateDtoList_Metod_Box.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas_details_Method_box)
|
||||
{
|
||||
//2.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//2.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#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.ExeInStockBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库单-箱库存变更
|
||||
/// </summary>
|
||||
/// <param name="dtoData"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateOutStockBox(OutStock dtoData, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoData == null)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//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 = dtoData.OrgCode,
|
||||
StockCode = dtoData.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)dtoData.Method,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
|
||||
}).ToList();
|
||||
//3.组装明细
|
||||
generateDtoList.ForEach(x =>
|
||||
{
|
||||
//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)
|
||||
{
|
||||
foreach (var detItem in current_materialDetails)
|
||||
{
|
||||
//2.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//提交处理
|
||||
return await this.ExeOutStockBox(generateDtoList, isTransaction);
|
||||
}
|
||||
/// <summary>
|
||||
/// 改箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> ExeChangeBox(List<BoxInventoryChangeGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -179,65 +569,13 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 改箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateChangeBox(List<ChangeBoxRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.原来箱库存集合
|
||||
var boxIds = dtoDatas.Where(x => x.SrcBoxId != 0).GroupBy(x => x.SrcBoxId).Select(x => x.Key).ToList();
|
||||
var sourceBoxInventorys = await _boxInventoryRepositories.GetList(boxIds);
|
||||
|
||||
//2.1目标箱库存集合
|
||||
var targetBoxIds = dtoDatas.GroupBy(x => x.DestBoxId).Select(x => x.Key).ToList();
|
||||
var targetBoxInventorys = await _boxInventoryRepositories.GetList(targetBoxIds);
|
||||
|
||||
//2.2组合要生成的dto
|
||||
var generateDtos = dtoDatas.GroupBy(x => new { x.SrcBoxId, x.DestBoxId, x.DestStockCode, x.DestSubStockId, x.DestBoxOrgCode }).Select(x => new BoxInventoryChangeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.SrcBoxId,
|
||||
TargetBoxId = x.Key.DestBoxId,
|
||||
StockCode = x.Key.DestStockCode,
|
||||
SubStockId = x.Key.DestSubStockId,
|
||||
TargetBoxOrgCode = x.Key.DestBoxOrgCode
|
||||
|
||||
}).ToList();
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtos.ForEach(x =>
|
||||
{
|
||||
foreach (var item in dtoDatas)
|
||||
{
|
||||
//3.1原箱和目标箱是当前的
|
||||
if (item.SrcBoxId == x.BoxId && item.DestBoxId == x.TargetBoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryDetailsChangeGenerateDto();
|
||||
det.MaterialId = item.MaterialId;
|
||||
det.Qty = item.Qty;
|
||||
det.SerialNumbers = item.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
//4.开始处理
|
||||
return await this.GenerateChangeBox(generateDtos, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateMoveBox(List<BoxInventoryMoveGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> ExeMoveBox(List<BoxInventoryMoveGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -352,49 +690,13 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移箱-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateMoveBox(List<MoveBoxRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.箱库存集合
|
||||
var boxIds = dtoDatas.Where(x => x.BoxId != 0 && x.Type == MoveBoxType.Down).GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var boxInventorys = await _boxInventoryRepositories.GetList(boxIds);
|
||||
|
||||
//2.1箱基本信息
|
||||
var boxs = await _boxRepositories.GetEntityList(boxIds);
|
||||
|
||||
//2.2组合要生成的dto
|
||||
var generateDtoList = new List<BoxInventoryMoveGenerateDto>();
|
||||
foreach (var item in dtoDatas)
|
||||
{
|
||||
var generateDto = new BoxInventoryMoveGenerateDto();
|
||||
generateDto.BoxId = item.BoxId;
|
||||
generateDto.OrgCode = item.OrgCode;
|
||||
generateDto.StockCode = item.StockCode;
|
||||
generateDto.SubStockId = item.Type == MoveBoxType.Up ? item.DestSubStockId : item.SrcSubStockId;
|
||||
generateDto.InventoryInOutType = item.Type == MoveBoxType.Down ? (int)InventoryInOutType.Out : (int)InventoryInOutType.In;
|
||||
generateDtoList.Add(generateDto);
|
||||
|
||||
}
|
||||
//4.开始处理
|
||||
return await this.GenerateMoveBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退上下架-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateBackBox(List<BoxInventoryBackGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> ExeBackBox(List<BoxInventoryBackGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -507,178 +809,13 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退上下架-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateBackBox(List<BackRecord> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
var generateDtoList = new List<BoxInventoryBackGenerateDto>();
|
||||
|
||||
#region 入库组装
|
||||
//入库的明细
|
||||
var dtoDetails_in = dtoDatas.Where(x => x.Type == BackRecordType.OutstockOn).SelectMany(x => x.Details).ToList();
|
||||
|
||||
//2.1组织:头部
|
||||
var generateDtoList_in = dtoDetails_in.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
.Select(x => new BoxInventoryBackGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDetails_in)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryBackDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
|
||||
#region 出库组装
|
||||
//出库的明细
|
||||
var dtoDetails_out = dtoDatas.Where(x => x.Type == BackRecordType.InstockOff).SelectMany(x => x.Details).ToList();
|
||||
|
||||
//2.1组织:头部
|
||||
var generateDtoList_out = dtoDetails_out.GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId })
|
||||
.Select(x => new BoxInventoryBackGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
}).ToList();
|
||||
|
||||
|
||||
//3.遍历:组装明细
|
||||
generateDtoList_out.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDetails_out)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryBackDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
generateDtoList.AddRange(generateDtoList_in);
|
||||
generateDtoList.AddRange(generateDtoList_out);
|
||||
//4.提交处理
|
||||
return await this.GenerateBackBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateTakeBox(List<TakeStock> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//2.组装:入库数据
|
||||
var generateDtoList_in = dtoDatas.Where(x => x.ResultType == TakeStockType.Profit).GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryTakeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
//2.1.遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryTakeDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.FinalQty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//3.组装:出库数据
|
||||
var generateDtoList_out = dtoDatas.Where(x => x.ResultType == TakeStockType.Loss).GroupBy(x => new { x.BoxId, x.OrgCode, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryTakeGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
}).ToList();
|
||||
|
||||
//3.1遍历:组装明细
|
||||
generateDtoList_in.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas)
|
||||
{
|
||||
//3.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//3.2组装明细
|
||||
var det = new BoxInventoryTakeDetailsGenerateDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.FinalQty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//整合一起
|
||||
var generateDtoList = new List<BoxInventoryTakeGenerateDto>();
|
||||
generateDtoList.AddRange(generateDtoList_in);
|
||||
generateDtoList.AddRange(generateDtoList_out);
|
||||
//提交处理
|
||||
return await this.GenerateTakeBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 盘点单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateTakeBox(List<BoxInventoryTakeGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> ExeTakeBox(List<BoxInventoryTakeGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -799,99 +936,13 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库单-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateInStockBox(List<InStock> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
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 })
|
||||
.Select(x => new BoxInventoryGenerateDto()
|
||||
{
|
||||
BoxId = x.Key.BoxId,
|
||||
OrgCode = x.Key.OrgCode,
|
||||
StockCode = x.Key.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
||||
InventoryInOutType = (int)InventoryInOutType.In
|
||||
}).ToList();
|
||||
|
||||
//2.1.遍历:组装明细
|
||||
generateDtoList_Metod_Box.ForEach(x =>
|
||||
{
|
||||
foreach (var detItem in dtoDatas_details_Method_box)
|
||||
{
|
||||
//2.1箱是当前的
|
||||
if (detItem.BoxId == x.BoxId)
|
||||
{
|
||||
//2.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
#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.GenerateInStockBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库单-箱库存变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateInStockBox(List<BoxInventoryGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> ExeInStockBox(List<BoxInventoryGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -1010,63 +1061,13 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库单-箱库存变更
|
||||
/// </summary>
|
||||
/// <param name="dtoData"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateOutStockBox(OutStock dtoData, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoData == null)
|
||||
return Result.ReFailure(ResultCodes.InventoryNoSourceError);
|
||||
|
||||
//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 = dtoData.OrgCode,
|
||||
StockCode = dtoData.StockCode,
|
||||
SubStockId = x.Key.SubStockId,
|
||||
InventoryInOutMethod = (int)dtoData.Method,
|
||||
InventoryInOutType = (int)InventoryInOutType.Out
|
||||
|
||||
}).ToList();
|
||||
//3.组装明细
|
||||
generateDtoList.ForEach(x =>
|
||||
{
|
||||
//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)
|
||||
{
|
||||
foreach (var detItem in current_materialDetails)
|
||||
{
|
||||
//2.2组装明细
|
||||
var det = new BoxInventoryGenerateDetailsDto();
|
||||
det.MaterialId = detItem.MaterialId;
|
||||
det.Qty = detItem.Qty;
|
||||
det.SerialNumbers = detItem.SerialNumbers;
|
||||
x.Details.Add(det);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//提交处理
|
||||
return await this.GenerateOutStockBox(generateDtoList, isTransaction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库单-箱库存变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Result> GenerateOutStockBox(List<BoxInventoryGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> ExeOutStockBox(List<BoxInventoryGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
|
||||
Reference in New Issue
Block a user