Skip to content

faq 108409626

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Freight contr.: cost dependent of ID

by Koen Mommens on 2017-03-14 16:25:16


Hello,


I have a question related to the freight contribution.

My shipments contain characteristics in their ID. Is it possible to change the cost for their transport linked to the information of those characteristics in the shipment ID? And how should that go?

I thank you in advance.


Best regards,

Koen Mommens


Comments: 2


Re: Freight contr.: cost dependent of ID

by Kai Nagel on 2017-03-14 19:44:03

Dear Koen,

There doesn't seem to be a good example.  RunChessboard (in the freight contrib) seems to be going into the right direction, in particular 

final CarrierScoringFunctionFactory scoringFunctionFactory = new MyCarrierScoringFunctionFactory();
 ...            
 bind(CarrierScoringFunctionFactory.class).toInstance(scoringFunctionFactory);

You then need to check how MyCarrierScoringFunctionFactory is implemented, and then either add or replace one of the pieces.  Then hopefully you can get what you need, i.e. the shipment ID.

Unfortunately, to me it looks like this code has never been streamlined so if this does not work please let us know, preferably with some git project with the construction site so we can look at it.

BTW, where is the shipment ID?  CarrierShipment does not seem to have an ID?

Please let us know how this goes, best wishes

Kai


Re: Freight contr.: cost dependent of ID

by Johan W. Joubert on 2017-03-15 15:54:04

I agree with Kai, a) using the CarrierScoringFunctionFactory, and b) CarrierShipment does not have an Id. If, however, the characteristics is associated with the Carrier's Id then you might do something similar than what we've done with roadpricing's TollFactor implementations, albeit there we used the vehicle's Id.

Clone this wiki locally