ERP系统里的BOM展开函数
ERP系统里的BOM展开函数:
l_grp_id NUMBER ;
l_session_id NUMBER ;
l_org_id NUMBER ;
l_levels_to_explode NUMBER := 10 ;
l_module NUMBER DEFAULT 2 ; -- BOM = 2
l_cst_type_id NUMBER DEFAULT -1 ; -- All cost = -1 else 0
l_item_id NUMBER ;
l_bom_or_eng NUMBER ;
l_using_req_quantity NUMBER ;
l_using_ass_dem_date DATE ;
l_rev_date VARCHAR2(20):= to_char(bom_dt,'DD-MON-YY HH24:MI');
l_err_msg VARCHAR2(250) ;
l_error_code NUMBER ;
BEGIN
-- 首先要有一个Group id
SELECT bom_explosion_temp_s.NEXTVAL
INTO l_grp_id
FROM dual ;
-- 其次要得到一个Session id
SELECT bom_explosion_temp_session_s.NEXTVAL
INTO l_session_id
FROM dual ;
bompexpl.exploder_userexit(
verify_flag =>0,
org_id =>l_org_id,
order_by =>1,
grp_id =>l_grp_id,
session_id =>l_session_id,
levels_to_explode =>l_levels_to_explode,
bom_or_eng =>l_bom_or_eng,
impl_flag =>1,
plan_factor_flag =>2,
explode_option =>2, -- 2,
module =>l_module,
cst_type_id =>l_cst_type_id,
std_comp_flag =>2,
expl_qty =>1,
item_id =>l_item_id,
alt_desg =>'',
comp_code =>'',
rev_date =>l_rev_date,
err_msg =>l_err_msg,
error_code =>l_error_code
);
END ;
运行结束后用以下语句得到结果.
SELECT * FROM bom_explosion_temp bet
WHERE bet.group_id = l_grp_id