Procházet zdrojové kódy

修改:新增的单据的BillNO前面拼接N

GDW před 8 měsíci
rodič
revize
eb9d532943

+ 8 - 3
src/main/java/cn/lttc/modules/lttcsamplescan/service/impl/SampleScanServiceImpl.java

@@ -73,6 +73,10 @@ public class SampleScanServiceImpl implements ISampleScanService {
         //查询数据库中最大的编号
         String maxCode = sampleScanMapper.getMaxCode();
         if (maxCode != null && !maxCode.isEmpty()) {
+            //如果N开头就先去除
+            if ("N".equals(String.valueOf(maxCode.charAt(0)))) {
+                maxCode = maxCode.substring(1);
+            }
             // 截取字符串的前面部分和后四位 (前八位为 年 + 月 + 日 后四位为流水号)
             String frontPart = maxCode.substring(0, maxCode.length() - 4);
             String lastFourCharacters = maxCode.substring(maxCode.length() - 4);
@@ -85,17 +89,18 @@ public class SampleScanServiceImpl implements ISampleScanService {
                 for (int i = newCode.length(); i < 4; i++) {
                     newCode.insert(0, "0");
                 }
-                sampleScan.setBillNO(now + newCode.toString());
+                sampleScan.setBillNO("N" + now + newCode.toString());
             } else {
                 //若不相同则将当前日期拼接上0001
                 String newCode = now + "0001";
-                sampleScan.setBillNO(newCode);
+                sampleScan.setBillNO("N" + newCode);
             }
         } else {
+            //如果是新表无数据就走这里
             String now = currentYear + currentMonthStr + dayStr;
             //若不相同则将当前日期拼接上0001
             String newCode = now + "0001";
-            sampleScan.setBillNO(newCode);
+            sampleScan.setBillNO("N" + newCode);
         }
 
 

+ 7 - 0
src/main/resources/application.yml

@@ -8,6 +8,13 @@ spring:
     username: xyuser
     password: Luth@ixySystem.
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
+    #测试环境数据源配置
+#    url: jdbc:sqlserver://10.201.1.63:1433;databaseName=sample_scan_test;useSSL=false;trustServerCertificate=true;
+#    username: erpdba
+#    password: s@fe201Oen0ugh
+#    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
   # 文件上传配置
   servlet:
     multipart: