Search in sources :

Example 1 with PickingCandidateRepository

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();
}
Also used : PickingCandidateRepository(de.metas.handlingunits.picking.PickingCandidateRepository) HUEditorViewRepository(de.metas.ui.web.handlingunits.HUEditorViewRepository) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) Test(org.junit.jupiter.api.Test)

Example 2 with PickingCandidateRepository

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);
    }
}
Also used : PickingCandidateRepository(de.metas.handlingunits.picking.PickingCandidateRepository) PickingSlotId(de.metas.picking.api.PickingSlotId) HuId(de.metas.handlingunits.HuId) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow) I_C_UOM(org.compiere.model.I_C_UOM) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) PickedHUEditorRow(de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow)

Example 3 with PickingCandidateRepository

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();
}
Also used : HUTraceRepository(de.metas.handlingunits.trace.HUTraceRepository) PickingCandidateRepository(de.metas.handlingunits.picking.PickingCandidateRepository) PickingConfigRepository(de.metas.picking.api.PickingConfigRepository) HuId2SourceHUsService(de.metas.handlingunits.sourcehu.HuId2SourceHUsService) PickingCandidateService(de.metas.handlingunits.picking.PickingCandidateService) IBPartnerBL(de.metas.bpartner.service.IBPartnerBL) HUReservationRepository(de.metas.handlingunits.reservation.HUReservationRepository) HUReservationService(de.metas.handlingunits.reservation.HUReservationService)

Aggregations

PickingCandidateRepository (de.metas.handlingunits.picking.PickingCandidateRepository)3 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)2 PickedHUEditorRow (de.metas.ui.web.picking.pickingslot.PickingHURowsRepository.PickedHUEditorRow)2 IBPartnerBL (de.metas.bpartner.service.IBPartnerBL)1 HuId (de.metas.handlingunits.HuId)1 PickingCandidateService (de.metas.handlingunits.picking.PickingCandidateService)1 HUReservationRepository (de.metas.handlingunits.reservation.HUReservationRepository)1 HUReservationService (de.metas.handlingunits.reservation.HUReservationService)1 HuId2SourceHUsService (de.metas.handlingunits.sourcehu.HuId2SourceHUsService)1 HUTraceRepository (de.metas.handlingunits.trace.HUTraceRepository)1 PickingConfigRepository (de.metas.picking.api.PickingConfigRepository)1 PickingSlotId (de.metas.picking.api.PickingSlotId)1 HUEditorViewRepository (de.metas.ui.web.handlingunits.HUEditorViewRepository)1 I_C_UOM (org.compiere.model.I_C_UOM)1 Test (org.junit.jupiter.api.Test)1