From bcd4c6fc21eef7abf7e28661bd4f9e1f5cdd2a61 Mon Sep 17 00:00:00 2001 From: chenlu <1320612696@qq.com> Date: 星期一, 09 十二月 2024 16:37:29 +0800 Subject: [PATCH] 补片新增修改会出现重复编号的问题 --- north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java index 04f0a32..762d829 100644 --- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java +++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java @@ -187,10 +187,15 @@ if(Objects.equals(type, "琛ョ墖")){ alias="BP"; } - //鏌ヨ褰撳ぉ鐨勬渶澶ф暟閲� - Integer maximum=patchMapper.getMaximum(); + //鏌ヨ褰撳ぉ鏈�鏂扮殑缂栧彿 + String str=patchMapper.getMaximum(); + if (str == null){ + str="00"; + } + String maximum = str.substring(str.length() - 2); + int lastTwoInteger = Integer.parseInt(maximum); //璁剧疆涓や綅涓嶅琛�0 - String formattedNumber = String.format("%02d", maximum+1); + String formattedNumber = String.format("%02d", lastTwoInteger+1); //鏍煎紡鍖栧綋鍓嶆棩鏈� Date currentDate = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd"); -- Gitblit v1.8.0