Work
This commit is contained in:
parent
0623e90029
commit
471f730d67
10 changed files with 149 additions and 23 deletions
|
|
@ -1,6 +0,0 @@
|
|||
package cost;
|
||||
|
||||
public class CostItem {
|
||||
|
||||
|
||||
}
|
||||
42
cost-calculation/src/main/java/cost/README.md
Normal file
42
cost-calculation/src/main/java/cost/README.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Cost Calculation Data model
|
||||
|
||||
The first thing to do when using drools is to build the java class model on which the rules will apply.
|
||||
|
||||

|
||||
|
||||
* CostCalculationRequest
|
||||
This is the top entity that will contain the trip description as well as the order the customer did and witch trip has to be calculated.
|
||||
And in the same object, we shall put the final result in a list of costs and the complete list of pallets where we will put the products.
|
||||
* Trip
|
||||
Contains the list of steps of the trip.
|
||||
* Step
|
||||
A step happens between two cities and a unique transport type : train, truck or boat
|
||||
* City
|
||||
A city which can ne a harbour, a train station or a a final destination by truck.
|
||||
* Order
|
||||
The detail of the customer order.
|
||||
* OrderLine
|
||||
It contains the product as well as the number of items.
|
||||
* LeftToDistribute
|
||||
As we have to distribute all products in the pallets, we shall store here during the distribution what is left to be distributed.
|
||||
* Product
|
||||
The product that is bought and has to be in the transport.
|
||||
* Pallet
|
||||
Here is a picture of a pallet.
|
||||
|
||||

|
||||
|
||||
|
||||
* HandlingCostElement, TaxesCostElement and TransportCostElement
|
||||
they represent the different costs that we have to calculate.
|
||||
|
||||
* CalculatedElement
|
||||
We shall use this class to store intermediate values.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ public class TaxesCostElement implements CostElement {
|
|||
private double amount;
|
||||
private City city;
|
||||
|
||||
private Pallet pallet;
|
||||
|
||||
|
||||
public double getAmount() {
|
||||
return amount;
|
||||
|
|
@ -22,18 +22,10 @@ public class TaxesCostElement implements CostElement {
|
|||
this.city = city;
|
||||
}
|
||||
|
||||
public Pallet getPallet() {
|
||||
return pallet;
|
||||
}
|
||||
|
||||
public void setPallet(Pallet pallet) {
|
||||
this.pallet = pallet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaxesCostElement [amount=" + amount + ", city=" + city + ", pallet="
|
||||
+ pallet + "]";
|
||||
return "TaxesCostElement [amount=" + amount + ", city=" + city + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
package cost;
|
||||
|
||||
public class TotalAmount {
|
||||
|
||||
}
|
||||
BIN
cost-calculation/src/main/java/cost/diagram.jpg
Normal file
BIN
cost-calculation/src/main/java/cost/diagram.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
cost-calculation/src/main/java/cost/pallet.jpg
Normal file
BIN
cost-calculation/src/main/java/cost/pallet.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
19
cost-calculation/src/main/resources/rules/README.md
Normal file
19
cost-calculation/src/main/resources/rules/README.md
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Rules
|
||||
|
||||
We shall use a Ruleflow and implement the rules in 3 steps :
|
||||
* Distribute the products in the pallet
|
||||
* Calculate the costs
|
||||
* Calculate and Display the results
|
||||
|
||||
This is done in the P1.bpmn2.
|
||||
|
||||

|
||||
|
||||
## Distribute the products in the pallet
|
||||
|
||||
|
||||
## Calculate the costs
|
||||
|
||||
|
||||
## Sum the results
|
||||
|
||||
BIN
cost-calculation/src/main/resources/rules/ruleflow.png
Normal file
BIN
cost-calculation/src/main/resources/rules/ruleflow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Loading…
Add table
editor.link_modal.header
Reference in a new issue