select msi.segment1 装配件编码 ,
msi.description 装配件描述 ,
msi.item_type 类型 ,
msi.planner_code 计划员 ,
msi1.segment1 部件编码 ,
msi1.description 部件描述 ,
msi1.primary_unit_of_measure 单位
--,nvl(bom.ALTERNATE_BOM_DESIGNATOR,‘主要‘) 替代项 ,
bic.ITEM_NUM 序号 ,
bic.COMPONENT_QUANTITY 定额
from apps.MTL_SYSTEM_ITEMS msi,
apps.MTL_SYSTEM_ITEMS msi1,
apps.bom_bill_of_materials bom,
apps.BOM_INVENTORY_COMPONENTS bic
where msi.organization_id=X
--and msi1.inventory_item_status_code = ‘Inactive‘ --子项已失效,BOM未失效
and msi.inventory_item_status_code = ‘Inactive‘ --父项已失效,BOM未失效
and bom.ORGANIZATION_ID=X
and bom.assembly_item_id=msi.inventory_item_id
and bom.bill_sequence_id=bic.bill_sequence_id
and bic.component_item_id=msi1.inventory_item_id
and msi1.organization_id=msi.organization_id
and bic.DISABLE_DATE is null
order by msi.segment1,
bic.ITEM_NUM