liding
2026-09-01 bf2026a38d4d36371060673d4651b6e05ca90632
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -277,9 +277,14 @@
    }
    @Override
    public Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory) {
    public Map<String,Object> checkSubmitPlan(Integer orderId, String laboratory, Integer reportType) {
        Map<String, Object> map = new HashMap<>();
        List<String> collect = new ArrayList<>();
        if (Objects.equals(DETECTION_REPORT, reportType)) {
            map.put("errorMsg", collect);
            map.put("unInsOrderCount", 0L);
            return map;
        }
        List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, orderId).select(InsSample::getId));
        List<Integer> ids = insSamples.stream().map(a -> a.getId()).collect(Collectors.toList());
        List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
@@ -773,7 +778,17 @@
        if (!Objects.equals(DETECTION_REPORT, reportType) && !Objects.equals(INSPECTION_REPORT, reportType)) {
            throw new ErrorException("请选择报告类型");
        }
        InsOrder order = insOrderMapper.selectById(orderId);
        InsOrder order = insOrderMapper.selectOne(Wrappers.<InsOrder>lambdaQuery()
                .eq(InsOrder::getId, orderId)
                .last("FOR UPDATE"));
        InsReport existingReport = insReportMapper.selectOne(Wrappers.<InsReport>lambdaQuery()
                .eq(InsReport::getInsOrderId, orderId));
        if (existingReport != null && existingReport.getReportType() != null
                && !Objects.equals(existingReport.getReportType(), reportType)) {
            throw new ErrorException("同一检验订单只能使用一种报告类型");
        }
        boolean isInspectionReport = Objects.equals(INSPECTION_REPORT, reportType);
        registerInsResults = isInspectionReport && Boolean.TRUE.equals(registerInsResults);
        // 1. 判断是否有重复编号, 有重复编号做提醒
        Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
                .ne(InsOrder::getState, -1)
@@ -887,7 +902,7 @@
        // 11.成品抽样添加合格状态
        // 判断是否有抽样信息
        if (order.getQuarterItemId() != null) {
        if (isInspectionReport && order.getQuarterItemId() != null) {
            // 判断是否有不合格
            this.addProductSpotCheck(insSamples, order);
        }
@@ -942,7 +957,7 @@
        });
        // 14.ifs移库(原材料需要进行移库操作) --> 最后执行,因为失败无法回滚
        if (ifsInventoryQuantity != null) {
        if (ifsInventoryQuantity != null && isInspectionReport) {
            // 登记检验结果
            // 判断是否有不合格, 有不合格不能移库
            // todo: ifs移库
@@ -956,7 +971,7 @@
            });
        } else {
        } else if (isInspectionReport) {
            // 修改成品状态
            // 判断是否有不合格
            Long unqualifiedCount = insReportService.getUnqualifiedCount(order);
@@ -983,7 +998,7 @@
    private void addAnalysis(List<InsProduct> productList, IfsInventoryQuantity ifsInventoryQuantity, InsOrder order, String sendUserAccount) {
        for (InsProduct insProduct : productList) {
            // 判断是否是数值类型
            if (insProduct.getInspectionValueType().equals("1") && insProduct.getInsResult().equals(1)) {
            if ("1".equals(insProduct.getInspectionValueType()) && Objects.equals(insProduct.getInsResult(), 1)) {
                List<InsProductDeviationWarningDetail> insProductAnalysisDtoList = insProductMapper.selectAnalysis(insProduct, ifsInventoryQuantity.getSupplierName());
                if (CollectionUtils.isEmpty(insProductAnalysisDtoList)) {