计划数量为0的修改

This commit is contained in:
秦鸿展
2026-02-09 10:26:07 +08:00
parent f149b7322d
commit 598a8b89e3
2 changed files with 83 additions and 20 deletions
@@ -11,7 +11,9 @@ import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.stockInOrder.repository.todo.StockInOrderDO;
import com.mhd.wms.interfaces.dto.stockInOrder.StockInOrderDTO;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.Date;
/**
@@ -78,6 +80,13 @@ public class StockInOrderAssembler {
if (orderTypeName == null || orderTypeName.trim().length() == 0) {
stockInOrderDO.setOrderTypeName("普通入库单");
}
// 新增入库单时,计划数量取所有明细行的入库数量之和
if (!CollectionUtils.isEmpty(stockInOrderDO.getMaterialDetailList())) {
BigDecimal totalInboundQuantity = stockInOrderDO.getMaterialDetailList().stream()
.map(detail -> detail.getInboundQuantity() != null ? detail.getInboundQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
stockInOrderDO.setQuantity(totalInboundQuantity);
}
}
return stockInOrderDO;
}