zoukankan      html  css  js  c++  java
  • Oracle EBS-SQL (PO-5):采购订单控制信息查询.sql

    select distinct

          pla.po_header_id,

       --pha.type_lookup_code,

         pha.segment1       采购订单号,

         appf.full_name            采购员,

         pla.line_num               订单行,

         msi.segment1          物料编码,

         pla.item_description 物料说明,

    case

         when pha.Authorization_Status='APPROVED' then '已审批'

         when pha.authorization_status='REQUIRES REAPPROVAL' then '要求重新审批'

         when pha.authorization_status='IN PROCESS' then '处理中'   

         when pha.authorization_status='REJECTED' then '拒绝'   

         else '未完成'

    end 审批状态,

     -- decode(pha.approved_flag,   case

     --         'Y',      when pha.approved_flag='Y' then '已审批'

     --      '已审批',    

     --      'N',         when pha.approved_flag='N' then '处理中'  

     --      '处理中',  

     --      'R',         when pha.approved_flag='R' then '要求重新审批'

     --      '要求重新审批', 

     --      'F',         when pha.approved_flag='F' then '拒绝'

     --      '拒绝',                   else '未完成'  

    --      '未完成') 审批状态,  

     end 审批状态,

    case   

           when pla.closed_code='CLOSED' then '已关闭'   

           when pla.closed_code='FINALLY CLOSED' then '最终关闭'   

           else '打开'

    end 关闭状态,

    case   

            when pLla.closed_code='CLOSED' then '已关闭'   

            when pLla.closed_code='CLOSED FOR RECEIVING' then '接收关闭'   

            when pLla.closed_code='CLOSED FOR INVOICE' then '发票关闭'   

            when pLla.closed_code='FINALLY CLOSED' then '最终关闭'   

            else '打开'

    end  发运行状态,

         --pla.closed_code                                          状态,

            plla.quantity                                               数量,

          --plla.QUANTITY_DUE                              数量到期,

         --(plla.quantity-plla.QUANTITY_RECEIVED) 数量到期,

            plla.QUANTITY_RECEIVED                       接收数量,

         --plla.QUANTITY_ACCEPTED                       验收数量,

            plla.QUANTITY_REJECTED                       拒收数量,

            plla.QUANTITY_BILLED                            开单数量,

            plla.QUANTITY_CANCELLED                      取消数量,

           (plla.QUANTITY_RECEIVED-plla.QUANTITY_BILLED) 未开单数,

            ppv.vendor_name                                      供应商,

    /*case   

             when ppv.vendor_type_lookup_code='A_VENDOR' then '固定资产供应商'   

             when ppv.vendor_type_lookup_code='L_VENDOR' then '备品备件供应商'   

             when ppv.vendor_type_lookup_code='M_VENDOR' then '材料供应商'   

             when ppv.vendor_type_lookup_code='F_VENDOR' then '成品供应商'   

             when ppv.vendor_type_lookup_code='C_VENDOR' then '费用资金类供应商'   

             when ppv.vendor_type_lookup_code='VENDOR' then '供应商'   

             when ppv.vendor_type_lookup_code='PUBLIC SECTOR COMPANIES' then '公关部门公司'  

             when ppv.vendor_type_lookup_code='TAX AUTHORITY' then '税务机关'   

             when ppv.vendor_type_lookup_code='EMPLOYEE' then '员工'   

             when ppv.vendor_type_lookup_code='S_VENDOR' then '安装维修类供应商'

             when ppv.vendor_type_lookup_code='O_VENDOR' then '其它类供应商'  

             else ''

    end 供应商类型,*/

         pvs.vendor_site_code   供应商地点,

         pla.unit_price                       单价,

         pla.creation_date            创建日期,

         pla.last_update_date       修改日期,

         plla.promised_date          承诺日期,

         plla.need_by_date           需求日期,

         pha.comments                 订单说明

    from po.po_headers_all pha,

            po.po_lines_all pla,

            po.po_line_locations_all plla,

            inv.mtl_system_items_b msi,

            po.po_vendors ppv,

            po.po_vendor_sites_all pvs,

            apps.per_people_f appf

    where     pha.po_header_id=pla.po_header_id

       and pla.item_id=msi.inventory_item_id

       and plla.po_header_id=pha.po_header_id

       and msi.organization_id=X

       and pha.org_id=Y

       and plla.po_line_id=pla.po_line_id

       and pha.vendor_id=ppv.vendor_id

       and pha.agent_id=appf.person_id

       and pvs.vendor_site_id=pha.vendor_site_id and pha.type_lookup_code='STANDARD'  --标准采购订单  --'BLANKET'

    --and decode(pla.closed_code,'','OPEN',pla.closed_code) = 'OPEN'   --查找未关闭订单行

    --and pla.creation_date between to_date('20**-01-01','yyyy-mm-dd') and to_date('20**-01-31','yyyy-mm-dd')

      and pla.creation_date > to_date('20**-01-15','yyyy-mm-dd')

      and msi.item_type ='OP' and appf.full_name not like 'ERP工%'

      and decode(pllA.cancel_flag,'','N',pllA.cancel_flag) = 'N'       

    --查找未取消订单行  --and pla.creation_date < to_date('20**-02-01','yyyy-mm-dd')

    --and (pla.quantity-plla.QUANTITY_RECEIVED)>0     --查找有剩余数订单

    --and plla.quantity_received > 0 --and pla.unit_price=0

    --and plla.quantity >1000000

    order by pha.segment1,

    pla.line_num

  • 相关阅读:
    005 ES的文档一些控制
    004 REST风格中在ES中的约定
    003 接触elasticsearch的Restful Api【快速入门】
    002 elasticsearch中的一些概念
    001 centos7下安装kibana
    000 centos7下安装elasticsearch7的单节点安装
    006 DOM节点操作与元素的创建
    006 认识BeanNameAware
    005 Spring和SpringBoot中的@Component 和@ComponentScan注解
    004 JpaRepository,CrudRepository,PagingAndSortingRepository的区别
  • 原文地址:https://www.cnblogs.com/st-sun/p/3779356.html
Copyright © 2011-2022 走看看