This commit is contained in:
2026-08-17 15:55:11 +08:00
parent 5f79616623
commit 68d9216cb8
21 changed files with 121 additions and 85 deletions
@@ -70,6 +70,8 @@ class LoadingPickServiceTest {
@MockBean
private LoadingDeliveryService loadingDeliveryService;
@MockBean
private TruckAppointmentService truckAppointmentService;
@MockBean
private InboundStatusHistoryMapper inboundHistories;
@MockBean
private PdaPickSettlementService settlementService;
@@ -509,13 +511,14 @@ class LoadingPickServiceTest {
verify(settlementService).settle(20L, 9L, "operator");
verify(repository).syncInboundProjections(20L, 9L, "operator");
verify(loadingDeliveryService).requirePdaCompletionReady(101L, 50L);
verify(truckAppointmentService).completeLoadingFromPda(99L, 20L, 9L, "operator");
verify(loadingDeliveryService).completeLoading(eq(101L), eq(50L), eq(9L), eq("operator"),
eq("PDA-complete-1-50"), argThat(value -> value.expectedVersion() == 7
&& "checked".equals(value.remark())));
}
@Test
void truckBlockerLeavesPdaTaskPlanAndSettlementUntouched() {
void conflictingTruckAppointmentsLeavePdaTaskPlanAndSettlementUntouched() {
LoadingPickTaskEntity task = task();
when(repository.taskForUpdate(20L)).thenReturn(task);
when(repository.allTaskItemsResolved(20L)).thenReturn(true);
@@ -525,12 +528,12 @@ class LoadingPickServiceTest {
when(repository.inboundForUpdate(101L, 50L)).thenReturn(
new LoadingInboundMapper.Snapshot(50L, 101L, "LOADING", 7));
doThrow(new BizException(com.baiyue.common.core.api.ResultCode.CONFLICT,
"LOADED门禁未通过:拖车尚未完成(必须为 COMPLETED)"))
.when(loadingDeliveryService).requirePdaCompletionReady(101L, 50L);
"同一柜次存在多条有效拖车预约,不能确认装柜完成"))
.when(truckAppointmentService).completeLoadingFromPda(99L, 20L, 9L, "operator");
assertThatThrownBy(() -> service.complete(20L,
new CompleteLoadingRequest(0, "complete-blocked", "checked"), 9L, "operator"))
.isInstanceOf(BizException.class).hasMessageContaining("拖车尚未完成");
.isInstanceOf(BizException.class).hasMessageContaining("多条有效拖车预约");
verify(settlementService, never()).settle(anyLong(), anyLong(), anyString());
verify(repository, never()).approve(anyLong(), anyLong(), anyString(), any());