zoukankan      html  css  js  c++  java
  • Items not exists bom list

    -- 没有加入BOM的物料

    select
        msi.segment1 item_no,
        msi.description,
        msi.primary_uom_code uom,
        --msi.item_type,
        (select meaning from FND_LOOKUP_VALUES_VL where 1=1 AND lookup_type = 'ITEM_TYPE' and lookup_code=msi.item_type) item_type,
        nvl((SELECT SUM (moq.primary_transaction_quantity) on_hand
            FROM mtl_onhand_quantities_detail moq
            WHERE 1 = 1 AND moq.inventory_item_id = msi.inventory_item_id AND moq.organization_id = msi.organization_id), 0) on_hand_qty
    from mtl_system_items_b msi
    where 1=1
    and msi.eng_item_flag = 'N'
    and msi.organization_id = 190
    --and msi.inventory_item_id= 15395
    --and msi.segment1 = '9SL4000030AFDIF0'
    and not exists(
        select  'x'
        --       bom.assembly_item_id,
        --       bic.component_item_id,
        --       bom.organization_id
          from bom_bill_of_materials bom,
               bom_inventory_components bic
         where bom.BILL_SEQUENCE_ID = bic.bill_sequence_id
           and bom.organization_id = msi.organization_id--190
           --and bom.assembly_item_id = 15395
           --and bic.component_item_id = 11898
           and ( bom.assembly_item_id = msi.inventory_item_id or bic.component_item_id = msi.inventory_item_id)
       )

    ---------------------------------------------------------------------------------------------------------------------------------------------------------

    -- bom list
    select level,
    lst.assembly_item_id,
    lst.component_item_id,
    lst.organization_id,
    lst.farther,
    lst.component
      from (select bom.assembly_item_id,
                   bic.component_item_id,
                   bom.organization_id
                   ,(select msi.segment1 from inv.mtl_system_items_b msi where msi.organization_id=123 and  msi.inventory_item_id = bom.assembly_item_id) farther,
                   (select msi.segment1 from inv.mtl_system_items_b msi where msi.organization_id=123 and msi.inventory_item_id = bic.component_item_id) component
              from bom_bill_of_materials bom,
                   bom_inventory_components bic
             where bom.BILL_SEQUENCE_ID = bic.bill_sequence_id
               and bom.organization_id = 123) lst
    start with (lst.assembly_item_id = 15395)--15395)
    connect by lst.assembly_item_id = prior lst.component_item_id

  • 相关阅读:
    IntelliJ IDEA创建Java项目
    Oracle常见五个服务的作用
    Windows2008开启telnet客户端命令
    整理jQuery操作select控件常用功能代码
    Asp.Net程序报错
    Oracle中start with connect by prior用法
    Spring中无法访问resources目录下页面或静态资源
    对搜狗输入法的个人评价
    课堂练习寻找水王
    典型用户分析及用户场景分析
  • 原文地址:https://www.cnblogs.com/quanweiru/p/2733504.html
Copyright © 2011-2022 走看看