查找某组织下子库存与物料信息

--某组织下的某子库存所有的物料信息
select 
      msib.segment1
     ,msi.secondary_inventory_name
     ,msi.organization_id
     ,msib.description
from
      mtl_secondary_inventories msi
     ,mtl_system_items_b msib
     ,mtl_item_sub_inventories misi
where  1=1
and msi.organization_id=msib.organization_id
and msi.organization_id=misi.organization_id
and msib.inventory_item_id=misi.inventory_item_id
and misi.secondary_inventory =msi.secondary_inventory_name
and msi.secondary_inventory_name='Stores'       --以名为Store的子库存为例
and msi.organization_id='207'        --以207组织为例

 

--某组织下子库存物料所在的货位
select 
        msib.segment1
       ,(mil.segment1||'.'||mil.segment2||'.'||mil.segment3) Locator
       ,mmst.status_code
from   mtl_secondary_locators msl
      ,mtl_item_locations mil
      ,mtl_system_items_b msib
      ,mtl_material_statuses_tl mmst
where 1=1
and msl.organization_id='207'        --以207组织为例
and mil.inventory_location_id=msl.secondary_locator
and msib.organization_id=msl.organization_id
and msib.inventory_item_id=msl.inventory_item_id
and mmst.status_id=mil.status_id
and mmst.language=userenv('LANG')

 

---某组织下的某子库存所有货位信息
select
      (mil.segment1||'.'||mil.segment2||'.'||mil.segment3) Locator
      ,mil.description
      ,mmst.status_code
      ,mil.subinventory_code
      ,mil.inventory_location_type
from
mtl_material_statuses_tl mmst
,mtl_item_locations mil
where 1=1
and mmst.status_id=mil.status_id
and mil.organization_id=207             --以207组织为例
and mil.subinventory_code='Stores'  --以名为Store的子库存为例
and mmst.language=userenv('LANG')

posted @ 2013-04-09 15:18  shenxiaozhi  阅读(342)  评论(0编辑  收藏  举报