fix: close inbound hold bypass paths

This commit is contained in:
2026-09-07 12:10:11 +08:00
parent 6b479d1a68
commit 41582fe17b
28 changed files with 899 additions and 11 deletions
@@ -106,6 +106,30 @@ class LoadingPickServiceTest {
@Resource
private LoadingPickService service;
@Test
void heldPlanBlocksDirectPdaItemSynchronizationBeforeTaskMutation() {
doThrow(new BizException(com.baiyue.common.core.api.ResultCode.CONFLICT, "入库单已扣货"))
.when(inboundHoldGuard).requirePlanNotHeld(10L);
assertThatThrownBy(() -> service.sync(10L, new LoadingPlanItemEntity()))
.isInstanceOf(BizException.class).hasMessageContaining("扣货");
verify(repository, never()).taskByPlan(anyLong());
}
@Test
void heldTaskStopsDurableCompletionWorkerBeforeAnyFulfillmentReadOrWrite() {
doThrow(new BizException(com.baiyue.common.core.api.ResultCode.CONFLICT, "入库单已扣货"))
.when(inboundHoldGuard).requireTaskNotHeld(20L);
assertThatThrownBy(() -> service.processCompletion(
completionCommand(999L, "held-worker"), "worker-held"))
.isInstanceOf(BizException.class).hasMessageContaining("扣货");
verify(repository, never()).task(anyLong());
verify(settlementService, never()).settleOwner(anyLong(), anyLong(), anyLong(), anyString());
}
@BeforeEach
void activeOperationalContainer() {
doAnswer(invocation -> {