Search in sources :

Example 6 with PriceListVersionId

use of de.metas.pricing.PriceListVersionId in project metasfresh-webui-api by metasfresh.

the class OrderProductProposalsService method getOrderById.

public Order getOrderById(@NonNull final OrderId orderId) {
    final I_C_Order orderRecord = ordersRepo.getById(orderId);
    final ZonedDateTime datePromised = TimeUtil.asZonedDateTime(orderRecord.getDatePromised());
    final PriceListId priceListId = PriceListId.ofRepoId(orderRecord.getM_PriceList_ID());
    final I_M_PriceList priceList = priceListsRepo.getById(priceListId);
    final PriceListVersionId priceListVersionId = priceListsRepo.retrievePriceListVersionId(priceListId, datePromised);
    final BPartnerId bpartnerId = BPartnerId.ofRepoId(orderRecord.getC_BPartner_ID());
    final String bpartnerName = bpartnersService.getBPartnerName(bpartnerId);
    return Order.builder().orderId(orderId).soTrx(SOTrx.ofBoolean(orderRecord.isSOTrx())).datePromised(datePromised).bpartnerId(bpartnerId).bpartnerName(bpartnerName).pricingSystemId(priceListsRepo.getPricingSystemId(priceListId)).priceListId(priceListId).priceListVersionId(priceListVersionId).countryId(CountryId.ofRepoIdOrNull(priceList.getC_Country_ID())).currencyId(CurrencyId.ofRepoId(priceList.getC_Currency_ID())).lines(ordersRepo.retrieveOrderLines(orderId, I_C_OrderLine.class).stream().map(this::toOrderLine).collect(ImmutableList.toImmutableList())).build();
}
Also used : I_M_PriceList(org.compiere.model.I_M_PriceList) I_C_Order(org.compiere.model.I_C_Order) ZonedDateTime(java.time.ZonedDateTime) PriceListId(de.metas.pricing.PriceListId) BPartnerId(de.metas.bpartner.BPartnerId) I_C_OrderLine(de.metas.handlingunits.model.I_C_OrderLine) PriceListVersionId(de.metas.pricing.PriceListVersionId)

Aggregations

PriceListVersionId (de.metas.pricing.PriceListVersionId)6 ZonedDateTime (java.time.ZonedDateTime)3 BPartnerId (de.metas.bpartner.BPartnerId)2 IPriceListDAO (de.metas.pricing.service.IPriceListDAO)2 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 BPartnerProductStatsService (de.metas.bpartner.product.stats.BPartnerProductStatsService)1 IBPartnerDAO (de.metas.bpartner.service.IBPartnerDAO)1 Amount (de.metas.currency.Amount)1 HUPIItemProductId (de.metas.handlingunits.HUPIItemProductId)1 I_C_OrderLine (de.metas.handlingunits.model.I_C_OrderLine)1 ITranslatableString (de.metas.i18n.ITranslatableString)1 SOTrx (de.metas.lang.SOTrx)1 CountryId (de.metas.location.CountryId)1 PriceListId (de.metas.pricing.PriceListId)1 PricingSystemId (de.metas.pricing.PricingSystemId)1 RelatedProcessDescriptor (de.metas.process.RelatedProcessDescriptor)1 ProductId (de.metas.product.ProductId)1 ProductsProposalRow (de.metas.ui.web.order.products_proposal.model.ProductsProposalRow)1 ProductsProposalRowsData (de.metas.ui.web.order.products_proposal.model.ProductsProposalRowsData)1