select msi.organization_id as org_id, md.formula_id as formula_id, md.formulaline_id as formulaline_id, md.line_type as line_type, msi.inventory_item_id as item_id, msi.segment1 as item_no, msi.description as item_descr, rr.start_date as start_date, nvl(rr.end_date,to_date('01-01-2099','dd-mm-yyyy')) as end_date /**/ from mtl_system_items_b msi, fm_matl_dtl md, gmd_recipes r, gmd_recipe_validity_rules rr where 1 = 1 -- formula and md.organization_id = msi.organization_id and md.inventory_item_id = msi.inventory_item_id -- recipes and r.formula_id = md.formula_id and r.recipe_status = 700 -- Утверждено для общего использования and r.delete_mark = 0 -- не помечен на удаление and r.owner_organization_id = md.organization_id -- recepe rules and rr.recipe_id = r.RECIPE_ID and rr.organization_id = md.organization_id and rr.delete_mark = 0 -- не помечен на удаление and rr.validity_rule_status = 700 -- Утверждено для общего использования and rr.recipe_use = 0 -- использование рецепта = Производство order by msi.organization_id, md.formula_id, md.line_type desc, md.line_no
Последние комментарии