Search in sources :

Example 1 with ViewHeaderPropertiesBuilder

use of de.metas.ui.web.view.ViewHeaderProperties.ViewHeaderPropertiesBuilder in project metasfresh-webui-api by metasfresh.

the class ProductsProposalRowsLoader method load.

public ProductsProposalRowsData load() {
    List<ProductsProposalRow> rows = loadRows();
    logger.debug("loaded {} productsProposalRows for priceListVersionIds={}", rows.size(), priceListVersionIds);
    rows = updateLastShipmentDays(rows);
    final PriceListVersionId singlePriceListVersionId = priceListVersionIds.size() == 1 ? priceListVersionIds.iterator().next() : null;
    final PriceListVersionId basePriceListVersionId;
    if (singlePriceListVersionId != null) {
        final ZonedDateTime datePromised = order == null ? SystemTime.asZonedDateTime() : order.getDatePromised();
        basePriceListVersionId = priceListsRepo.getBasePriceListVersionIdForPricingCalculationOrNull(singlePriceListVersionId, datePromised);
        logger.debug("singlePriceListVersionId={} and datePromised={}; -> basePriceListVersionId={}", PriceListVersionId.toRepoId(singlePriceListVersionId), datePromised, PriceListVersionId.toRepoId(basePriceListVersionId));
    } else {
        basePriceListVersionId = null;
    }
    // 
    final ViewHeaderPropertiesBuilder headerProperties = ViewHeaderProperties.builder();
    if (order != null) {
        logger.debug("order!=null; -> add bpartnerName={} to headerProperties", order.getBpartnerName());
        headerProperties.entry(ViewHeaderProperty.builder().caption(msgBL.translatable("C_BPartner_ID")).value(order.getBpartnerName()).build());
    }
    return ProductsProposalRowsData.builder().nextRowIdSequence(nextRowIdSequence).campaignPriceProvider(campaignPriceProvider).singlePriceListVersionId(singlePriceListVersionId).basePriceListVersionId(basePriceListVersionId).order(order).bpartnerId(bpartnerId).soTrx(soTrx).headerProperties(headerProperties.build()).rows(rows).build();
}
Also used : ZonedDateTime(java.time.ZonedDateTime) ViewHeaderPropertiesBuilder(de.metas.ui.web.view.ViewHeaderProperties.ViewHeaderPropertiesBuilder) PriceListVersionId(de.metas.pricing.PriceListVersionId)

Aggregations

PriceListVersionId (de.metas.pricing.PriceListVersionId)1 ViewHeaderPropertiesBuilder (de.metas.ui.web.view.ViewHeaderProperties.ViewHeaderPropertiesBuilder)1 ZonedDateTime (java.time.ZonedDateTime)1