fix(lastleg): keep unconfirmed container resources recoverable

This commit is contained in:
2026-10-05 05:26:01 +08:00
parent 3afb3bcfd1
commit 47acfc991b
10 changed files with 146 additions and 6 deletions
@@ -123,6 +123,24 @@ class ReceivingContainerServiceBehaviorTest {
verifyNoInteractions(warehouse);
}
@Test
void localCommittedResourcesAreNotPdaCandidatesOrReceivableDespiteCompleteLocalPalletBindings() {
InboundPlan pending = plan("CONT-A");
when(plans.selectList(any())).thenReturn(List.of(pending));
when(lines.selectList(any())).thenReturn(List.of(line("FBA")));
when(orders.selectList(any())).thenReturn(List.of(containerOrder(1L, "100", "CONT-A", "BOOKING-A", "IN-1")));
when(plans.countUnconfirmedResourcePlans(pending.getCustomerId(), pending.getId())).thenReturn(1L);
var candidates = service.candidates("7", 100L);
assertThat(candidates).hasSize(1);
assertThat(candidates.get(0).operable()).isFalse();
assertThat(candidates.get(0).blockReason()).contains("资源尚未确认");
assertThatThrownBy(() -> service.prepare("7", "receiver", 100L, "CONT-A", "BOOKING-A",
new ReceivingContainerRequests.Action("reserved-only")))
.isInstanceOf(ResponseStatusException.class).hasMessageContaining("资源尚未确认");
verify(pallets, never()).selectCount(any());
verifyNoInteractions(warehouse);
}
@Test
void prepareIdempotencyHashIncludesContainerPath() {
when(plans.selectList(any())).thenReturn(List.of(plan("CONT-A")));