zoukankan      html  css  js  c++  java
  • Oracle EBS-SQL (WIP-15):检查车间任务物料未发数量与现有量对照.sql

    select

           we.wip_entity_name                          任务号
          ,mfg_lookups_wjs.meaning               作业状态
          ,wdj.class_code                                任务类型
          ,msi1.segment1                               装配编码
          ,msi1.description                              装配描述
          ,wdj.scheduled_start_date          计划完成日期
          ,wdj.scheduled_completion_date 计划完成日期
          ,nvl(wdj.start_quantity
              ,0)                                             计划数量
          ,nvl(wdj.quantity_completed
              ,0)                                             完成数量
          ,msi2.segment1                              物料编码
          ,msi2.description                             物料描述
          ,nvl(wro.required_quantity
              ,0)                                             需求数量
          ,nvl(wro.quantity_issued
              ,0)                                             发料数量
          ,nvl(wro.required_quantity
              ,0) - nvl(wro.quantity_issued
                       ,0)                                    未发数量
          ,wro.supply_subinventory                供应子库
          ,ml.meaning                                   供应类型
          ,onhand.subinventory_code                   子库
          ,onhand.TRANSACTION_QUANTITY   子库数量
          ,(select nvl(sum(moq.TRANSACTION_QUANTITY),0)
            from   apps.mtl_onhand_quantities moq
            where  moq.organization_id=851
            and    moq.inventory_item_id=msi2.inventory_item_id) 现有量
    from wip.wip_discrete_jobs          wdj
          ,wip.wip_requirement_operations wro
          ,inv.mtl_system_items_b         msi1
          ,inv.mtl_system_items_b         msi2
          ,wip.wip_entities               we
          ,bom.cst_item_costs             cic
          ,applsys.fnd_lookup_values      ml
          ,applsys.fnd_lookup_values      mfg_lookups_wjs
          ,(select moq.inventory_item_id,
                   moq.subinventory_code,
                   sum(moq.TRANSACTION_QUANTITY) TRANSACTION_QUANTITY              
            from   apps.mtl_onhand_quantities moq
            where  moq.organization_id=x
            group by moq.inventory_item_id,
            moq.subinventory_code) onhand
     where we.organization_id = x
       and wdj.wip_entity_id = we.wip_entity_id
       and wdj.organization_id = we.organization_id
       and msi1.inventory_item_id = we.primary_item_id
       and msi1.organization_id = we.organization_id
       and wro.wip_entity_id = wdj.wip_entity_id
       and wro.organization_id = wdj.organization_id
       and msi2.inventory_item_id= wro.inventory_item_id
       and msi2.organization_id = wro.organization_id
       and onhand.inventory_item_id(+)=msi2.inventory_item_id
       and ml.lookup_type = 'WIP_SUPPLY'
       and ml.lookup_code = wro.wip_supply_type
       and (mfg_lookups_wjs.lookup_type = 'WIP_JOB_STATUS')
       and (wdj.status_type = mfg_lookups_wjs.lookup_code)
       and cic.inventory_item_id = msi2.inventory_item_id
       and cic.organization_id = msi2.organization_id
       and cic.cost_type_id = 1
       and mfg_lookups_wjs.meaning <> '已关闭'
       and ml.meaning not like '虚拟件'
       and trunc(wdj.scheduled_completion_date) between
           to_date('20**/01/01'
                  ,'yyyy-mm-dd') and
           to_date('20**/01/31'
                  ,'yyyy-mm-dd')
       and mfg_lookups_wjs.language = 'ZHS'
       and ml.language = 'ZHS'
       and nvl(wro.required_quantity
              ,0) - nvl(wro.quantity_issued
                       ,0) > 0
       and nvl(wdj.start_quantity
              ,0) = nvl(wdj.quantity_completed
                       ,0)
       order by 1,10

  • 相关阅读:
    【CSS】330- 手把手教你玩转 CSS3 3D 技术
    【每周小回顾】4- 一起回顾上周精彩内容
    【CSS】329- 非常强!3行核心css代码的rate评分组件
    Android 高仿微信头像截取 打造不一样的自定义控件
    十三.200多万元得到的创业教训--用户体验就是人性
    十一. 没有这4项素质,别想在创业公司
    十二.200多万元得到的创业教训--app名字是关键
    十. 加班等于团队建设?
    Android 实现形态各异的双向侧滑菜单 自定义控件来袭
    九. 200多万元得到的创业教训--“雕爷”是忽悠吗?
  • 原文地址:https://www.cnblogs.com/st-sun/p/3780317.html
Copyright © 2011-2022 走看看