电子表—取现有量
物料工作台 现有量
inv_quantity_tree_pub.clear_quantity_cache;
inv_quantity_tree_pub.query_quantities(p_api_version_number => 1.0
,p_init_msg_lst => 'F'
,x_return_status => l_return_status
,x_msg_count => l_msg_count
,x_msg_data => l_msg_data
,p_organization_id => p_organization_id
,p_inventory_item_id => p_inventory_item_id -- 物料
,p_tree_mode => 2
,p_is_revision_control => FALSE
,p_is_lot_control => TRUE --- 是否受批次控制
,p_is_serial_control => false -- 是否受序列控制
,p_revision => NULL
,p_lot_number => p_lot_number -- 批次
,p_lot_expiration_date => NULL
,p_subinventory_code => p_subinventory_code -- 库存
,p_locator_id => p_inventory_location_id -- 货位
,p_onhand_source => inv_quantity_tree_pvt.g_all_subs
,x_qoh => l_qoh -- 现有量
,x_rqoh => l_rqoh
,x_qr => l_qr
,x_qs => l_qs
,x_att => l_att -- 可用量
,x_atr => l_atr -- 可保留量);
FUNCTION get_item_att_qty(p_inventory_item_id NUMBER,--物料
p_organization_id NUMBER,--库存组织
p_subinventory_code VARCHAR,--子库存
p_inventory_location_id NUMBER--
) RETURN NUMBER IS
l_onhand_qty NUMBER;
l_resv_qty NUMBER;
l_qoh NUMBER;
l_rqoh NUMBER;
l_qr NUMBER;
l_qs NUMBER;
l_att NUMBER;
l_atr NUMBER;
l_tree_mode NUMBER;
l_booked_qty NUMBER;
l_msg_count VARCHAR2(100);
l_msg_data VARCHAR2(1000);
l_return_status VARCHAR2(1);
x_return VARCHAR2(1);
BEGIN
-- Transact mode
l_tree_mode := 2;
inv_quantity_tree_pub.clear_quantity_cache;
inv_quantity_tree_pub.query_quantities(p_api_version_number => 1.0,
p_init_msg_lst => 'F',
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_organization_id => p_organization_id,
p_inventory_item_id => p_inventory_item_id,
p_tree_mode => l_tree_mode,
p_is_revision_control => FALSE,
p_is_lot_control => FALSE,
p_is_serial_control => FALSE,
p_revision => NULL,
p_lot_number => NULL,
p_lot_expiration_date => NULL,
p_subinventory_code => p_subinventory_code,
p_locator_id => p_inventory_location_id,
p_onhand_source => inv_quantity_tree_pvt.g_all_subs,
x_qoh => l_qoh,
x_rqoh => l_rqoh,
x_qr => l_qr,
x_qs => l_qs,
x_att => l_att, --可用量
x_atr => l_atr); --可保留量
RETURN l_att;
END get_item_att_qty;