inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -46,6 +46,7 @@
import com.ruoyi.inspect.service.*;
import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
import com.ruoyi.inspect.vo.InsOrderPlanVO;
import com.ruoyi.inspect.vo.InsSampleUserVO;
@@ -1217,13 +1218,12 @@
                .last("FOR UPDATE"));
        boolean isInspectionReport = Objects.equals(INSPECTION_REPORT, reportType);
        registerInsResults = isInspectionReport && Boolean.TRUE.equals(registerInsResults);
        // 1. 判断是否有重复编号, 有重复编号做提醒
        // 1. 委托编号全局唯一,提交复核时再次校验,防止并发或历史数据绕过生成校验。
        Long codeCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery()
                .ne(InsOrder::getState, -1)
                .ne(InsOrder::getIfsInventoryId, order.getIfsInventoryId())
                .ne(InsOrder::getId, orderId)
                .eq(InsOrder::getEntrustCode, order.getEntrustCode()));
        if (codeCount > 0) {
            throw new ErrorException("当前编号有重复, 请先去修改重复编号");
            throw new ErrorException("样品/委托单已存在,请确认样品编号");
        }
        // 2. 判断该订单是否是第一次生产(后续报告生成只取第一次提交时间)
@@ -1985,13 +1985,13 @@
                || report.getExamineTime() != null;
        if (submitted) {
            User writer = getReportSigner(report.getWriteUserId(), "编制人");
            marks.put("writeUrl", Pictures.ofLocal(imgUrl + "/" + writer.getSignatureUrl()).create());
            marks.put("writeUrl", ReportSignaturePictureUtils.create(imgUrl, writer.getSignatureUrl()));
            marks.put("writeDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(report.getWriteTime())).create());
            marks.put("insUrl", Pictures.ofLocal(imgUrl + "/" + writer.getSignatureUrl()).create());
            marks.put("insUrl", ReportSignaturePictureUtils.create(imgUrl, writer.getSignatureUrl()));
        }
        if (Objects.equals(report.getIsExamine(), 1)) {
            User examiner = getReportSigner(report.getExamineUserId(), "审核人");
            marks.put("examineUrl", Pictures.ofLocal(imgUrl + "/" + examiner.getSignatureUrl()).create());
            marks.put("examineUrl", ReportSignaturePictureUtils.create(imgUrl, examiner.getSignatureUrl()));
            marks.put("examineDateUrl", Pictures.ofStream(DateImageUtil.createDateImage(report.getExamineTime())).create());
        }
        return marks;
@@ -2536,13 +2536,18 @@
        enterFactoryReport.setLotBatchNo(ifsInventoryQuantity.getUpdateBatchNo());
        // 检测依据
        Set<String> standardMethod = new HashSet<>();
        Set<String> standardMethod = new LinkedHashSet<>();
        StringBuilder standardMethod2 = new StringBuilder();
        standardMethod.add(baseMapper.getStandardMethodCode(insSample.getStandardMethodListId()));
        String reportStandardMethod = baseMapper.getStandardMethodReportText(insSample.getStandardMethodListId());
        if (StringUtils.isNotBlank(reportStandardMethod)) {
            standardMethod.add(reportStandardMethod);
        }
        for (String s : standardMethod) {
            standardMethod2.append("、").append(s);
        }
        standardMethod2.replace(0, 1, "");
        if (standardMethod2.length() > 0) {
            standardMethod2.deleteCharAt(0);
        }
        // 样品类型
        String orderType = iSysDictTypeService.selectLabelByDict(DictDataConstants.CHECK_TYPE, insOrder.getOrderType());
@@ -3214,7 +3219,7 @@
        insReport.setReportType(reportType);
        boolean showResult = Objects.equals(reportType, INSPECTION_REPORT);
        List<Map<String, Object>> tables = new ArrayList<>();
        Set<String> standardMethod = new HashSet<>();
        Set<String> standardMethod = new LinkedHashSet<>();
        Set<String> deviceSet = new HashSet<>();
        Set<String> models = new HashSet<>();
        // 查询检验项数量
@@ -3227,11 +3232,13 @@
        /*基础报告(根据绘制的原始记录模版形成)*/
        samples.forEach(a -> {
            models.add(a.getModel());
            String standardMethodCode = baseMapper.getStandardMethodCode(a.getStandardMethodListId());
            if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) {
                standardMethodCode = standardMethodCode + "+" + a.getSpecialStandardMethod();
            String standardMethodCode = baseMapper.getStandardMethodReportText(a.getStandardMethodListId());
            if (StrUtil.isNotBlank(standardMethodCode)) {
                if (StrUtil.isNotBlank(a.getSpecialStandardMethod())) {
                    standardMethodCode = standardMethodCode + "+" + a.getSpecialStandardMethod();
                }
                standardMethod.add(standardMethodCode);
            }
            standardMethod.add(standardMethodCode);
            for (InsProduct b : a.getInsProduct()) {
                if (b.getInsProductResult() != null) {
                    List<JSONObject> jsonObjects = JSON.parseArray(b.getInsProductResult().getEquipValue(), JSONObject.class);
@@ -3577,9 +3584,14 @@
        if (firstInspectDate == null) {
            firstInspectDate = insOrder.getSendTime();
        }
        if (firstInspectDate == null) {
            firstInspectDate = submitTime;
        }
        String insTime = firstInspectDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")) + "-"
                + submitTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
        String testStartDate = firstInspectDate.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
        String testEndDate = submitTime.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
        String insTimeEn = monthNames[firstInspectDate.getMonthValue() - 1] + " " + firstInspectDate.format(DateTimeFormatter.ofPattern("dd, yyyy")) + "-"
                + monthNames[submitTime.getMonthValue() - 1] + " " + submitTime.format(DateTimeFormatter.ofPattern("dd, yyyy"));
@@ -3636,11 +3648,8 @@
                productionDate = insOrder.getProductionDate().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
            }
            batchNo = defaultReportText(insOrder.getProductionBatch(), "/");
            standardMethodText = templateSnapshots.stream()
                    .map(InsOrderStandardTemplate::getRemark)
                    .filter(StringUtils::isNotBlank)
                    .distinct()
                    .collect(Collectors.joining(";"));
            standardMethodText = defaultReportText(
                    baseMapper.getStandardMethodReportTextByCode(insOrder.getSample()), insOrder.getSample());
        }
        boolean containsOrganicChlorine = detectionResultRows.stream()
                .map(row -> row.get("itemName"))
@@ -3729,6 +3738,8 @@
                    put("batch", finalBatchNo);
                    put("phone", defaultReportText(insOrder.getPhone(), "/"));
                    put("testDate", insTime);
                    put("testStartDate", testStartDate);
                    put("testEndDate", testEndDate);
                    put("entrustNo", defaultReportText(insOrder.getEntrustCode(), "/"));
                    put("sampling", "/");
                    put("standard", finalStandardMethodText);