即时库存
This commit is contained in:
@@ -37,14 +37,6 @@ namespace WMS.Web.Domain.IService
|
||||
/// <returns></returns>
|
||||
Task<Result> GenerateMoveBox(List<MoveBoxRecord> dtoDatas, bool isTransaction);
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退上下架-箱库存的变更
|
||||
/// </summary>
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> GenerateBackBox(List<BoxInventoryBackGenerateDto> dtoDatas, bool isTransaction);
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退上下架-箱库存的变更
|
||||
/// </summary>
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace WMS.Web.Domain.Services
|
||||
/// <param name="dtoDatas"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> GenerateBackBox(List<BoxInventoryBackGenerateDto> dtoDatas, bool isTransaction)
|
||||
private async Task<Result> GenerateBackBox(List<BoxInventoryBackGenerateDto> dtoDatas, bool isTransaction)
|
||||
{
|
||||
//1.判断来源数据是否存在
|
||||
if (dtoDatas == null || dtoDatas.Count == 0)
|
||||
@@ -402,6 +402,7 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
var update_entitys = new List<BoxInventory>();
|
||||
var add_entitys = new List<BoxInventory>();
|
||||
var InventoryDetailsGenerateDto = new List<InventoryDetailsGenerateDto>();
|
||||
|
||||
//2.获取“箱库存集合”
|
||||
var boxIds = dtoDatas.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
@@ -431,6 +432,21 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
add_entitys.Add(addEntity);
|
||||
|
||||
//4.1即时库存:组装入库
|
||||
foreach (var item in box.Details)
|
||||
{
|
||||
//3.2.2组装即时库存dto
|
||||
var inventoryDet = new InventoryDetailsGenerateDto();
|
||||
inventoryDet.MaterialId = item.MaterialId;
|
||||
inventoryDet.OrgCode = dto.OrgCode;
|
||||
inventoryDet.StockCode = dto.StockCode;
|
||||
inventoryDet.SubStockId = dto.SubStockId;
|
||||
inventoryDet.Qty = item.Qty;
|
||||
inventoryDet.InventoryInOutType = (int)InventoryInOutType.In;
|
||||
//3.2.2即时库存:修改箱库存的集合
|
||||
InventoryDetailsGenerateDto.Add(inventoryDet);
|
||||
}
|
||||
|
||||
|
||||
}//下架
|
||||
else
|
||||
@@ -457,8 +473,23 @@ namespace WMS.Web.Domain.Services
|
||||
updateDetail.Qty = updateDetail.Qty - dtoItem.Qty;
|
||||
//再移除要改箱的序列号;最后就是原箱库存的新序列号
|
||||
updateDetail.SerialNumbers.RemoveAll(x => dtoItem.SerialNumbers.Contains(x));
|
||||
|
||||
//4.1即时库存:组装出库
|
||||
//3.2.2组装即时库存dto
|
||||
var inventoryDet = new InventoryDetailsGenerateDto();
|
||||
inventoryDet.MaterialId = dtoItem.MaterialId;
|
||||
inventoryDet.OrgCode = dto.OrgCode;
|
||||
inventoryDet.StockCode = dto.StockCode;
|
||||
inventoryDet.SubStockId = dto.SubStockId;
|
||||
inventoryDet.Qty = dtoItem.Qty;
|
||||
inventoryDet.InventoryInOutType = (int)InventoryInOutType.Out;
|
||||
//3.2.2即时库存:修改箱库存的集合
|
||||
InventoryDetailsGenerateDto.Add(inventoryDet);
|
||||
|
||||
}
|
||||
update_entitys.Add(update_entity);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,6 +505,13 @@ namespace WMS.Web.Domain.Services
|
||||
isSuccess = await _boxInventoryRepositories.UpdateRange(update_entitys, isTransaction);
|
||||
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
//5.即时库存:处理
|
||||
if (InventoryDetailsGenerateDto.Count != 0)
|
||||
{
|
||||
var InventoryDetailsGenerate_result = await _inventoryDetailsService.GenerateInventoryDetails(InventoryDetailsGenerateDto, isTransaction);
|
||||
if (!InventoryDetailsGenerate_result.IsSuccess)
|
||||
return InventoryDetailsGenerate_result;
|
||||
}
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
@@ -572,6 +610,17 @@ namespace WMS.Web.Domain.Services
|
||||
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)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理箱库存变更:出入库
|
||||
|
||||
Reference in New Issue
Block a user