Search in sources :

Example 1 with ReserveHUsRequest

use of de.metas.handlingunits.reservation.ReserveHUsRequest in project metasfresh-webui-api by metasfresh.

the class WEBUI_C_OrderLineSO_Make_HUReservation method doIt.

@Override
protected String doIt() {
    final SalesOrderLine salesOrderLine = WEBUI_C_OrderLineSO_Util.retrieveSalesOrderLine(getView(), salesOrderLineRepository).get();
    final ImmutableList<HuId> selectedHuIds = streamSelectedHUIds(Select.ALL).collect(ImmutableList.toImmutableList());
    if (selectedHuIds.isEmpty()) {
        throw new AdempiereException("@NoSelection@");
    }
    final Quantity qtyToReserve = Quantity.of(qtyToReserveBD, salesOrderLine.getOrderedQty().getUOM());
    final ReserveHUsRequest reservationRequest = ReserveHUsRequest.builder().huIds(selectedHuIds).productId(salesOrderLine.getProductId()).qtyToReserve(qtyToReserve).salesOrderLineId(salesOrderLine.getId().getOrderLineId()).build();
    huReservationService.makeReservation(reservationRequest);
    return MSG_OK;
}
Also used : AdempiereException(org.adempiere.exceptions.AdempiereException) SalesOrderLine(de.metas.purchasecandidate.SalesOrderLine) Quantity(de.metas.quantity.Quantity) HuId(de.metas.handlingunits.HuId) ReserveHUsRequest(de.metas.handlingunits.reservation.ReserveHUsRequest)

Aggregations

HuId (de.metas.handlingunits.HuId)1 ReserveHUsRequest (de.metas.handlingunits.reservation.ReserveHUsRequest)1 SalesOrderLine (de.metas.purchasecandidate.SalesOrderLine)1 Quantity (de.metas.quantity.Quantity)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1