huminmin
2026-05-14 804b34fb9d6735c434ff0ee69fe3d2c7c4292298
src/main/java/com/ruoyi/production/service/impl/ProductionPlanServiceImpl.java
@@ -101,12 +101,13 @@
            throw new BaseException("合并失败,所选生产计划的产品型号不一致");
        }
        // 已下发或部分下发的计划不允许再次合并
        boolean hasIssuedPlan = planLists.stream()
        // 仅“已下发”计划不允许再次参与合并下发;
        // “待下发/部分下发”允许继续下发剩余数量。
        boolean hasFullyIssuedPlan = planLists.stream()
                .anyMatch(item -> item.getStatus() != null
                        && (item.getStatus() == PLAN_STATUS_PARTIAL || item.getStatus() == PLAN_STATUS_ISSUED));
        if (hasIssuedPlan) {
            throw new BaseException("合并失败,所选生产计划存在已下发或部分下发的数据");
                        && item.getStatus() == PLAN_STATUS_ISSUED);
        if (hasFullyIssuedPlan) {
            throw new BaseException("合并失败,所选生产计划存在已下发的数据");
        }
        // 计算本次可下发的剩余需求总量
@@ -150,6 +151,7 @@
        productionOrder.setProductModelId(firstPlan.getProductModelId());
        productionOrder.setQuantity(assignedQuantity);
        productionOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
        productionOrder.setTeamLeaderUserId(productionPlanDto.getLeaderId());
        if (!productionOrderService.saveProductionOrder(productionOrder)) {
            throw new ServiceException("下发失败,生产订单保存失败");
        }