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);
}
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();
}
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);
}
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());
}
Aggregations