feat: finalize dropship pallet print documents
This commit is contained in:
+3
-1
@@ -16,7 +16,8 @@ class DropshipPalletizationSqlContractTest {
|
||||
void inboundPalletReadAndPrintUseTheRegisteredPlatformInboundPermission() throws Exception {
|
||||
var controller = com.baiyue.firstleg.controller.PlatformDropshipPalletizationController.class;
|
||||
for (var method : controller.getDeclaredMethods()) {
|
||||
if (method.getName().equals("inboundPallets") || method.getName().equals("printPallet")) {
|
||||
if (method.getName().equals("inboundPallets") || method.getName().equals("printPallet")
|
||||
|| method.getName().equals("printInboundPallets")) {
|
||||
assertThat(method.getAnnotation(org.springframework.security.access.prepost.PreAuthorize.class).value())
|
||||
.isEqualTo("hasAuthority('platform:firstleg:inbound:list')");
|
||||
}
|
||||
@@ -24,6 +25,7 @@ class DropshipPalletizationSqlContractTest {
|
||||
String api = new ClassPathResource("openapi/dropship-palletization-v1.yaml")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
assertThat(api).contains("x-required-authority: platform:firstleg:inbound:list")
|
||||
.contains("/api/platform/v1/first-leg/pda-dropship/inbound-orders/{inboundId}/pallets/print:")
|
||||
.doesNotContain("x-required-authority: firstleg:inbound:list");
|
||||
}
|
||||
|
||||
|
||||
+4
-8
@@ -45,7 +45,7 @@ class InboundCartonLabelPrintServiceTest {
|
||||
@Test
|
||||
void dropshipPalletLabelIsAvailableBeforeSeal() {
|
||||
Pallet open = dropshipPallet("OPEN");
|
||||
stubPalletFacts(90001L, 1, 2);
|
||||
stubPalletFacts(90001L);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_PDF);
|
||||
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
|
||||
@@ -66,8 +66,6 @@ class InboundCartonLabelPrintServiceTest {
|
||||
assertThat(request.getValue().documents()).singleElement().satisfies(document -> {
|
||||
assertThat(document.palletNo()).isEqualTo("DP-260911-0001");
|
||||
assertThat(document.destinationWarehouse()).isEqualTo("NJDF");
|
||||
assertThat(document.palletSequence()).isEqualTo(1);
|
||||
assertThat(document.totalPallets()).isEqualTo(2);
|
||||
assertThat(document.inboundRows()).singleElement().satisfies(row -> {
|
||||
assertThat(row.inboundCode()).isEqualTo("PCHK2608040174");
|
||||
assertThat(row.customerNickname()).isEqualTo("小虫科技");
|
||||
@@ -88,8 +86,8 @@ class InboundCartonLabelPrintServiceTest {
|
||||
Pallet first = dropshipPallet("OPEN");
|
||||
Pallet second = new Pallet(90002L, "DP-260911-0002", "OPEN", 0, 0, 0,
|
||||
BigDecimal.ZERO, BigDecimal.ZERO, 1, List.of(), List.of(), null);
|
||||
stubPalletFacts(90001L, 1, 2);
|
||||
stubPalletFacts(90002L, 2, 2);
|
||||
stubPalletFacts(90001L);
|
||||
stubPalletFacts(90002L);
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_PDF);
|
||||
when(print.generateDropshipPalletA4Documents(org.mockito.ArgumentMatchers.anyString(),
|
||||
@@ -242,7 +240,7 @@ class InboundCartonLabelPrintServiceTest {
|
||||
BigDecimal.ONE, BigDecimal.ONE, 1, List.of(item), List.of(), null);
|
||||
}
|
||||
|
||||
private void stubPalletFacts(long palletId, int sequence, int total) {
|
||||
private void stubPalletFacts(long palletId) {
|
||||
DropshipPalletizationMapper.PrintInboundRow inbound =
|
||||
new DropshipPalletizationMapper.PrintInboundRow();
|
||||
inbound.setTenantId(10001L);
|
||||
@@ -260,8 +258,6 @@ class InboundCartonLabelPrintServiceTest {
|
||||
sku.setMaxUnitsPerCarton(19);
|
||||
when(palletization.printSkuRows(palletId))
|
||||
.thenReturn(palletId == 90001L ? List.of(sku) : List.of());
|
||||
when(palletization.palletPosition(palletId))
|
||||
.thenReturn(new DropshipPalletizationMapper.PalletPosition(sequence, total));
|
||||
when(customerSnapshots.customerNickname(10001L)).thenReturn("小虫科技");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user