上架数量显示异常1

This commit is contained in:
秦鸿展
2026-04-15 10:56:04 +08:00
parent fdb70db6f6
commit 1fbdaaaf51
3 changed files with 52 additions and 17 deletions
@@ -317,8 +317,17 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
// 有子项时,父项不参与库存扣减,避免父项+子项重复扣减导致数量翻倍(子项已代表实际分配)
outMaterialDetail.setNowAllocationQuantity(BigDecimal.ZERO);
}
//记录收货单收货总数
totalAllocationQuantity = totalAllocationQuantity.add(outMaterialDetail.getAlreadyAllocationQuantity());
// 单头「分配数量」= 本计划行主行已分配 + 各子行已分配(主行字段不再存主+子合计)
BigDecimal lineAllocatedSum = outMaterialDetail.getAlreadyAllocationQuantity() != null
? outMaterialDetail.getAlreadyAllocationQuantity() : BigDecimal.ZERO;
if (!CollectionUtils.isEmpty(materialDetailDOChildList)) {
for (OutMaterialDetailDO childDo : materialDetailDOChildList) {
BigDecimal childAlloc = childDo.getAlreadyAllocationQuantity() != null
? childDo.getAlreadyAllocationQuantity() : BigDecimal.ZERO;
lineAllocatedSum = lineAllocatedSum.add(childAlloc);
}
}
totalAllocationQuantity = totalAllocationQuantity.add(lineAllocatedSum);
}
stockOutOrderPO.setAllocationQuantity(totalAllocationQuantity);
//分配(修改库存)