fix: scope smart loading recommendations
This commit is contained in:
@@ -764,7 +764,7 @@ class SmartLoadingServiceTest {
|
||||
when(repository.candidates(null)).thenReturn(List.of(first, second, third));
|
||||
when(coloadGroups.findByInbound(anyLong(), anyLong())).thenReturn(group);
|
||||
|
||||
Plan result = service.recommend(1L, new RecommendRequest(0, "recommend-group-too-large"), 7L, "u");
|
||||
Plan result = service.recommend(1L, new RecommendRequest(0, "recommend-group-too-large", null, null), 7L, "u");
|
||||
|
||||
assertThat(result.items()).isEmpty();
|
||||
verify(coloadGroups, never()).lockWholeGroupForAssignment(anyLong(), anyLong(), anyLong(),
|
||||
@@ -775,6 +775,7 @@ class SmartLoadingServiceTest {
|
||||
@Test
|
||||
void recommendAssignsMultipleDropshipCandidatesThroughWholePalletCommands() {
|
||||
Candidate dropship = candidate(9L, 10L, 20L, 30L, 20);
|
||||
Candidate anotherCustomer = candidate(19L, 11L, 21L, 31L, 10);
|
||||
AtomicInteger version = new AtomicInteger();
|
||||
List<LoadingPlanItemEntity> saved = new ArrayList<>();
|
||||
InboundOrderEntity inbound = inbound(9L, 10L);
|
||||
@@ -783,7 +784,7 @@ class SmartLoadingServiceTest {
|
||||
when(repository.planByBooking(99L)).thenAnswer(invocation -> plan("EDITING", version.get()));
|
||||
when(repository.booking(99L)).thenReturn(booking());
|
||||
when(repository.items(1L)).thenAnswer(invocation -> List.copyOf(saved));
|
||||
when(repository.candidates(null)).thenReturn(List.of(dropship));
|
||||
when(repository.candidates(null)).thenReturn(List.of(dropship, anotherCustomer));
|
||||
when(repository.inbound(9L, 10L)).thenReturn(inbound);
|
||||
when(repository.activeItemsByPallet(anyLong())).thenReturn(List.of());
|
||||
when(repository.activePalletItem(eq(1L), anyLong(), eq(20L))).thenReturn(null);
|
||||
@@ -810,7 +811,7 @@ class SmartLoadingServiceTest {
|
||||
}).when(repository).insert(any(LoadingPlanItemEntity.class));
|
||||
|
||||
Plan result = service.recommend(1L,
|
||||
new RecommendRequest(0, "recommend-dropship-pallet"), 7L, "u");
|
||||
new RecommendRequest(0, "recommend-dropship-pallet", 9L, "I10"), 7L, "u");
|
||||
|
||||
assertThat(result.version()).isEqualTo(2);
|
||||
assertThat(saved).hasSize(2).allSatisfy(item -> {
|
||||
@@ -823,6 +824,9 @@ class SmartLoadingServiceTest {
|
||||
org.assertj.core.groups.Tuple.tuple(801L, "DP-260914-0021"),
|
||||
org.assertj.core.groups.Tuple.tuple(802L, "DP-260914-0022"));
|
||||
verify(repository, never()).candidate(anyLong(), anyLong(), anyLong());
|
||||
verify(dropshipPallets, never()).palletCandidates(11L);
|
||||
verify(fbaPricingService, times(1)).recalculateUnlockedContainerCustomerFees(
|
||||
eq(99L), eq(9L), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -839,7 +843,7 @@ class SmartLoadingServiceTest {
|
||||
when(dropshipPallets.sealedPalletLines(801L)).thenReturn(List.of());
|
||||
|
||||
Plan result = service.recommend(1L,
|
||||
new RecommendRequest(0, "recommend-stale-pallet"), 7L, "u");
|
||||
new RecommendRequest(0, "recommend-stale-pallet", null, null), 7L, "u");
|
||||
|
||||
assertThat(result.items()).isEmpty();
|
||||
verify(repository, never()).touch(anyLong(), anyInt(), anyLong(), anyString());
|
||||
@@ -888,7 +892,7 @@ class SmartLoadingServiceTest {
|
||||
when(coloadGroups.findByInbound(9L, 12L)).thenReturn(group);
|
||||
|
||||
Plan result = service.recommend(1L,
|
||||
new RecommendRequest(0, "recommend-refresh-group-capacity"), 7L, "u");
|
||||
new RecommendRequest(0, "recommend-refresh-group-capacity", null, null), 7L, "u");
|
||||
|
||||
assertThat(result.version()).isEqualTo(2);
|
||||
assertThat(saved).extracting(LoadingPlanItemEntity::getInboundId,
|
||||
@@ -1397,9 +1401,9 @@ class SmartLoadingServiceTest {
|
||||
|
||||
@Test
|
||||
void replaysRecommendation() {
|
||||
RecommendRequest request = new RecommendRequest(0, "recommend-replay");
|
||||
RecommendRequest request = new RecommendRequest(0, "recommend-replay", null, null);
|
||||
when(repository.operation("recommend-replay")).thenReturn(history(1, null,
|
||||
"SMART_RECOMMEND", sha256("RECOMMEND|1|0")));
|
||||
"SMART_RECOMMEND", sha256("RECOMMEND|1|0|null|null")));
|
||||
when(repository.plan(1)).thenReturn(plan("LOADING", 8));
|
||||
when(repository.booking(99)).thenReturn(booking());
|
||||
when(repository.items(1)).thenReturn(List.of());
|
||||
|
||||
Reference in New Issue
Block a user