API wsh_deliveries_pub.delivery_action問題點:
一、發運確認會調用接口請求,同一個SO對應幾個交貨號會報出現鎖,
二、請求會存在延時,報表不能輸出正確的結果
解決方法:
把發運確認API設置爲延遲接口,即p_sc_defer_interface_flag爲‘Y’,
而後存儲過程當中直接調用鏈接停靠站過程。app
declareide
--PARAMETER FOR "WSH_DELIVERIES_PUB.Delivery_Action"spa
x_Return_Status Varchar2(1);
x_Msg_Count Number;
x_Msg_Data Varchar2(3500);
l_Trip_Id Number;
l_Trip_Name Varchar2(40);
x_msg_details VARCHAR2(3000);
x_msg_summary VARCHAR2(3000);code
BEGINorm
fnd_global.apps_initialize(1371,50627,660);接口
Wsh_Deliveries_Pub.Delivery_Action(p_Api_Version_Number => 1.0,
p_Init_Msg_List => Fnd_Api.g_True,
x_Return_Status => x_Return_Status,
x_Msg_Count => x_Msg_Count,
x_Msg_Data => x_Msg_Data,
p_Action_Code => 'CONFIRM',
p_Delivery_Id => R2.DELIVERY_ID,
p_sc_rule_id => 21, --發運規則 select * from wsh_ship_confirm_rules
p_sc_action_flag => 'S', --s/a/c/o: Ship entered quantity--option - 'S', 'B', 'T', 'A', 'C'
p_sc_stage_del_flag => 'Y', --ship confirm create delivery for staged quantity flag
p_sc_actual_dep_date => sysdate, --ship confirm actual departure date
p_sc_intransit_flag => 'Y', --ship confirm set in-transit flag
p_sc_close_trip_flag => 'Y', --ship confirm close trip flag
p_sc_create_bol_flag => 'N', --ship confirm create BOL flag
p_sc_defer_interface_flag => 'Y', --ship confirm defer interface flag --爲‘Y’,手動運行鏈接停靠站
--p_sc_report_set_id => 6, --Ship Confirm Documents:from wsh_report_sets where usage_code='SHIP_CONFIRM'
x_Trip_Id => l_Trip_Id,
x_Trip_Name => l_Trip_Name);
if (x_return_status <> WSH_UTIL_CORE.G_RET_STS_SUCCESS and
x_return_status <> 'W') then
rollback;
--raise Api_Failed;
elseip
--調用鏈接停靠站請求過程
--defer_interface_flag是'Y',需運行如下接口請求
wsh_ship_confirm_actions.interface_all(errbuf => errbuf2,
retcode => retcode2,
p_mode => p_mod,
p_stop_id => p_stop_id,
p_delivery_id => R2.delivery_id,
p_log_level => p_log_level);
IF retcode != '0' THEN
rollback;
ELSE
commit;
END IF;
end if;
it
end;io