use of de.metas.product.ProductAndCategoryAndManufacturerId in project metasfresh-webui-api by metasfresh.
the class OrderLinePricingConditionsViewFactory method createPricingConditionsBreakQuery.
private final PricingConditionsBreakQuery createPricingConditionsBreakQuery(final I_C_OrderLine salesOrderLine) {
final IProductDAO productsRepo = Services.get(IProductDAO.class);
final IAttributeDAO attributesRepo = Services.get(IAttributeDAO.class);
final ProductId productId = ProductId.ofRepoId(salesOrderLine.getM_Product_ID());
final ProductAndCategoryAndManufacturerId product = productsRepo.retrieveProductAndCategoryAndManufacturerByProductId(productId);
final AttributeSetInstanceId asiId = AttributeSetInstanceId.ofRepoIdOrNone(salesOrderLine.getM_AttributeSetInstance_ID());
final ImmutableAttributeSet attributes = attributesRepo.getImmutableAttributeSetById(asiId);
final BigDecimal qty = salesOrderLine.getQtyOrdered();
final BigDecimal price = salesOrderLine.getPriceActual();
return PricingConditionsBreakQuery.builder().product(product).attributes(attributes).qty(qty).price(price).build();
}
use of de.metas.product.ProductAndCategoryAndManufacturerId in project metasfresh-webui-api by metasfresh.
the class ProductPricingConditionsViewFactory method createPricingConditionsRowData.
@Override
protected PricingConditionsRowData createPricingConditionsRowData(final CreateViewRequest request) {
final Set<ProductId> productIds = ProductId.ofRepoIds(request.getFilterOnlyIds());
Check.assumeNotEmpty(productIds, "productIds is not empty");
final IProductDAO productsRepo = Services.get(IProductDAO.class);
final Set<ProductAndCategoryAndManufacturerId> products = productsRepo.retrieveProductAndCategoryAndManufacturersByProductIds(productIds);
return preparePricingConditionsRowData().pricingConditionsBreaksExtractor(pricingConditions -> pricingConditions.streamBreaksMatchingAnyOfProducts(products)).basePricingSystemPriceCalculator(this::calculateBasePricingSystemPrice).load();
}
Aggregations