From 3166624edda4fc938593432b619fa5ad00409f0a Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 03 十一月 2026 16:49:12 +0800
Subject: [PATCH] feat(outsource): 1.支持外协订单按物料属性分流复用原有业务流程 2.修复工时字段空值判断与赋值逻辑

---
 inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java |   49 ++++++++++++++++++-------------------------------
 1 files changed, 18 insertions(+), 31 deletions(-)

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 b77a7fd..1c4ddaa 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
@@ -156,6 +156,8 @@
     @Resource
     private ISysDictTypeService iSysDictTypeService;
     @Resource
+    private OutsourceOrderFlowService outsourceOrderFlowService;
+    @Resource
     private InsOrderRatesService insOrderRatesService;
     @Resource
     private InsProductDeviationWarningService insProductDeviationWarningService;
@@ -811,7 +813,7 @@
                 )
                 .ne(InsProduct::getIsBinding, 1));
         insProducts.addAll(insProductMapper.selectFiberInsProduct(InsSampleIds, laboratory));
-        if (insProducts.size() > 0) {
+        if (!insProducts.isEmpty()) {
             String str = "";
             int count = 0;
             for (InsProduct product : insProducts) {
@@ -1716,8 +1718,8 @@
             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)) {
+                        tellSet.add(sDto.getTell());
                         lastValueList.add(sDto.getLastValue());
                     }
                 }
@@ -1745,22 +1747,6 @@
     }
 
     /**
-     * 浣跨敤姝e垯琛ㄨ揪寮忓幓闄ゅ瓧绗︿覆鏈�鍚庝竴涓�"-"鍙婂叾鍚庨潰鐨勬墍鏈夊唴瀹�
-     * @param str 寰呭鐞嗙殑瀛楃涓诧紙鍏佽涓簄ull锛�
-     * @return 澶勭悊鍚庣殑瀛楃涓诧紝null杩斿洖null锛屾棤"-"杩斿洖鍘熷瓧绗︿覆
-     */
-    public static String removeLastHyphenAndContent(String str) {
-        // 绌哄�兼牎楠岋細閬垮厤NullPointerException
-        if (str == null || str.isEmpty()) {
-            return str;
-        }
-        // 姝e垯琛ㄨ揪寮忥細鍖归厤鏈�鍚庝竴涓�"-"鍙婂叾鍚庨潰鐨勬墍鏈夊唴瀹�
-        String regex = "-[^-]*$";
-        // 鏇挎崲鍖归厤鐨勫唴瀹逛负绌哄瓧绗︿覆
-        return str.replaceAll(regex, "");
-    }
-
-    /**
      * 灏忔姤鍛婄敓鎴�
      *
      * @param orderId
@@ -1781,7 +1767,7 @@
         IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId());
         //鏌ヨ闆朵欢灞炴��
         IfsPartPropsRecord ifsPartPropsRecord = ifsPartPropsRecordMapper.selectOne(Wrappers.<IfsPartPropsRecord>lambdaQuery()
-                .eq(IfsPartPropsRecord::getIfsInventoryId, ifsInventoryQuantity.getId()));
+                .eq(IfsPartPropsRecord::getIfsInventoryId, ifsInventoryQuantity.getId()).last("limit 1"));
         if (Objects.nonNull(ifsPartPropsRecord)) {
             enterFactoryReport.setOuterColor(StringUtils.equals(ifsPartPropsRecord.getOuterColor(),"/")?ifsPartPropsRecord.getInsulationColor():ifsPartPropsRecord.getOuterColor());
         }
@@ -1820,7 +1806,8 @@
         Integer max = insSamples.stream().mapToInt(InsSample::getQuantity).sum();
         TableRenderData tableRenderData = new TableRenderData();
         String templateName;
-        if (StringUtils.equals(OrderType.WG.getValue(), ifsInventoryQuantity.getOrderType())) {
+        if (StringUtils.equals(OrderType.WG.getValue(),
+                outsourceOrderFlowService.resolve(ifsInventoryQuantity.getOrderType(), ifsInventoryQuantity.getMaterialProp()))) {
             //杩囨护涓嶅垽瀹氱殑妫�娴嬮」
             List<SampleProductExportDto> filterItems = sampleProductDto2s.stream().filter(f -> f.getInsResult() != 3).collect(Collectors.toList());
             int maxCableTag = 5;//鍗曚釜琛ㄦ牸锛岀數缂嗛鑹叉爣璇嗘渶澶т釜鏁�
@@ -1828,7 +1815,7 @@
             //鏌ヨ妫�楠屽崟娑堟伅
             InsSampleUserVO insSampleUser = insSampleUserMapper.selectUserNameByOrderId(orderId);
             if (Objects.nonNull(insSampleUser)) {
-                enterFactoryReport.setPartDesc(removeLastHyphenAndContent(insSampleUser.getModel()));
+                enterFactoryReport.setPartDesc(insSampleUser.getModel());
                 enterFactoryReport.setInspector(insSampleUser.getInspector());
                 enterFactoryReport.setInspectDate(insSampleUser.getInspectDate());
             }
@@ -4376,17 +4363,17 @@
     }
 
 
-    private static int getDecimalPlaces(String str) {
-        // 鏌ユ壘灏忔暟鐐逛綅缃�
-        int decimalPointIndex = str.lastIndexOf('.');
-
-        if (decimalPointIndex == -1) {
-            // 濡傛灉娌℃湁灏忔暟鐐癸紝杩斿洖0浣嶅皬鏁�
-            return 0;
+   private static int getDecimalPlaces(String str) {
+        // 浣跨敤姝e垯鍖归厤鎵�鏈夊甫灏忔暟鐐圭殑鏁板瓧锛屽彇鏈�澶у皬鏁颁綅鏁�
+        java.util.regex.Matcher matcher = Pattern.compile("\\d+\\.(\\d+)").matcher(str);
+        int maxDecimalPlaces = 0;
+        while (matcher.find()) {
+            int places = matcher.group(1).length();
+            if (places > maxDecimalPlaces) {
+                maxDecimalPlaces = places;
+            }
         }
-
-        // 璁$畻灏忔暟鐐瑰悗鐨勪綅鏁�
-        return str.length() - decimalPointIndex - 1;
+        return maxDecimalPlaces;
     }
 
     /**

--
Gitblit v1.9.3