Search in sources :

Example 1 with MatchingSourceHusQuery

use of de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery in project metasfresh-webui-api by metasfresh.

the class PickingHURowsRepository method retrieveSourceHUs.

/**
 * Retrieve the union of all HUs that match any one of the given shipment schedule IDs and that are flagged to be fine picking source HUs.
 *
 * @param shipmentScheduleIds
 * @return
 */
public List<HUEditorRow> retrieveSourceHUs(@NonNull final PickingSlotRepoQuery query) {
    final MatchingSourceHusQuery matchingSourceHUsQuery = createMatchingSourceHusQuery(query);
    final Set<Integer> sourceHUIds = SourceHUsService.get().retrieveMatchingSourceHUIds(matchingSourceHUsQuery);
    return huEditorRepo.retrieveHUEditorRows(sourceHUIds, HUEditorRowFilter.ALL);
}
Also used : MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery)

Example 2 with MatchingSourceHusQuery

use of de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery in project metasfresh-webui-api by metasfresh.

the class PPOrderLinesLoader method createRowsForIssueProductSourceHUs.

private List<PPOrderLineRow> createRowsForIssueProductSourceHUs(int m_Warehouse_ID, @NonNull final List<PPOrderLineRow> bomLineRows) {
    final ImmutableSet<Integer> issueProductIds = bomLineRows.stream().filter(PPOrderLineRow::isIssue).map(PPOrderLineRow::getM_Product_ID).collect(ImmutableSet.toImmutableSet());
    final ImmutableList.Builder<PPOrderLineRow> result = ImmutableList.builder();
    final MatchingSourceHusQuery sourceHusQuery = MatchingSourceHusQuery.builder().productIds(issueProductIds).warehouseId(m_Warehouse_ID).build();
    for (final int sourceHUId : SourceHUsService.get().retrieveMatchingSourceHUIds(sourceHusQuery)) {
        final HUEditorRow huEditorRow = huEditorRepo.retrieveForHUId(sourceHUId);
        result.add(createRowForSourceHU(huEditorRow));
    }
    return result.build();
}
Also used : MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) ImmutableList(com.google.common.collect.ImmutableList) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow)

Example 3 with MatchingSourceHusQuery

use of de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery in project metasfresh-webui-api by metasfresh.

the class WEBUI_PP_Order_M_Source_HU_IssueTuQty method retrieveActiveSourceHus.

private static List<I_M_Source_HU> retrieveActiveSourceHus(@NonNull final PPOrderLineRow row) {
    final I_PP_Order ppOrder = load(row.getPP_Order_ID(), I_PP_Order.class);
    final MatchingSourceHusQuery query = MatchingSourceHusQuery.builder().productId(row.getM_Product_ID()).warehouseId(ppOrder.getM_Warehouse_ID()).build();
    return SourceHUsService.get().retrieveMatchingSourceHuMarkers(query);
}
Also used : MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) I_PP_Order(org.eevolution.model.I_PP_Order)

Example 4 with MatchingSourceHusQuery

use of de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery in project metasfresh-webui-api by metasfresh.

the class PickingHURowsRepositoryTest method testRetrieveActiveSourceHusQuery_fromShipmentSchedules.

@Test
public void testRetrieveActiveSourceHusQuery_fromShipmentSchedules() {
    final I_M_Warehouse wh = newInstance(I_M_Warehouse.class);
    save(wh);
    final I_M_Product product = newInstance(I_M_Product.class);
    save(product);
    final I_M_ShipmentSchedule shipmentSchedule1 = newInstance(I_M_ShipmentSchedule.class);
    shipmentSchedule1.setM_Warehouse(wh);
    shipmentSchedule1.setM_Product(product);
    save(shipmentSchedule1);
    final I_M_ShipmentSchedule shipmentSchedule2 = newInstance(I_M_ShipmentSchedule.class);
    shipmentSchedule2.setM_Warehouse(wh);
    shipmentSchedule2.setM_Product(product);
    save(shipmentSchedule2);
    final MatchingSourceHusQuery query = PickingHURowsRepository.createMatchingSourceHusQuery(PickingSlotRepoQuery.builder().currentShipmentScheduleId(shipmentSchedule1.getM_ShipmentSchedule_ID()).shipmentScheduleId(shipmentSchedule1.getM_ShipmentSchedule_ID()).shipmentScheduleId(shipmentSchedule2.getM_ShipmentSchedule_ID()).build());
    assertThat(query.getWarehouseId()).isEqualTo(wh.getM_Warehouse_ID());
    assertThat(query.getProductIds()).containsExactly(product.getM_Product_ID());
}
Also used : MatchingSourceHusQuery(de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery) I_M_Product(de.metas.adempiere.model.I_M_Product) I_M_ShipmentSchedule(de.metas.handlingunits.model.I_M_ShipmentSchedule) I_M_Warehouse(de.metas.handlingunits.model.I_M_Warehouse) Test(org.junit.Test)

Aggregations

MatchingSourceHusQuery (de.metas.handlingunits.sourcehu.SourceHUsService.MatchingSourceHusQuery)4 ImmutableList (com.google.common.collect.ImmutableList)1 I_M_Product (de.metas.adempiere.model.I_M_Product)1 I_M_ShipmentSchedule (de.metas.handlingunits.model.I_M_ShipmentSchedule)1 I_M_Warehouse (de.metas.handlingunits.model.I_M_Warehouse)1 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)1 I_PP_Order (org.eevolution.model.I_PP_Order)1 Test (org.junit.Test)1