Search in sources :

Example 1 with IHUPIItemProductDAO

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

the class PackingInfoProcessParams method getDefaultLUTUConfig.

public I_M_HU_LUTU_Configuration getDefaultLUTUConfig() {
    if (_defaultLUTUConfig == null) {
        final I_M_HU_LUTU_Configuration defaultLUTUConfig = defaultLUTUConfigManager.getCreateLUTUConfiguration();
        // Apply adjustment rules to default LU/TU config
        if (enforceOneLUorTU) {
            adjustDefaultLUTUConfig_EnforceOneLUorTU(defaultLUTUConfig, enforceAvailableQtyTU);
        } else if (enforceAvailableQtyTU != null) {
            // IMPORTANT: this rule shall be applied if not enforceOneLUorTU
            adjustDefaultLUTUConfig_EnforceAvailableTUs(defaultLUTUConfig, enforceAvailableQtyTU);
        }
        if (enforcePhysicalTU) {
            // check if we need to do something
            boolean needToFallback;
            if (defaultLUTUConfig.getM_HU_PI_Item_Product_ID() <= 0) {
                // no piip specified at all
                needToFallback = true;
            } else {
                // check if the piip that we got is the virtual one. If yes, we need to fallback
                final IHUPIItemProductDAO hupiItemProductDAO = Services.get(IHUPIItemProductDAO.class);
                needToFallback = defaultLUTUConfig.getM_HU_PI_Item_Product_ID() == hupiItemProductDAO.retrieveVirtualPIMaterialItemProduct(Env.getCtx()).getM_HU_PI_Item_Product_ID();
            }
            if (needToFallback) {
                insertPhysicalFallbackTU(defaultLUTUConfig);
            }
        }
        // Make sure nobody is overriding the existing configuration
        if (defaultLUTUConfig.getM_HU_LUTU_Configuration_ID() > 0) {
            InterfaceWrapperHelper.setSaveDeleteDisabled(defaultLUTUConfig, true);
        }
        _defaultLUTUConfig = defaultLUTUConfig;
    }
    return _defaultLUTUConfig;
}
Also used : I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) IHUPIItemProductDAO(de.metas.handlingunits.IHUPIItemProductDAO)

Example 2 with IHUPIItemProductDAO

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

the class WEBUI_ProcessHelper method retrieveHUPIItemProductRecords.

public List<I_M_HU_PI_Item_Product> retrieveHUPIItemProductRecords(@NonNull final Properties ctx, @NonNull final I_M_Product product, @Nullable final I_C_BPartner bPartner, final boolean includeVirtualItem) {
    final IHUPIItemProductDAO hupiItemProductDAO = Services.get(IHUPIItemProductDAO.class);
    final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
    final boolean allowInfiniteCapacity = sysConfigBL.getBooleanValue(SYSCONFIG_ALLOW_INFINIT_CAPACITY_TUS, true, Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx));
    final List<I_M_HU_PI_Item_Product> list = hupiItemProductDAO.retrieveTUs(ctx, product, bPartner, allowInfiniteCapacity);
    if (includeVirtualItem) {
        list.add(hupiItemProductDAO.retrieveVirtualPIMaterialItemProduct(ctx));
    }
    return list;
}
Also used : ISysConfigBL(org.adempiere.service.ISysConfigBL) I_M_HU_PI_Item_Product(de.metas.handlingunits.model.I_M_HU_PI_Item_Product) IHUPIItemProductDAO(de.metas.handlingunits.IHUPIItemProductDAO)

Aggregations

IHUPIItemProductDAO (de.metas.handlingunits.IHUPIItemProductDAO)2 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)1 I_M_HU_PI_Item_Product (de.metas.handlingunits.model.I_M_HU_PI_Item_Product)1 ISysConfigBL (org.adempiere.service.ISysConfigBL)1