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