优化
This commit is contained in:
+5
@@ -91,6 +91,11 @@ class SmartLoadingCandidateMapperContractTest {
|
||||
.contains("status.name() == 'WAIT_SPLIT'")
|
||||
.contains("status.name() == 'LOADING'")
|
||||
.contains("NOT EXISTS (", "active_item.inbound_id=o.id", "active_item.deleted=0")
|
||||
.contains("available_pallet.palletId palletId")
|
||||
.contains("pallet.pallet_status='SEALED'")
|
||||
.contains("pallet_item.pallet_id=pallet.id", "pallet_item.deleted=0")
|
||||
.contains("o.fulfillment_type='ONE_CLICK_DROPSHIP' AND available_pallet.palletId IS NOT NULL")
|
||||
.contains("CASE WHEN current_group.id IS NULL THEN eligible.palletId END palletId")
|
||||
.contains("current_group.id groupId")
|
||||
.contains("group_member_count.group_id=current_group.id")
|
||||
.doesNotContain("fl_container_booking")
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.baiyue.firstleg.dto.SmartLoadingDtos.DeleteRequest;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.GroupMemberCandidate;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.InboundCandidateQuery;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.InboundCandidate;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.PalletCandidate;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.WorkbenchContainer;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.WorkbenchContainerQuery;
|
||||
import com.baiyue.firstleg.dto.SmartLoadingDtos.Plan;
|
||||
@@ -224,6 +225,39 @@ class SmartLoadingServiceTest {
|
||||
verify(repository, never()).booking(anyLong());
|
||||
}
|
||||
|
||||
@Test
|
||||
void pagesEachAvailableDropshipPalletAsAnIndependentCandidate() {
|
||||
Candidate dropship = withChannel(candidate(9L, 10L, 20L, 30L, 12),
|
||||
"EXX_TRUCK", "EXX海卡");
|
||||
InboundCandidateQuery query = new InboundCandidateQuery(
|
||||
List.of("EXX"), null, null, "EXXHWK2609140003", null, null,
|
||||
null, null, List.of(CandidateOrderStatus.WAIT_SPLIT), 1, 20);
|
||||
List<CandidateUnit> units = List.of(
|
||||
new CandidateUnit(null, 9L, 10L, 801L, null, 10L),
|
||||
new CandidateUnit(null, 9L, 10L, 802L, null, 10L));
|
||||
when(repository.globalCandidateUnits(eq(query), anySet()))
|
||||
.thenReturn(new PageResult<>(units, 1, 20, 2, 1));
|
||||
when(repository.globalCandidatesByUnits(units)).thenReturn(List.of(dropship));
|
||||
when(dropshipPallets.palletCandidates(10L)).thenReturn(List.of(
|
||||
new PalletCandidate(801L, "DP-260914-0004", "SEALED_PALLET", true,
|
||||
8, 1, new BigDecimal("79.2"), new BigDecimal("4.4")),
|
||||
new PalletCandidate(802L, "DP-260914-0005", "SEALED_PALLET", true,
|
||||
4, 1, new BigDecimal("39.6"), new BigDecimal("2.2"))));
|
||||
|
||||
var result = service.inboundCandidates(query);
|
||||
|
||||
assertThat(result.total()).isEqualTo(2);
|
||||
assertThat(result.records()).extracting(InboundCandidate::palletId,
|
||||
InboundCandidate::palletNo, InboundCandidate::availablePackageCount)
|
||||
.containsExactly(
|
||||
org.assertj.core.groups.Tuple.tuple(801L, "DP-260914-0004", 8),
|
||||
org.assertj.core.groups.Tuple.tuple(802L, "DP-260914-0005", 4));
|
||||
assertThat(result.records()).allSatisfy(candidate -> {
|
||||
assertThat(candidate.unitType()).isEqualTo("SEALED_PALLET");
|
||||
assertThat(candidate.indivisible()).isTrue();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void combinesAllUnfinishedStatusesBeforeReturningTheRequestedPage() {
|
||||
InboundCandidateQuery query = new InboundCandidateQuery(
|
||||
|
||||
Reference in New Issue
Block a user