fix: enforce dropship whole-pallet receiving

This commit is contained in:
2026-09-09 19:07:13 +08:00
parent 3e01dec4f8
commit 1e66fc6c22
4 changed files with 22 additions and 2 deletions
@@ -289,6 +289,9 @@ public class ReceivingContainerService {
ReceivingContainerSession session = requireSigned(operatorKey);
String customerId = session.getCustomerId();
InboundRef ref = requireInbound(customerId, session.getContainerNo(), request.inboundCode());
if ("ONE_CLICK_DROPSHIP".equals(ref.order().getOrderType())) {
throw conflict("One-click dropship inbound must be operated by complete source pallet");
}
if (!"FBA".equals(destinationType(ref.line(), ref.order()))) {
throw conflict("OVERSEAS destination must use carton-by-carton scanning; bulk count is forbidden");
}
@@ -364,6 +364,22 @@ class ReceivingContainerServiceBehaviorTest {
verifyNoInteractions(warehouse);
}
@Test
void dropshipFbaBulkReceiveIsRejectedBeforeWarehouseCalls() {
stubCurrent("FBA", "CONT-A");
LastlegOrder dropshipOrder = order("FBA");
dropshipOrder.setOrderType("ONE_CLICK_DROPSHIP");
when(orders.selectById(1L)).thenReturn(dropshipOrder);
assertThatThrownBy(() -> service.receiveBulk("7", "receiver",
new ReceivingContainerRequests.BulkReceive("IN-1", "PAL-1", 1, "dropship-bulk-key")))
.isInstanceOf(ResponseStatusException.class)
.hasMessageContaining("complete source pallet");
verifyNoInteractions(warehouse);
verifyNoInteractions(workflow);
}
@Test
void crossContainerCartonAndMismatchedPalletAreRejectedBeforeReservation() {
stubCurrent("OVERSEAS", "CONT-A");