H
HSalim[MVP]
Hello,
I am revisiting Access/VB coding after a while and my skills are getting
rusty. I'd appreciate any assistance you can offer. DDL statements follow.
I am looking for an elegant way to minimize the number of boxes used to pack
the following items.
The following lines of the order represent the loose items that need to be
packed into as few boxes as possible.
Assumptions:
Weight is the only criteria for consideration,
Each box should weigh no more that 35 lbs,
A lineitem may be split into two or more boxes - (fewer is better) but no
fractional quantities.
thus we can pack
Box 1: AA Qty:5, wt 10 CumWt 10
Box1: BB Qty 129 Wt 11 CumWt 21
Box1: CC Qty49 Wt 12 CumWt 33
Box1 DD Qty2 Wt 2 CumWt 35
box2 DD: Qty 21 wt:21 CumWt 21
box2: EE: Qty 41 wt:12 Cunwt 33
and so on
So I guess I need a recursive procedure that will run through the lines,
split a row into two( add a new row to the table) where needed
I have been working on it for a few hours, but a jusp start would be useful.
Thanks
Habib
----------------------------
CREATE TABLE PACKLIST
(OrderNum long,
BoxNum long,
itemCode Text(8),
Qty long,
FullFlag bit,
Weight Double,
Row_ID long )
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"AA",5,0,10)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"BB",129,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"CC",49,0,12)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"DD",23,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"EE",41,0,12)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"FF",13,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"GG",1,0,14)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"HH",54,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"II",46,0,15)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"JJ",36,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"KK",8,0,16)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"LL",40,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"MM",49,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"NN",37,0,34)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"OO",1098,0,32)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"PP",33,0,12)
I am revisiting Access/VB coding after a while and my skills are getting
rusty. I'd appreciate any assistance you can offer. DDL statements follow.
I am looking for an elegant way to minimize the number of boxes used to pack
the following items.
The following lines of the order represent the loose items that need to be
packed into as few boxes as possible.
Assumptions:
Weight is the only criteria for consideration,
Each box should weigh no more that 35 lbs,
A lineitem may be split into two or more boxes - (fewer is better) but no
fractional quantities.
thus we can pack
Box 1: AA Qty:5, wt 10 CumWt 10
Box1: BB Qty 129 Wt 11 CumWt 21
Box1: CC Qty49 Wt 12 CumWt 33
Box1 DD Qty2 Wt 2 CumWt 35
box2 DD: Qty 21 wt:21 CumWt 21
box2: EE: Qty 41 wt:12 Cunwt 33
and so on
So I guess I need a recursive procedure that will run through the lines,
split a row into two( add a new row to the table) where needed
I have been working on it for a few hours, but a jusp start would be useful.
Thanks
Habib
----------------------------
CREATE TABLE PACKLIST
(OrderNum long,
BoxNum long,
itemCode Text(8),
Qty long,
FullFlag bit,
Weight Double,
Row_ID long )
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"AA",5,0,10)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"BB",129,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"CC",49,0,12)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"DD",23,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"EE",41,0,12)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"FF",13,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"GG",1,0,14)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"HH",54,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"II",46,0,15)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"JJ",36,0,11)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"KK",8,0,16)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"LL",40,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"MM",49,0,23)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"NN",37,0,34)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"OO",1098,0,32)
insert into PACKLIST(OrderNum, BoxNum, ItemCode, Qty, FullFlag,
Weight)
Values(322726,0,"PP",33,0,12)