检查订单是否有退货
2011-12-14 17:07
239 查看
使用下面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
注: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
相关文章推荐
- 检查订单是否有退货
- VL01N/VL02N增强-退货订单(ZRE,ZWRE,ZRD)在VL01N对于发货过账时判断成本是否为0碰到的问题
- 检查订单是否开了系统发票
- Oracle EBS-SQL (PO-11):检查采购订单退货数.sql
- 订单签名错误,请检查partner对应的密钥是否正确
- android 接入支付宝支付 "订单签名错误,请检查PARTNER对应的密钥是否正确"
- php中检查某个网页地址是否有效能被打开的最简单方法
- 检查是否为数字
- 检查圆括号是否匹配
- ORACLE:检查一个表(TABLE)/函数(FUNCTION)/过程(PROCEDRE)是否存在
- 浅谈PHP检查数组中是否存在某个值 in_array 函数
- 在复选框提交时检查是否为空
- javascript SocialHistory 检查访问者是否访问过某站点
- 限制*开头的订单不允许退货
- Python检查xpath和csspath表达式是否合法
- 在脚本中, 使用sqlite3检查android程序生成的数据库是否OK
- 检查android设备是否支持某些功能
- 由于AddressFilter在EndpointDispatcher不匹配,To 为“http://*/*”的消息无法在接收方处理。请检查发送方和接收方的 EndpointAddresses 是否一致
- 检查用户名是否存在jsp——access