博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle EBS-SQL (WIP-15):检查车间任务物料未发数量与现有量对照.sql
阅读量:5862 次
发布时间:2019-06-19

本文共 2395 字,大约阅读时间需要 7 分钟。

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

转载于:https://www.cnblogs.com/st-sun/p/3780317.html

你可能感兴趣的文章
legend---十一、thinkphp事务中if($ans1&&$ans2){}else{}方式和try{}catch{}方式事务操作的区别在哪里...
查看>>
Spinner使用一
查看>>
js词法结构
查看>>
实验五
查看>>
非节点主机通过内网远程管理docker swarm集群
查看>>
js判断PC端还是移动端
查看>>
远程协助
查看>>
欧拉函数
查看>>
Unable to locate package错误解决办法
查看>>
2013.5.29
查看>>
Fiddler实现手机抓包——小白入门(转载csdn)
查看>>
Scrum实施日记 - 一切从零开始
查看>>
Windows中安装Emacs
查看>>
vim tab四个空格修改
查看>>
C#面向对象编程 封装 继承 多态
查看>>
一gradle创建SSM项目——依赖包
查看>>
(转载)在WinForm中使用GMap.Net地图插件
查看>>
安装xampp出错,windows找不到-n ?
查看>>
初涉c++学习笔记
查看>>
python基础之 Python os._exit() sys.exit() exit()区别
查看>>