提交
This commit is contained in:
+1
-7
@@ -18,8 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.Set;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Service
|
||||
@@ -448,11 +446,7 @@ public class WarehouseResourceService {
|
||||
}
|
||||
|
||||
private static String generatedPalletCode(String warehouseCode, long palletId) {
|
||||
String compactWarehouseCode = warehouseCode.replaceAll("[^A-Za-z0-9]", "").toUpperCase(java.util.Locale.ROOT);
|
||||
if (compactWarehouseCode.length() > 9) compactWarehouseCode = compactWarehouseCode.substring(0, 9);
|
||||
return "PLT-" + compactWarehouseCode + "-"
|
||||
+ LocalDate.now().format(DateTimeFormatter.ofPattern("yyMMdd")) + "-"
|
||||
+ Long.toUnsignedString(palletId, 36).toUpperCase(java.util.Locale.ROOT);
|
||||
return "TP-" + Long.toUnsignedString(palletId, 36).toUpperCase(java.util.Locale.ROOT);
|
||||
}
|
||||
|
||||
private static String defaultLocationCode(String warehouseCode) {
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ class WarehouseResourceServiceTest {
|
||||
|
||||
ArgumentCaptor<WarehousePalletEntity> captor = ArgumentCaptor.forClass(WarehousePalletEntity.class);
|
||||
verify(repository).insertPallet(captor.capture());
|
||||
assertThat(captor.getValue().getPalletCode()).matches("PLT-USLAX01-[0-9]{6}-[0-9A-Z]+");
|
||||
assertThat(captor.getValue().getPalletCode()).matches("TP-[0-9A-Z]+");
|
||||
assertThat(captor.getValue().getPalletCode()).hasSizeLessThanOrEqualTo(34);
|
||||
assertThat(captor.getValue().getLocationId()).isEqualTo(30003L);
|
||||
assertThat(captor.getValue().getId()).isNotNull();
|
||||
|
||||
Reference in New Issue
Block a user