Merge branch 'test' of http://8.163.30.128:10082/java-project/baiyue-firstleg into test
This commit is contained in:
+2
@@ -153,6 +153,8 @@ class ReceivingContainerContractTest {
|
||||
assertTrue(yaml.contains("enum: [LICENSE_PLATE, CONTAINER_SEAL, DOOR_OPEN]"));
|
||||
assertTrue(yaml.contains("photos: { type: array, minItems: 3, maxItems: 3"));
|
||||
assertTrue(yaml.contains("required: [role, fileId, downloadPath]"));
|
||||
assertTrue(yaml.contains("packageCount: { type: integer, minimum: 1, maximum: 66 }"));
|
||||
assertTrue(receivingPaths.contains("单托最多 66 箱"));
|
||||
assertTrue(yaml.contains("overseasWarehouseId: { type: string"));
|
||||
assertTrue(yaml.contains("overseasWarehouseName: { type: string"));
|
||||
assertFalse(receivingPaths.contains("photoFileIds"));
|
||||
|
||||
+73
@@ -49,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.Mockito.doThrow;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -422,6 +423,55 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
verifyNoInteractions(workflow);
|
||||
}
|
||||
|
||||
@Test
|
||||
void fbaPalletAccepts66PackagesAndRejects67BeforeReceivingStarts() {
|
||||
stubCurrent("FBA", "CONT-A");
|
||||
InboundPlanLine fbaLine = line("FBA");
|
||||
fbaLine.setRequiredPackageCount(66);
|
||||
when(lines.selectList(any())).thenReturn(List.of(fbaLine));
|
||||
when(orderDetails.selectList(any())).thenReturn(List.of(detail("SKU-1", 66)));
|
||||
when(skuReceipts.listLineSku("100", 10L, "SKU-1")).thenReturn(List.of());
|
||||
stubReservedFbaPallet();
|
||||
when(workflow.receiveBulkResolved(any(), any(), any(), any(), anyInt(), any(), any()))
|
||||
.thenAnswer(invocation -> invocation.getArgument(4));
|
||||
when(fbaPalletCounts.insert(any(ReceivingFbaPalletCount.class))).thenReturn(1);
|
||||
when(sessions.updateById(any(ReceivingContainerSession.class))).thenReturn(1);
|
||||
when(operations.insert(any(ReceivingContainerOperation.class))).thenReturn(1);
|
||||
|
||||
var accepted = service.receiveBulk("7", "receiver",
|
||||
new ReceivingContainerRequests.BulkReceive("IN-1", "PAL-1", 66, "capacity-66"));
|
||||
|
||||
assertThat(accepted.acceptedPackages()).isEqualTo(66);
|
||||
|
||||
org.mockito.Mockito.reset(sessions, workflow, warehouse);
|
||||
assertThatThrownBy(() -> service.receiveBulk("7", "receiver",
|
||||
new ReceivingContainerRequests.BulkReceive("IN-1", "PAL-1", 67, "capacity-67")))
|
||||
.isInstanceOf(ResponseStatusException.class)
|
||||
.hasMessageContaining("66箱");
|
||||
verifyNoInteractions(sessions, workflow, warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
void overseasCartonIsRejectedWhenPhysicalPalletAlreadyContains66Packages() {
|
||||
stubCurrent("OVERSEAS", "CONT-A");
|
||||
when(cartons.selectOne(any())).thenReturn(carton(1L, "IN-1#67"));
|
||||
InboundPlanPallet reserved = planPallet();
|
||||
reserved.setPalletNo("PAL-1"); reserved.setWarehousePalletId(30L); reserved.setWarehouseLocationId(40L);
|
||||
reserved.setWarehouseResourceLockId(50L); reserved.setAssignmentStatus("RESERVED");
|
||||
when(pallets.selectList(any())).thenReturn(List.of(reserved));
|
||||
when(warehouse.resolveReservedPallet("PAL-1", "100", 100L, 30L, 40L, 50L))
|
||||
.thenReturn(resource(100L, null));
|
||||
when(cartons.selectCount(any())).thenReturn(66L);
|
||||
|
||||
assertThatThrownBy(() -> service.receiveCarton("7", "receiver",
|
||||
new ReceivingContainerRequests.CartonReceive("IN-1#67", "PAL-1", "carton-capacity")))
|
||||
.isInstanceOf(ResponseStatusException.class)
|
||||
.hasMessageContaining("66箱");
|
||||
|
||||
verify(workflow, never()).validateCartonResolved(any(), any(), any(), any(), any());
|
||||
verify(workflow, never()).assignResolvedPallet(any(), any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void crossContainerCartonAndMismatchedPalletAreRejectedBeforeReservation() {
|
||||
stubCurrent("OVERSEAS", "CONT-A");
|
||||
@@ -950,6 +1000,29 @@ class ReceivingContainerServiceBehaviorTest {
|
||||
verifyNoInteractions(warehouse);
|
||||
}
|
||||
|
||||
@Test
|
||||
void dropshipWholePalletOver66PackagesIsRejectedBeforePicking() {
|
||||
stubCurrent("OVERSEAS", "CONT-A");
|
||||
LastlegOrder dropship = order("OVERSEAS"); dropship.setOrderType("ONE_CLICK_DROPSHIP");
|
||||
when(orders.selectById(1L)).thenReturn(dropship);
|
||||
InboundPlanPallet pallet = planPallet();
|
||||
pallet.setPalletNo("DP-260909-0067"); pallet.setSourcePalletNo("DP-260909-0067");
|
||||
pallet.setWarehousePalletId(30L);
|
||||
InboundPlanPalletAllocation pending = new InboundPlanPalletAllocation();
|
||||
pending.setId(67L); pending.setCustomerId("100"); pending.setPlanId(2L);
|
||||
pending.setLineId(10L); pending.setPalletId(20L); pending.setPlannedPackageCount(67);
|
||||
when(pallets.selectList(any())).thenReturn(List.of(pallet));
|
||||
when(allocations.selectList(any())).thenReturn(List.of(pending));
|
||||
stubCompleteManifest("DP-260909-0067", 67);
|
||||
|
||||
assertThatThrownBy(() -> service.receiveWholePallet("7", "receiver",
|
||||
new ReceivingContainerRequests.WholePalletReceive("DP-260909-0067", "whole-capacity")))
|
||||
.isInstanceOf(ResponseStatusException.class)
|
||||
.hasMessageContaining("66箱");
|
||||
|
||||
verify(workflow, never()).pickWholePallet(any(), any(), anyLong(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void domesticLoadingPhotoDownloadIsScopedToTheCurrentPhysicalContainer() {
|
||||
ReceivingContainerSession current = session("CONT-A", "SIGNED");
|
||||
|
||||
+16
@@ -85,6 +85,22 @@ class ContainerInboundPlanPreviewTest {
|
||||
assertFalse(result.ready());
|
||||
}
|
||||
|
||||
@Test
|
||||
void heldHistoricalOrderRemainsReadyBecauseHoldOnlyBlocksOutbound() {
|
||||
when(orderMapper.containerPreviewOrders("BOOKING-HELD")).thenReturn(List.of(
|
||||
new InboundPlanOrderMapper.ContainerPreviewOrderRow("100", 1L, "LM-HELD", "FO-1",
|
||||
"测试客户", "FIRST_LEG", "FBA", "IN-1", "PENDING_ASSIGNMENT", null,
|
||||
"MSCU6639870", 1, 10, new BigDecimal("1.0000"), "193000000000200003", "US-LAX-01",
|
||||
"洛杉矶仓", "ACY2", null, null, "Amazon ACY2", 0, true, 1,
|
||||
null, null, null, null, 1)));
|
||||
|
||||
var result = service.previewContainer("BOOKING-HELD");
|
||||
|
||||
assertEquals(true, result.ready());
|
||||
assertEquals("READY", result.groups().get(0).orders().get(0).readiness());
|
||||
assertEquals(List.of(), result.groups().get(0).orders().get(0).blockers());
|
||||
}
|
||||
|
||||
@Test
|
||||
void dropshipPreviewKeepsUnderlyingFbaFactSeparateFromItsDisplayCategory() {
|
||||
when(orderMapper.containerPreviewOrders("BOOKING-DROPSHIP")).thenReturn(List.of(
|
||||
|
||||
+9
-7
@@ -352,21 +352,23 @@ class InboundPlanServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void refusesManualPlanForHeldOrderBeforeWriting() {
|
||||
void createsManualPlanForHeldHistoricalOrderBecauseHoldOnlyBlocksOutbound() {
|
||||
SourceOrderSnapshot held = new SourceOrderSnapshot(2L, "100", "MSCU6639870", "RK-2",
|
||||
"PENDING_ASSIGNMENT", null, new BigDecimal("1.0000"), 10, 0,
|
||||
"193000000000200003", "US-LAX-01", "洛杉矶仓", null,
|
||||
null, "WH-A", "仓A", 1, 0, true, 5);
|
||||
"WH-A", "WH-A", "仓A", 1, 0, true, 5);
|
||||
when(orderMapper.lockOrder("100", 2L)).thenReturn(List.of(held));
|
||||
when(orderMapper.markPlannedManual(eq("100"), eq(2L), any(), eq(1), eq(false), eq(5), any()))
|
||||
.thenReturn(1);
|
||||
|
||||
ResponseStatusException error = assertThrows(ResponseStatusException.class, () -> service.convertManual(
|
||||
var result = service.convertManual(
|
||||
new ManualInboundPlanRequest("100", 2L, 5,
|
||||
1, "STANDARD", false, false, false, null),
|
||||
"manual-held", "900"));
|
||||
"manual-held", "900");
|
||||
|
||||
assertEquals(409, error.getStatusCode().value());
|
||||
verify(planMapper, never()).insert(any(InboundPlan.class));
|
||||
verify(commandMapper, never()).insert(any(com.baiyue.lastleg.entity.LastlegOrderCommandRecord.class));
|
||||
assertEquals(2L, result.sourceOrderId());
|
||||
verify(planMapper).insert(any(InboundPlan.class));
|
||||
verify(orderMapper).markPlannedManual(eq("100"), eq(2L), any(), eq(1), eq(false), eq(5), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user