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