zoukankan      html  css  js  c++  java
  • 检查订单是否有退货

    使用下面SQL检查:
    注:A区代表现在要退的订单信息,
         B区是最原始的订单信息,
         C区是可能针对B的已退的订单信息,,  如果C存在,且数据与B中的数据相当,,,那就是说退货已完成,,

    就没有办法再针对B做退货啦!
    ============================

    SELECT ooh1.order_number     A1,
           ool1.ordered_item     A2,
           ool1.line_number      A3,
           ool1.ordered_quantity A4,
           ooh1.flow_status_code A5,
           ooh2.order_number     B1,
           ool2.line_number      B1,
           ool2.ordered_quantity B3,
           ooh2.flow_status_code B4,
           ooh3.order_number     C1,
           ool3.line_number      C2,
           ool3.ordered_quantity C3,
           ooh3.flow_status_code C4
      FROM ont.oe_order_headers_all ooh1,
           ont.oe_order_lines_all   ool1,
           ont.oe_order_lines_all   ool2,
           ont.oe_order_headers_all ooh2,
           ont.oe_order_lines_all   ool3,
           ont.oe_order_headers_all ooh3
     WHERE ooh1.header_id = ool1.header_id
       AND ool1.line_category_code = 'RETURN'
       AND ooh1.order_number = '&return_order_number'
       AND ool1.reference_line_id = ool2.line_id
       AND ooh2.header_id = ool2.header_id
       AND ool1.reference_line_id = ool3.reference_line_id(+)
       AND ooh3.header_id(+) = ool3.header_id
       AND ooh1.order_number <> ooh3.order_number
    参考:
    Solution
    ANSWER:
    ========
    It is likely this indicates the original order line was referenced for the item and quantity on an earlier RMA order line.

    The following SQL select statements can be used to determine if this Order Item has already been "Returned"
    by a previous RMA order line.

    1. To get information on order lines which have referenced the original sales order line previously, run the following:

    SQL > select line_id, ordered_quantity, reference_line_id
                     from oe_order_lines_all
                where line_category_code = 'RETURN' and reference_line_id = &line_id ;

    Please Note: The '&line_id' is replaced by the actual reference_line_id, which would be the line_id for the original sales order line.


    2. Using the line_id's returned from sql #1, ('X' and 'Y'), you can find the other return type lines and header_id's they belong to;

    SQL > select LINE_NUMBER, LINE_ID, LINE_TYPE_ID, HEADER_ID, REFERENCE_HEADER_ID,
                LINE_CATEGORY_CODE, OPEN_FLAG, BOOKED_FLAG,
               CANCELLED_FLAG, FLOW_STATUS_CODE
                      from OE_ORDER_LINES_ALL
               where line_id in ('XXXXX','YYYYY');


    3. The returned values for the header_id's ('N' and 'M') for the lines in sql #2, show status and type, so using the header_ids in the last select,

    SQL > select ORDER_NUMBER, HEADER_ID, ORDER_TYPE_ID, CANCELLED_FLAG, OPEN_FLAG,
    BOOKED_FLAG, ORDER_CATEGORY_CODE, FLOW_STATUS_CODE
    from OE_ORDER_HEADERS_ALL
    where header_id in ('NNNNN','MMMMM');

    One can find the other separate orders. If one has a return line which is either 'Booked' (Awaiting Return), or 'Closed', then there is already a valid return for the original order item and qty, and no additional returns can reference the same sales order and line item qty. Be sure the ordered item qty and the returned item qty are the same, or there can be additional return lines created for the remaining quantity.

    References
    Note 133464.1 - OMSE11i.SQL release 11i script
    Note 156860.1 - OMCHECK.SQL Oracle Order Management Diagnostic Tool
  • 相关阅读:
    Test_StringBuilder
    什么是朋友
    Uncharted4-Resource-Extract
    在使用 .NET Remoting 技术开发跨进程通信时Remoting找不到请求的服务--解决方法
    SourceTree 拉取github资源包时报错:fatal: unable to access 'https://github.com/xxx.git/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 --解决办法
    .net core3.1 文件导出报错The type initializer for 'Gdip' threw an exception 的解决方法
    .net core3.1文件下载之MimeTypeMapHelper
    .net core3.1 webapi项目部署在centos7中,通过supervisor来做进程守护遇到backoff Exited too quickly (process log may have details)的错误--并提供解决方法
    jenkins安装在ubuntu的解决方法-运维系列
    supervisord.conf配置文件详情
  • 原文地址:https://www.cnblogs.com/benio/p/2287809.html
Copyright © 2011-2022 走看看