Forráskód Böngészése

aps-开工时加工中的批次号要按升序排列testin1671

zhoudazhuang 9 hónapja
szülő
commit
c2401d0c75

+ 24 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java

@@ -1647,6 +1647,12 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
             //========更新工序作业明细==========
             ApsProcessOperationProcessEquDo needUpdateProcessEqu = new ApsProcessOperationProcessEquDo();
             needUpdateProcessEqu.setId(apsProcessOperationProcessEquDo.getId());
+            // 根据批次号列表进行升序排序
+            inputBatchNumberList.sort((e, b)->{
+                LinkedList<String> a1 = new LinkedList<>(Arrays.asList(e.split("-")));
+                LinkedList<String> b1 = new LinkedList<>(Arrays.asList(b.split("-")));
+                return sortAsc(a1,b1);
+            });
             //该工序作业明细的加工中批次号=“{批次号}-{单个分卷序列号}”逗号拼接
             needUpdateProcessEqu.setDoingbatchnumber(String.join(",", inputBatchNumberList));
 
@@ -1705,6 +1711,24 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
         return R.ok();
     }
 
+    private int sortAsc(List<String> parts1,List<String> parts2){
+        int length1 = parts1.size();
+        int length2 = parts2.size();
+        if(length1 == 0){
+            return -1;
+        }
+        if(length2 == 0){
+            return 1;
+        }
+        if (Integer.parseInt(parts1.get(0)) != Integer.parseInt(parts2.get(0))) {
+            return Integer.parseInt(parts1.get(0)) - Integer.parseInt(parts2.get(0));
+        }else {
+            parts1.remove(0);
+            parts2.remove(0);
+            return sortAsc(parts1, parts2);
+        }
+    }
+
 
 }