From bbdacee9ce126402d291eae13a9f1238c407a4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Tue, 3 Nov 2026 16:49:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E5=85=81=E8=AE=B8-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../part/service/Impl/PartAdvancedCopyService.java | 5 +---- .../modules/part/service/Impl/PartServiceImpl.java | 10 ++++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/xujie/modules/part/service/Impl/PartAdvancedCopyService.java b/src/main/java/com/xujie/modules/part/service/Impl/PartAdvancedCopyService.java index 9105e66..16b8d69 100644 --- a/src/main/java/com/xujie/modules/part/service/Impl/PartAdvancedCopyService.java +++ b/src/main/java/com/xujie/modules/part/service/Impl/PartAdvancedCopyService.java @@ -163,10 +163,7 @@ public class PartAdvancedCopyService { || StringUtils.isBlank(request.getBasePartNo())) { throw new RuntimeException("工厂、源物料和目标基准料号不能为空(请前端传site)"); } - if (request.getPartSuffix().contains("-")) { - throw new RuntimeException("物料后缀不能包含 '-' 符号"); - } - // 空后缀不拼接 '-';新基准号无需与源物料相同。 + // 后缀允许包含 '-',按原值拼接;空后缀不追加连字符,新基准号无需与源物料相同 - rqrq。 String targetPartNo = request.getBasePartNo() + (StringUtils.isBlank(request.getPartSuffix()) ? "" : "-" + request.getPartSuffix()); if (targetPartNo.length() > 30) { diff --git a/src/main/java/com/xujie/modules/part/service/Impl/PartServiceImpl.java b/src/main/java/com/xujie/modules/part/service/Impl/PartServiceImpl.java index 170cd89..65e2cde 100644 --- a/src/main/java/com/xujie/modules/part/service/Impl/PartServiceImpl.java +++ b/src/main/java/com/xujie/modules/part/service/Impl/PartServiceImpl.java @@ -529,17 +529,19 @@ public class PartServiceImpl extends ServiceImpl implements IP model.setItem(StringUtils.trimToEmpty(model.getItem()).toUpperCase()); } - /** 基准料号必填,后缀可空;空后缀直接使用基准料号,供新增及原有复制共用 - rqrq */ + /** 基准料号必填,后缀可空且允许包含 '-';生成的完整编码最多30位,供新增及原有复制共用 - rqrq */ private String buildPartNo(String basePartNo, String partSuffix) { String normalizedBase = StringUtils.trimToEmpty(basePartNo).toUpperCase(); String normalizedSuffix = StringUtils.trimToEmpty(partSuffix).toUpperCase(); if (StringUtils.isBlank(normalizedBase)) { throw new RuntimeException("基准料号不能为空!"); } - if (normalizedSuffix.contains("-")) { - throw new RuntimeException("物料后缀不能包含 '-' 符号!"); + // 保留后缀内的连字符;空后缀直接使用基准料号,统一校验 part.part_no 的30位长度 - rqrq。 + String partNo = StringUtils.isBlank(normalizedSuffix) ? normalizedBase : normalizedBase + "-" + normalizedSuffix; + if (partNo.length() > 30) { + throw new RuntimeException("产品编码不能超过30个字符"); } - return StringUtils.isBlank(normalizedSuffix) ? normalizedBase : normalizedBase + "-" + normalizedSuffix; + return partNo; } private String extractBasePartNo(String partNo) {