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 序号
,PONENT_QUANTITY 定额
,PONENT_YIELD_FACTOR 产出率
,decode(bic.WIP_SUPPLY_TYPE,1,'推式',2,'装配拉式',3,'操作拉式',6,'虚拟件') BOM供应类型
,bic.SUPPLY_SUBINVENTORY BOM供应子库
,msi1.item_type 类型
,msi1.wip_supply_type ITEM供应类型
,msi1.wip_supply_subinventory ITEM供应子库
from
apps.MTL_SYSTEM_ITEMS msi,
apps.MTL_SYSTEM_ITEMS msi1,
apps.bom_bill_of_materials bom, --bom.bom_structures_b
apps.BOM_INVENTORY_COMPONENTS bic --bom.bom_components_b
where
anization_id=X
--and msi.inventory_item_status_code = 'Active'
and ANIZATION_ID=X
and bom.assembly_item_id=msi.inventory_item_id
and bom.bill_sequence_id=bic.bill_sequence_id
and ponent_item_id=msi1.inventory_item_id
and anization_id=anization_id
--and msi.item_type in ('FG','SA','PH')
and msi.item_type in ('P')
--and msi.item_type = 'PH'
--and msi1.wip_supply_type='6'
--and msi1.item_type in ('SA','MP')
and bic.DISABLE_DATE is null
--and msi.segment1 like'A0000000%' --物料清单
--and msi1.segment1 in ('B00000000001','B00000000002') --物料使用处
order by msi.segment1,
bic.ITEM_NUM