|
@@ -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);
|
|
|
}
|
|
|
|
|
|
|