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