use of de.metas.handlingunits.picking.PickingCandidateRepository in project metasfresh-webui-api by metasfresh.
the class PickingHUsRepositoryTests method test_retrieveSourceHUs_empty_shipmentScheduleIds.
@Test
public void test_retrieveSourceHUs_empty_shipmentScheduleIds() {
final HUEditorViewRepository huEditorViewRepository = new MockedHUEditorViewRepository();
final PickingHURowsRepository pickingHUsRepository = new PickingHURowsRepository(() -> huEditorViewRepository, new PickingCandidateRepository());
final List<HUEditorRow> sourceHUs = pickingHUsRepository.retrieveSourceHUs(PickingSlotRepoQuery.builder().build());
assertThat(sourceHUs).isEmpty();
}
use of de.metas.handlingunits.picking.PickingCandidateRepository in project metasfresh-webui-api by metasfresh.
the class PickingHUsRepositoryTests method test_retrieveHUsIndexedByPickingSlotId.
private void test_retrieveHUsIndexedByPickingSlotId(@NonNull final PickingCandidateStatus processingStatus, final boolean pickingRackSystem) {
final I_C_UOM uom = createUOM();
final PickingSlotId pickingSlotId = createPickingSlot(pickingRackSystem);
final HuId huId = createHU();
final PickingCandidateRepository pickingCandidatesRepo = new PickingCandidateRepository();
pickingCandidatesRepo.save(PickingCandidate.builder().processingStatus(processingStatus).qtyPicked(Quantity.zero(uom)).shipmentScheduleId(M_SHIPMENT_SCHEDULE_ID).pickingSlotId(pickingSlotId).pickFrom(PickFrom.ofHuId(huId)).packedToHuId(PickingCandidateStatus.Draft.equals(processingStatus) ? null : huId).build());
final HUEditorRow huEditorRow = HUEditorRow.builder(WindowId.of(423)).setRowId(HUEditorRowId.ofTopLevelHU(huId)).setType(HUEditorRowType.LU).setTopLevel(true).build();
final boolean expectNoRows = PickingCandidateStatus.Closed.equals(processingStatus) && pickingRackSystem;
final MockedHUEditorViewRepository huEditorViewRepository = new MockedHUEditorViewRepository();
if (!expectNoRows) {
huEditorViewRepository.addRow(huEditorRow);
}
final PickingHURowsRepository pickingHUsRepository = new PickingHURowsRepository(() -> huEditorViewRepository, new PickingCandidateRepository());
final ListMultimap<PickingSlotId, PickedHUEditorRow> result = pickingHUsRepository.retrievePickedHUsIndexedByPickingSlotId(PickingCandidatesQuery.builder().shipmentScheduleId(M_SHIPMENT_SCHEDULE_ID).onlyNotClosedOrNotRackSystem(true).build());
if (expectNoRows) {
// if 'pickingCandidate' is "closed", then nothing shall be returned
assertThat(result.isEmpty()).isTrue();
} else {
assertThat(result.size()).isEqualTo(1);
assertThat(result.get(pickingSlotId)).hasSize(1);
final boolean expectedProcessed = !PickingCandidateStatus.Draft.equals(processingStatus);
final PickedHUEditorRow resultRow = result.get(pickingSlotId).get(0);
final PickedHUEditorRow expectedRow = new PickedHUEditorRow(huEditorRow, expectedProcessed);
assertThat(resultRow).isEqualTo(expectedRow);
}
}
use of de.metas.handlingunits.picking.PickingCandidateRepository in project metasfresh-webui-api by metasfresh.
the class PickingV2TestHelper method createProductsToPickRowsDataFactory.
public ProductsToPickRowsDataFactory createProductsToPickRowsDataFactory() {
final IBPartnerBL bpartnersService = createAndRegisterBPartnerBL();
final HUReservationRepository huReservationRepository = new HUReservationRepository();
final HUReservationService huReservationService = new HUReservationService(huReservationRepository);
final PickingCandidateRepository pickingCandidateRepository = new PickingCandidateRepository();
final HUTraceRepository huTraceRepository = new HUTraceRepository();
final HuId2SourceHUsService sourceHUsRepository = new HuId2SourceHUsService(huTraceRepository);
final PickingCandidateService pickingCandidateService = new PickingCandidateService(new PickingConfigRepository(), pickingCandidateRepository, sourceHUsRepository);
return ProductsToPickRowsDataFactory.builder().bpartnersService(bpartnersService).huReservationService(huReservationService).pickingCandidateService(pickingCandidateService).locatorLookup(this::generateLocatorLookupById).build();
}
Aggregations