fix(firstleg): finalize loading before customs acceptance

This commit is contained in:
2026-08-24 12:52:23 +08:00
parent 4377a7acd9
commit 92dbeb1676
7 changed files with 41 additions and 10 deletions
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.Assertions.catchThrowableOfType;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -595,6 +596,23 @@ class SmartLoadingServiceTest {
assertThat(updated.getValue().getWarehouseRemark()).isEqualTo("装柜时注意外箱");
}
@Test
void pickedQuantityConflictPrecedesCandidateAvailabilityValidation() {
LoadingPlanEntity plan = plan("LOADING", 2);
LoadingPlanItemEntity line = item(8, 9, 20, 2);
when(repository.plan(1L)).thenReturn(plan);
when(repository.item(1L, 8L)).thenReturn(line);
when(loadingPickService.mutationSnapshot(1L)).thenReturn(
new LoadingPickService.MutationSnapshot(77L, "LOADING", 6, Map.of(8L, 2)));
assertThatThrownBy(() -> service.adjust(1L, 8L,
new AdjustRequest(1, 2, 0, "adjust-picked"), 7L, "u"))
.hasMessageContaining("不能低于已拣货箱数");
verify(repository, never()).candidate(anyLong(), anyLong(), anyLong());
verify(repository, never()).touch(anyLong(), anyInt(), anyLong(), anyString());
}
@Test
void preservesDownstreamCode() {
stubAssignment();