Oracle INV现用量,可保留量,可处理量
create or replace procedure get_inv_quantity(p_organization_id in number,
p_inventory_item_id in number,
p_lot_number in varchar2,
p_subinventory_code in varchar2,
p_locator_id in number,
x_onhand_qty out number,
x_reservable_qty out number,
x_transactable_qty out number) is
l_return_status varchar2(1);
l_msg_count number;
l_msg_data varchar2(2000);
l_is_revision_control boolean := true;
l_is_lot_control boolean := true;
l_is_serial_control boolean := false;
p_revision varchar2(100);
l_qoh number;
l_rqoh number;
l_qr number;
l_qs number;
l_att number;
l_atr number;
p_lpn_id number;
begin
if p_lot_number is null then
l_is_lot_control := false;
end if;
if p_locator_id is null then
l_is_lot_control := false;
end if;
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 => 1,
p_is_revision_control => false, -- no revision control
p_is_lot_control => l_is_lot_control,
p_is_serial_control => l_is_serial_control,
p_demand_source_type_id => 2,
p_revision => null,
p_lot_number => p_lot_number,
p_lot_expiration_date => sysdate,
p_subinventory_code => p_subinventory_code,
p_locator_id => p_locator_id,
p_onhand_source => 3,
x_qoh => l_qoh,
x_rqoh => l_rqoh,
x_qr => l_qr,
x_qs => l_qs,
x_att => l_att,
x_atr => l_atr,
p_lpn_id => null);
if (l_return_status = 'S') then
x_onhand_qty := l_qoh;
x_reservable_qty := l_atr;
else
l_return_status := 'F';
return;
end if;
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, -- no revision control
p_is_lot_control => l_is_lot_control,
p_is_serial_control => l_is_serial_control,
p_demand_source_type_id => 2,
p_revision => null,
p_lot_number => p_lot_number,
p_lot_expiration_date => sysdate,
p_subinventory_code => p_subinventory_code,
p_locator_id => p_locator_id,
p_onhand_source => 3,
x_qoh => l_qoh,
x_rqoh => l_rqoh,
x_qr => l_qr,
x_qs => l_qs,
x_att => l_att,
x_atr => l_atr,
p_lpn_id => null);
if (l_return_status = 'S') then
x_onhand_qty := l_qoh;
x_transactable_qty := l_att;
else
l_return_status := 'F';
return;
end if;
end get_inv_quantity;
create or replace function get_reservable_qty(p_organization_id number,
p_inventory_item_id number,
p_sub varchar2)
return number is
l_onhand_qty number;
l_reservable_qty number;
l_transactable_qty number;
begin
--p_sub可以为空,为空时,所有库别的可保留数量
get_inv_quantity(p_organization_id => p_organization_id,
p_inventory_item_id => p_inventory_item_id,
p_lot_number => null,
p_subinventory_code => p_sub,
p_locator_id => null,
x_onhand_qty => l_onhand_qty,
x_reservable_qty => l_reservable_qty,
x_transactable_qty => l_transactable_qty);
return l_reservable_qty;
end get_reservable_qty;
本文来自博客园,作者:Iven_lin,转载请注明原文链接:https://www.cnblogs.com/ivenlin/p/18082045
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了