Search in sources :

Example 1 with LUTUProducerDestination

use of de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination in project metasfresh-webui-api by metasfresh.

the class PickingSlotsClearingViewBasedProcess method createNewHUProducer.

protected final LUTUProducerDestination createNewHUProducer(@NonNull final PickingSlotRow pickingRow, @NonNull final I_M_HU_PI targetHUPI) {
    final int bpartnerId = pickingRow.getBPartnerId();
    final I_C_BPartner bpartner = bpartnerId > 0 ? load(bpartnerId, I_C_BPartner.class) : null;
    final int bpartnerLocationId = pickingRow.getBPartnerLocationId();
    final int locatorId = pickingRow.getPickingSlotLocatorId();
    final I_M_Locator locator = load(locatorId, I_M_Locator.class);
    if (!locator.isAfterPickingLocator()) {
        throw new AdempiereException("Picking slot's locator is not an after picking locator: " + locator.getValue());
    }
    final LUTUProducerDestination lutuProducer = new LUTUProducerDestination();
    lutuProducer.setC_BPartner(bpartner).setC_BPartner_Location_ID(bpartnerLocationId).setM_Locator(locator).setHUStatus(X_M_HU.HUSTATUS_Picked);
    final String targetHuType = Services.get(IHandlingUnitsBL.class).getHU_UnitType(targetHUPI);
    if (X_M_HU_PI_Version.HU_UNITTYPE_LoadLogistiqueUnit.equals(targetHuType)) {
        lutuProducer.setLUPI(targetHUPI);
    } else if (X_M_HU_PI_Version.HU_UNITTYPE_TransportUnit.equals(targetHuType)) {
        pickingRow.getHuProductId();
        lutuProducer.setNoLU();
        lutuProducer.setTUPI(targetHUPI);
    }
    return lutuProducer;
}
Also used : IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) AdempiereException(org.adempiere.exceptions.AdempiereException) LUTUProducerDestination(de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination) I_C_BPartner(org.compiere.model.I_C_BPartner) I_M_Locator(de.metas.handlingunits.model.I_M_Locator)

Example 2 with LUTUProducerDestination

use of de.metas.handlingunits.allocation.transfer.impl.LUTUProducerDestination 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

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