PC出库单库存分配问题

This commit is contained in:
秦鸿展
2026-03-14 19:37:00 +08:00
parent 998f58c586
commit ed1566f1ad
@@ -307,6 +307,8 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
}
if (CollectionUtil.isNotEmpty(outMaterialDetailListChild)){
outMaterialDetailList.addAll(outMaterialDetailListChild);
// 有子项时,父项不参与库存扣减,避免父项+子项重复扣减导致数量翻倍(子项已代表实际分配)
outMaterialDetail.setNowAllocationQuantity(BigDecimal.ZERO);
}
//记录收货单收货总数
totalAllocationQuantity = totalAllocationQuantity.add(outMaterialDetail.getAlreadyAllocationQuantity());
@@ -433,7 +435,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
StockOutOrder stockOutOrder = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda().eq(StockOutOrder::getOutOrderNumber, outOrderNumber));
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
BigDecimal nowAllocationQuantity = outMaterialDetail.getNowAllocationQuantity();
if (nowAllocationQuantity == null && nowAllocationQuantity.compareTo(BigDecimal.ZERO) <= 0) {
if (nowAllocationQuantity == null || nowAllocationQuantity.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
@@ -524,7 +526,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
StockOutOrder stockOutOrder = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda().eq(StockOutOrder::getOutOrderNumber, outOrderNumber));
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
BigDecimal nowAllocationQuantity = outMaterialDetail.getNowAllocationQuantity();
if (nowAllocationQuantity == null && nowAllocationQuantity.compareTo(BigDecimal.ZERO) <= 0) {
if (nowAllocationQuantity == null || nowAllocationQuantity.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();