N
NH
I am looking for a bit of advice and a shove in the right direction..I want
to create a system which will be able to store a list of products, and
distribute them based on rules.
I suppose the easiest way of looking at it is the following:
I have warehouse full of fruit,
I get an order for 40 bananas, 60 Oranges and 70 Apples
I have boxes which will hold 100 pieces of fruit each.
BUT there are rules: e.g.
1. A box cannot contain more than 20 bananas if it is to also contain
apples.
2. Bananas must be distributed in multiples of 5
3. A box cannot contain more than 80 oranges
4. Bananas must be packed at the top of a box
....You get the idea...
What I need is to use these rules to output a packing list. How many boxes
do I need, and how many of what do I put in each?
The code...
Would my best bet be to build a temporary table which actually resembles the
boxes, and distribute the fruit on a line by line basis i.e.
box slot fruit
1 1 apple
1 2 apple.....
Or write procedures which calculate all of this 'on the fly' resulting in
data something like:
Boxes = 2
Box1.Apples = 70
Box1.Oranges = 10
Box1.Bananas = 20
Box1.Top = Bananas
Box2.Oranges = 50
Box2.Bananas = 20
Box2.Top = Bananas
I assume this is something which is relatively well practiced, I am just not
quite sure of the best (or easiest) way of doing it... At what point am I
likely to run into headaches? Have I got completely the wrong idea?
Thank you
nick
to create a system which will be able to store a list of products, and
distribute them based on rules.
I suppose the easiest way of looking at it is the following:
I have warehouse full of fruit,
I get an order for 40 bananas, 60 Oranges and 70 Apples
I have boxes which will hold 100 pieces of fruit each.
BUT there are rules: e.g.
1. A box cannot contain more than 20 bananas if it is to also contain
apples.
2. Bananas must be distributed in multiples of 5
3. A box cannot contain more than 80 oranges
4. Bananas must be packed at the top of a box
....You get the idea...
What I need is to use these rules to output a packing list. How many boxes
do I need, and how many of what do I put in each?
The code...
Would my best bet be to build a temporary table which actually resembles the
boxes, and distribute the fruit on a line by line basis i.e.
box slot fruit
1 1 apple
1 2 apple.....
Or write procedures which calculate all of this 'on the fly' resulting in
data something like:
Boxes = 2
Box1.Apples = 70
Box1.Oranges = 10
Box1.Bananas = 20
Box1.Top = Bananas
Box2.Oranges = 50
Box2.Bananas = 20
Box2.Top = Bananas
I assume this is something which is relatively well practiced, I am just not
quite sure of the best (or easiest) way of doing it... At what point am I
likely to run into headaches? Have I got completely the wrong idea?
Thank you
nick