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

Oracle EBS-SQL (WIP-15):检查车间任务物料未发数量与现有量对照.sql的更多相关文章

  1. Oracle EBS R12 WIP Component Issue&Return Process

    oracleassemblytransactionscomponentsjobsreference 目录(?)[-] 定义BOM 定义Routing 定义WIP Discrete Job 发料 Mat ...

  2. Oracle EBS 隐藏帮助-诊断-检查

  3. Oracle EBS DBA常用SQL - 安装/补丁【Z】

    Oracle EBS DBA常用SQL - 安装/补丁 检查应用补丁有没有安装:select bug_number,last_update_date from ad_bugs where bug_nu ...

  4. Oracle EBS中分类账和法人实体 的关系(有sql语句实例)

    Oracle EBS中分类账和法人实体 的关系(有sql语句实例) 2012-12-06 16:05 2822人阅读 评论(0) 收藏 举报  分类: Oracle EBS(12)  Oracle数据 ...

  5. oracle锁表查询,资源占用,连接会话,低效SQL等性能检查

    查询oracle用户名,机器名,锁表对象 select l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, l.os_user ...

  6. [转]oracle EBS 基础100问

    from:http://www.cnblogs.com/xiaoL/p/3593691.html  http://f.dataguru.cn/thread-51057-1-1.html 1001 OR ...

  7. Oracle EBS R12经验谈(二)

    作者: jianping.ni    时间: 2009-2-13 12:52     标题: Oracle EBS R12经验谈(二) OAF页面:银行帐户开户人LOV值列表无值    在输入 应付超 ...

  8. Oracle EBS应用笔记整理 (转自IT++ flyingkite)

    ***************************************************** Author: Flyingkite Blog:   http://space.itpub. ...

  9. Oracle EBS R12 (12.1.3) Installation Linux(64 bit)

    Oracle EBS R12 (12.1.3) Installation Linux(64 bit) Contents Objective. 3 1 Download & Unzip. 3 D ...

随机推荐

  1. zz[C++]合理的设计和使用消息队列

    http://www.cnblogs.com/egmkang/archive/2012/11/17/2763295.html 生产者消费者问题,是永远的经典. 单纯让多个线程去竞争,占有资源然后处理, ...

  2. centos出现磁盘坏掉,怎么修复和检测。

    当dmesg的时候,出现下面的信息说明磁盘有问题 Info fld=0x139066d0 end_request: I/O error, dev sda, sector 328230608 Buffe ...

  3. Python2.7 转义和正则匹配中文

    今天爬虫(新浪微博 个人信息页面)的时候遇到了转义和正则匹配中文出乱码的问题. 先给出要匹配的部分网页源代码如下: <span class=\"pt_title S_txt2\&quo ...

  4. NDK 的helloworld步奏

    1. helloworld.c #include <string.h> #include <jni.h> /* * Class: com_example_ndk_NativeH ...

  5. UVA 816 Abbott’s Revenge

    bfs求最短路,递归打印最短路的具体路径: 难点: 当前状态和转弯方式很复杂,要仔细处理: 递归打印:用一个数组存储路径中结点的前一个节点,递归查找 (bfs无法确定下一个结点,但对于没一个结点,它的 ...

  6. Nginx 模块开发(1)—— 一个稍稍能说明问题模块开发 Step By Step 过程

    1. Nginx 介绍        Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,它的发音为“engine X”, 是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/S ...

  7. C# Chart 折线图 多条数据展示

    private void btn_Click(object sender, EventArgs e) { DBHelper db = new DBHelper(); DataSet ds = db.G ...

  8. android 代码布局 记录

    1.概述 android 中大部分ui 布局是用xml 进行的,但是用代码布局调整是不可避免的.自己比较喜欢写模版,有些时候子类再继承模版时,往往有一些ui上的调整,又懒得去重写一个xml,就偷懒用代 ...

  9. logstash 使用grok正则解析日志

    http://xiaorui.cc/2015/01/27/logstash%E4%BD%BF%E7%94%A8grok%E6%AD%A3%E5%88%99%E8%A7%A3%E6%9E%90%E6%9 ...

  10. Introduction to Big Data with Apache Spark 课程总结

    课程主要实用内容: 1.spark实验环境的搭建 2.4个lab的内容 3.常用函数 4.变量共享   1.spark实验环境的搭建(windows)   a. 下载,安装visualbox 管理员身 ...