gongchunyi
3 天以前 f0bcc6b51f4a272321710650800486d7d2f019fd
src/main/java/com/ruoyi/production/service/impl/ProductionRecordServiceImpl.java
@@ -202,8 +202,18 @@
            throw new ServiceException("报工失败,生产订单不存在");
        }
        //  当前报工合格数量(前端已保证 = 投入数量 - 不合格数量,直接使用)
        //  当前报工合格数量
        BigDecimal qualifiedQty = dto.getQualifiedQuantity() == null ? BigDecimal.ZERO : dto.getQualifiedQuantity();
        BigDecimal unqualifiedQty = dto.getUnqualifiedQuantity() == null ? BigDecimal.ZERO : dto.getUnqualifiedQuantity();
        BigDecimal totalReportQty = dto.getQuantity() == null ? BigDecimal.ZERO : dto.getQuantity();
        if (qualifiedQty.compareTo(BigDecimal.ZERO) < 0 || unqualifiedQty.compareTo(BigDecimal.ZERO) < 0 || totalReportQty.compareTo(BigDecimal.ZERO) < 0) {
            throw new ServiceException("报工失败:合格数量、不合格数量或总数量不能为负数");
        }
        if (qualifiedQty.add(unqualifiedQty).compareTo(totalReportQty) != 0) {
            throw new ServiceException("报工失败:合格数量与不合格数量之和必须等于总报工数量");
        }
        //  订单已完成数量(历史累计)
        BigDecimal completeQty = productOrder.getCompleteQuantity() == null ? BigDecimal.ZERO : productOrder.getCompleteQuantity();
        //  需求数量
@@ -307,6 +317,8 @@
                                paramEntity.setValueMode(orderParam.getValueMode());
                                paramEntity.setUnit(orderParam.getUnit());
                                paramEntity.setStandardValue(orderParam.getStandardValue());
                                paramEntity.setMinValue(orderParam.getMinValue());
                                paramEntity.setMaxValue(orderParam.getMaxValue());
                            }
                        }
                        productionProductRouteItemParamService.save(paramEntity);
@@ -752,6 +764,9 @@
                                paramEntity.setParamFormat(orderParam.getParamFormat());
                                paramEntity.setValueMode(orderParam.getValueMode());
                                paramEntity.setUnit(orderParam.getUnit());
                                paramEntity.setStandardValue(orderParam.getStandardValue());
                                paramEntity.setMinValue(orderParam.getMinValue());
                                paramEntity.setMaxValue(orderParam.getMaxValue());
                            }
                        }
                        productionProductRouteItemParamService.save(paramEntity);