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)
@@ -808,7 +823,8 @@
                })
                .ne(InsProduct::getIsBinding, 1));
        if (Objects.equals(reportType, INSPECTION_REPORT)) {
            insProducts.addAll(insProductMapper.selectFiberInsProduct(InsSampleIds, laboratory));
            List<InsProduct> insProducts1 = insProductMapper.selectFiberInsProduct(InsSampleIds, laboratory);
            insProducts.addAll(insProducts1);
        }
        if (insProducts.size() > 0) {
            String str = "";
@@ -887,7 +903,7 @@
        // 11.成品抽样添加合格状态
        // 判断是否有抽样信息
        if (order.getQuarterItemId() != null) {
        if (isInspectionReport && order.getQuarterItemId() != null) {
            // 判断是否有不合格
            this.addProductSpotCheck(insSamples, order);
        }
@@ -942,7 +958,7 @@
        });
        // 14.ifs移库(原材料需要进行移库操作) --> 最后执行,因为失败无法回滚
        if (ifsInventoryQuantity != null) {
        if (ifsInventoryQuantity != null && isInspectionReport) {
            // 登记检验结果
            // 判断是否有不合格, 有不合格不能移库
            // todo: ifs移库
@@ -956,7 +972,7 @@
            });
        } else {
        } else if (isInspectionReport) {
            // 修改成品状态
            // 判断是否有不合格
            Long unqualifiedCount = insReportService.getUnqualifiedCount(order);
@@ -983,7 +999,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)) {
@@ -1939,7 +1955,8 @@
            // 修改换行和合并问题
            updaeMerge(template.getXWPFDocument(), true);
            String name = insReport.getCode().replace("/", "") + (showResult ? "-J.docx" : "-C.docx");
            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name)));
            Files.createDirectories(Paths.get(wordUrl));
            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl, name)));
            insReport.setUrl("/word/" + name);
            insReport.setIsPass(0);
            insReport.setWriteUserId(SecurityUtils.getUserId().intValue());//提交人
@@ -2851,7 +2868,8 @@
            // 修改换行和合并问题
            updaeMerge(template.getXWPFDocument(), false);
            String name = insReport.getCode().replace("/", "") + (showResult ? ".docx" : "-C.docx");
            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name)));
            Files.createDirectories(Paths.get(wordUrl));
            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl, name)));
            insReport.setUrl("/word/" + name);
            insReport.setWriteUserId(SecurityUtils.getUserId().intValue());//提交人
            insReport.setWriteTime(LocalDateTime.now());//提交时间
@@ -3231,6 +3249,11 @@
            }
        }
        // 检测报告不展示“结论”列,首行也要同步减少一个单元格,
        // 否则首行为 max + 6 列、其余行为 max + 5 列,poi-tl 无法渲染表格。
        if (!showResult && !text.isEmpty()) {
            text.remove(text.size() - 1);
        }
        TextRenderData[] text2 = text.toArray(new TextRenderData[0]);
        rowRenderData = Rows.of(text2).center().rowAtleastHeight(1).create();
        rows.add(rowRenderData);