9 天以前 47e4fbbae343e37b4697ae786a147333ec8acf82
src/main/java/com/ruoyi/production/service/impl/ProductionOrderServiceImpl.java
@@ -446,7 +446,8 @@
            target.setProductModelId(source.getProductModelId());
            target.setTechnologyOperationId(source.getOperationId());
            target.setUnitQuantity(source.getUnitQuantity());
            target.setDemandedQuantity(source.getUnitQuantity().multiply(orderQuantity));
            // 直接使用订单数量 × 当前BOM的单位产出,不再逐层累积
            target.setDemandedQuantity(orderQuantity.multiply(source.getUnitQuantity()));
            target.setUnit(source.getUnit());
            productionBomStructureMapper.insert(target);
            idMap.put(source.getId(), target.getId());
@@ -1049,9 +1050,11 @@
                    continue;
                }
                Long productModelId = stockItem.getProductModelId();
                stockQuantityMap.merge(productModelId, defaultDecimal(stockItem.getQualitity()), BigDecimal::add);
                BigDecimal quantity = defaultDecimal(stockItem.getQualitity());
                stockQuantityMap.merge(productModelId, quantity, BigDecimal::add);
                String batchNo = stockItem.getBatchNo();
                if (batchNo != null && !batchNo.trim().isEmpty()) {
                // 只添加库存数量大于0的批号
                if (batchNo != null && !batchNo.trim().isEmpty() && quantity.compareTo(BigDecimal.ZERO) > 0) {
                    stockBatchNoMap.computeIfAbsent(productModelId, key -> new LinkedHashSet<>()).add(batchNo);
                }
            }