Search in sources :

Example 6 with IHUProductStorage

use of de.metas.handlingunits.storage.IHUProductStorage in project metasfresh-webui-api by metasfresh.

the class PickingSlotsClearingViewBasedProcess method prepareUnloadRequest.

protected IAllocationRequestBuilder prepareUnloadRequest(@NonNull final I_M_HU fromHU, @NonNull final BigDecimal qtyCU) {
    Check.assume(qtyCU.signum() > 0, "qtyCU > 0");
    final IHUContext huContext = huContextFactory.createMutableHUContext();
    final IHUStorage fromHUStorage = huContext.getHUStorageFactory().getStorage(fromHU);
    final I_M_Product product = fromHUStorage.getSingleProductOrNull();
    if (product == null) {
        throw new AdempiereException("Cannot determine the product to transfer from " + fromHU);
    }
    final IHUProductStorage productStorage = fromHUStorage.getProductStorage(product);
    return AllocationUtils.createAllocationRequestBuilder().setHUContext(huContext).setProduct(product).setQuantity(qtyCU, productStorage.getC_UOM()).setDateAsToday().setFromReferencedModel(null).setForceQtyAllocation(false);
}
Also used : I_M_Product(org.compiere.model.I_M_Product) AdempiereException(org.adempiere.exceptions.AdempiereException) IHUStorage(de.metas.handlingunits.storage.IHUStorage) IHUProductStorage(de.metas.handlingunits.storage.IHUProductStorage) IHUContext(de.metas.handlingunits.IHUContext)

Aggregations

IHUProductStorage (de.metas.handlingunits.storage.IHUProductStorage)6 IHUStorage (de.metas.handlingunits.storage.IHUStorage)4 I_M_Product (org.compiere.model.I_M_Product)4 IHUContext (de.metas.handlingunits.IHUContext)2 I_M_HU (de.metas.handlingunits.model.I_M_HU)2 AdempiereException (org.adempiere.exceptions.AdempiereException)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 IHUQueryBuilder (de.metas.handlingunits.IHUQueryBuilder)1 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)1 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)1 HUException (de.metas.handlingunits.exceptions.HUException)1 I_M_Locator (de.metas.handlingunits.model.I_M_Locator)1 I_M_Warehouse (de.metas.handlingunits.model.I_M_Warehouse)1 X_M_HU_PI_Version (de.metas.handlingunits.model.X_M_HU_PI_Version)1 IHUStorageFactory (de.metas.handlingunits.storage.IHUStorageFactory)1 LogManager (de.metas.logging.LogManager)1 DocumentFilter (de.metas.ui.web.document.filter.DocumentFilter)1 SqlDocumentFilterConverter (de.metas.ui.web.document.filter.sql.SqlDocumentFilterConverter)1 SqlDocumentFilterConverters (de.metas.ui.web.document.filter.sql.SqlDocumentFilterConverters)1