src/main/java/com/ruoyi/production/service/impl/ProductionOrderPickServiceImpl.java
@@ -189,6 +189,7 @@
            return Collections.emptyList();
        }
        List<ProductionOrderPickVo> detailList = baseMapper.listPickedDetailByOrderId(productionOrderId);
        fillStockQuantity(detailList);
        fillBatchNoList(detailList);
        fillSelectableBatchNoList(detailList);
        return detailList;
@@ -1121,6 +1122,34 @@
        }
    }
    private void fillStockQuantity(List<ProductionOrderPickVo> detailList) {
        if (detailList == null || detailList.isEmpty()) {
            return;
        }
        Set<Long> productModelIdSet = detailList.stream()
                .map(ProductionOrderPickVo::getProductModelId)
                .filter(Objects::nonNull)
                .collect(Collectors.toSet());
        if (productModelIdSet.isEmpty()) {
            return;
        }
        List<StockInventory> stockList = stockInventoryMapper.selectList(
                Wrappers.<StockInventory>lambdaQuery()
                        .in(StockInventory::getProductModelId, productModelIdSet));
        Map<Long, BigDecimal> stockQuantityMap = new HashMap<>();
        for (StockInventory stockInventory : stockList) {
            if (stockInventory == null || stockInventory.getProductModelId() == null) {
                continue;
            }
            stockQuantityMap.merge(stockInventory.getProductModelId(),
                    defaultDecimal(stockInventory.getQualitity()),
                    BigDecimal::add);
        }
        for (ProductionOrderPickVo detail : detailList) {
            detail.setStockQuantity(stockQuantityMap.getOrDefault(detail.getProductModelId(), BigDecimal.ZERO));
        }
    }
    private String buildBatchNoGroupKey(ProductionOrderPickVo detail) {
        // 构建批次聚合分组键。
        return detail.getProductionOrderId() + "|"