use of de.metas.product.ProductId in project metasfresh-webui-api by metasfresh.
the class WEBUI_C_OrderLineSO_Make_HUReservation method checkPreconditionsApplicable.
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable() {
final SalesOrderLine salesOrderLine = WEBUI_C_OrderLineSO_Util.retrieveSalesOrderLine(getView(), salesOrderLineRepository).orElse(null);
if (salesOrderLine == null) {
return ProcessPreconditionsResolution.rejectWithInternalReason("No sales order was set");
}
final ProductId productId = salesOrderLine.getProductId();
final Quantity reservableQty = retrieveReservableQuantity(productId);
if (reservableQty.signum() <= 0) {
return ProcessPreconditionsResolution.rejectWithInternalReason("No reservable quantity for productId=" + productId);
}
return ProcessPreconditionsResolution.accept();
}
Aggregations