From 56e6e0bf18c39a933aec78762b636fdf2efa8d68 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 08 十二月 2025 17:59:24 +0800
Subject: [PATCH] 外购成品检验报告生成功能

---
 cnas-device/src/main/java/com/ruoyi/device/service/impl/CollectBridgeServiceImpl.java          |    5 
 inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java                      |    1 
 inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java                 |    3 
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java   |   12 
 inspect-server/src/main/resources/static/small-wg-report-template.docx                         |    0 
 inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java                         |   33 +++
 ruoyi-admin-ztns/src/main/resources/application-ztns.yml                                       |   32 --
 inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml                               |   12 +
 inspect-server/src/main/resources/static/report-template.docx                                  |    0 
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java           |    9 
 inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java |    5 
 ruoyi-admin-ztns/src/main/resources/application-druid.yml                                      |   16 
 inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java                     |   21 +
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java       |  469 +++++++++++++++++++++++++++++++-----------
 14 files changed, 450 insertions(+), 168 deletions(-)

diff --git a/cnas-device/src/main/java/com/ruoyi/device/service/impl/CollectBridgeServiceImpl.java b/cnas-device/src/main/java/com/ruoyi/device/service/impl/CollectBridgeServiceImpl.java
index 4d35e6d..b968dec 100644
--- a/cnas-device/src/main/java/com/ruoyi/device/service/impl/CollectBridgeServiceImpl.java
+++ b/cnas-device/src/main/java/com/ruoyi/device/service/impl/CollectBridgeServiceImpl.java
@@ -155,9 +155,10 @@
      */
     private String getValueByDataStream(Map<String,Object> dataMap, String dataStream) {
         try{
-            return dataMap.get(dataStream).toString();
+            String val = dataMap.get(dataStream).toString();
+            return StringUtils.isNotBlank(val)?val:"0";
         }catch (Exception e){
-            return "";
+            return "0";
         }
     }
 
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
index d6ee1d0..42a2539 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/aspect/MoveLocationAfterPushMesStockAspect.java
@@ -37,6 +37,9 @@
 
     private final static String LOCATION_NO = "WG-02-001";//mes澶栬喘鍚堟牸搴撲綅
 
+    public static final int DIGIT = 6;
+    public static final String PREFIX ="KC";
+
     @AfterReturning(value = "execution(* com.ruoyi.inspect.service.impl.InsOrderServiceImpl.moveRawMaterial(..))")
     @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED)
     public void doAfterReturning(JoinPoint joinPoint) {
@@ -55,6 +58,8 @@
                         .last("limit 1")
                 );
                 if(Objects.nonNull(one)){
+                    //鐢熸垚绯荤粺缂栧彿
+
                     //鍚屾MES瀹炴椂搴撳瓨
                     Map<String, Object> requestMap = new HashMap<>();
                     requestMap.put("partNo", one.getPartNo()); // 闆朵欢缂栧彿
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java b/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java
index 3a5456d..1d060f2 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/dto/EnterFactoryReport.java
@@ -30,4 +30,25 @@
 
     @ApiModelProperty("妫�娴嬬紪鍙�")
     private String code;
+
+    /**
+     * 澶栨姢棰滆壊
+     */
+    @ApiModelProperty("澶栨姢棰滆壊")
+    private String outerColor;
+
+    /**
+     * 妫�楠屽憳
+     */
+    @ApiModelProperty("妫�楠屽憳")
+    private String inspector;
+
+    /**
+     * 妫�楠屾棩鏈�
+     */
+    @ApiModelProperty("妫�楠屾棩鏈�")
+    private String inspectDate;
+
+
+
 }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
index 1d69e5e..e1b8321 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsOrderMapper.java
@@ -149,4 +149,5 @@
     Integer selectNotSpotCheckOrder(@Param("itmeId") Integer itmeId, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     IfsOrderVO selectOrderInfoById(@Param("id") Integer id);
+
 }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
index b3f0c19..ae3a445 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/mapper/InsSampleUserMapper.java
@@ -2,6 +2,8 @@
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.inspect.pojo.InsSampleUser;
+import com.ruoyi.inspect.vo.InsSampleUserVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
 * @author Administrator
@@ -11,6 +13,7 @@
 */
 public interface InsSampleUserMapper extends BaseMapper<InsSampleUser> {
 
+    InsSampleUserVO selectUserNameByOrderId(@Param("orderId") Integer orderId);
 }
 
 
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
index e7df59d..7cd35f6 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -2,6 +2,7 @@
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -11,7 +12,6 @@
 import com.alibaba.fastjson.JSONObject;
 import com.aspose.words.License;
 import com.aspose.words.SaveFormat;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@@ -31,13 +31,13 @@
 import com.ruoyi.basic.pojo.IfsInventoryQuantity;
 import com.ruoyi.basic.pojo.StandardTemplate;
 import com.ruoyi.basic.service.StandardTemplateService;
-import com.ruoyi.basic.vo.IfsInventoryQuantityVO;
 import com.ruoyi.common.constant.DictDataConstants;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
 import com.ruoyi.common.constant.MenuJumpPathConstants;
 import com.ruoyi.common.core.domain.entity.Custom;
 import com.ruoyi.common.core.domain.entity.InformationNotification;
 import com.ruoyi.common.core.domain.entity.User;
+import com.ruoyi.common.enums.OrderType;
 import com.ruoyi.common.utils.*;
 import com.ruoyi.framework.exception.ErrorException;
 import com.ruoyi.inspect.dto.*;
@@ -47,13 +47,10 @@
 import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
 import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
 import com.ruoyi.inspect.vo.InsOrderPlanVO;
+import com.ruoyi.inspect.vo.InsSampleUserVO;
 import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
-import com.ruoyi.performance.mapper.PerformanceShiftMapper;
-import com.ruoyi.performance.mapper.ShiftTimeMapper;
 import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
-import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHoursTemporary;
 import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursService;
-import com.ruoyi.performance.service.AuxiliaryOutputWorkingHoursTemporaryService;
 import com.ruoyi.system.mapper.CustomMapper;
 import com.ruoyi.system.mapper.UserMapper;
 import com.ruoyi.system.service.ISysDictTypeService;
@@ -76,9 +73,7 @@
 import java.nio.file.Paths;
 import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -132,6 +127,8 @@
     private InsOrderFileMapper insOrderFileMapper;
     @Resource
     private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
+    @Resource
+    private IfsPartPropsRecordMapper ifsPartPropsRecordMapper;
     @Resource
     private InsReportService insReportService;
     @Resource
@@ -1635,6 +1632,95 @@
     /*****************************************************  灏忔姤鍛�    ***************************************************************************/
 
     /**
+     * 璁剧疆琛ㄦ牸鏍峰紡
+     * @param max 鏍囪瘑鏈�澶т釜鏁�
+     * @return
+     */
+    private TableStyle setTableStyle(int max){
+        //璁剧疆鏍峰紡
+        TableStyle tableStyle = new TableStyle();
+        if(max<=5){
+            for (int i = 1; i <= max; i++) {
+                // 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
+                switch (i) {
+                    case 1:
+                        tableStyle.setColWidths(new int[]{650, 2900, 850, 2300, 2100, 1200});
+                        break;
+                    case 2:
+                        tableStyle.setColWidths(new int[]{650, 2700, 850, 2200, 1200, 1200, 1200});
+                        break;
+                    case 3:
+                        tableStyle.setColWidths(new int[]{650, 2700, 850, 1600, 1000, 1000, 1000, 1200});
+                        break;
+                    case 4:
+                        tableStyle.setColWidths(new int[]{650, 2400, 850, 1500, 850, 850, 850, 850, 1200});
+                        break;
+                    case 5:
+                        tableStyle.setColWidths(new int[]{650, 2200, 850, 1350, 770, 770, 770, 770, 770, 1100});
+                        break;
+                }
+            }
+        }
+
+        tableStyle.setWidth("10000");
+        tableStyle.setAlign(TableRowAlign.CENTER);
+        BorderStyle borderStyle = new BorderStyle();
+        borderStyle.setColor("000000");
+        borderStyle.setType(XWPFTable.XWPFBorderType.SINGLE);
+        borderStyle.setSize(4);
+        tableStyle.setLeftBorder(borderStyle);
+        tableStyle.setRightBorder(borderStyle);
+        tableStyle.setInsideHBorder(borderStyle); // 璁剧疆姘村钩鍐呰竟妗�
+        tableStyle.setInsideVBorder(borderStyle);
+        return tableStyle;
+    }
+
+    /**
+     * 澶勭悊鏈夌數缂嗛鑹叉爣璇嗙殑妫�娴嬮」
+     * @param cableTags 鐢电紗棰滆壊鏍囪瘑
+     * @param collect   妫�娴嬮」鍒楄〃
+     * @param startIndex 璧峰涓嬫爣
+     * @param endIndex   缁撴潫涓嬫爣
+     * @return
+     */
+    private List<SampleProductExportDto> transformSampleProduct(List<String> cableTags,Map<String, List<SampleProductExportDto>> collect,int startIndex,int endIndex){
+        List<SampleProductExportDto> sampleProductExportDtos = new ArrayList<>();
+        for (String s : collect.keySet()) {
+            List<String> lastValueList = new ArrayList<>();
+            SampleProductExportDto dto = new SampleProductExportDto();
+            BeanUtil.copyProperties(collect.get(s).get(0),dto);
+            Set<String> tellSet = new HashSet<>();
+            for (int i = startIndex; i < endIndex; i++) {
+                String cableTag = cableTags.get(i);
+                for (SampleProductExportDto sDto : collect.get(s)) {
+                    tellSet.add(sDto.getTell());
+                    if(sDto.getCableTag().equals(cableTag)){
+                        lastValueList.add(sDto.getLastValue());
+                    }
+                }
+            }
+            //鍒囧壊鐢电紗閰嶇疆椤�
+            dto.setTell(String.join("\n",tellSet));
+            dto.setLastValueList(lastValueList);
+            sampleProductExportDtos.add(dto);
+        }
+        return sampleProductExportDtos;
+    }
+
+    /**
+     * 妫�娴嬮」鎺掑簭
+     * @param sourceMap
+     * @param targetMap
+     */
+    private void sortSampleProduct(Map<String, List<SampleProductExportDto>> sourceMap,Map<String, List<SampleProductExportDto>> targetMap){
+        List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sourceMap.entrySet());
+        entries.sort(Comparator.comparingInt(o -> (o.getValue().get(0).getSort() == null ? 0 : o.getValue().get(0).getSort())));
+        for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
+            targetMap.put(entry.getKey(), entry.getValue());
+        }
+    }
+
+    /**
      * 灏忔姤鍛婄敓鎴�
      * @param orderId
      * @param insOrder
@@ -1652,11 +1738,17 @@
         enterFactoryReport.setSample(insOrder.getSample());
         // 鑾峰彇ifs鏁版嵁
         IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
+        //鏌ヨ闆朵欢灞炴��
+        IfsPartPropsRecord ifsPartPropsRecord = ifsPartPropsRecordMapper.selectOne(Wrappers.<IfsPartPropsRecord>lambdaQuery()
+                .eq(IfsPartPropsRecord::getIfsInventoryId, ifsInventoryQuantity.getId()));
+        if(Objects.nonNull(ifsPartPropsRecord)){
+            enterFactoryReport.setOuterColor(ifsPartPropsRecord.getOuterColor());
+        }
         enterFactoryReport.setQtyArrived(ifsInventoryQuantity.getQtyArrived() == null ? "" :
                 ifsInventoryQuantity.getQtyArrived().stripTrailingZeros().toPlainString() + ifsInventoryQuantity.getBuyUnitMeas());
         enterFactoryReport.setQuantity(insOrder.getTestQuantity());
         enterFactoryReport.setPartDesc(insOrder.getPartDetail());
-        enterFactoryReport.setSupplierName("**********");
+        enterFactoryReport.setSupplierName(ifsInventoryQuantity.getSupplierName());
         enterFactoryReport.setLotBatchNo(ifsInventoryQuantity.getUpdateBatchNo());
 
         // 妫�娴嬩緷鎹�
@@ -1674,6 +1766,7 @@
         List<RowRenderData> rows = new ArrayList<>();
         List<TextRenderData> text = new ArrayList<>();
         RowRenderData rowRenderData = null;
+        List<Map<String,Object>> cableTagEnclosureTables = new ArrayList<>();
 
         // 鏌ヨ妫�楠屽唴瀹�
         List<SampleProductExportDto> sampleProductDto2s = insOrderMapper.selectSampleBySampleId(insSamples.stream()
@@ -1684,21 +1777,173 @@
 
         List<SampleProductExportDto> sampleList = new ArrayList<>();
         Integer max = insSamples.stream().mapToInt(InsSample::getQuantity).sum();
+        TableRenderData tableRenderData = new TableRenderData();
+        String templateName;
+        if(StringUtils.equals(OrderType.WG.getValue(),ifsInventoryQuantity.getOrderType())){
+            //杩囨护涓嶅垽瀹氱殑妫�娴嬮」
+            List<SampleProductExportDto> filterItems = sampleProductDto2s.stream().filter(f -> f.getInsResult() != 3).collect(Collectors.toList());
+            int maxCableTag = 5;//鍗曚釜琛ㄦ牸锛岀數缂嗛鑹叉爣璇嗘渶澶т釜鏁�
+            templateName = "/static/small-wg-report-template.docx";
+            //鏌ヨ妫�楠屽崟娑堟伅
+            InsSampleUserVO insSampleUser = insSampleUserMapper.selectUserNameByOrderId(orderId);
+            if(Objects.nonNull(insSampleUser)){
+                enterFactoryReport.setPartDesc(insSampleUser.getModel());
+                enterFactoryReport.setInspector(insSampleUser.getInspector());
+                enterFactoryReport.setInspectDate(insSampleUser.getInspectDate());
+            }
 
-        // 杞垚Mpa杩涜鎺掑簭
-        Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream()
-                .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem()))
-                .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
-        List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sortedMap.entrySet());
-        entries.sort((o1, o2) -> (o1.getValue().get(0).getSort() == null ? 0 : o1.getValue().get(0).getSort())
-                - (o2.getValue().get(0).getSort() == null ? 0 : o2.getValue().get(0).getSort()));
-        // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
-        Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
-        for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
-            item.put(entry.getKey(), entry.getValue());
+            Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();//闈炵數缂嗛厤缃娴嬮」
+            Map<String, List<SampleProductExportDto>> cableTagItem = new LinkedHashMap<>();//鐢电紗閰嶇疆妫�娴嬮」
+            Map<String, List<SampleProductExportDto>> cableTagEnclosureItem = new LinkedHashMap<>();//鐢电紗閰嶇疆妫�娴嬮」闄勪欢
+
+            AtomicInteger finalIndex = new AtomicInteger(1);
+            List<String> cableTags = insOrderMapper.selectSampleCableTag(insSample.getId());
+            max = cableTags.size();
+            //澶勭悊鐢电紗閰嶇疆妫�娴嬮」
+            Map<String, List<SampleProductExportDto>> tempMap = new HashMap<>();
+            Map<String, List<SampleProductExportDto>> tempMap2 = new HashMap<>();
+            Map<String, List<SampleProductExportDto>> listMap2 = filterItems.stream()
+                    .filter(f -> StringUtils.isNotBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem()))
+                    .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
+            for (String key : listMap2.keySet()) {
+                List<SampleProductExportDto> sampleProductExportDtos;
+                List<SampleProductExportDto> sampleProductExportDtos2;
+                //澶勭悊鐢电紗閰嶇疆椤�
+                Map<String, List<SampleProductExportDto>> collect = listMap2.get(key).stream().collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItemSubclass));
+                if(cableTags.size()>maxCableTag){
+                    sampleProductExportDtos = transformSampleProduct(cableTags,collect,0,maxCableTag);
+                    sampleProductExportDtos2 = transformSampleProduct(cableTags,collect,maxCableTag,cableTags.size());
+                    tempMap2.put(key,sampleProductExportDtos2);
+                }else{
+                    sampleProductExportDtos = transformSampleProduct(cableTags,collect,0,cableTags.size());
+                }
+                tempMap.put(key,sampleProductExportDtos);
+            }
+            sortSampleProduct(tempMap,cableTagItem);
+            int tagNum = Math.min(max,maxCableTag);
+            List<String> tagList = cableTags.subList(0,tagNum);
+            handlerSampleItems(cableTagItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true);
+
+            if(CollectionUtil.isNotEmpty(tempMap2)){
+                sortSampleProduct(tempMap2,cableTagEnclosureItem);
+                //鐢熸垚闄勪欢鐢电紗琛ㄦ牸
+                TableRenderData tableRenderData2 = new TableRenderData();
+                List<String> newCableTags = cableTags.subList(maxCableTag,cableTags.size());
+                AtomicInteger finalIndex2 = new AtomicInteger(1);
+                List<TextRenderData> newText = new ArrayList<TextRenderData>();
+                List<RowRenderData> newRows = new ArrayList<>();
+                RowRenderData newRowRenderData = null;
+                handlerSampleItems(cableTagEnclosureItem,finalIndex2, new ArrayList<>(),newCableTags.size(),newText,newRows,newRowRenderData,resultCh,newCableTags,true);
+                tableRenderData2.setRows(newRows);
+                tableRenderData2.setTableStyle(setTableStyle(newCableTags.size()));
+                HashMap<String, Object> tableMap = new HashMap<>();
+                tableMap.put("enclosureTable",tableRenderData2);
+                tableMap.put("resultCh", resultCh);
+                tableMap.put("writeUrl", null);
+                tableMap.put("examineUrl", null);
+                tableMap.put("ratifyUrl", null);
+                tableMap.put("writeDateUrl", null);
+                tableMap.put("examineDateUrl", null);
+                tableMap.put("ratifyDateUrl", null);
+                tableMap.put("seal1", null);
+                cableTagEnclosureTables.add(tableMap);
+            }
+
+            //澶勭悊闈炵數缂嗛厤缃娴嬮」
+            Map<String, List<SampleProductExportDto>> listMap = filterItems.stream()
+                    .filter(f -> StringUtils.isBlank(f.getCableTag()) && StringUtils.isNotBlank(f.getInspectionItem()))
+                    .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
+            sortSampleProduct(listMap,item);
+            text = new ArrayList<>();
+            sampleList = new ArrayList<>();
+            handlerSampleItems(item,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,cableTags,false);
+            tableRenderData.setRows(rows);
+            tableRenderData.setTableStyle(setTableStyle(tagNum));
+            if (!resultCh.get().equals("")) {
+                resultCh.set("缁忔楠岋紝" + resultCh.get() + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺�傦紙鐩栫珷鏈夋晥锛�");
+            } else {
+                resultCh.set("鏈骇鍝佺鍚堢浉鍏虫爣鍑嗚姹傦紝缁忔楠屽悎鏍煎噯浜堝嚭鍘傦紙鐩栫珷鏈夋晥锛�");
+            }
+
+        }else{
+            templateName = "/static/small-report-template.docx";
+            // 杞垚Mpa杩涜鎺掑簭
+            Map<String, List<SampleProductExportDto>> sortedMap = sampleProductDto2s.stream()
+                    .filter(sampleProductDto2 -> StringUtils.isNotBlank(sampleProductDto2.getInspectionItem()))
+                    .collect(Collectors.groupingBy(SampleProductExportDto::getInspectionItem));
+//            List<Map.Entry<String, List<SampleProductExportDto>>> entries = new ArrayList<>(sortedMap.entrySet());
+//            entries.sort(Comparator.comparingInt(o -> (o.getValue().get(0).getSort() == null ? 0 : o.getValue().get(0).getSort())));
+//            // 鍒涘缓涓�涓� LinkedHashMap 鏉ヤ繚鎸佹彃鍏ラ『搴�
+            Map<String, List<SampleProductExportDto>> item = new LinkedHashMap<>();
+//            for (Map.Entry<String, List<SampleProductExportDto>> entry : entries) {
+//                item.put(entry.getKey(), entry.getValue());
+//            }
+            sortSampleProduct(sortedMap,item);
+
+
+            AtomicInteger finalIndex = new AtomicInteger(1);
+            handlerSampleItems(item,finalIndex,sampleList,max,text,rows,rowRenderData,resultCh,null,true);
+            tableRenderData.setRows(rows);
+            tableRenderData.setTableStyle(setTableStyle(max));
+
+            if (!resultCh.get().equals("")) {
+                resultCh.set("缁忔楠岋紝" + resultCh.get() + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺��");
+            } else {
+                resultCh.set("缁忔楠屾鎵�" + enterFactoryReport.getSample() + "鍚勯」鐩潎绗﹀悎妫�楠岃鑼冭姹傘��");
+            }
         }
 
-        AtomicInteger finalIndex = new AtomicInteger(1);
+        ConfigureBuilder builder = Configure.builder();
+        builder.useSpringEL(true);
+
+        InputStream inputStream = this.getClass().getResourceAsStream(templateName);
+        XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
+                new HashMap<String, Object>() {{
+                    put("report", enterFactoryReport);
+                    put("standardMethod", standardMethod2.toString().equals("null") ? "" : standardMethod2);
+                    put("orderType", orderType);
+                    put("table", tableRenderData);
+                    put("enclosureTables", cableTagEnclosureTables.isEmpty()?null:cableTagEnclosureTables);
+                    put("resultCh", resultCh);
+                    put("writeUrl", null);
+                    put("examineUrl", null);
+                    put("ratifyUrl", null);
+                    put("writeDateUrl", null);
+                    put("examineDateUrl", null);
+                    put("ratifyDateUrl", null);
+                    put("seal1", null);
+                }});
+        try {
+            // 淇敼鎹㈣鍜屽悎骞堕棶棰�
+            updaeMerge(template.getXWPFDocument(), true);
+            String name = insReport.getCode().replace("/", "") + "-J.docx";
+            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name)));
+            insReport.setUrl("/word/" + name);
+            insReport.setIsPass(0);
+            insReport.setWriteUserId(SecurityUtils.getUserId().intValue());//鎻愪氦浜�
+            insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
+            // 鏌ヨ鎶ュ憡, 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�, 娣诲姞杩囧垹闄�
+            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
+                    .eq(InsReport::getInsOrderId, insOrder.getId()));
+            insReportMapper.insert(insReport);
+            inputStream.close();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 澶勭悊甯歌妫�娴嬮」
+     * @param item
+     * @param finalIndex
+     * @param sampleList
+     * @param max
+     * @param text
+     * @param rows
+     * @param rowRenderData
+     * @param resultCh
+     */
+    private static void handlerSampleItems(Map<String, List<SampleProductExportDto>> item,AtomicInteger finalIndex,List<SampleProductExportDto> sampleList,Integer max,List<TextRenderData> text,List<RowRenderData> rows,RowRenderData rowRenderData,AtomicReference<String> resultCh,List<String> cableTagList,Boolean hasAddHead ){
         item.forEach((s, sampleProductDtoInside) -> {
             // 娣诲姞妫�楠岄」
             SampleProductExportDto dto2 = new SampleProductExportDto();
@@ -1714,16 +1959,20 @@
                     String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem();
                     if (map.containsKey(productName)) {
                         // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
-                        map.get(productName)
-                                .getLastValueList()
-                                .add(productDto2.getLastValue());
+                        if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){
+                            map.get(productName)
+                                    .getLastValueList()
+                                    .add(productDto2.getLastValue());
+                        }
                         map.get(productName)
                                 .getInsResultList()
                                 .add(productDto2.getInsResult());
                     } else {
                         // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
-                        productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
-                        productDto2.getLastValueList().add(productDto2.getLastValue());
+                        if(CollectionUtil.isEmpty(productDto2.getLastValueList())){
+                            productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+                            productDto2.getLastValueList().add(productDto2.getLastValue());
+                        }
                         productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
                         productDto2.getInsResultList().add(productDto2.getInsResult());
 
@@ -1755,16 +2004,20 @@
                     String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass();
                     if (map.containsKey(productName)) {
                         // 濡傛灉鍚嶇О宸茬粡瀛樺湪锛屾坊鍔� lastValue 鍊煎埌 lastValueList 鍒楄〃
-                        map.get(productName)
-                                .getLastValueList()
-                                .add(productDto2.getLastValue());
+                        if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){
+                            map.get(productName)
+                                    .getLastValueList()
+                                    .add(productDto2.getLastValue());
+                        }
                         map.get(productName)
                                 .getInsResultList()
                                 .add(productDto2.getInsResult());
                     } else {
                         // 濡傛灉鍚嶇О涓嶅瓨鍦紝鐩存帴鏀惧叆 map
-                        productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
-                        productDto2.getLastValueList().add(productDto2.getLastValue());
+                        if(CollectionUtil.isEmpty(productDto2.getLastValueList())){
+                            productDto2.setLastValueList(new ArrayList<>()); // 妫�楠屽唴瀹�
+                            productDto2.getLastValueList().add(productDto2.getLastValue());
+                        }
                         productDto2.setInsResultList(new ArrayList<>()); // 缁撴灉
                         productDto2.getInsResultList().add(productDto2.getInsResult());
 
@@ -1782,8 +2035,9 @@
         });
 
         // 娣诲姞灏忔姤鍛婅〃澶�
-        text = addSmallHead(text, max, rows);
-
+        if(hasAddHead){
+            text = addSmallHead(text, max, rows,cableTagList);
+        }
 
         // 涓棿妫�娴嬪�兼坊鍔�
         for (int i = 0; i < sampleList.size(); i++) {
@@ -1800,7 +2054,7 @@
 
             // 妫�楠岄」鐩�
             TextRenderData middleRenderData2 = new TextRenderData();
-            middleRenderData2.setText(sample.getInspectionName());
+            middleRenderData2.setText(sample.getInspectionName()+"鈭�"+sample.getInspectionName()+i);
             Style middleStyle2 = new Style();
             middleStyle2.setFontFamily("瀹嬩綋");
             middleStyle2.setColor("000000");
@@ -1887,7 +2141,7 @@
                     TextRenderData middleRenderData6 = new TextRenderData();
                     middleRenderData6.setText((StringUtils.isNotEmpty(sample.getLastValue()) ?
                             sample.getLastValue() : "")
-                            + "鈭�" + (7 + i));
+                            + "鈭�" + (finalIndex.get() +"_"+ i));
                     Style middleStyle6 = new Style();
                     middleStyle6.setFontFamily("瀹嬩綋");
                     middleStyle6.setColor("000000");
@@ -1925,7 +2179,7 @@
                             String type;
                             if (count.equals(0)) {
                                 // 娣诲姞涓嶅悎鏍兼弿杩�
-                                String item1 = (max == 1 ? "" : "绗�" + Integer.toString(index) + "娆�")
+                                String item1 = (max == 1 ? "" : "绗�" + index + "娆�")
                                         + sample.getInspectionItem()
                                         + (StringUtils.isBlank(sample.getInspectionItemSubclass()) ? "" : "" + sample.getInspectionItemSubclass());
                                 if (resultCh.get().equals("")) {
@@ -1965,98 +2219,17 @@
             text = new ArrayList<>();
         }
 
-        TableRenderData tableRenderData = new TableRenderData();
-        tableRenderData.setRows(rows);
-
-        //璁剧疆鏍峰紡
-        TableStyle tableStyle = new TableStyle();
-        if(max<=5){
-            for (int i = 1; i <= max; i++) {
-                // 鏍规嵁妫�楠岀粨鏋滀釜鏁颁慨鏀归暱搴�
-                switch (i) {
-                    case 1:
-                        tableStyle.setColWidths(new int[]{650, 2900, 850, 2300, 2100, 1200});
-                        break;
-                    case 2:
-                        tableStyle.setColWidths(new int[]{650, 2700, 850, 2200, 1200, 1200, 1200});
-                        break;
-                    case 3:
-                        tableStyle.setColWidths(new int[]{650, 2700, 850, 1600, 1000, 1000, 1000, 1200});
-                        break;
-                    case 4:
-                        tableStyle.setColWidths(new int[]{650, 2400, 850, 1500, 850, 850, 850, 850, 1200});
-                        break;
-                    case 5:
-                        tableStyle.setColWidths(new int[]{650, 2200, 850, 1350, 750, 750, 750, 750, 750, 1200});
-                        break;
-                }
-            }
-        }
-
-        tableStyle.setWidth("10000");
-        tableStyle.setAlign(TableRowAlign.CENTER);
-        BorderStyle borderStyle = new BorderStyle();
-        borderStyle.setColor("000000");
-        borderStyle.setType(XWPFTable.XWPFBorderType.SINGLE);
-        borderStyle.setSize(4);
-        tableStyle.setLeftBorder(borderStyle);
-        tableStyle.setRightBorder(borderStyle);
-        tableStyle.setInsideHBorder(borderStyle); // 璁剧疆姘村钩鍐呰竟妗�
-        tableStyle.setInsideVBorder(borderStyle);
-        tableRenderData.setTableStyle(tableStyle);
-
-        if (!resultCh.get().equals("")) {
-            resultCh.set("缁忔楠岋紝" + resultCh.get() + "鎵�妫�椤圭洰涓嶅悎鏍硷紝鍏朵綑鎵�妫�椤圭洰鍧囧悎鏍笺��");
-        } else {
-            resultCh.set("缁忔楠屾鎵�" + enterFactoryReport.getSample() + "鍚勯」鐩潎绗﹀悎妫�楠岃鑼冭姹傘��");
-        }
-
-        ConfigureBuilder builder = Configure.builder();
-        builder.useSpringEL(true);
-
-        InputStream inputStream = this.getClass().getResourceAsStream("/static/small-report-template.docx");
-        XWPFTemplate template = XWPFTemplate.compile(inputStream, builder.build()).render(
-                new HashMap<String, Object>() {{
-                    put("report", enterFactoryReport);
-                    put("standardMethod", standardMethod2.toString().equals("null") ? "" : standardMethod2);
-                    put("orderType", orderType);
-                    put("table", tableRenderData);
-                    put("resultCh", resultCh);
-                    put("writeUrl", null);
-                    put("examineUrl", null);
-                    put("ratifyUrl", null);
-                    put("writeDateUrl", null);
-                    put("examineDateUrl", null);
-                    put("ratifyDateUrl", null);
-                    put("seal1", null);
-                }});
-        try {
-            // 淇敼鎹㈣鍜屽悎骞堕棶棰�
-            updaeMerge(template.getXWPFDocument(), true);
-            String name = insReport.getCode().replace("/", "") + "-J.docx";
-            template.writeAndClose(Files.newOutputStream(Paths.get(wordUrl + "/" + name)));
-            insReport.setUrl("/word/" + name);
-            insReport.setIsPass(0);
-            insReport.setWriteUserId(SecurityUtils.getUserId().intValue());//鎻愪氦浜�
-            insReport.setWriteTime(LocalDateTime.now());//鎻愪氦鏃堕棿
-            // 鏌ヨ鎶ュ憡, 鍒ゆ柇涔嬪墠鏄惁娣诲姞杩�, 娣诲姞杩囧垹闄�
-            insReportMapper.delete(Wrappers.<InsReport>lambdaQuery()
-                    .eq(InsReport::getInsOrderId, insOrder.getId()));
-            insReportMapper.insert(insReport);
-            inputStream.close();
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
     }
 
+
     /**
-     * 娣诲姞灏忓疂琛ㄥご
+     * 娣诲姞灏忔姤鍛婅〃澶�
      * @param text
      * @param max
      * @param rows
      * @return
      */
-    private static List<TextRenderData> addSmallHead(List<TextRenderData> text, Integer max, List<RowRenderData> rows) {
+    private static List<TextRenderData> addSmallHead(List<TextRenderData> text, Integer max, List<RowRenderData> rows,List<String> cableTagList) {
         RowRenderData rowRenderData;
 //        // 澶�
         TextRenderData headRenderData1 = new TextRenderData();
@@ -2114,7 +2287,7 @@
         text = new ArrayList<>();
 
         // 绗簩琛�(鍙兘娌℃湁)
-        if (max > 1) {
+        if (max > 1 && CollectionUtil.isEmpty(cableTagList)) {
             TextRenderData tagRenderData1 = new TextRenderData();
             tagRenderData1.setText("");
             Style tagStyle1 = new Style();
@@ -2168,8 +2341,62 @@
             rowRenderData = Rows.of(text4).center().rowAtleastHeight(1).create();
             rows.add(rowRenderData);
             text = new ArrayList<>();
+        }
+        //濡傛灉鏈夌數缂嗛鑹诧紝鐢熸垚棰滆壊鏍囪瘑琛�
+        if(CollectionUtil.isNotEmpty(cableTagList)){
+            TextRenderData tagRenderData1 = new TextRenderData();
+            tagRenderData1.setText("");
+            Style tagStyle1 = new Style();
+            tagStyle1.setFontFamily("瀹嬩綋");
+            tagStyle1.setColor("000000");
+            tagRenderData1.setStyle(tagStyle1);
+            text.add(tagRenderData1);
 
+            TextRenderData tagRenderData2 = new TextRenderData();
+            tagRenderData2.setText("缁濈紭绾胯姱棰滆壊鍜屾爣蹇�");
+            Style tagStyle2 = new Style();
+            tagStyle2.setFontFamily("瀹嬩綋");
+            tagStyle2.setColor("000000");
+            tagRenderData2.setStyle(tagStyle2);
+            text.add(tagRenderData2);
 
+            TextRenderData tagRenderData4 = new TextRenderData();
+            tagRenderData4.setText("/");
+            Style tagStyle4 = new Style();
+            tagStyle4.setFontFamily("瀹嬩綋");
+            tagStyle4.setColor("000000");
+            tagRenderData4.setStyle(tagStyle4);
+            text.add(tagRenderData4);
+
+            TextRenderData tagRenderData5 = new TextRenderData();
+            tagRenderData5.setText("/");
+            Style tagStyle5 = new Style();
+            tagStyle5.setFontFamily("瀹嬩綋");
+            tagStyle5.setColor("000000");
+            tagRenderData5.setStyle(tagStyle5);
+            text.add(tagRenderData5);
+
+            for (String cableTag : cableTagList) {
+                TextRenderData tagRenderData6 = new TextRenderData();
+                tagRenderData6.setText(cableTag);
+                Style tagStyle6 = new Style();
+                tagStyle6.setFontFamily("瀹嬩綋");
+                tagStyle6.setColor("000000");
+                tagRenderData6.setStyle(tagStyle6);
+                text.add(tagRenderData6);
+            }
+            TextRenderData tagRenderData7 = new TextRenderData();
+            tagRenderData7.setText("/");
+            Style tagStyle7 = new Style();
+            tagStyle7.setFontFamily("瀹嬩綋");
+            tagStyle7.setColor("000000");
+            tagRenderData7.setStyle(tagStyle7);
+            text.add(tagRenderData7);
+
+            TextRenderData[] text4 = text.toArray(new TextRenderData[0]);
+            rowRenderData = Rows.of(text4).center().rowAtleastHeight(1).create();
+            rows.add(rowRenderData);
+            text = new ArrayList<>();
         }
 
         return text;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
index 7d550f7..759ecbb 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderServiceImpl.java
@@ -646,11 +646,12 @@
                 if(isSplitOrder){
                     ifsInventoryQuantity.setIsSplitOrder(1);
                 }
+                //todo:涓嶆竻妤氱敤閫旓紝鏆傛椂娉ㄩ噴鎺�
                 // 鏌ヨ浜т笟閾炬娴嬫暟鎹�
-                String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
-                        ifsInventoryQuantity.getLineNo(),
-                        ifsInventoryQuantity.getReleaseNo());
-                ifsInventoryQuantity.setIndustryChain(industryChainAttrFields);
+//                String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(),
+//                        ifsInventoryQuantity.getLineNo(),
+//                        ifsInventoryQuantity.getReleaseNo());
+//                ifsInventoryQuantity.setIndustryChain(industryChainAttrFields);
 
                 ifsInventoryQuantityMapper.insert(ifsInventoryQuantity);
             }
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
index 9cff08f..a515e38 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/RawMaterialOrderServiceImpl.java
@@ -20,23 +20,24 @@
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.basic.dto.*;
+import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
+import com.ruoyi.basic.mapper.StandardTreeMapper;
 import com.ruoyi.basic.pojo.IfsInventoryQuantity;
+import com.ruoyi.common.config.WechatProperty;
 import com.ruoyi.common.constant.InsOrderTypeConstants;
 import com.ruoyi.common.core.domain.Result;
 import com.ruoyi.common.core.domain.entity.User;
-import com.ruoyi.common.config.WechatProperty;
 import com.ruoyi.common.enums.OrderType;
+import com.ruoyi.common.numgen.NumberGenerator;
 import com.ruoyi.common.utils.LimsDateUtil;
 import com.ruoyi.common.utils.QueryWrappers;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.WxCpUtils;
 import com.ruoyi.common.utils.api.IfsApiUtils;
-import com.ruoyi.common.utils.api.MesApiUtils;
+import com.ruoyi.framework.exception.ErrorException;
 import com.ruoyi.inspect.dto.CopperInsOrderDto;
 import com.ruoyi.inspect.dto.OrderSplitDTO;
 import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto;
-import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
-import com.ruoyi.basic.mapper.StandardTreeMapper;
 import com.ruoyi.inspect.dto.SampleProductDto;
 import com.ruoyi.inspect.excel.OrderSplitExcelData;
 import com.ruoyi.inspect.excel.OrderSplitExcelListener;
@@ -47,13 +48,10 @@
 import com.ruoyi.inspect.pojo.IfsSplitOrderRecord;
 import com.ruoyi.inspect.pojo.InsOrder;
 import com.ruoyi.inspect.pojo.InsReport;
-import com.ruoyi.inspect.pojo.InsUnqualifiedHandler;
 import com.ruoyi.inspect.service.IfsSplitOrderRecordService;
 import com.ruoyi.inspect.service.InsOrderService;
 import com.ruoyi.inspect.service.InsReportService;
 import com.ruoyi.inspect.service.RawMaterialOrderService;
-import com.ruoyi.common.numgen.NumberGenerator;
-import com.ruoyi.framework.exception.ErrorException;
 import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper;
 import com.ruoyi.performance.pojo.AuxiliaryOutputWorkingHours;
 import com.ruoyi.system.mapper.UserMapper;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java
new file mode 100644
index 0000000..1db7091
--- /dev/null
+++ b/inspect-server/src/main/java/com/ruoyi/inspect/vo/InsSampleUserVO.java
@@ -0,0 +1,33 @@
+package com.ruoyi.inspect.vo;
+
+import com.ruoyi.inspect.pojo.InsSampleUser;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class InsSampleUserVO extends InsSampleUser implements Serializable {
+
+    /**
+     * 妫�楠屽憳
+     */
+    @ApiModelProperty("妫�楠屽憳")
+    private String inspector;
+
+    /**
+     * 妫�楠屾棩鏈�
+     */
+    @ApiModelProperty("妫�楠屾棩鏈�")
+    private String inspectDate;
+
+    /**
+     * 鍨嬪彿
+     */
+    @ApiModelProperty("鍨嬪彿")
+    private String model;
+
+
+
+
+}
diff --git a/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml
index 5cad2d2..aaf0cb2 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleUserMapper.xml
@@ -1,4 +1,16 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.ruoyi.inspect.mapper.InsSampleUserMapper">
+    <select id="selectUserNameByOrderId" resultType="com.ruoyi.inspect.vo.InsSampleUserVO">
+        select
+            group_concat(DISTINCT u.name separator ',') AS inspector,
+            date_format(isu.create_time,'%Y-%m-%d') AS inspect_date,
+            isa.model
+        from ins_sample_user isu
+            left join ins_sample isa on isu.ins_sample_id = isa.ins_order_id
+            left join user u on isu.user_id=u.id
+        where isu.ins_sample_id=#{orderId} and isu.state=0
+        group by isu.ins_sample_id
+        order by isu.create_time
+    </select>
 </mapper>
diff --git a/inspect-server/src/main/resources/static/report-template.docx b/inspect-server/src/main/resources/static/report-template.docx
index 0502472..7235122 100644
--- a/inspect-server/src/main/resources/static/report-template.docx
+++ b/inspect-server/src/main/resources/static/report-template.docx
Binary files differ
diff --git a/inspect-server/src/main/resources/static/small-wg-report-template.docx b/inspect-server/src/main/resources/static/small-wg-report-template.docx
new file mode 100644
index 0000000..fdfa528
--- /dev/null
+++ b/inspect-server/src/main/resources/static/small-wg-report-template.docx
Binary files differ
diff --git a/ruoyi-admin-ztns/src/main/resources/application-druid.yml b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
index 075fa56..c79dc4e 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-druid.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-druid.yml
@@ -168,7 +168,7 @@
 
 # 澶囨敞 18083瀵嗙爜锛歾ttZTT123!@
 mqtt:
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -177,8 +177,8 @@
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
     clientId: ztns_gc_scl_108303_dev # clientId,杩囩▼璇曢獙瀹や几闀跨巼璁惧
     subscribe: /aiot/5447dad0-c6b9-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
-    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+    client: false # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -187,8 +187,8 @@
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
     clientId: ztns_gc_dz_108301_dev # clientId
     subscribe: /aiot/51eaff10-c6b9-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
-    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+    client: false # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -197,8 +197,8 @@
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
     clientId: ztns_cp_scl_108295_dev # clientId,鎴愬搧璇曢獙瀹や几闀跨巼璁惧
     subscribe: /aiot/a4b27900-c6b7-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
-    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+    client: false # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -207,4 +207,4 @@
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
     clientId: ztns_cp_dz_108300_dev # clientId锛屾垚鍝佽瘯楠屽鐢甸樆
     subscribe: /aiot/4e40cdb0-c6b7-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
-    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
+    client: false # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
diff --git a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
index ddf388d..17b3421 100644
--- a/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
+++ b/ruoyi-admin-ztns/src/main/resources/application-ztns.yml
@@ -169,27 +169,7 @@
 
 # 澶囨敞 18083瀵嗙爜锛歾ttZTT123!@
 mqtt:
-#  - url: tcp://mqtt-ztt.zttiot.com:1883 # 鏈嶅姟鍣╥p
-#    username: 2455220 # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
-#    password: 108300 # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
-#    timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
-#    keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
-#    qos: 1 # 蹇冭烦鍖呯骇鍒�
-#    completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-#    clientId: ztns01 # clientId
-#    subscribe: /ztt/v3/2455220/publish # 璁㈤槄涓婚
-#    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-#  - url: tcp://mqtt-ztt.zttiot.com:1883 # 鏈嶅姟鍣╥p
-#    username: 2455221 # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
-#    password: 108295 # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
-#    timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
-#    keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
-#    qos: 1 # 蹇冭烦鍖呯骇鍒�
-#    completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-#    clientId: ztns02 # clientId
-#    subscribe: /ztt/v3/2455221/publish # 璁㈤槄涓婚
-#    client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -199,7 +179,7 @@
     clientId: ztns_gc_scl_108303 # clientId,杩囩▼璇曢獙瀹や几闀跨巼璁惧
     subscribe: /aiot/5447dad0-c6b9-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
@@ -209,23 +189,23 @@
     clientId: ztns_gc_dz_108301 # clientId
     subscribe: /aiot/51eaff10-c6b9-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
     keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
     qos: 1 # 蹇冭烦鍖呯骇鍒�
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-    clientId: ztns_cp_scl_108295 # clientId,杩囩▼璇曢獙瀹や几闀跨巼璁惧
+    clientId: ztns_cp_scl_108295 # clientId,鎴愬搧璇曢獙瀹や几闀跨巼璁惧
     subscribe: /aiot/a4b27900-c6b7-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
-  - url: tcp://mqtt.ztt.cn:1883 # 鏈嶅姟鍣╥p
+  - url: tcp://192.168.21.97:1883 # 鏈嶅姟鍣╥p
     username: admin # MQTT-鏈嶅姟绔�-鐢ㄦ埛鍚�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍鍚�
     password: public # MQTT-鏈嶅姟绔�-瀵嗙爜锛�,鍚庢湡浼氫慨鏀逛负鐢ㄦ埛鐧诲綍瀵嗙爜
     timeout: 100 # 瓒呮椂鏃堕棿 锛堝崟浣嶏細绉掞級
     keepalive: 60 # 蹇冭烦 锛堝崟浣嶏細绉掞級
     qos: 1 # 蹇冭烦鍖呯骇鍒�
     completion-timeout: 3000 # 杩炴帴瓒呮椂鏃堕棿锛堝崟浣嶏細绉掞級
-    clientId: ztns_cp_dz_108300 # clientId
+    clientId: ztns_cp_dz_108300 # clientId锛屾垚鍝佽瘯楠屽鐢甸樆
     subscribe: /aiot/4e40cdb0-c6b7-11f0-8b13-c14e8310d70b # 璁㈤槄涓婚
     client: true # 濡傛灉寮�鍙戦渶瑕佸惎鍔ㄦ祴璇曪紝闇�瑕佹敼涓篺alse涓嶇劧浼氫竴鐩存姤閿�
\ No newline at end of file

--
Gitblit v1.9.3