From e9ec1e39ffe9de5a88b417893211ba08bb38c2e6 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Thu, 27 Aug 2026 11:34:28 +0800 Subject: [PATCH] =?UTF-8?q?8=E3=80=81Tracking=20Status=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9C=89=E6=97=A5=E6=9C=9F=E5=85=88=E5=90=8E?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E7=9A=84=E5=B7=A5=E5=BA=8F=EF=BC=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=A2=9E=E5=8A=A0=E5=B7=A5=E5=BA=8F=E7=9A=84=E5=88=86?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=98=BE=E7=A4=BA=E5=9C=A8?= =?UTF-8?q?Tracking=20Status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SampleProofTrackingServiceImpl.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/xujie/sys/modules/sampletracking/service/impl/SampleProofTrackingServiceImpl.java b/src/main/java/com/xujie/sys/modules/sampletracking/service/impl/SampleProofTrackingServiceImpl.java index 73a85af9..5be4ba7c 100644 --- a/src/main/java/com/xujie/sys/modules/sampletracking/service/impl/SampleProofTrackingServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/sampletracking/service/impl/SampleProofTrackingServiceImpl.java @@ -1619,7 +1619,8 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic } List finalRows = new ArrayList<>(); Set submitCodeKeys = new LinkedHashSet<>(); - int nextCategorySeq = resolveNextAutoProcessCategorySequence(existingRows); + String categoryCodePrefix = resolveProcessCategoryCodePrefixByBuNo(buNo); + int nextCategorySeq = resolveNextAutoProcessCategorySequence(existingRows, categoryCodePrefix); int sortNo = 10; for (ProofTrackingProcessCategoryData row : normalizedRows) { String rawCategoryCode = isBlank(row.getCategoryCode()) ? "" : row.getCategoryCode().trim(); @@ -1631,7 +1632,7 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic } } else { while (true) { - String candidateCode = buildAutoProcessCategoryCode(nextCategorySeq); + String candidateCode = buildAutoProcessCategoryCode(categoryCodePrefix, nextCategorySeq); nextCategorySeq += 1; String candidateKey = candidateCode.toLowerCase(); if (reservedCodeKeys.contains(candidateKey) || submitCodeKeys.contains(candidateKey)) { @@ -1808,7 +1809,9 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic return rows; } - private int resolveNextAutoProcessCategorySequence(List existingRows) { + private int resolveNextAutoProcessCategorySequence(List existingRows, + String categoryCodePrefix) { + String normalizedPrefix = isBlank(categoryCodePrefix) ? "RF" : categoryCodePrefix.trim().toUpperCase(); int maxSequence = 0; if (existingRows == null || existingRows.isEmpty()) { return 1; @@ -1818,24 +1821,35 @@ public class SampleProofTrackingServiceImpl implements SampleProofTrackingServic continue; } String code = item.getCategoryCode().trim(); - if (code.length() <= 3 || !code.regionMatches(true, 0, "bu-", 0, 3)) { + if (code.length() <= normalizedPrefix.length() + || !code.regionMatches(true, 0, normalizedPrefix, 0, normalizedPrefix.length())) { continue; } try { - int parsedSeq = Integer.parseInt(code.substring(3)); + int parsedSeq = Integer.parseInt(code.substring(normalizedPrefix.length())); if (parsedSeq > maxSequence) { maxSequence = parsedSeq; } } catch (NumberFormatException ignore) { - // 非 bu-数字 格式编码不参与自动序号计算。 + // 非“前缀+数字”格式编码不参与自动序号计算。 } } return maxSequence + 1; } - private String buildAutoProcessCategoryCode(int sequence) { + private String buildAutoProcessCategoryCode(String categoryCodePrefix, int sequence) { + String normalizedPrefix = isBlank(categoryCodePrefix) ? "RF" : categoryCodePrefix.trim().toUpperCase(); int safeSequence = sequence <= 0 ? 1 : sequence; - return String.format("bu-%03d", safeSequence); + return String.format("%s%03d", normalizedPrefix, safeSequence); + } + + private String resolveProcessCategoryCodePrefixByBuNo(String buNo) { + String normalizedBuNo = isBlank(buNo) ? "" : buNo.trim().toUpperCase(); + if (normalizedBuNo.contains("RFID")) { + return "RFID"; + } + // 软标(例如 01-Label)使用 RF 前缀;其余 BU 默认也归为 RF。 + return "RF"; } private String buildPlanFieldByCode(String code) {