|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
請教,如何用程序去自動book符合條件的SO?
我將SO的from下載下來,查看了其中的trigger,代碼如下 分別調用了其中的幾個procedure,都不能book訂單)
------------------------------------------------------------------------------
PROCEDURE Book_Order_Button
------------------------------------------------------------------------------
(
event IN VARCHAR2
) IS
l_header_id NUMBER;
l_return_status VARCHAR2(30);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_booked_flag_field VARCHAR2(80) := 'ORDER.BOOKED_FLAG';
l_commit_result BOOLEAN;
l_selection_type VARCHAR2(30);
-- MOAC CHANGES
l_record_ids OE_GLOBALS.Selected_Record_Tbl;
l_count NUMBER;
l_error_count NUMBER := 1;
l_block_name VARCHAR2(30);
l_continue BOOLEAN;
l_so_doc_type VARCHAR2(2) := OE_CONTRACTS_UTIL.get_G_SO_DOC_TYPE();
l_qa_return_status VARCHAR2(1);
l_sign_by DATE;
l_header_id_char VARCHAR2(50);
l_multi_OU BOOLEAN;
l_msg_tbl OE_MSG_PUB.msg_tbl_type; -- bug 4374444
l_init_msg_list VARCHAR2(1); -- Bug 6255128
l_item_key VARCHAR2(30); --Bug 6338223
l_exists NUMBER; -- Bug 6338223
BEGIN
IF (event IN ('WHEN-NEW-RECORD-INSTANCE','POST-BLOCK')) THEN
-- Disable the Book button if order is already booked
IF NVL(NAME_IN(l_booked_flag_field),'N') = 'Y' THEN
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_OFF);
ELSE
/* commenting the logic to disable the book_order button in negotiation phase.
During TSO Enabled contact Center Project, it is decided to always make the book order button enabled.
Changes for Bug 6338223*/
IF Name_In('PARAMETER.OE_CODE_RELEASE_LEVEL') >= '110510' THEN
IF Name_In('Order.transaction_phase_code') = 'N' THEN
IF Name_In('SYSTEM.RECORD_STATUS') NOT IN ('NEW','INSERT') THEN
l_item_key := Name_In('Order.header_id');
BEGIN
SELECT 1 INTO l_exists
FROM wf_item_activity_statuses s,
wf_process_activities pa,
wf_activities act
WHERE s.item_type = 'OENH'
AND s.item_key = to_char(l_item_key)
AND s.process_activity = pa.instance_id
AND s.activity_status = 'NOTIFIED'
AND act.NAME = pa.activity_name
AND act.item_type = s.item_type
AND act.version = (SELECT MAX(act1.version)
FROM wf_activities act1
WHERE act1.item_type = act.item_type
AND act1.name = act.name)
AND act.function = 'OE_STANDARD_WF.STANDARD_BLOCK' ;
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_ON);
EXCEPTION
WHEN no_data_found THEN
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_OFF);
END;
ELSE
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_OFF);
END IF;
ELSE
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_ON);
END IF;
ELSE
APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_ON);
END IF;
/* APP_ITEM_PROPERTY.Set_Property( 'ORDER_CONTROL.BOOK_ORDER'
, ENABLED, PROPERTY_ON); */
END IF;
ELSIF (event = 'WHEN-BUTTON-PRESSED') THEN
IF(Name_In('Parameter.startup_mode')='CONTACT_CENTER') THEN
if (get_canvas_property('ORDERS_TAB',topmost_tab_page) ='LINES') then
go_block('line');
end if;
if (get_canvas_property('ORDERS_TAB',topmost_tab_page) ='ORDER_BASIC') then
go_block('order');
end if;
if (get_canvas_property('ORDERS_TAB',topmost_tab_page) ='ORDER_SUMMARY') then
go_block('Recurring_charges');
end if;
end if;
l_block_name := Name_IN('SYSTEM.CURSOR_BLOCK');
-- cc project, bug 4691707
IF(l_block_name in ('RECURRING_CHARGES','OE_PAYMENTS_INFO')) THEN
l_block_name :='ORDER';
END IF;
--Related_Items added for bug 2987992
if l_block_name='RELATED_ITEMS' then
l_block_name := 'LINE' ;
l_count := 1;
l_selection_type := 'LINE';
l_header_id := Name_In(l_block_name||'.Header_Id');
else
OE_SO_MASSCHANGE.Get_Selected_Ids
( l_block_name
, l_selection_type
, l_record_ids
, l_count
, l_multi_ou);
-- selection type is LINE if order booked from
-- the LINE block
IF l_selection_type = 'LINE' THEN
l_count := 1;
l_header_id := Name_In(l_block_name||'.HEADER_ID');
ELSIF l_count = 1 THEN
l_header_id := Name_In(l_block_name||'.HEADER_ID');
END IF;
end if; --end bug2987992
-- commit changes if any to the order
OE_NAVIGATE.Commit_Pending_Changes;
-- Bug 6255128 starts
-- If there messages that are not yet displayed, then the message data will not be intialised
IF OE_MSG_PUB.Count_Msg > 1 THEN
l_init_msg_list := OE_Client_Globals.G_FALSE;
copy('Y','GLOBAL.MESSAGES_DISPLAYED_IN_BOOKING');
ELSE
l_init_msg_list := OE_Client_Globals.G_TRUE;
END IF;
-- Bug 6255128 ends
--start 4900713
APPCORE_CUSTOM.event('OM_PRE_BOOK_EVENT');
--end 4900713
-- only one order selected
IF l_count = 1 THEN
/* cc project */
IF (Name_In(l_block_name||'.transaction_phase_code') = 'N')
THEN
OE_Order_Wf_Util.Complete_eligible_and_Book
( p_api_version_number =>1.0
, p_init_msg_list => OE_Client_Globals.G_TRUE
, p_header_id => l_header_id
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data);
ELSE
-- Progress the workflow so that booking process is kicked off.
-- This call should come back with a message OE_ORDER_BOOKED
-- if booking completed successfully and if booking was deferred,
-- message OE_ORDER_BOOK_DEFERRED is added to the stack.
-- If booking was not successful, it should come back with a
-- return status of FND_API.G_RET_STS_ERROR or
-- FND_API.G_RET_STS_UNEXP_ERROR
OE_Order_Book_Util.Complete_Book_Eligible
( p_api_version_number => 1.0
, p_init_msg_list => l_init_msg_list -- OE_Client_Globals.G_TRUE - Bug 6255128
, p_header_id => l_header_id
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data);
END IF;
/*cc project*/
IF l_return_status = OE_Client_Globals.G_RET_STS_SUCCESS THEN -- 1700784
l_error_count := 0;
END IF;
ELSE
-- More than one order selected, therefore call the utility that
-- would parse the record id string and progress each order
-- individually. This procedure would return status of
-- FND_API.G_RET_STS_SUCCESS only if all orders are booked
-- successfully
OE_Order_Book_Util.Book_Multiple_Orders
( p_api_version_number => 1.0
, p_init_msg_list => OE_Client_Globals.G_TRUE
, p_header_id_list => l_record_ids
, p_header_count => l_count
, x_error_count => l_error_count
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
);
END IF;
--start 4900713
APPCORE_CUSTOM.event('OM_POST_BOOK_EVENT');
--end 4900713
IF ( l_block_name IN ('ORDER','LINE') AND l_return_status = OE_Client_Globals.G_RET_STS_SUCCESS)
THEN
-- Bug 3401187
-- Commit before displaying success messages
-- Set g_exec_post_forms_commit to N - this will prevent
-- the message stack from being cleared as process_object
-- is not executed
-- Removed all the commented code to keep the code readble.
-- This has been done to fix bug 4776672
--OE_NAVIGATE.g_exec_post_forms_commit := 'N'; -- commented for bug 4374444
oe_msg_pub.get_msg_tbl(l_msg_tbl); -- added for 4374444
l_commit_result := APP_FORM.QuietCommit;
IF l_msg_count = 1 THEN
fnd_message.set_string(l_msg_tbl(1).message);
fnd_message.show;
OE_MSG_PUB.Delete_Msg;
OE_REFRESH.Refresh_Block('order');
ELSIF l_msg_count > 1 THEN /*3663684*/
OE_MSG_PUB.Populate_Msg_tbl(l_msg_tbl);
oe_ui_message.open_message(
p_block_name => name_in('system.cursor_block'),
p_processed => l_count,
p_success => (l_count - l_error_count),
p_error => l_error_count,
p_continue => TRUE,
p_cancel => FALSE,
p_process_name => 'BOOK');
END IF; /*3663684*/
APP_ITEM_PROPERTY.Set_Property('ORDER_CONTROL.BOOK_ORDER' , ENABLED,PROPERTY_OFF);
ELSE
-- Bug 1238010: if block is a single record block ('ORDER','LINE')
-- If user clicks on 'Continue', the action is saved and the block is
-- refreshed. Please look at the continue_process logic in OEXERMSG.pld
oe_ui_message.open_message(
p_block_name => name_in('system.cursor_block'),
p_processed => l_count,
p_success => (l_count - l_error_count),
p_error => l_error_count,
p_continue => TRUE,
p_cancel => FALSE, --bug4923402
p_process_name => 'BOOK'
);
END IF;
ELSE
APP_EXCEPTION.Invalid_Argument('OE_ORDER_CONTROL.Book_Order_Button',
'Event', Event);
END IF;
END Book_Order_Button;
该贴已经同步到 beyonce_nero的微博 |
|