This commit is contained in:
2026-09-15 14:18:18 +08:00
parent 6a2075fe4b
commit a474ca4d93
35 changed files with 751 additions and 228 deletions
@@ -853,6 +853,40 @@ class ReceivingContainerServiceBehaviorTest {
.containsExactly("SKU-A", "SKU-B", "SKU-C");
}
@Test
void mixedContainerFbaBulkNeverReceivesDropshipOrOrdinaryOverseasLines() {
InboundPlanLine fba = line("FBA");
InboundPlanLine dropship = line("FBA");
dropship.setId(20L); dropship.setOrderId(2L); dropship.setInboundCode("IN-DROPSHIP");
InboundPlanLine overseas = line("OVERSEAS");
overseas.setId(30L); overseas.setOrderId(3L); overseas.setInboundCode("IN-OVERSEAS");
LastlegOrder dropshipOrder = order("FBA");
dropshipOrder.setId(2L); dropshipOrder.setOrderType("ONE_CLICK_DROPSHIP");
LastlegOrder overseasOrder = order("OVERSEAS"); overseasOrder.setId(3L);
when(sessions.lockActiveByOperator("OPERATOR:7")).thenReturn(session("CONT-A", "SIGNED"));
when(plans.selectList(any())).thenReturn(List.of(plan("CONT-A")));
when(lines.selectList(any())).thenReturn(List.of(dropship, overseas, fba));
when(orders.selectById(1L)).thenReturn(order("FBA"));
when(orders.selectById(2L)).thenReturn(dropshipOrder);
when(orders.selectById(3L)).thenReturn(overseasOrder);
when(orderDetails.selectList(any())).thenReturn(List.of(detail("FBA-SKU", 2)));
stubReservedFbaPallet();
when(workflow.receiveBulkResolved(any(), any(), any(), any(), anyInt(), any(), any()))
.thenAnswer(invocation -> invocation.getArgument(4));
when(sessions.updateById(any(ReceivingContainerSession.class))).thenReturn(1);
when(operations.insert(any(ReceivingContainerOperation.class))).thenReturn(1);
var result = service.receiveBulk("7", "receiver",
new ReceivingContainerRequests.BulkReceive("IN-1", "PAL-1", 2, "mixed-fba-receive"));
assertThat(result.acceptedPackages()).isEqualTo(2);
ArgumentCaptor<InboundPlanLine> captured = ArgumentCaptor.forClass(InboundPlanLine.class);
verify(workflow).receiveBulkResolved(any(), any(), captured.capture(), any(),
org.mockito.ArgumentMatchers.eq(2), any(), any());
assertThat(captured.getValue()).isSameAs(fba);
verifyNoInteractions(dropshipProfiles, dropshipCartons);
}
@Test
void dropshipCartonResolvesItsCompleteDpInsteadOfAPlanOrCustomer() {
stubCurrent("OVERSEAS", "CONT-A");