select ood.organization_name,
msi.segment1 as "物料",
msi.description as "描述",
msi.primary_uom_code as "单位",
bor.alternate_routing_designator as "替代项",
nvl(bor.ctp_flag, 2) as "可承诺能力",
bor.attribute1 as "Organization",
bor.attribute2 as "BASELINE",
mri.process_revision as "版本",
mri.effectivity_date as "有效日期",
mri.implementation_date as "实施日期",
mri.change_notice as "ECO-版本",
seq.operation_seq_num as "序号",
bd.department_code as "部门",
seq.effectivity_date as "有效日期",
seq.disable_date as "禁用日期",
decode(seq.count_point_type, 1, 1, 2) as "计数点",
decode(seq.count_point_type, 3, 2, 1) as "自动计费",
seq.backflush_flag as "倒冲",
seq.minimum_transfer_quantity as "最小传送数量",
seq.yield AS "产出率",
seq.cumulative_yield as "累计产出率",
seq.include_in_rollup as "包括在累计中",
decode(seq.implementation_date, null, 2, 1) as "已实施",
seq.change_notice as "ECO",
seq.operation_description as "说明",
bo.resource_seq_num as "序号",
br.resource_code as "资源",
br.unit_of_measure as "单位",
decode(bo.basis_type, 1, '物料 ', 2, '批次 ') as "基准",
bo.usage_rate_or_amount as "单位使用量",
bo.usage_rate_or_amount_inverse as "倒数",
bdr.available_24_hours_flag as "24小时可用",
bo.assigned_units as "分配数量",
decode(bo.schedule_flag,
1,
'是',
2,
'否',
3,
'前一个 ',
4,
'下一个 ') as "计划",
lv.meaning as "计费类型"
from bom_operational_routings bor,
mtl_system_items_b msi,
mtl_rtg_item_revisions mri,
bom_operation_sequences seq,
bom_departments bd,
bom_operation_resources bo,
bom_resources br,
bom_department_resources bdr,
fnd_lookup_values lv,
org_organization_definitions ood
where bor.organization_id = ood.organization_id
--and bor.routing_sequence_id = 283709
and bor.assembly_item_id = msi.inventory_item_id(+)
and bor.organization_id = msi.organization_id(+)
and msi.inventory_item_id = mri.inventory_item_id(+)
and msi.organization_id = mri.organization_id(+)
and msi.inventory_item_status_code <> 'Inactive' --排除失效物料
and bor.routing_sequence_id = seq.routing_sequence_id
and nvl(seq.disable_date, sysdate) >= sysdate
and seq.department_id is not null
and seq.department_id = bd.department_id(+)
and seq.operation_sequence_id = bo.operation_sequence_id(+)
and bo.resource_id = br.resource_id(+)
and bo.resource_id = bdr.resource_id(+)
and lv.lookup_type(+) = 'BOM_AUTOCHARGE_TYPE'
and lv.lookup_code(+) = bo.autocharge_type
and lv.language(+) = 'ZHS'
and lv.view_application_id(+) = 700
and lv.security_group_id(+) = 0
order by ood.organization_id,
msi.segment1,
bor.alternate_routing_designator;