Search in sources :

Example 1 with HUPIItemProductId

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

the class ProductsProposalRowsLoader method toProductsProposalRowOrNull.

private ProductsProposalRow toProductsProposalRowOrNull(@NonNull final I_M_ProductPrice record) {
    final ProductId productId = ProductId.ofRepoId(record.getM_Product_ID());
    final LookupValue product = productLookup.findById(productId);
    if (!product.isActive()) {
        return null;
    }
    final HUPIItemProductId packingMaterialId = HUPIItemProductId.ofRepoIdOrNull(record.getM_HU_PI_Item_Product_ID());
    final ITranslatableString packingDescription = packingMaterialId != null ? packingMaterialsService.getDisplayName(packingMaterialId) : TranslatableStrings.empty();
    return ProductsProposalRow.builder().id(nextRowIdSequence.nextDocumentId()).product(product).packingMaterialId(packingMaterialId).packingDescription(packingDescription).asiDescription(extractProductASIDescription(record)).price(extractProductProposalPrice(record)).qty(null).lastShipmentDays(// will be populated later
    null).seqNo(record.getSeqNo()).productPriceId(ProductPriceId.ofRepoId(record.getM_ProductPrice_ID())).build().withExistingOrderLine(order);
}
Also used : HUPIItemProductId(de.metas.handlingunits.HUPIItemProductId) ITranslatableString(de.metas.i18n.ITranslatableString) ProductId(de.metas.product.ProductId) HUPIItemProductId(de.metas.handlingunits.HUPIItemProductId) LookupValue(de.metas.ui.web.window.datatypes.LookupValue)

Example 2 with HUPIItemProductId

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

the class PackingInfoProcessParams method createAndSaveNewLUTUConfig.

public I_M_HU_LUTU_Configuration createAndSaveNewLUTUConfig() {
    final I_M_HU_LUTU_Configuration defaultLUTUConfig = getDefaultLUTUConfig();
    // Validate parameters
    // not mandatory
    final int lu_PI_Item_ID = getLuPiItemId();
    final HUPIItemProductId M_HU_PI_Item_Product_ID = getTU_HU_PI_Item_Product_ID();
    final BigDecimal qtyCU = getQtyCU();
    final BigDecimal qtyTU = M_HU_PI_Item_Product_ID.isVirtualHU() ? BigDecimal.ONE : this.qtyTU;
    if (qtyCU == null || qtyCU.signum() <= 0) {
        throw new FillMandatoryException(PARAM_QtyCU);
    }
    if (qtyTU == null || qtyTU.signum() <= 0) {
        throw new FillMandatoryException(PARAM_QtyTU);
    }
    final I_M_HU_LUTU_Configuration lutuConfigNew = InterfaceWrapperHelper.copy().setFrom(defaultLUTUConfig).copyToNew(I_M_HU_LUTU_Configuration.class);
    // CU
    lutuConfigNew.setQtyCU(qtyCU);
    lutuConfigNew.setIsInfiniteQtyCU(false);
    // TU
    configureLUTUConfigTU(lutuConfigNew, M_HU_PI_Item_Product_ID, qtyTU);
    // LU
    configureLUTUConfigLU(lutuConfigNew, lu_PI_Item_ID);
    lutuConfigurationFactory.save(lutuConfigNew);
    return lutuConfigNew;
}
Also used : HUPIItemProductId(de.metas.handlingunits.HUPIItemProductId) I_M_HU_LUTU_Configuration(de.metas.handlingunits.model.I_M_HU_LUTU_Configuration) FillMandatoryException(org.adempiere.exceptions.FillMandatoryException) BigDecimal(java.math.BigDecimal)

Aggregations

HUPIItemProductId (de.metas.handlingunits.HUPIItemProductId)2 I_M_HU_LUTU_Configuration (de.metas.handlingunits.model.I_M_HU_LUTU_Configuration)1 ITranslatableString (de.metas.i18n.ITranslatableString)1 ProductId (de.metas.product.ProductId)1 LookupValue (de.metas.ui.web.window.datatypes.LookupValue)1 BigDecimal (java.math.BigDecimal)1 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1