27.07.2019, 00:16 | #1 |
Участник
|
stoneridgesoftware: How to Create a Transportation Management System Rate Engine in Dynamics 365 Finance and Operations
Источник: https://stoneridgesoftware.com/how-t...nd-operations/
============== The other day I had to create a new Transportation Management System (TMS) Rate Engine in Dynamics 365 Finance and Operations so that the weight could be included in the calculation of a rate. The math desired was to add a multiplier on the standard rate calculation where the weight of the shipment would be divided by a divisor (set as a parameter on the rate engine) and then multiplied by the rate. For example: Rate per mile: $1, Mileage: 100, Weight: 100, Divisor on new rate engine: 25. The math would work out to be (100/25) * 1 * 100 = $400. While that is a simplistic example, the point remains that the desire was to utilize the weight. While following the link for Create a new transportation management engine was helpful as to the actual creation of the class, what I found was that to utilize the mileage point we needed to do various changes. The first thing is we want is for our class to extend the MileageRateEngine class, this is what will allow for the calculated rate to be added to the form. Without that we were able to see the calculated rate when debugging, but that rate would not transfer to the form. As far as the code to actually do the math using the rate engine, you’d extend the rate method and execute the following code in addition to the standard mileage engine code: decimal num = BaseRateEngine.RetrieveRate(tMSRateBase, tMSRateBaseDetail, (tMSFwkMileageHelperResponse.parmMiles() * tMSRateBaseDetail.Rate) / StringExtensions.ToDecimal(tMSRateBaseDetail.Dimension1)); //get shipment/load weight decimal wght = XDocExtensions.SumDown(shipment, ElementXmlConstants.Weight); // multiply ton-miles rate by wght of the load num = num* wght; // XElement re = shipment.RetrieveOrCreateRatingEntity(this.RatingDto); xElement.AddRate(TmsRateType.Rate, num);Happy calculating! If you have any questions about TMS in Dynamics 365 for Finance and Operations, let us know if we can help! Источник: https://stoneridgesoftware.com/how-t...nd-operations/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|