码迷,mamicode.com
首页 > 其他好文 > 详细

EBS 物料单位换算

时间:2015-10-08 16:26:37      阅读:897      评论:0      收藏:0      [点我收藏+]

标签:

api: inv_convert.inv_um_convert

 

FUNCTION get_uom_rate(pn_item_id NUMBER
,pv_from_uom VARCHAR2) RETURN NUMBER AS
lv_from_uom_code VARCHAR2(15);
lv_from_uom VARCHAR2(15);
lv_to_uom_code VARCHAR2(15);
lv_to_uom VARCHAR2(15);

ln_return_rate NUMBER;
BEGIN
BEGIN
SELECT msi.primary_uom_code
,msi.primary_unit_of_measure
INTO lv_to_uom_code
,lv_to_uom
FROM mtl_system_items_b msi
WHERE msi.inventory_item_id = pn_item_id
AND msi.organization_id = gn_default_organization_id;
EXCEPTION
WHEN OTHERS THEN
lv_to_uom_code := NULL;
END;
--dbms_output.put_line(pv_from_uom ||‘--‘||lv_to_uom_code||‘--‘);
IF pv_from_uom = lv_to_uom
THEN
ln_return_rate := 1;
ELSE
SELECT inv_uom.from_uom_code
INTO lv_from_uom_code
FROM (SELECT mucc.from_uom_code
,mucc.from_uom_class
,mucc.from_unit_of_measure
,mucc.inventory_item_id
FROM mtl_uom_class_conversions mucc
UNION
SELECT mucc.to_uom_code
,mucc.to_uom_class
,mucc.to_unit_of_measure
,mucc.inventory_item_id
FROM mtl_uom_class_conversions mucc) inv_uom
WHERE inv_uom.from_unit_of_measure = pv_from_uom
AND inv_uom.inventory_item_id = pn_item_id;

ln_return_rate := inv_convert.inv_um_convert(pn_item_id, lv_from_uom_code, lv_to_uom_code);
END IF;
RETURN ln_return_rate;
END;

EBS 物料单位换算

标签:

原文地址:http://www.cnblogs.com/gary-bao/p/4861145.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!