改箱库存
This commit is contained in:
@@ -69,24 +69,37 @@ namespace WMS.Web.Domain.Services
|
|||||||
var sour = sourceBoxInventorys.Where(x => x.BoxId == dto.BoxId).FirstOrDefault();
|
var sour = sourceBoxInventorys.Where(x => x.BoxId == dto.BoxId).FirstOrDefault();
|
||||||
if (sour != null)
|
if (sour != null)
|
||||||
{
|
{
|
||||||
|
//2.2箱库存
|
||||||
var sour_update_entity = sour;
|
var sour_update_entity = sour;
|
||||||
sour_update_entity.Details = sour.Details;
|
sour_update_entity.Details = sour.Details;
|
||||||
foreach (var dtoItem in dto.Details)
|
foreach (var dtoItem in dto.Details)
|
||||||
{
|
{
|
||||||
//找到原来的箱库存对应要改变的物料:这个一定是存在的,不存在就有问题
|
//2.2.1箱库存:找到原来的箱库存对应要改变的物料:这个一定是存在的,不存在就有问题
|
||||||
var sour_ChangeDetail = sour_update_entity.Details.Where(x => x.MaterialId == dtoItem.MaterialId).FirstOrDefault();
|
var sour_ChangeDetail = sour_update_entity.Details.Where(x => x.MaterialId == dtoItem.MaterialId).FirstOrDefault();
|
||||||
if (sour_ChangeDetail == null)
|
if (sour_ChangeDetail == null)
|
||||||
return Result.ReFailure(ResultCodes.BoxInventoryNoDataError);
|
return Result.ReFailure(ResultCodes.BoxInventoryNoDataError);
|
||||||
//箱物料的库存数量不足;小于要拿出来的数量
|
//2.2.1箱库存:箱物料的库存数量不足;小于要拿出来的数量
|
||||||
if (sour_ChangeDetail.Qty < dtoItem.Qty)
|
if (sour_ChangeDetail.Qty < dtoItem.Qty)
|
||||||
return Result.ReFailure(ResultCodes.BoxInventoryNoInventoryError);
|
return Result.ReFailure(ResultCodes.BoxInventoryNoInventoryError);
|
||||||
//减库存
|
//2.2.1箱库存:减库存
|
||||||
sour_ChangeDetail.Qty = sour_ChangeDetail.Qty - dtoItem.Qty;
|
sour_ChangeDetail.Qty = sour_ChangeDetail.Qty - dtoItem.Qty;
|
||||||
|
|
||||||
//再移除要改箱的序列号;最后就是原箱库存的新序列号
|
//2.2.1箱库存:再移除要改箱的序列号;最后就是原箱库存的新序列号
|
||||||
sour_ChangeDetail.SerialNumbers.RemoveAll(x => dtoItem.SerialNumbers.Contains(x));
|
sour_ChangeDetail.SerialNumbers.RemoveAll(x => dtoItem.SerialNumbers.Contains(x));
|
||||||
|
|
||||||
|
//2.2.2组装即时库存dto
|
||||||
|
var inventoryDet = new InventoryDetailsGenerateDto();
|
||||||
|
inventoryDet.MaterialId = dtoItem.MaterialId;
|
||||||
|
inventoryDet.OrgCode = sour_update_entity.OrgCode;
|
||||||
|
inventoryDet.StockCode = sour_update_entity.StockCode;
|
||||||
|
inventoryDet.SubStockId = sour_update_entity.SubStockId;
|
||||||
|
inventoryDet.Qty = dtoItem.Qty;
|
||||||
|
inventoryDet.InventoryInOutType = (int)InventoryInOutType.Out;
|
||||||
|
//2.2.2即时库存:修改箱库存的集合
|
||||||
|
InventoryDetailsGenerateDto.Add(inventoryDet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//2.2.1箱库存:修改箱库存的集合
|
||||||
update_entitys.Add(sour_update_entity);
|
update_entitys.Add(sour_update_entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user