Oracle EBS-SQL (OM-1):查询订单发货明细.sql

select

mtrh.request_number                 
发货单号,
      
mmt.transaction_date                 
发货时间,
      
oola.creation_date                      
下单时间,
       nvl(fu.description, fu.user_name)
下单人员,
      
ott.name                                   
订单类型,
      
qp.name                                      
价目表,
      
srp.name                                  
销售人员,
      
a.acra1                                     
销售大区,
      
a.acra2                                        
办事处,
      
cust_acct.account_number         
客户编码,
      
hp.party_name                          
客户名称,
      
ship_su.location                        
发货地址,
      
ship_loc.address1                      
客户地址,
      
ooha.order_number                 销售订单号,
      
oola.line_number                      
订单行号,
      
oola.ordered_item                      产品型号,
      
msib.segment1                          物料编码,
      
msib.description                       
物料描述,
      
msib.primary_unit_of_measure       
单位,
      
ooha.transactional_curr_code    
订单币种,
      
oola.unit_selling_price                    
价格,
      
mmt.transaction_quantity          发货数量,
      
round(mmt.transaction_quantity * oola.unit_selling_price, 2)
发货金额,
       nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1)
汇率,
       nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1) * oola.unit_selling_price
"价格CNY",
       round(nvl((select
gdr.conversion_rate
                  
from gl.gl_daily_rates
gdr
                 
where gdr.conversion_type =
‘Corporate‘
                   
and gdr.from_currency =
ooha.transactional_curr_code
                   
and trunc(gdr.conversion_date)
=
                       
trunc(ooha.creation_date)
                   
and gdr.from_currency <> ‘CNY‘), 1)
*
            
mmt.transaction_quantity * oola.unit_selling_price, 2)
"发货金额CNY",
      
rt.name                                  
 付款条件,
      
mtrl.date_required              
交付通知时间,
      
wdd.shipping_instructions         
发运说明
  from
wsh.wsh_delivery_details            
 wdd,
      
inv.mtl_txn_request_lines                mtrl,
      
inv.mtl_txn_request_headers         
mtrh,
      
ont.oe_order_lines_all                    
oola,
      
ont.oe_order_headers_all              
ooha,
      
ont.oe_transaction_types_tl              
ott,
      
jtf.jtf_rs_salesreps                           
srp,
      
ar.hz_parties                                    
hp,
      
ar.hz_party_sites                             
hps,
       ar.hz_cust_accounts
cust_acct,
       ar.hz_cust_site_uses_all
ship_su,
       ar.hz_locations
ship_loc,
       ar.hz_cust_acct_sites_all
ship_cas,
       inv.mtl_system_items_b
msib,
       inv.mtl_material_transactions
mmt,
       applsys.fnd_user
fu,
       qp.qp_list_headers_tl
qp,
       ar.ra_terms_tl
rt,
       (select ffv1.flex_value
acra1,
              
ffv2.flex_value
acra2,
              
hc.site_use_id
          from
ar.ra_territories       
rt,
              
apps.fnd_flex_values_vl 
ffv1,
              
apps.fnd_flex_values_vl 
ffv2,
              
ar.hz_cust_site_uses_all hc
        
where ffv1.flex_value_set_id =
1014164
           and
ffv2.flex_value_set_id =
1014165
           and
rt.segment1 =
ffv1.flex_value(+)
          
and rt.segment2 =
ffv2.flex_value(+)
          
and hc.site_use_code =
‘BILL_TO‘
           and
rt.territory_id = hc.territory_id) a
 where mtrl.header_id =
mtrh.header_id
   and ooha.sold_to_org_id =
cust_acct.cust_account_id(+)
   and cust_acct.party_id =
hp.party_id(+)
   and ooha.ship_to_org_id =
ship_su.site_use_id(+)
   and ship_su.cust_acct_site_id =
ship_cas.cust_acct_site_id(+)
   and ship_cas.party_site_id =
hps.party_site_id(+)
   and ship_loc.location_id(+) =
hps.location_id
   and mtrl.line_id =
wdd.move_order_line_id
   and wdd.source_line_id =
oola.line_id
   and wdd.source_header_id =
oola.header_id
   and oola.inventory_item_id =
msib.inventory_item_id(+)
   and oola.ship_from_org_id =
msib.organization_id(+)
   and ooha.order_type_id =
ott.transaction_type_id
   and oola.header_id =
ooha.header_id
   and ooha.salesrep_id =
srp.salesrep_id(+)
   and ooha.org_id =
srp.org_id(+)
   and mmt.move_order_line_id =
mtrl.line_id
   and wdd.organization_id =
mmt.organization_id
   and wdd.inventory_item_id =
mmt.inventory_item_id
   and wdd.inventory_item_id =
msib.inventory_item_id
   and mmt.transaction_type_id = 52
--33
   and mmt.transaction_quantity > 0
   and
ott.language = userenv(‘LANG‘)
   and wdd.source_code =
‘OE‘
   and wdd.released_status in (‘C‘, ‘Y‘)
   and
oola.org_id = x
   and msib.organization_id
= y
   and a.site_use_id(+) =
ooha.invoice_to_org_id
   and fu.user_id =
ooha.created_by
   and qp.list_header_id =
ooha.price_list_id
   and qp.language =
userenv(‘LANG‘)
   and rt.term_id =
oola.payment_term_id
   and rt.language = ‘ZHS‘
union all
----增加退货部分
select ‘‘ 发货单号,
      
mmt.transaction_date                 
发货时间,
      
oola.creation_date                       下单时间,
      
nvl(fu.description, fu.user_name) 下单人员,
      
ott.name                                   
订单类型,
      
qp.name                                      
价目表,
      
srp.name                                  
销售人员,
      
a.acra1                                      销售大区,
      
a.acra2                                        
办事处,
      
cust_acct.account_number         
客户编码,
      
hp.party_name                          
客户名称,
      
ship_su.location                        
发货地址,
      
ship_loc.address1                     
客户地址,
      
ooha.order_number                销售订单号,
      
oola.line_number                     
订单行号,
      
oola.ordered_item                    
产品型号,
      
msib.segment1                        
物料编码,
      
msib.description                       
物料描述,
      
msib.primary_unit_of_measure        单位,
      
ooha.transactional_curr_code   
订单币种,
      
oola.unit_selling_price                   
价格,
       -round(mmt.transaction_quantity, 4)
发货数量,
       -round(mmt.transaction_quantity *
oola.unit_selling_price, 2) 发货金额,
      
nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1)
汇率,
       nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1) * oola.unit_selling_price
"价格CNY",
       -round(nvl((select
gdr.conversion_rate
                  
from gl.gl_daily_rates
gdr
                 
where gdr.conversion_type =
‘Corporate‘
                   
and gdr.from_currency =
ooha.transactional_curr_code
                   
and trunc(gdr.conversion_date)
=
                       
trunc(ooha.creation_date)
                   
and gdr.from_currency <> ‘CNY‘), 1)
*
            
mmt.transaction_quantity * oola.unit_selling_price, 2)
"发货金额CNY",
      
rt.name                                 
付款条件,
      
mmt.transaction_date       
交付通知时间,
       ‘ ‘ 发运说明
  from
ont.oe_order_lines_all               
oola,
      
ont.oe_order_headers_all            
ooha,
      
ont.oe_transaction_types_tl            ott,
      
jtf.jtf_rs_salesreps                        
srp,
      
ar.hz_parties                                 
hp,
      
ar.hz_party_sites                         
hps,
       ar.hz_cust_accounts
cust_acct,
       ar.hz_cust_site_uses_all
ship_su,
       ar.hz_locations
ship_loc,
       ar.hz_cust_acct_sites_all
ship_cas,
       inv.mtl_system_items_b
msib,
       inv.mtl_material_transactions
mmt,
       po.rcv_transactions
rt,
       applsys.fnd_user
fu,
       qp.qp_list_headers_tl
qp,
       ar.ra_terms_tl
rt,
       (select ffv1.flex_value
acra1,
              
ffv2.flex_value
acra2,
              
hc.site_use_id
          from
ar.ra_territories       
rt,
              
apps.fnd_flex_values_vl 
ffv1,
              
apps.fnd_flex_values_vl 
ffv2,
              
ar.hz_cust_site_uses_all hc
        
where ffv1.flex_value_set_id =
1014164
           and
ffv2.flex_value_set_id =
1014165
           and
rt.segment1 =
ffv1.flex_value(+)
          
and rt.segment2 =
ffv2.flex_value(+)
          
and hc.site_use_code =
‘BILL_TO‘
           and
rt.territory_id = hc.territory_id) a
 where ooha.sold_to_org_id =
cust_acct.cust_account_id(+)
   and cust_acct.party_id =
hp.party_id(+)
   and ooha.ship_to_org_id =
ship_su.site_use_id(+)
   and ship_su.cust_acct_site_id =
ship_cas.cust_acct_site_id(+)
   and ship_cas.party_site_id =
hps.party_site_id(+)
   and ship_loc.location_id(+) =
hps.location_id
   and oola.inventory_item_id =
msib.inventory_item_id(+)
   and oola.ship_from_org_id =
msib.organization_id(+)
   and oola.line_category_code =
‘RETURN‘
   and ooha.order_type_id =
ott.transaction_type_id
   and oola.header_id =
ooha.header_id
   and ooha.salesrep_id =
srp.salesrep_id(+)
   and ooha.org_id =
srp.org_id(+)
   and mmt.transaction_type_id = 15
  
and mmt.rcv_transaction_id = rt.transaction_id
   and
mmt.organization_id = rt.organization_id
   and
rt.oe_order_header_id = ooha.header_id
   and rt.oe_order_line_id =
oola.line_id
   and ott.language = userenv(‘LANG‘)
  
and msib.organization_id = y
   and a.site_use_id(+) =
ooha.invoice_to_org_id
   and fu.user_id =
ooha.created_by
   and qp.list_header_id =
ooha.price_list_id
   and qp.language =
userenv(‘LANG‘)
   and rt.term_id =
oola.payment_term_id
   and rt.language = ‘ZHS‘
union all
----直接开票订单
select to_char(‘‘) 发货单号,
      
oola.fulfillment_date                    发货时间,
      
oola.creation_date                      
下单时间,
       nvl(fu.description,
fu.user_name)  下单人员,
      
ott.name                                     订单类型,
      
qp.name                                        价目表,
      
srp.name                                   
 销售人员,
      
a.acra1                                       
销售大区,
      
a.acra2                                        
  办事处,
      
cust_acct.account_number          
 客户编码,
      
hp.party_name                           
 客户名称,
      
ship_su.location                          
 发货地址,
      
ship_loc.address1                       
 客户地址,
      
ooha.order_number                 
 销售订单号,
      
oola.line_number                       
  订单行号,
      
oola.ordered_item                       
 产品型号,
      
msib.segment1                             
物料编码,
      
msib.description                           
 物料描述,
      
msib.primary_unit_of_measure         
   单位,
      
ooha.transactional_curr_code         
订单币种,
      
oola.unit_selling_price                       
  价格,
      
round(oola.fulfilled_quantity, 2)     
 发货数量,
      
round(oola.fulfilled_quantity * oola.unit_selling_price, 2)
发货金额,
       nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1)
汇率,
       nvl((select
gdr.conversion_rate
            
from gl.gl_daily_rates
gdr
            where
gdr.conversion_type =
‘Corporate‘
             
and gdr.from_currency =
ooha.transactional_curr_code
             
and trunc(gdr.conversion_date) =
trunc(ooha.creation_date)
             
and gdr.from_currency <> ‘CNY‘), 1) * oola.unit_selling_price
"价格CNY",
       round(nvl((select
gdr.conversion_rate
                  
from gl.gl_daily_rates
gdr
                 
where gdr.conversion_type =
‘Corporate‘
                   
and gdr.from_currency =
ooha.transactional_curr_code
                   
and trunc(gdr.conversion_date)
=
                       
trunc(ooha.creation_date)
                   
and gdr.from_currency <> ‘CNY‘), 1)
*
            
oola.fulfilled_quantity * oola.unit_selling_price, 2)
"发货金额CNY",
      
rt.name                                  
付款条件,
      
oola.fulfillment_date          
交付通知时间,
       ‘ ‘ 发运说明
  from
ont.oe_order_lines_all                
oola,
      
ont.oe_order_headers_all             
ooha,
      
ont.oe_transaction_types_tl            
 ott,
      
jtf.jtf_rs_salesreps                          
srp,
      
ar.hz_parties                                    hp,
      
ar.hz_party_sites                           
hps,
       ar.hz_cust_accounts
cust_acct,
       ar.hz_cust_site_uses_all
ship_su,
       ar.hz_locations
ship_loc,
       ar.hz_cust_acct_sites_all
ship_cas,
       inv.mtl_system_items_b
msib,
       applsys.fnd_user
fu,
       qp.qp_list_headers_tl
qp,
       ar.ra_terms_tl
rt,
       ( select ffv1.flex_value
acra1,
                 
ffv2.flex_value
acra2,
                 
hc.site_use_id
          from
ar.ra_territories       
rt,
            
     apps.fnd_flex_values_vl 
ffv1,
               
  apps.fnd_flex_values_vl 
ffv2,
                 
ar.hz_cust_site_uses_all hc
        
where ffv1.flex_value_set_id =
1014164
           and
ffv2.flex_value_set_id =
1014165
           and
rt.segment1 =
ffv1.flex_value(+)
          
and rt.segment2 =
ffv2.flex_value(+)
          
and hc.site_use_code =
‘BILL_TO‘
           and
rt.territory_id = hc.territory_id) a
 where ooha.sold_to_org_id =
cust_acct.cust_account_id(+)
   and cust_acct.party_id =
hp.party_id(+)
   and ooha.ship_to_org_id =
ship_su.site_use_id(+)
   and ship_su.cust_acct_site_id =
ship_cas.cust_acct_site_id(+)
   and ship_cas.party_site_id =
hps.party_site_id(+)
   and ship_loc.location_id(+) =
hps.location_id
   and oola.inventory_item_id =
msib.inventory_item_id(+)
   and oola.ship_from_org_id =
msib.organization_id(+)
   and ooha.order_type_id =
ott.transaction_type_id
   and oola.header_id =
ooha.header_id
   and ooha.salesrep_id =
srp.salesrep_id(+)
   and ooha.org_id =
srp.org_id(+)
   and oola.flow_status_code =
‘CLOSED‘
   and oola.inventory_item_id =
msib.inventory_item_id
   and oola.ship_from_org_id =
msib.organization_id
   and ott.language =
userenv(‘LANG‘)
   and oola.line_category_code <>
‘RETURN‘
   and oola.org_id = x
   and
msib.organization_id = y
   and a.site_use_id(+) =
ooha.invoice_to_org_id
   and fu.user_id =
ooha.created_by
   and qp.list_header_id =
ooha.price_list_id
   and qp.language =
userenv(‘LANG‘)
   and rt.term_id =
oola.payment_term_id
   and rt.language = ‘ZHS‘
   and
not exists (select ‘X‘
         
from wsh.wsh_delivery_details
wdd
         where
wdd.source_header_id =
oola.header_id
          
and wdd.source_line_id = oola.line_id)

Oracle EBS-SQL (OM-1):查询订单发货明细.sql,布布扣,bubuko.com

时间: 2024-07-30 06:36:57

Oracle EBS-SQL (OM-1):查询订单发货明细.sql的相关文章

关于Oracle 创建用户 ,分级查询,以及PL/SQL语言的随感

--------系统权限-------- 创建用户 create user zc identifid by zc ; --创建用户 grant create session to zc;--创建用户登陆权限 revoke create session from zc;--接触用户登陆权限 alter user account  unlock; --修改用户不锁定权限 drop user zc cascade:---级联删除 ----对象权限 三种对象:DBA  最高权限 resource 不能创

Oracle EBS-SQL (PO-9):检查期间采购订单执行情况.sql

--采购订单执行情况查询(七天内接收情况)select pha.segment1       采购订单,         msib.segment1      物料编码,         pla.quantity           订单数量,         plla.need_by_date 需求日期,         ppf.FULL_NAME        采购员,         nvl(rcv.quantity,0)  接收数量from inv.mtl_system_items_b

Oracle 用中文作为关键字查询无数据及sql loader 导入数据时数据分隔异常的解决办法

前提:电脑A使用sqlldr向电脑B中的Oracle批量导入数据.数据分隔及查询都正常. 拷贝A中的源数据及ctl文件到电脑C中,拷贝B中的Oracle安装文件并安装至电脑C中. 电脑C使用ctl将源文件导入本机Oracle中之后发现.导入的数据分隔错误,比如[email protected]@ccc格式的数据,sqlldr导入的时候用@分隔.但是实际导入结果并不是column1=aaa,column2=bbb, column3=ccc:有部分数据变成了[email protected],[em

《Entity Framework 6 Recipes》中文翻译系列 (13) -----第三章 查询之使用Entity SQL

3-4使用实体SQL查询模型 问题 你想通过执行Entity SQL语句来查询你的实体数据模型并返回强类型的对象. 解决方案 假设你有图3-5所示的模型,它包含一个Customer实体类型.这个实体类型有一个Name属性和Email属性.你要使用Entiyt SQL查询这个模型. 图3-5 包含一个Customer实体类型的模型 使用Entity SQL(eSQL)查询模型,Entity SQL是SQL在实体框架中实现的一种方言,代码清单3-8中的模式正是使用这种方式.当在查询底层数据存储时,你

Oracle EBS OM RMA销售退货异常处理(Datafix)

系统版本: RDBMS : 9.2.0.6.0 Oracle 应用产品 : 11.5.10.2 问题症状:       1.通过物料事务处理查看销售订单行退货记录显示已经入库为40: 2.销售退货订单行已经接收入库.但是,订单行状态仍然是"等待退货",发运数量为空: 3.销售退货仍然能做RMA接收40数量.但是,查看接收事务处理记录显示已经接收入库了: 4.AR接口行和AR事务处理没有找到对应销售退货订单行的记录: 5.销售退货订单行工作流报错: EBS群下的朋友说要Datafix.但

Oracle EBS 中直发订单Drop Ship流程的系统操作记录

Oracle EBS 中直发订单Drop Ship流程的系统操作记录 应用场景: A公司向客户B销售产品,但是自己不生产该产品,而是向供应商C来采购,并且通常是要供应商C直接把货发到B客户处,属于贸易型企业经常用到的业务流程,有些集团公司下的子公司销售业务也用这种方式. 在实际业务中,并非所有的销售都是企业内部发出的,为了节约成本.提高周转效率.甚至应急销售,企业往往将外部企业也作为自己销售供货的来源之一,通过采购后直接发货的方式,将其他企业的货物直接销往自己的客户.这种销售业务模式,系统中称之

Oracle SQL语言之查询语句_超越OCP精通Oracle视频教程培训29

Oracle SQL语言之查询语句_超越OCP精通Oracle视频教程培训29 本课程介绍: Oracle视频教程,风哥本套oracle教程培训是<<Oracle数据库SQL语言实战培训教程>>的第4/5套:Oracle SQL语言之查询语句.主要学习Oracle数据库SQL查询限制排序.Oracle SQL联接查询.Oracle SQL子查询等. 视频学习地址: http://edu.51cto.com/course/course_id-8047.html Oracle SQL语

Oracle EBS-SQL (SYS-10):锁定表查询.sql

/*死锁查询-1*/ SELECT o.object_name, l.session_id,l.process, l.locked_mode FROM v$locked_object l , dba_objects o WHERE o.object_id=l.object_id ------------------------------------------------ /*死锁查询-2*/ select GL.SESSION_ID,         do.object_name,     

Oracle EBS-SQL (SYS-5):sys_配置文件查询.sql

select    distinct l.profile_option_name,             v.profile_option_value,             fu.user_nameform     applsys.fnd_profile_option_values v,            apps.fnd_profile_options_vl          l,            apps.fnd_user