Search in sources :

Example 1 with IHUStorage

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

the class PickingSlotsClearingViewBasedProcess method retrieveQtyCU.

protected final BigDecimal retrieveQtyCU(@NonNull final I_M_HU hu) {
    final IHUContext huContext = huContextFactory.createMutableHUContext();
    final IHUStorage fromHUStorage = huContext.getHUStorageFactory().getStorage(hu);
    final I_M_Product product = fromHUStorage.getSingleProductOrNull();
    if (product == null) {
        return BigDecimal.ZERO;
    }
    final IHUProductStorage productStorage = fromHUStorage.getProductStorage(product);
    return productStorage.getQty();
}
Also used : I_M_Product(org.compiere.model.I_M_Product) IHUStorage(de.metas.handlingunits.storage.IHUStorage) IHUProductStorage(de.metas.handlingunits.storage.IHUProductStorage) IHUContext(de.metas.handlingunits.IHUContext)

Example 2 with IHUStorage

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

the class SqlHUEditorViewRepository method getSingleProductStorage.

private IHUProductStorage getSingleProductStorage(final I_M_HU hu) {
    final IHUStorage huStorage = Services.get(IHandlingUnitsBL.class).getStorageFactory().getStorage(hu);
    final I_M_Product product = huStorage.getSingleProductOrNull();
    if (product == null) {
        return null;
    }
    final IHUProductStorage productStorage = huStorage.getProductStorage(product);
    return productStorage;
}
Also used : I_M_Product(org.compiere.model.I_M_Product) IHUStorage(de.metas.handlingunits.storage.IHUStorage) IHUProductStorage(de.metas.handlingunits.storage.IHUProductStorage)

Example 3 with IHUStorage

use of de.metas.handlingunits.storage.IHUStorage 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)

Example 4 with IHUStorage

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

the class WEBUI_PickingSlotsClearingView_TakeOutHUAndAddToNewHU method createHUProducer.

private IHUProducerAllocationDestination createHUProducer(@NonNull final I_M_HU fromHU) {
    final PickingSlotRow pickingRow = getRootRowForSelectedPickingSlotRows();
    final IHUStorageFactory storageFactory = Services.get(IHandlingUnitsBL.class).getStorageFactory();
    final IHUStorage storage = storageFactory.getStorage(fromHU);
    final I_M_Product singleProduct = storage.getSingleProductOrNull();
    final LUTUProducerDestination lutuProducerDestination = createNewHUProducer(pickingRow, targetHUPI);
    lutuProducerDestination.addCUPerTU(singleProduct, qtyCU, singleProduct.getC_UOM());
    return lutuProducerDestination;
}
Also used : PickingSlotRow(de.metas.ui.web.picking.pickingslot.PickingSlotRow) IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) I_M_Product(org.compiere.model.I_M_Product) IHUStorageFactory(de.metas.handlingunits.storage.IHUStorageFactory) IHUStorage(de.metas.handlingunits.storage.IHUStorage) LUTUProducerDestination(de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination)

Aggregations

IHUStorage (de.metas.handlingunits.storage.IHUStorage)4 I_M_Product (org.compiere.model.I_M_Product)4 IHUProductStorage (de.metas.handlingunits.storage.IHUProductStorage)3 IHUContext (de.metas.handlingunits.IHUContext)2 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)1 LUTUProducerDestination (de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination)1 IHUStorageFactory (de.metas.handlingunits.storage.IHUStorageFactory)1 PickingSlotRow (de.metas.ui.web.picking.pickingslot.PickingSlotRow)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1