(一)销售订单概述
1.1 与车间模块关系
当使用ATO类型订单时,订单管理模块会直接在车间模块中产生任务
1.2 与库存模块关系
在销售订单中使用的物料,单位等信息均来自库存模块,在订单执行过程中,按订单保留及销售发运等功能也会对库存模块起作用
1.3 与应收模块关系
销售完成后,订单管理模块会在应收接口中产生INVOICE信息,影响应收模块中销售订单对应的应收INVOICE处理操作
1.4 与采购模块关系
在直发流程,背对背等销售流程中,订单模块会在采购模块中产生对应的采购需求和请购信息,供采购模块导入,影响后续采购操作
1.5 与CRM模块关系
在CRM中,如sale online等许多模块,营销流程执行结束后都会在订单管理模块接口中产生销售订单信息,供订单管理模块导入
1.5 与物料清单模块关系
在ATO类型和PTO类型的销售订单中,进行配置时销售模块都将引用物料设置于物料清单模块的物料清单信息进行配置
1.6 与主计划/MRP模块关系
当对销售订单进行计划后,订单管理模块会将需求信息传递给MRP模块
1.7 与外部系统关系
订单管理模块通过调用高级定价模块产生销售订单中的销售价格信息
1.8 与发运模块的关系
对于需要从库存发运物品的销售订单,订单会将需要发运的信息传递给发运模块,在发运模块中完成对此物品的挑库,发货等操作。完成后发运模块会将发运状态回写到订单管理模块中。
1.9 销售订单模块主要功能
创建客户,维护客户信息及客户关系,进行客户合并操作
销售及退货单的录入,登记
对于销售和退货单的复制,修改,取消,暂挂,释放等操作
查询销售订单执行状况及与之关联的价格调整,库存,交货,发运,INVOICE信息、
根据客户的信用额度进行控制销售订单的挑库及发货
对销售价格的记录和使用控制
与高级定价模块集成,调用高级定价功能结合价目表产生销售价格
与发运模块集成,通过发运模块进行库存类物品的挑库,发货操作
自动产生应收INVOICE/贷项通知单接口记录,供应收模块导入
处理复杂公司销售业务流程,如直发,内部销售,公司间交易,ATO订单,PTO订单
(二)标准销售订单流程
2.1 基本流程
Ebs标准销售流程比较简单清晰,如图,但是过程中夹杂着许多东西,例如信用控制等,相对来说还是比较复杂的
2.2 创建订单(界面)
1.填写订单头信息
2.填写订单行信息
2.3 创建订单(API)
1 DECLARE 2 x_Header_Rec Oe_Order_Pub.Header_Rec_Type; 3 x_Header_Val_Rec Oe_Order_Pub.Header_Val_Rec_Type; 4 x_Header_Adj_Tbl Oe_Order_Pub.Header_Adj_Tbl_Type; 5 x_Header_Adj_Val_Tbl Oe_Order_Pub.Header_Adj_Val_Tbl_Type; 6 x_Header_Price_Att_Tbl Oe_Order_Pub.Header_Price_Att_Tbl_Type; 7 x_Header_Adj_Att_Tbl Oe_Order_Pub.Header_Adj_Att_Tbl_Type; 8 x_Header_Adj_Assoc_Tbl Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type; 9 x_Header_Scredit_Tbl Oe_Order_Pub.Header_Scredit_Tbl_Type; 10 x_Header_Scredit_Val_Tbl Oe_Order_Pub.Header_Scredit_Val_Tbl_Type; 11 x_Line_Tbl Oe_Order_Pub.Line_Tbl_Type; 12 x_Line_Val_Tbl Oe_Order_Pub.Line_Val_Tbl_Type; 13 x_Line_Adj_Tbl Oe_Order_Pub.Line_Adj_Tbl_Type; 14 x_Line_Adj_Val_Tbl Oe_Order_Pub.Line_Adj_Val_Tbl_Type; 15 x_Line_Price_Att_Tbl Oe_Order_Pub.Line_Price_Att_Tbl_Type; 16 x_Line_Adj_Att_Tbl Oe_Order_Pub.Line_Adj_Att_Tbl_Type; 17 x_Line_Adj_Assoc_Tbl Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type; 18 x_Line_Scredit_Tbl Oe_Order_Pub.Line_Scredit_Tbl_Type; 19 x_Line_Scredit_Val_Tbl Oe_Order_Pub.Line_Scredit_Val_Tbl_Type; 20 x_Lot_Serial_Tbl Oe_Order_Pub.Lot_Serial_Tbl_Type; 21 x_Lot_Serial_Val_Tbl Oe_Order_Pub.Lot_Serial_Val_Tbl_Type; 22 x_Action_Request_Tbl Oe_Order_Pub.Request_Tbl_Type; 23 24 i NUMBER := 1; 25 l_header_rec oe_order_pub.header_rec_type; 26 l_line_tbl oe_order_pub.line_tbl_type; 27 l_action_request_tbl oe_order_pub.request_tbl_type; 28 x_Return_Status VARCHAR2(1); 29 x_Msg_Count NUMBER; 30 x_Msg_Data VARCHAR2(255); 31 32 BEGIN 33 fnd_global.APPS_INITIALIZE(user_id => 1143,resp_id => 50877,resp_appl_id => 20004); 34 Mo_Global.init(‘CUX‘); 35 oe_msg_pub.initialize; 36 37 l_Header_Rec := Oe_Order_Pub.g_Miss_Header_Rec; 38 l_Header_Rec.Operation := Oe_Globals.g_Opr_Create; 39 l_Header_Rec.Org_Id := &Org_Id; 40 l_Header_Rec.Sold_To_Org_Id := &Customer_Id; 41 l_header_rec.order_type_id := &order_type_id; 42 43 l_Line_Tbl.Delete; 44 l_Line_Tbl(i) := Oe_Order_Pub.g_Miss_Line_Rec; 45 l_Line_Tbl(i).Operation := Oe_Globals.g_Opr_Create; 46 l_Line_Tbl(i).Inventory_Item_Id := &Inventory_Item_Id; 47 l_Line_Tbl(i).Ordered_Quantity := &Quantity; 48 l_Line_Tbl(i).Unit_Selling_Price := &unit_price; 49 l_Line_Tbl(i).Unit_List_Price := &unit_price; 50 l_Line_Tbl(i).Calculate_Price_Flag := ‘N‘; 51 --如果没使用修改量或者运费作为价格,通过API导入价格必须导入冻结的价格 52 Oe_Order_Pub.Process_Order(p_Org_Id => &org_id, 53 p_Api_Version_Number => 1.0, 54 p_Init_Msg_List => NULL, 55 p_Return_Values => NULL, 56 p_Header_Rec => l_Header_Rec, 57 p_Action_Request_Tbl => l_Action_Request_Tbl, 58 p_Line_Tbl => l_Line_Tbl, 59 x_Header_Rec => x_Header_Rec, 60 x_Header_Val_Rec => x_Header_Val_Rec, 61 x_Header_Adj_Tbl => x_Header_Adj_Tbl, 62 x_Header_Adj_Val_Tbl => x_Header_Adj_Val_Tbl, 63 x_Header_Price_Att_Tbl => x_Header_Price_Att_Tbl, 64 x_Header_Adj_Att_Tbl => x_Header_Adj_Att_Tbl, 65 x_Header_Adj_Assoc_Tbl => x_Header_Adj_Assoc_Tbl, 66 x_Header_Scredit_Tbl => x_Header_Scredit_Tbl, 67 x_Header_Scredit_Val_Tbl => x_Header_Scredit_Val_Tbl, 68 x_Line_Tbl => x_Line_Tbl, 69 x_Line_Val_Tbl => x_Line_Val_Tbl, 70 x_Line_Adj_Tbl => x_Line_Adj_Tbl, 71 x_Line_Adj_Val_Tbl => x_Line_Adj_Val_Tbl, 72 x_Line_Price_Att_Tbl => x_Line_Price_Att_Tbl, 73 x_Line_Adj_Att_Tbl => x_Line_Adj_Att_Tbl, 74 x_Line_Adj_Assoc_Tbl => x_Line_Adj_Assoc_Tbl, 75 x_Line_Scredit_Tbl => x_Line_Scredit_Tbl, 76 x_Line_Scredit_Val_Tbl => x_Line_Scredit_Val_Tbl, 77 x_Lot_Serial_Tbl => x_Lot_Serial_Tbl, 78 x_Lot_Serial_Val_Tbl => x_Lot_Serial_Val_Tbl, 79 x_Action_Request_Tbl => x_Action_Request_Tbl, 80 -- Return msg 81 x_Return_Status => x_Return_Status, 82 x_Msg_Count => x_Msg_Count, 83 x_Msg_Data => x_Msg_Data); 84 85 IF x_Return_Status = Fnd_Api.g_Ret_Sts_Success THEN 86 Dbms_Output.Put_Line(‘订单导入成功!‘); 87 Dbms_Output.Put_Line(‘订单编号:‘||x_Header_Rec.order_number); 88 ELSE 89 FOR l_index IN 1 .. x_Msg_Count LOOP 90 Dbms_Output.Put_Line(oe_msg_pub.get(p_msg_index => l_index, p_encoded => ‘F‘)); 91 END LOOP; 92 END IF; 93 END;
说明:导入已登记订单,一般不建议通过头的booked_flag的标记去导入,结果会只是行状态为已登记状态,但是头的状态为已输入状态。
如果需要导入期初价格的订单,且无修改量及运费计算的,则设置行上的Calculate_Price_Flag=‘N‘
2.4 登记订单
1 DECLARE 2 x_Header_Rec Oe_Order_Pub.Header_Rec_Type; 3 x_Header_Val_Rec Oe_Order_Pub.Header_Val_Rec_Type; 4 x_Header_Adj_Tbl Oe_Order_Pub.Header_Adj_Tbl_Type; 5 x_Header_Adj_Val_Tbl Oe_Order_Pub.Header_Adj_Val_Tbl_Type; 6 x_Header_Price_Att_Tbl Oe_Order_Pub.Header_Price_Att_Tbl_Type; 7 x_Header_Adj_Att_Tbl Oe_Order_Pub.Header_Adj_Att_Tbl_Type; 8 x_Header_Adj_Assoc_Tbl Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type; 9 x_Header_Scredit_Tbl Oe_Order_Pub.Header_Scredit_Tbl_Type; 10 x_Header_Scredit_Val_Tbl Oe_Order_Pub.Header_Scredit_Val_Tbl_Type; 11 x_Line_Tbl Oe_Order_Pub.Line_Tbl_Type; 12 x_Line_Val_Tbl Oe_Order_Pub.Line_Val_Tbl_Type; 13 x_Line_Adj_Tbl Oe_Order_Pub.Line_Adj_Tbl_Type; 14 x_Line_Adj_Val_Tbl Oe_Order_Pub.Line_Adj_Val_Tbl_Type; 15 x_Line_Price_Att_Tbl Oe_Order_Pub.Line_Price_Att_Tbl_Type; 16 x_Line_Adj_Att_Tbl Oe_Order_Pub.Line_Adj_Att_Tbl_Type; 17 x_Line_Adj_Assoc_Tbl Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type; 18 x_Line_Scredit_Tbl Oe_Order_Pub.Line_Scredit_Tbl_Type; 19 x_Line_Scredit_Val_Tbl Oe_Order_Pub.Line_Scredit_Val_Tbl_Type; 20 x_Lot_Serial_Tbl Oe_Order_Pub.Lot_Serial_Tbl_Type; 21 x_Lot_Serial_Val_Tbl Oe_Order_Pub.Lot_Serial_Val_Tbl_Type; 22 x_Action_Request_Tbl Oe_Order_Pub.Request_Tbl_Type; 23 24 i NUMBER := 1; 25 l_Header_Rec Oe_Order_Pub.Header_Rec_Type; 26 l_Line_Tbl Oe_Order_Pub.Line_Tbl_Type; 27 l_Action_Request_Tbl Oe_Order_Pub.Request_Tbl_Type; 28 x_Return_Status VARCHAR2(1); 29 x_Msg_Count NUMBER; 30 x_Msg_Data VARCHAR2(255); 31 32 BEGIN 33 34 Fnd_Global.Apps_Initialize(User_Id => 1143,Resp_Id => 50877,Resp_Appl_Id => 20004); 35 Mo_Global.init(‘CUX‘);--必须初始化MOAC,否则无法完成OU验证 36 mo_global.set_policy_context(‘S‘,88); 37 38 Oe_Msg_Pub.Initialize; 39 40 i := 1; 41 l_action_request_tbl(i).request_type := oe_globals.g_book_order; 42 l_action_request_tbl(i).entity_code := oe_globals.g_entity_header; 43 l_action_request_tbl(i).entity_id := &header_id; 44 45 /*如果有多个订单增加record记录 46 i := i+1; 47 l_action_request_tbl(i).request_type := oe_globals.g_book_order; 48 l_action_request_tbl(i).entity_code := oe_globals.g_entity_header; 49 l_action_request_tbl(i).entity_id := &header_id1;*/ 50 51 Oe_Order_Pub.Process_Order(p_Api_Version_Number => 1.0, 52 p_Init_Msg_List => NULL, 53 p_Return_Values => NULL, 54 p_Action_Request_Tbl => l_Action_Request_Tbl, 55 --out 56 x_Header_Rec => x_Header_Rec, 57 x_Header_Val_Rec => x_Header_Val_Rec, 58 x_Header_Adj_Tbl => x_Header_Adj_Tbl, 59 x_Header_Adj_Val_Tbl => x_Header_Adj_Val_Tbl, 60 x_Header_Price_Att_Tbl => x_Header_Price_Att_Tbl, 61 x_Header_Adj_Att_Tbl => x_Header_Adj_Att_Tbl, 62 x_Header_Adj_Assoc_Tbl => x_Header_Adj_Assoc_Tbl, 63 x_Header_Scredit_Tbl => x_Header_Scredit_Tbl, 64 x_Header_Scredit_Val_Tbl => x_Header_Scredit_Val_Tbl, 65 x_Line_Tbl => x_Line_Tbl, 66 x_Line_Val_Tbl => x_Line_Val_Tbl, 67 x_Line_Adj_Tbl => x_Line_Adj_Tbl, 68 x_Line_Adj_Val_Tbl => x_Line_Adj_Val_Tbl, 69 x_Line_Price_Att_Tbl => x_Line_Price_Att_Tbl, 70 x_Line_Adj_Att_Tbl => x_Line_Adj_Att_Tbl, 71 x_Line_Adj_Assoc_Tbl => x_Line_Adj_Assoc_Tbl, 72 x_Line_Scredit_Tbl => x_Line_Scredit_Tbl, 73 x_Line_Scredit_Val_Tbl => x_Line_Scredit_Val_Tbl, 74 x_Lot_Serial_Tbl => x_Lot_Serial_Tbl, 75 x_Lot_Serial_Val_Tbl => x_Lot_Serial_Val_Tbl, 76 x_Action_Request_Tbl => x_Action_Request_Tbl, 77 -- Return msg 78 x_Return_Status => x_Return_Status, 79 x_Msg_Count => x_Msg_Count, 80 x_Msg_Data => x_Msg_Data); 81 82 IF (x_Msg_Count>0) THEN--这里不能按x_return_status的状态判断 83 FOR l_Index IN 1 .. x_Msg_Count LOOP 84 Dbms_Output.Put_Line(Oe_Msg_Pub.Get(p_Msg_Index => l_Index,p_Encoded => ‘F‘)); 85 END LOOP; 86 ELSE 87 Dbms_Output.Put_Line(‘登记成功!‘); 88 END IF; 89 END;
2.5 创建保留(界面)
2.6 创建保留(API)
1 PROCEDURE create_reservation(p_init_msg_list IN VARCHAR2, 2 x_return_status OUT NOCOPY VARCHAR2, 3 x_msg_count OUT NOCOPY NUMBER, 4 x_msg_data OUT NOCOPY VARCHAR2, 5 p_rsv_rec inv_reservation_global.mtl_reservation_rec_type) IS 6 l_sub_program VARCHAR2(100) := ‘create_reservation‘; 7 l_process VARCHAR2(4000); 8 l_api_name CONSTANT VARCHAR2(30) := ‘create_reservation‘; 9 l_savepoint_name CONSTANT VARCHAR2(30) := ‘create_reservation01‘; 10 11 l_rsv_rec inv_reservation_global.mtl_reservation_rec_type; 12 l_serial_number inv_reservation_global.serial_number_tbl_type; 13 14 x_reservation_id NUMBER; 15 l_partial_reservation_flag VARCHAR2(1); 16 x_quantity_reserved NUMBER; 17 18 BEGIN 19 20 x_return_status := cux_api.start_activity(p_pkg_name => g_pkg_name, 21 p_api_name => l_api_name, 22 p_savepoint_name => l_savepoint_name, 23 p_init_msg_list => p_init_msg_list); 24 IF x_return_status = fnd_api.g_ret_sts_error THEN 25 RAISE fnd_api.g_exc_error; 26 ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN 27 RAISE fnd_api.g_exc_unexpected_error; 28 END IF; 29 30 l_process := l_sub_program || ‘Step:1 .开始创建INV保留.‘; 31 IF g_debug = ‘Y‘ THEN 32 cux_conc_utl.log_msg(p_msg => l_process); 33 END IF; 34 35 l_rsv_rec := p_rsv_rec; 36 37 --create reservation 38 BEGIN 39 inv_reservation_pub.create_reservation(p_api_version_number => 1.0, 40 p_init_msg_lst => fnd_api.g_false, 41 x_return_status => x_return_status, 42 x_msg_count => x_msg_count, 43 x_msg_data => x_msg_data, 44 p_rsv_rec => l_rsv_rec, 45 p_serial_number => l_serial_number, 46 x_serial_number => l_serial_number, 47 p_partial_reservation_flag => l_partial_reservation_flag, 48 p_force_reservation_flag => fnd_api.g_false, 49 p_validation_flag => fnd_api.g_true, 50 x_quantity_reserved => x_quantity_reserved, 51 x_reservation_id => x_reservation_id); 52 53 IF x_return_status <> fnd_api.g_ret_sts_success THEN 54 raise_exception(x_return_status); 55 END IF; 56 EXCEPTION 57 WHEN OTHERS THEN 58 fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, 59 p_count => x_msg_count, 60 p_data => x_msg_data); 61 IF x_msg_count > 1 THEN 62 x_msg_data := fnd_msg_pub.get_detail(p_msg_index => fnd_msg_pub.g_first, 63 p_encoded => fnd_api.g_false); 64 END IF; 65 x_return_status := fnd_api.g_ret_sts_error; 66 x_msg_data := ‘创建保留出错.‘ || x_msg_data; 67 init_message(x_msg_data); 68 raise_exception(x_return_status); 69 END; 70 71 l_process := l_sub_program || ‘Step:2 .结束创建订单保留.‘; 72 IF g_debug = ‘Y‘ THEN 73 cux_conc_utl.log_msg(p_msg => l_process); 74 END IF; 75 76 x_return_status := cux_api.end_activity(p_pkg_name => g_pkg_name, 77 p_api_name => l_api_name, 78 p_commit => fnd_api.g_true, 79 x_msg_count => x_msg_count, 80 x_msg_data => x_msg_data); 81 82 EXCEPTION 83 WHEN fnd_api.g_exc_error THEN 84 x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name, 85 p_api_name => l_api_name, 86 p_savepoint_name => l_savepoint_name, 87 p_exc_name => cux_api.g_exc_name_error, 88 x_msg_count => x_msg_count, 89 x_msg_data => x_msg_data); 90 WHEN fnd_api.g_exc_unexpected_error THEN 91 x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name, 92 p_api_name => l_api_name, 93 p_savepoint_name => l_savepoint_name, 94 p_exc_name => cux_api.g_exc_name_unexp, 95 x_msg_count => x_msg_count, 96 x_msg_data => x_msg_data); 97 WHEN OTHERS THEN 98 x_return_status := cux_api.handle_exceptions(p_pkg_name => g_pkg_name, 99 p_api_name => l_api_name, 100 p_savepoint_name => l_savepoint_name, 101 p_exc_name => cux_api.g_exc_name_others, 102 x_msg_count => x_msg_count, 103 x_msg_data => x_msg_data); 104 END create_reservation;
2.7 挑库发放(界面)
挑库发放可以细分为2个步骤,第一创建挑库批次,第二启用挑库;
在挑库参数里面有三个参数通常情况上是我们比较关注的值
自动创建交货
自动确认挑库
自动创建分配
2.8 挑库发放(API)
1 DECLARE 2 CURSOR Csr_Detail IS 3 SELECT Wdd.Delivery_Detail_Id 4 FROM Wsh_Delivery_Details Wdd 5 WHERE Wdd.Released_Status IN (‘R‘, ‘B‘, ‘X‘) 6 AND Wdd.Source_Header_Id = 1; 7 x_Return_Status VARCHAR2(1); 8 x_Msg_Count NUMBER; 9 x_Msg_Data VARCHAR2(2000); 10 l_Batch_Info_Rec Wsh_Picking_Batches_Pub.Batch_Info_Rec; 11 l_Batch_Id NUMBER; 12 l_Batch_Name VARCHAR2(2000); 13 x_Request_Id NUMBER; 14 l_Log_Level NUMBER; 15 BEGIN 16 fnd_global.APPS_INITIALIZE(user_id => 1143,resp_id => 50877,resp_appl_id => 20004); 17 Mo_Global.Init(‘CUX‘); 18 Mo_Global.Set_Policy_Context(‘S‘, 88); 19 20 --FOR Rec_Detail IN Csr_Detail LOOP 21 l_Batch_Info_Rec := NULL; 22 l_Batch_Info_Rec.Order_Type_Id := 1326; 23 l_Batch_Info_Rec.Order_Number := 2900012911; 24 l_Batch_Info_Rec.Backorders_Only_Flag := ‘O‘; 25 --l_Batch_Info_Rec.Delivery_Detail_Id := -460639; 26 l_Batch_Info_Rec.Append_Flag := ‘N‘; 27 l_Batch_Info_Rec.Organization_Id := 95; 28 l_Batch_Info_Rec.Pick_Grouping_Rule_Id := 1006; 29 l_Batch_Info_Rec.AUTO_PICK_CONFIRM_FLAG := ‘N‘; 30 l_Batch_Info_Rec.AUTODETAIL_PR_FLAG := ‘N‘; 31 32 Wsh_Picking_Batches_Pub.Create_Batch(p_Api_Version => 1.0, 33 p_Init_Msg_List => Fnd_Api.g_True, 34 p_Commit => Fnd_Api.g_false, 35 x_Return_Status => x_Return_Status, 36 x_Msg_Count => x_Msg_Count, 37 x_Msg_Data => x_Msg_Data, 38 p_Batch_Rec => l_Batch_Info_Rec, 39 x_Batch_Id => l_Batch_Id); 40 41 IF (x_Return_Status = Wsh_Util_Core.g_Ret_Sts_Success) THEN 42 Wsh_Picking_Batches_Pub.Release_Batch(p_Api_Version => 1.0, 43 p_Init_Msg_List => Fnd_Api.g_False, 44 p_Commit => fnd_api.g_false, 45 x_Msg_Count => x_Msg_Count, 46 x_Return_Status => x_Return_Status, 47 x_Msg_Data => x_Msg_Data, 48 p_Batch_Id => l_Batch_Id, 49 p_Batch_Name => l_Batch_Name, 50 p_Log_Level => l_Log_Level, 51 p_Release_Mode => ‘CONCURRENT‘, 52 x_Request_Id => x_Request_Id); 53 54 IF (x_return_status = WSH_UTIL_CORE.G_RET_STS_SUCCESS) THEN 55 COMMIT; 56 dbms_output.put_line(‘Return Status= ‘|| SUBSTR (x_return_status,1,255)); 57 dbms_output.put_line(‘Request_id= ‘|| x_request_id); 58 ELSE 59 dbms_output.put_line(‘Msg Data= ‘|| SUBSTR (x_msg_data,1,255)); 60 END IF; 61 ELSE 62 Dbms_Output.Put_Line(‘Return Status= ‘ || Substr(x_Return_Status, 1, 255)); 63 Dbms_Output.Put_Line(‘Msg Count=‘ || To_Char(x_Msg_Count)); 64 Dbms_Output.Put_Line(‘Msg Data= ‘ || x_Msg_Data); 65 END IF; 66 END;
2.9挑库确认(界面)
2.10 挑库确认(API)
分配物料搬运单
1 DECLARE 2 x_Return_Status VARCHAR2(2); 3 x_Msg_Count NUMBER := 0; 4 x_Msg_Data VARCHAR2(255); 5 -- for detail 6 l_Move_Order_Type Mtl_Txn_Request_Headers.Move_Order_Type%TYPE := 3; 7 x_Detailed_Qty NUMBER := 5; 8 x_Number_Of_Rows NUMBER := 0; 9 x_Revision VARCHAR2(3); 10 x_Locator_Id NUMBER := 0; 11 x_Transfer_To_Location NUMBER := 0; 12 x_Lot_Number VARCHAR2(30); 13 x_Expiration_Date DATE; 14 x_Transaction_Temp_Id NUMBER := 0; 15 16 CURSOR csr_mo_line IS 17 SELECT Tl.Line_Id Mo_Line_Id, 18 tl.quantity 19 FROM Wsh_Delivery_Details Wdd, 20 Mtl_Txn_Request_Lines Tl, 21 Mtl_Txn_Request_Headers th 22 WHERE Wdd.Released_Status = ‘S‘ 23 AND Wdd.Move_Order_Line_Id = Tl.Line_Id 24 AND Nvl(Tl.Quantity_Detailed, 0) < Tl.Quantity 25 AND Wdd.Source_Header_Id = &Oe_Header_Id 26 AND tl.header_id = th.header_id 27 GROUP BY Tl.Line_Id,tl.quantity 28 ORDER BY tl.line_id; 29 30 BEGIN 31 32 fnd_global.APPS_INITIALIZE(user_id => 1143,resp_id => 50877,resp_appl_id => 20004); 33 34 -- Allocate each line of the Move Order 35 FOR rec_line in csr_mo_line LOOP 36 Inv_Replenish_Detail_Pub.Line_Details_Pub(p_Line_Id => rec_line.mo_Line_Id, 37 x_Number_Of_Rows => x_Number_Of_Rows, 38 x_Detailed_Qty => x_Detailed_Qty, 39 x_Return_Status => x_Return_Status, 40 x_Msg_Count => x_Msg_Count, 41 x_Msg_Data => x_Msg_Data, 42 x_Revision => x_Revision, 43 x_Locator_Id => x_Locator_Id, 44 x_Transfer_To_Location => x_Transfer_To_Location, 45 x_Lot_Number => x_Lot_Number, 46 x_Expiration_Date => x_Expiration_Date, 47 x_Transaction_Temp_Id => x_Transaction_Temp_Id, 48 p_Transaction_Header_Id => NULL, 49 p_Transaction_Mode => NULL, 50 p_Move_Order_Type => l_Move_Order_Type, 51 p_Serial_Flag => Fnd_Api.g_False, 52 p_Plan_Tasks => FALSE, --FND_API.G_FALSE 53 p_Auto_Pick_Confirm => FALSE, --FND_API.G_FALSE 54 p_Commit => FALSE --FND_API.G_FALSE 55 ); 56 57 Dbms_Output.Put_Line(‘==========================================================‘); 58 Dbms_Output.Put_Line(‘Return Status: ‘ || x_Return_Status); 59 60 IF (x_Return_Status <> Fnd_Api.g_Ret_Sts_Success) THEN 61 Dbms_Output.Put_Line(‘Error Message :‘||x_Msg_Data); 62 FOR i IN 1 .. fnd_msg_pub.count_msg LOOP 63 Dbms_Output.Put_Line(fnd_msg_pub.Get(i,‘F‘)); 64 END LOOP; 65 ELSE 66 IF x_number_of_rows = 0 OR nvl(x_detailed_qty,0)< rec_line.quantity THEN 67 dbms_output.put_line(‘not enough onhand quantity!‘); 68 END IF; 69 END IF; 70 Dbms_Output.Put_Line(‘==========================================================‘); 71 END LOOP; 72 73 EXCEPTION 74 WHEN OTHERS THEN 75 Dbms_Output.Put_Line(‘Exception Occured :‘); 76 Dbms_Output.Put_Line(SQLCODE || ‘:‘ || SQLERRM); 77 Dbms_Output.Put_Line(‘=======================================================‘); 78 END;
处理物料搬运单
1 DECLARE 2 -- Common Declarations 3 l_Api_Version NUMBER := 1.0; 4 l_Init_Msg_List VARCHAR2(2) := Fnd_Api.g_True; 5 l_Commit VARCHAR2(2) := Fnd_Api.g_False; 6 x_Return_Status VARCHAR2(2); 7 x_Msg_Count NUMBER := 0; 8 x_Msg_Data VARCHAR2(255); 9 -- API specific declarations 10 l_Move_Order_Type NUMBER := 1; 11 l_Transaction_Mode NUMBER := 1; 12 l_Trolin_Tbl Inv_Move_Order_Pub.Trolin_Tbl_Type; 13 l_Mold_Tbl Inv_Mo_Line_Detail_Util.g_Mmtt_Tbl_Type; 14 x_Mmtt_Tbl Inv_Mo_Line_Detail_Util.g_Mmtt_Tbl_Type; 15 x_Trolin_Tbl Inv_Move_Order_Pub.Trolin_Tbl_Type; 16 l_Transaction_Date DATE := SYSDATE; 17 -- WHO columns 18 l_User_Id NUMBER := -1; 19 l_Resp_Id NUMBER := -1; 20 l_Application_Id NUMBER := -1; 21 l_Row_Cnt NUMBER := 1; 22 l_User_Name VARCHAR2(30) := ‘MFG‘; 23 l_Resp_Name VARCHAR2(30) := ‘MFG_AND_DIST_SUPER_USER_APS‘; 24 25 BEGIN 26 27 Fnd_Global.Apps_Initialize(User_Id => 1143,Resp_Id => 50877,Resp_Appl_Id => 20004); 28 l_Trolin_Tbl(1).Line_Id := &mo_Line_Id; 29 -- call API to create move order header 30 Dbms_Output.Put_Line(‘=======================================================‘); 31 Dbms_Output.Put_Line(‘Calling INV_Pick_Wave_Pick_Confirm_PUB.Pick_Confirm API‘); 32 33 Inv_Pick_Wave_Pick_Confirm_Pub.Pick_Confirm(p_Api_Version_Number => l_Api_Version, 34 p_Init_Msg_List => l_Init_Msg_List, 35 p_Commit => l_Commit, 36 x_Return_Status => x_Return_Status, 37 x_Msg_Count => x_Msg_Count, 38 x_Msg_Data => x_Msg_Data, 39 p_Move_Order_Type => l_Move_Order_Type, 40 p_Transaction_Mode => l_Transaction_Mode, 41 p_Trolin_Tbl => l_Trolin_Tbl, 42 p_Mold_Tbl => l_Mold_Tbl, 43 x_Mmtt_Tbl => x_Mmtt_Tbl, 44 x_Trolin_Tbl => x_Trolin_Tbl, 45 p_Transaction_Date => l_Transaction_Date); 46 47 Dbms_Output.Put_Line(‘=======================================================‘); 48 Dbms_Output.Put_Line(‘Return Status: ‘ || x_Return_Status); 49 50 IF (x_Return_Status <> Fnd_Api.g_Ret_Sts_Success) THEN 51 Dbms_Output.Put_Line(‘Error Message :‘ || x_Msg_Data); 52 END IF; 53 54 Dbms_Output.Put_Line(‘=======================================================‘); 55 56 EXCEPTION 57 WHEN OTHERS THEN 58 Dbms_Output.Put_Line(‘Exception Occured :‘); 59 Dbms_Output.Put_Line(SQLCODE || ‘:‘ || SQLERRM); 60 Dbms_Output.Put_Line(‘=======================================================‘); 61 END;
2.11 创建交货(界面)
2.12创建交货(API)
1 DECLARE 2 Tbl_Line_Rows Wsh_Util_Core.Id_Tab_Type; 3 Tbl_Del_Rows Wsh_Util_Core.Id_Tab_Type; 4 x_Return_Status VARCHAR2(1); 5 x_Msg_Count NUMBER; 6 x_Msg_Data VARCHAR2(2000); 7 l_Api_Version NUMBER := 1; 8 BEGIN 9 Fnd_Global.Apps_Initialize(User_Id => 1143,Resp_Id => 50877,Resp_Appl_Id => 20004); 10 11 Tbl_Line_Rows(1) := &Delivery_Detail_Id1; 12 Tbl_Line_Rows(2) := &Delivery_Detail_Id2; 13 Wsh_Delivery_Details_Pub.Autocreate_Deliveries(p_Api_Version_Number => l_Api_Version, 14 p_Init_Msg_List => Fnd_Api.g_True, 15 p_Commit => Fnd_Api.g_False, 16 x_Return_Status => x_Return_Status, 17 x_Msg_Count => x_Msg_Count, 18 x_Msg_Data => x_Msg_Data, 19 p_Line_Rows => Tbl_Line_Rows, 20 x_Del_Rows => Tbl_Del_Rows); 21 Dbms_Output.Put_Line(‘=======================================================‘); 22 Dbms_Output.Put_Line(‘Return Status: ‘ || x_Return_Status); 23 24 IF (x_Return_Status <> Fnd_Api.g_Ret_Sts_Success) THEN 25 Dbms_Output.Put_Line(‘Error Message :‘ || x_Msg_Data); 26 END IF; 27 Dbms_Output.Put_Line(‘=======================================================‘); 28 END;
2.13 发运确认
1 DECLARE 2 x_Return_Status VARCHAR2(1); 3 x_Msg_Count NUMBER; 4 x_Msg_Data VARCHAR2(2000); 5 6 l_Sc_Action_Flag VARCHAR2(2); 7 l_Sc_Intransit_Flag VARCHAR2(2); 8 l_Sc_Close_Trip_Flag VARCHAR2(2); 9 l_Sc_Create_Bol_Flag VARCHAR2(2); 10 l_Sc_Stage_Del_Flag VARCHAR2(2); 11 l_Sc_Trip_Ship_Method VARCHAR2(30); 12 l_Sc_Actual_Dep_Date DATE; 13 l_Sc_Report_Set_Id NUMBER; 14 l_Sc_Report_Set_Name VARCHAR2(100); 15 l_Sc_Defer_Interface_Flag VARCHAR2(2); 16 l_Sc_Send_945_Flag VARCHAR2(2); 17 l_Wv_Override_Flag VARCHAR2(2); 18 x_Trip_Id VARCHAR2(30); 19 x_Trip_Name VARCHAR2(30); 20 l_Organization_Id NUMBER; 21 l_Delivery_Name VARCHAR2(30); 22 BEGIN 23 BEGIN 24 SELECT Wnd.Organization_Id, 25 Wnd.Name 26 INTO l_Organization_Id, 27 l_Delivery_Name 28 FROM Wsh_New_Deliveries Wnd 29 WHERE Wnd.Delivery_Id = &Delivery_Id; 30 END; 31 32 BEGIN 33 SELECT Cr.Action_Flag, 34 Cr.Ac_Intransit_Flag, 35 Cr.Ac_Close_Trip_Flag, 36 Cr.Mc_Bol_Flag, 37 Cr.Stage_Del_Flag, 38 Cr.Ship_Method_Code, 39 &l_Transaction_Date, --SYSDATE, 40 Cr.Report_Set_Id, 41 Cr.Ac_Defer_Interface_Flag, 42 Cr.Send_945_Flag 43 INTO l_Sc_Action_Flag, 44 l_Sc_Intransit_Flag, 45 l_Sc_Close_Trip_Flag, 46 l_Sc_Create_Bol_Flag, 47 l_Sc_Stage_Del_Flag, 48 l_Sc_Trip_Ship_Method, 49 l_Sc_Actual_Dep_Date, 50 l_Sc_Report_Set_Id, 51 l_Sc_Defer_Interface_Flag, 52 l_Sc_Send_945_Flag 53 FROM Wsh_Shipping_Parameters Wsp, 54 Wsh_Ship_Confirm_Rules Cr 55 WHERE Wsp.Organization_Id = l_Organization_Id 56 AND Wsp.Ship_Confirm_Rule_Id = Cr.Ship_Confirm_Rule_Id; 57 END; 58 59 Wsh_Deliveries_Pub.Delivery_Action(p_Api_Version_Number => 1.0, 60 p_Init_Msg_List => Fnd_Api.g_True, 61 x_Return_Status => x_Return_Status, 62 x_Msg_Count => x_Msg_Count, 63 x_Msg_Data => x_Msg_Data, 64 p_Action_Code => ‘CONFIRM‘, 65 p_Delivery_Id => &Delivery_Id, 66 p_Delivery_Name => l_Delivery_Name, 67 p_Sc_Action_Flag => l_Sc_Action_Flag, 68 p_Sc_Intransit_Flag => l_Sc_Intransit_Flag, 69 p_Sc_Close_Trip_Flag => l_Sc_Close_Trip_Flag, 70 p_Sc_Create_Bol_Flag => l_Sc_Create_Bol_Flag, 71 p_Sc_Stage_Del_Flag => l_Sc_Stage_Del_Flag, 72 p_Sc_Trip_Ship_Method => l_Sc_Trip_Ship_Method, 73 p_Sc_Actual_Dep_Date => l_Sc_Actual_Dep_Date, 74 p_Sc_Report_Set_Id => l_Sc_Report_Set_Id, 75 p_Sc_Report_Set_Name => l_Sc_Report_Set_Name, 76 p_Sc_Defer_Interface_Flag => l_Sc_Defer_Interface_Flag, 77 p_Sc_Send_945_Flag => l_Sc_Send_945_Flag, 78 p_Wv_Override_Flag => l_Wv_Override_Flag, 79 x_Trip_Id => x_Trip_Id, 80 x_Trip_Name => x_Trip_Name); 81 82 Dbms_Output.Put_Line(‘=======================================================‘); 83 Dbms_Output.Put_Line(‘Return Status: ‘ || x_Return_Status); 84 85 IF (x_Return_Status <> Fnd_Api.g_Ret_Sts_Success) THEN 86 Dbms_Output.Put_Line(‘Error Message :‘ || x_Msg_Data); 87 FOR i IN 1..fnd_msg_pub.Count_Msg LOOP 88 Dbms_Output.Put_Line(‘Error Message :‘ || fnd_msg_pub.Get(i,‘F‘)); 89 END LOOP; 90 END IF; 91 Dbms_Output.Put_Line(‘=======================================================‘); 92 93 END;
2.14 链接行程停靠站
Interface Trip Stop实际上包含两部分:Order Management Interface SRS(更新发运行状态、以准备生成ARINVOICE)和 Inventory Interface SRS(产生库存出货事务)
Order Management Interface - SRS是在Inventory Interface SRS之前运行的,这个Request更新发运行状态、以准备生成ARINVOICE,OM Interface运行结束后会更新WSH_DELIVERY_DETAILS表的OE_INTERFACED_FLAG为Y。
Inventory Interface SRS会根据Shipping Transaction来插入记录到MTI,进而INV Manager会把这条MTI记录转到MMT表中,一条Sales Order Issue的transaction记录就产生了,并完成库存数量的扣减和Reservation的删除。Inventory Interface SRS运行完之后,会更新WSH_DELIVERY_DETAILS表的INV_INTERFACED_FLAG字段为Y。
1 DECLARE 2 CURSOR Csr_Wdd IS 3 SELECT Wnd.Delivery_Id 4 FROM Wsh_New_Deliveries Wnd 5 WHERE EXISTS (SELECT 1 6 FROM Wsh_Delivery_Details Wdd, 7 Wsh_Delivery_Assignments Wda 8 WHERE Wdd.Released_Status = ‘C‘ 9 AND Wdd.Delivery_Detail_Id = Wda.Delivery_Detail_Id 10 AND Wda.Delivery_Id = Wnd.Delivery_Id 11 AND Wdd.Source_Line_Id = &Order_Line_Id); 12 l_Error_Message VARCHAR2(20000); 13 l_Retcode VARCHAR2(2); 14 BEGIN 15 FOR Rec_d IN Csr_Wdd LOOP 16 Wsh_Ship_Confirm_Actions.Interface_All_Wrp(Errbuf => l_Error_Message, 17 Retcode => l_Retcode, 18 p_Mode => ‘ALL‘, 19 p_Delivery_Id => Rec_d.Delivery_Id, 20 p_Log_Level => 0); 21 IF (l_retcode <> ‘0‘) THEN 22 dbms_output.put_line(l_Error_Message); 23 ELSE 24 dbms_output.put_line(‘成功!‘); 25 END IF; 26 END LOOP; 27 END;
2.15 工作流后台引擎
这个program用于处理Deffered状态的workflow,Workflow Background Process运行后,相关数据就会从Order表导入到RA Interface表中去(RA_INTERFACE_LINES_ALL,RA_INTERFACE_SALESCREDITS_ALL,RA_Interface_distribution)
你可以通过下边的SQL来查看RA Interface信息:
1.SELECT * FROM RA_INTERFACE_LINES_ALL WHEREsales_order = ‘65961‘;
2.SELECT * FROMRA_INTERFACE_SALESCREDITS_ALL
WHERE INTERFACE_LINE_ID IN (SELECTINTERFACE_LINE_ID FROM RA_INTERFACE_LINES_ALL WHERE sales_order = ‘65961‘ );
3.SELECT * FROM RA_INTERFACE_DISTRIBUTIONS_ALL
WHERE INTERFACE_LINE_ID IN (SELECTINTERFACE_LINE_ID FROM RA_INTERFACE_LINES_ALL WHERE sales_order = ‘65961‘ );
数据插入到RA Interface之后,再看OE_ORDER_LINES_ALL的INVOICE_INTERFACE_STATUS_CODE字段变成了Yes,INVOICED_QUANTITY变为了订单行的数量。并且你会发现订单行的状态变成了Closed,订单头的状态仍为Booked。
2.16 自动开票主程序(生成ARINVOICE)
(三)销售相关其他API
3.1 暂挂/释放暂挂
方法一:
1 DECLARE 2 l_Return_Status VARCHAR2(30); 3 l_Msg_Data VARCHAR2(4000); 4 l_Msg_Count NUMBER; 5 l_Hold_Source_Rec Oe_Holds_Pvt.Hold_Source_Rec_Type; 6 BEGIN 7 8 Fnd_Global.Apps_Initialize(User_Id => 1143,Resp_Id => 50877,Resp_Appl_Id => 20004); 9 mo_global.init(‘CUX‘); 10 mo_global.set_policy_context(‘S‘,88); 11 oe_msg_pub.Initialize; 12 13 l_Hold_Source_Rec := Oe_Holds_Pvt.g_Miss_Hold_Source_Rec; 14 l_Hold_Source_Rec.Hold_Id := &Hold_Id; 15 l_Hold_Source_Rec.Hold_Entity_Code := ‘O‘; -- order level hold 16 l_Hold_Source_Rec.Hold_Entity_Id := &header_id; -- header_id of the order 17 l_Hold_Source_Rec.Header_Id := &header_id; -- header_id of the order 18 --l_Hold_Source_Rec.line_id := &line_id;--如果是暂挂订单行,否则无需赋值 19 20 Oe_Holds_Pub.Apply_Holds(p_Api_Version => 1.0, 21 p_Init_Msg_List => Fnd_Api.g_True, 22 p_Commit => Fnd_Api.g_True, 23 p_Hold_Source_Rec => l_Hold_Source_Rec, 24 x_Return_Status => l_Return_Status, 25 x_Msg_Count => l_Msg_Count, 26 x_Msg_Data => l_Msg_Data); 27 28 IF l_Return_Status = Fnd_Api.g_Ret_Sts_Success THEN 29 Dbms_Output.Put_Line(‘应用暂挂成功!‘); 30 COMMIT; 31 ELSE 32 FOR l_Index IN 1 .. l_Msg_Count LOOP 33 Dbms_Output.Put_Line(oe_Msg_Pub.Get(p_Msg_Index => l_Index,p_Encoded => ‘F‘)); 34 END LOOP; 35 ROLLBACK; 36 END IF; 37 END;
方法二:
1 x_Header_Rec Oe_Order_Pub.Header_Rec_Type; 2 x_Header_Val_Rec Oe_Order_Pub.Header_Val_Rec_Type; 3 x_Header_Adj_Tbl Oe_Order_Pub.Header_Adj_Tbl_Type; 4 x_Header_Adj_Val_Tbl Oe_Order_Pub.Header_Adj_Val_Tbl_Type; 5 x_Header_Price_Att_Tbl Oe_Order_Pub.Header_Price_Att_Tbl_Type; 6 x_Header_Adj_Att_Tbl Oe_Order_Pub.Header_Adj_Att_Tbl_Type; 7 x_Header_Adj_Assoc_Tbl Oe_Order_Pub.Header_Adj_Assoc_Tbl_Type; 8 x_Header_Scredit_Tbl Oe_Order_Pub.Header_Scredit_Tbl_Type; 9 x_Header_Scredit_Val_Tbl Oe_Order_Pub.Header_Scredit_Val_Tbl_Type; 10 x_Line_Tbl Oe_Order_Pub.Line_Tbl_Type; 11 x_Line_Val_Tbl Oe_Order_Pub.Line_Val_Tbl_Type; 12 x_Line_Adj_Tbl Oe_Order_Pub.Line_Adj_Tbl_Type; 13 x_Line_Adj_Val_Tbl Oe_Order_Pub.Line_Adj_Val_Tbl_Type; 14 x_Line_Price_Att_Tbl Oe_Order_Pub.Line_Price_Att_Tbl_Type; 15 x_Line_Adj_Att_Tbl Oe_Order_Pub.Line_Adj_Att_Tbl_Type; 16 x_Line_Adj_Assoc_Tbl Oe_Order_Pub.Line_Adj_Assoc_Tbl_Type; 17 x_Line_Scredit_Tbl Oe_Order_Pub.Line_Scredit_Tbl_Type; 18 x_Line_Scredit_Val_Tbl Oe_Order_Pub.Line_Scredit_Val_Tbl_Type; 19 x_Lot_Serial_Tbl Oe_Order_Pub.Lot_Serial_Tbl_Type; 20 x_Lot_Serial_Val_Tbl Oe_Order_Pub.Lot_Serial_Val_Tbl_Type; 21 x_Action_Request_Tbl Oe_Order_Pub.Request_Tbl_Type; 22 23 i NUMBER := 1; 24 l_Header_Rec Oe_Order_Pub.Header_Rec_Type; 25 l_Line_Tbl Oe_Order_Pub.Line_Tbl_Type; 26 l_Action_Request_Tbl Oe_Order_Pub.Request_Tbl_Type; 27 x_Return_Status VARCHAR2(1); 28 x_Msg_Count NUMBER; 29 x_Msg_Data VARCHAR2(255); 30 31 BEGIN 32 33 Fnd_Global.Apps_Initialize(User_Id => 1143,Resp_Id => 50877,Resp_Appl_Id => 20004); 34 Mo_Global.init(‘CUX‘);--必须初始化职责的应用,否则无法完成OU验证 35 mo_global.set_policy_context(‘S‘,88); 36 Oe_Msg_Pub.Initialize; 37 /*************************** 38 --应用暂挂 39 ***************************/ 40 /*i := 1; 41 l_action_request_tbl(i).request_type := oe_globals.G_APPLY_HOLD; 42 l_action_request_tbl(i).entity_code := oe_globals.G_ENTITY_HEADER; 43 l_action_request_tbl(i).entity_id := &header_id; 44 l_action_request_tbl(i).param1 := &Hold_ID;--暂挂名称标记 45 l_action_request_tbl(i).param2 := ‘O‘;--暂挂来源:“O”表示来自订单的暂挂 46 --选填字段 47 \*l_action_request_tbl(i).Param3 := --暂挂来源的ID* 48 \*l_action_request_tbl(i).param4 := ‘‘; --暂挂备注* 49 \*l_action_request_tbl(i).date_param1 := sysdate+7;--暂挂截止日* 50 \*l_action_request_tbl(i).parm6-param20 attribute1-15*\*/ 51 /*************************** 52 ---释放暂挂 53 ***************************/ 54 i := 1; 55 l_action_request_tbl(i).request_type := oe_globals.G_RELEASE_HOLD; 56 l_action_request_tbl(i).entity_code := oe_globals.G_ENTITY_HEADER; 57 l_action_request_tbl(i).entity_id := &header_id; 58 l_action_request_tbl(i).param1 := &Hold_ID;--暂挂名称标记 59 l_action_request_tbl(i).param4 := ‘&reason_code‘;--释放原因 60 61 /*--选填字段 62 param2和param3这两个参数只是为了更精准的定位一个暂估名称 63 l_action_request_tbl(i).param2 := ‘O‘; --暂挂来源:“O”表示来自订单 64 l_action_request_tbl(i).Param3 := ‘‘ --暂挂来源的ID 65 /*l_action_request_tbl(i).param5 := ‘手工取消‘;--释放备注*/ 66 67 Oe_Order_Pub.Process_Order(p_Api_Version_Number => 1.0, 68 p_Init_Msg_List => NULL, 69 p_Return_Values => NULL, 70 p_Action_Request_Tbl => l_Action_Request_Tbl, 71 --out 72 x_Header_Rec => x_Header_Rec, 73 x_Header_Val_Rec => x_Header_Val_Rec, 74 x_Header_Adj_Tbl => x_Header_Adj_Tbl, 75 x_Header_Adj_Val_Tbl => x_Header_Adj_Val_Tbl, 76 x_Header_Price_Att_Tbl => x_Header_Price_Att_Tbl, 77 x_Header_Adj_Att_Tbl => x_Header_Adj_Att_Tbl, 78 x_Header_Adj_Assoc_Tbl => x_Header_Adj_Assoc_Tbl, 79 x_Header_Scredit_Tbl => x_Header_Scredit_Tbl, 80 x_Header_Scredit_Val_Tbl => x_Header_Scredit_Val_Tbl, 81 x_Line_Tbl => x_Line_Tbl, 82 x_Line_Val_Tbl => x_Line_Val_Tbl, 83 x_Line_Adj_Tbl => x_Line_Adj_Tbl, 84 x_Line_Adj_Val_Tbl => x_Line_Adj_Val_Tbl, 85 x_Line_Price_Att_Tbl => x_Line_Price_Att_Tbl, 86 x_Line_Adj_Att_Tbl => x_Line_Adj_Att_Tbl, 87 x_Line_Adj_Assoc_Tbl => x_Line_Adj_Assoc_Tbl, 88 x_Line_Scredit_Tbl => x_Line_Scredit_Tbl, 89 x_Line_Scredit_Val_Tbl => x_Line_Scredit_Val_Tbl, 90 x_Lot_Serial_Tbl => x_Lot_Serial_Tbl, 91 x_Lot_Serial_Val_Tbl => x_Lot_Serial_Val_Tbl, 92 x_Action_Request_Tbl => x_Action_Request_Tbl, 93 x_Return_Status => x_Return_Status, 94 x_Msg_Count => x_Msg_Count, 95 x_Msg_Data => x_Msg_Data); 96 97 IF (x_Msg_Count>0) THEN--这里不能按x_return_status的状态判断 98 FOR l_Index IN 1 .. x_Msg_Count LOOP 99 Dbms_Output.Put_Line(Oe_Msg_Pub.Get(p_Msg_Index => l_Index,p_Encoded => ‘F‘)); 100 END LOOP; 101 ELSE 102 Dbms_Output.Put_Line(‘暂挂成功!‘); 103 END IF; 104 END;
3.2 修改量(创建/更新)
1 DECLARE 2 l_header_rec oe_order_pub.header_rec_type; 3 l_line_tbl oe_order_pub.line_tbl_type; 4 l_line_adj_tbl oe_order_pub.Line_Adj_Tbl_Type; 5 --OUT var 6 x_header_rec oe_order_pub.header_rec_type; 7 x_header_val_rec oe_order_pub.header_val_rec_type; 8 x_header_adj_tbl oe_order_pub.header_adj_tbl_type; 9 x_header_adj_val_tbl oe_order_pub.header_adj_val_tbl_type; 10 x_header_price_att_tbl oe_order_pub.header_price_att_tbl_type; 11 x_header_adj_att_tbl oe_order_pub.header_adj_att_tbl_type; 12 x_header_adj_assoc_tbl oe_order_pub.header_adj_assoc_tbl_type; 13 x_header_scredit_tbl oe_order_pub.header_scredit_tbl_type; 14 x_header_scredit_val_tbl oe_order_pub.header_scredit_val_tbl_type; 15 x_line_tbl oe_order_pub.line_tbl_type; 16 x_line_val_tbl oe_order_pub.line_val_tbl_type; 17 x_line_adj_tbl oe_order_pub.line_adj_tbl_type; 18 x_line_adj_val_tbl oe_order_pub.line_adj_val_tbl_type; 19 x_line_price_att_tbl oe_order_pub.line_price_att_tbl_type; 20 x_line_adj_att_tbl oe_order_pub.line_adj_att_tbl_type; 21 x_line_adj_assoc_tbl oe_order_pub.line_adj_assoc_tbl_type; 22 x_line_scredit_tbl oe_order_pub.line_scredit_tbl_type; 23 x_line_scredit_val_tbl oe_order_pub.line_scredit_val_tbl_type; 24 x_lot_serial_tbl oe_order_pub.lot_serial_tbl_type; 25 x_lot_serial_val_tbl oe_order_pub.lot_serial_val_tbl_type; 26 x_action_request_tbl oe_order_pub.request_tbl_type; 27 28 CURSOR csr_modify IS 29 SELECT ql.* 30 FROM qp_list_lines ql 31 WHERE ql.list_line_id = &modify_list_line_id; 32 33 l_return_status VARCHAR2(1); 34 l_msg_count NUMBER; 35 l_msg_data VARCHAR2(2000); 36 l_price_adjustment_id NUMBER; 37 BEGIN 38 39 fnd_global.apps_initialize(user_id => 1143,resp_id => 50877,resp_appl_id => 20004); 40 Mo_Global.init(‘CUX‘); 41 oe_msg_pub.initialize; 42 43 l_header_rec := oe_order_pub.g_miss_header_rec; 44 l_header_rec.header_id := &header_id; 45 l_header_rec.operation := oe_globals.g_opr_update; 46 47 l_line_tbl.delete; 48 l_line_tbl(1) := oe_order_pub.g_miss_line_rec; 49 l_line_tbl(1).header_id := l_header_rec.header_id; 50 l_line_tbl(1).operation := oe_globals.g_opr_update; 51 l_line_tbl(1).calculate_price_flag := ‘Y‘; 52 l_line_tbl(1).line_id := &line_id; 53 54 --/*判断是否存在相同名称的修改量*/ 55 BEGIN 56 SELECT opa.price_adjustment_id 57 INTO l_price_adjustment_id 58 FROM oe_price_adjustments opa 59 WHERE opa.list_line_id = &modify_list_line_id 60 AND opa.line_id = &line_id 61 AND opa.applied_flag = ‘Y‘ 62 AND ROWNUM =1; 63 EXCEPTION 64 WHEN OTHERS THEN NULL; 65 END; 66 67 IF (l_price_adjustment_id IS NULL) THEN--创建修改量 68 FOR rec_mod IN csr_modify LOOP 69 l_line_adj_tbl(1) := oe_order_pub.g_miss_line_adj_rec; 70 l_line_adj_tbl(1).operation := oe_globals.g_opr_create; 71 l_line_adj_tbl(1).header_id := l_header_rec.header_id; 72 l_line_adj_tbl(1).line_id := l_line_tbl(1).line_id; 73 l_line_adj_tbl(1).list_header_id := rec_mod.list_header_id; 74 l_line_adj_tbl(1).list_line_id := rec_mod.list_line_id; 75 l_line_adj_tbl(1).applied_flag := ‘Y‘;--applied_flag该字段是表示修改量是否应用,如果为否或为空,修改量不会应用到销售定价上.在界面查不到 76 l_line_adj_tbl(1).updated_flag := ‘Y‘; 77 l_line_adj_tbl(1).operand := &operand; 78 END LOOP; 79 ELSE--更新修改量 80 l_line_adj_tbl(1) := oe_order_pub.G_MISS_LINE_ADJ_REC; 81 l_line_adj_tbl(1).operation := oe_globals.g_opr_update; 82 l_line_adj_tbl(1).price_adjustment_id := l_price_adjustment_id; 83 l_line_adj_tbl(1).operand := &operand; 84 l_Line_Adj_Tbl(1).Updated_Flag := ‘Y‘; 85 l_line_adj_tbl(1).change_reason_code := ‘MANUAL‘; 86 END IF; 87 88 OE_Order_PUB.process_order(p_org_id => &org_id, 89 p_api_version_number => 1.0, 90 p_init_msg_list => NULL, 91 p_return_values => NULL, 92 p_header_rec => l_header_rec, 93 p_line_tbl => l_line_tbl, 94 p_Line_Adj_tbl => l_line_adj_tbl, 95 x_header_rec => x_header_rec, 96 x_header_val_rec => x_header_val_rec, 97 x_header_adj_tbl => x_header_adj_tbl, 98 x_header_adj_val_tbl => x_header_adj_val_tbl, 99 x_header_price_att_tbl => x_header_price_att_tbl, 100 x_header_adj_att_tbl => x_header_adj_att_tbl, 101 x_header_adj_assoc_tbl => x_header_adj_assoc_tbl, 102 x_header_scredit_tbl => x_header_scredit_tbl, 103 x_header_scredit_val_tbl => x_header_scredit_val_tbl, 104 x_line_tbl => x_line_tbl, 105 x_line_val_tbl => x_line_val_tbl, 106 x_line_adj_tbl => x_line_adj_tbl, 107 x_line_adj_val_tbl => x_line_adj_val_tbl, 108 x_line_price_att_tbl => x_line_price_att_tbl, 109 x_line_adj_att_tbl => x_line_adj_att_tbl, 110 x_line_adj_assoc_tbl => x_line_adj_assoc_tbl, 111 x_line_scredit_tbl => x_line_scredit_tbl, 112 x_line_scredit_val_tbl => x_line_scredit_val_tbl, 113 x_lot_serial_tbl => x_lot_serial_tbl, 114 x_lot_serial_val_tbl => x_lot_serial_val_tbl, 115 x_action_request_tbl => x_action_request_tbl, 116 x_return_status => l_return_status, 117 x_msg_count => l_msg_count, 118 x_msg_data => l_msg_data); 119 IF (l_return_status <> ‘S‘) THEN 120 FOR l_index IN 1 .. l_msg_count LOOP 121 dbms_output.put_line(oe_msg_pub.get(p_msg_index => l_index,p_encoded=>‘F‘)); 122 END LOOP; 123 ELSE 124 COMMIT; 125 dbms_output.put_line(‘创建/修改修改量成功!‘); 126 END IF; 127 END;
3.3 重订价
1 DECLARE 2 l_sel_rec_tbl oe_globals.selected_record_tbl; 3 l_return_status VARCHAR2(100); 4 l_msg_count NUMBER; 5 l_msg_data VARCHAR2(100); 6 x_msg_data VARCHAR2(1000); 7 8 BEGIN 9 mo_global.init(‘ONT‘); 10 oe_msg_pub.initialize; 11 oe_debug_pub.initialize; 12 fnd_global.apps_initialize(user_id => 1170, 13 resp_id => 50717, 14 resp_appl_id => 20005); 15 l_sel_rec_tbl(1).id1 := 3012; --LINE_ID/HEADER_ID 16 l_sel_rec_tbl(1).org_id := 82; 17 oe_order_adj_pvt.price_action(p_selected_records => l_sel_rec_tbl, 18 p_price_level => ‘LINE‘ --‘LINE‘/‘ORDER‘ 19 , 20 x_return_status => l_return_status, 21 x_msg_count => l_msg_count, 22 x_msg_data => l_msg_data); 23 24 IF l_msg_count > 0 THEN 25 FOR l_index IN 1 .. l_msg_count LOOP 26 l_msg_data := oe_msg_pub.get(p_msg_index => l_index, 27 p_encoded => ‘F‘); 28 x_msg_data := x_msg_data || ‘-‘ || l_msg_data; 29 END LOOP; 30 31 dbms_output.put_line(‘E‘); 32 dbms_output.put_line(‘l_return_status:‘ || l_return_status); 33 dbms_output.put_line(‘l_msg_count:‘ || l_msg_count); 34 dbms_output.put_line(‘x_msg_data:‘ || x_msg_data); 35 36 ELSE 37 dbms_output.put_line(‘S‘); 38 dbms_output.put_line(‘l_return_status:‘ || l_return_status); 39 dbms_output.put_line(‘l_msg_count:‘ || l_msg_count); 40 dbms_output.put_line(‘x_msg_data:‘ || x_msg_data); 41 END IF; -- IF l_msg_count > 0 THEN 42 END; 43 44 /*SELECT * FROM OE_PRICE_ADJUSTMENTS;*/
3.4 更多API参考
Note Number |
Script Description |
How does one import Credit Card Payments using Process Order API ? |
|
How does one process orders from different operating units using Process Order API ? |
|
How Does One Book An Order Using Process Order API ? |
|
How Does One Update Order Header Details Using Process Order API For R12 ? |
|
Script To Create An Order With One Line |
|
Process Order API In Order Management |
|
Script To Add A New Line To An Existing Order |
|
Script To Cancel An Existing Order |
|
Script To Cancel An Existing Order Line |
|
Script To Update An Existing Order Line |
|
Script To Reserve an Order Line |
|
Script To Unreserve An Order Line |
|
Script To Split An Order Line |
|
Script To Delete An Order |
|
Script To Delete An Order Line |
|
Script To Apply Hold in Sales Order |
|
Script To Release Hold In A Sales Order |
|
How does one update Unit Price using Process Order API? |
|
How Does One Book An Order Using OE_INBOUND_INT.PROCESS_ORDER() ? |
|
Process Order API In Order Management - R12 Updates |
|
Need Script To Apply Hold using Process Order API in R12 ? |
|
Seeded API Not Generating Trxn_Extension_id In Oe_payments Table For ACH Payment Type Information |
(四)信用控制
客户信用限额
参考博客:http://blog.csdn.net/caixingyun/article/category/2587183
(五)高级定价
高级定价知识&应用
参考博客:http://blog.csdn.net/cai_xingyun/article/details/41009943
http://blog.csdn.net/cai_xingyun/article/details/41010189
https://www.cnblogs.com/AI-xiaocai/p/11820340.html
更多参考博客:http://blog.csdn.net/cai_xingyun/article/category/2701797