|
如何写Routing SQL
Routing的SQL写法相对简单,但也要注意有效日期、类型的限制。下面是取当前时点(Sysdate)Routing的例子,尚缺考虑Revision:
SELECT mst.segment1 assembly_item,
bor.alternate_routing_designator alternate,
bor.completion_subinventory,
bos.operation_seq_num,
dept.department_code,
bos.effectivity_date,
bos.disable_date,
bres.resource_seq_num,
res.resource_code,
bres.basis_type,
bres.usage_rate_or_amount
FROM inv.mtl_system_items_b mst,
bom.bom_operational_routings bor,
bom.bom_operation_sequences bos,
bom.bom_departments dept,
bom.bom_operation_resources bres,
bom.bom_resources res
WHERE mst.organization_id = bor.organization_id
AND mst.inventory_item_id = bor.assembly_item_id
AND bor.routing_sequence_id = bos.routing_sequence_id
AND bos.department_id = dept.department_id
AND bos.operation_sequence_id = bres.operation_sequence_id
AND bres.resource_id = res.resource_id
--Item
AND mst.bom_enabled_flag = 'Y'
AND mst.bom_item_type IN (1, 2, 3, 4) --Dependent
AND nvl(mst.eam_item_type, 0) = 0
--Routing Header
AND bor.routing_type = 1 --1 Manufature, 2 ENG
AND nvl(bor.cfm_routing_flag, 2) = 2
--Operations
AND nvl(bos.disable_date, SYSDATE) >= SYSDATE
AND bos.implementation_date IS NOT NULL
AND nvl(bos.eco_for_production, 2) = 2
--Filters
AND mst.organization_id = 104
AND mst.segment1 LIKE '960%'
ORDER BY 1, 2 NULLS FIRST, 4, 8; |
|