|
|
发表于 2005/8/13 15:01:25
|
显示全部楼层
加一个,七层BOM,
select xye.*,
xy7.item1 item7,
xy7.item_desc1 item_desc7,
xy7.item_type1 item_type7,
xy7.l1 l7,
xy7.compqty1*xye.compqty6 compqty7,
xy7.sub1 sub7
from (select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from BOM.bom_bill_of_materials bbm,
BOM.bom_inventory_components bic,
inv.mtl_system_items_b msib,
inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
order by item,l1) xy7,
(select
xyd.*,
xy6.item1 item6,
xy6.item_desc1 item_desc6,
xy6.item_type1 item_type6,
xy6.l1 l6,
xy6.compqty1*xyd.compqty5 compqty6,
xy6.sub1 sub6
from
(select
msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.item_type item_type1,
msib.description item_desc1,
bic.item_num l1,
bic.component_quantity compqty1,
Bic.supply_subinventory sub1
from
bom.bom_bill_of_materials bbm,
bom.bom_inventory_components bic,
inv.mtl_system_items_b msib,
inv.mtl_system_items_b msib1
where
bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
order by item,l1)xy6,
(select
xyc.*,
xy5.item1 item5,
xy5.item_desc1 item_desc5,
xy5.item_type1 item_type5,
xy5.l1 l5,
xy5.compqty1*xyc.compqty4 compqty5,
xy5.sub1 sub5
from (select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from bom.bom_bill_of_materials bbm,
bom.bom_inventory_components bic,
inv.mtl_system_items_b msib,
inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
order by item,l1) xy5,
(select xyb.*,
xy4.item1 item4,
xy4.item_desc1 item_desc4,
xy4.item_type1 item_type4,
xy4.l1 l4,
xy4.compqty1*xyb.compqty3 compqty4,
xy4.sub1 sub4
from
(select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from bom.bom_bill_of_materials bbm
,bom.bom_inventory_components bic
,inv.mtl_system_items_b msib
,inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
and bbm.alternate_bom_designator is null
order by item,l1) xy4,
(select xy2.*,
xy3.item1 item3,
xy3.item_desc1 item_desc3,
xy3.item_type1 item_type3,
xy3.l1 l3,
xy3.compqty1*xy2.compqty2 compqty3,
xy3.sub1 sub3
from (select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from bom.bom_bill_of_materials bbm
,bom.bom_inventory_components bic
,inv.mtl_system_items_b msib
,inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
and bbm.alternate_bom_designator is null
order by item,l1) xy3,
(select xy.*,
xy1.item1 item2,
xy1.item_desc1 item_desc2,
xy1.item_type1 item_type2,
xy1.l1 l2,
xy1.compqty1*xy.compqty1 compqty2,
xy1.sub1 sub2
from
(select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from bom.bom_bill_of_materials bbm
,bom.bom_inventory_components bic
,inv.mtl_system_items_b msib
,inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
and bbm.alternate_bom_designator is null
order by item,l1) xy,
(select msib1.segment1 item,
msib1.description item_desc,
msib.segment1 item1,
msib.description item_desc1,
msib.item_type item_type1,
bic.item_num l1,
bic.component_quantity compqty1,
bic.supply_subinventory sub1
from bom.bom_bill_of_materials bbm
,bom.bom_inventory_components bic
,inv.mtl_system_items_b msib
,inv.mtl_system_items_b msib1
where bbm.bill_sequence_id=bic.bill_sequence_id
and bbm.assembly_item_id=msib1.inventory_item_id
and bic.component_item_id=msib.inventory_item_id
and bbm.alternate_bom_designator is null
order by item,l1) xy1
where
xy1.item(+)=xy.item1
order by xy.item,xy.l1) xy2
where
xy3.item(+)=xy2.item2) xyb
where xy4.item(+)=xyb.item3) xyc
where xy5.item(+)=xyc.item4) xyd
where xy6.item(+)=xyd.item5) xye
where xy7.item(+)=xye.item6
and xye.item like'XXX%'
and length(xye.item)=16
order by 1
[此贴子已经被作者于2005-8-15 16:23:06编辑过]
|
|