Você está na página 1de 3


Query for finding out Sourcing rule for an item

Description: This query is used for finding the sourcing rule details for an
item in a plan. The inputs are item_id and plan_id

select mis.source_organization_id
from msc_item_sourcing mis,
msc_sourcing_rules msr,
msc_system_items msi,
mfg_lookups ml
where mis.sourcing_rule_id = msr.sourcing_rule_id
and mis.inventory_item_id = msi.inventory_item_id
and mis.organization_id = msi.organization_id
and mis.plan_id = msi.plan_id
and mis.plan_id = :plan_id
and ml.lookup_type = 'MRP_SOURCE_TYPE'
and mis.inventory_item_id = :item_id;

2. Query for finding out order type for an item in a plan

Description: This query will give the supply details along with the meaning
of the supply type the record belongs to. The input is plan_id and item_id.

select ms.plan_id
from msc_system_items msi,
msc_supplies ms,
mfg_lookups ml
where ms.inventory_item_id = msi.inventory_item_id
and ms.organization_id = msi.organization_id
and ms.plan_id = msi.plan_id
and ms.order_type = ml.LOOKUP_CODE
and ms.plan_id = :plan_id
and ml.lookup_type = 'MRP_ORDER_TYPE'
and item_name = :item_name

3. Query to get the generic BOM parent and child record. (only one level of
the BOM is expected as the output).

Description: This query will provide the one level BOM given the parent
item id and the plan name as inputs.

select mb.plan_id
,msi.item_name assembly
,msi1.item_name component
from msc_boms mb
,msc_bom_components mbc
,msc_system_items msi
,msc_system_items msi1
,msc_plans mp
where msi.item_name = :item_name
and mb.plan_id = mp.plan_id
and mbc.plan_id = mb.plan_id
and mb.bill_sequence_id = mbc.bill_sequence_id
and msi.plan_id = mb.plan_id
and msi.inventory_item_id = mb.assembly_item_id
and msi.organization_id = mb.organization_id
and msi1.plan_id = mbc.plan_id
and msi1.inventory_item_id = mbc.inventory_item_id
and msi1.organization_id = mbc.organization_id
and mp.compile_designator = :plan_name

4. Query to find the SS calculation details

Description: This query is to be used to get the safety stock parameters for
a given item in a given plan.

select msi.item_name,
from msc_system_items msi,
mfg_lookups ml
where to_char(msi.SAFETY_STOCK_CODE) = to_char(ml.LOOKUP_code)
and msi.plan_id = :plan_id
and ml.lookup_type = 'MRP_SAFETY_STOCK_METHOD'
and msi.item_name like :partial_item_name
and msi.safety_stock_code = '2'
and msi.safety_stock_percent is not null

5. Demand Columns Required for Independent Demand

Description: This query is used to get the demand details required for
analysis. This will give the demand date, demand quantity, demand type

select md.using_assembly_demand_date
,ml.meaning supply_type
from msc_demands md
,mfg_lookups ml
where ml.lookup_code = md.demand_type
and md.plan_id = :plan_id
and md.organization_id = :organization_id
and md.inventory_item_id = :item_id
and ml.lookup_type = 'MRP_DESIGNATOR_TYPE'