Oracle EBS OPM 查询现有量
--查询现有量
--created by jenrry
DECLARE
p_inventory_item_id NUMBER := 231652; --NOT NULL
p_organization_id NUMBER := 104; --NOT NULL
p_subinventory VARCHAR2(30) := 'JSK01';
p_locator_id NUMBER := NULL;
p_lot_number VARCHAR2(30) := NULL;
p_qty_type VARCHAR2(30) := 'QOH';
p_onhand_source NUMBER := 3; l_quantity NUMBER;
-- reutnr msg parameter
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000); -- return quantity parameter
l_qty_on_hand NUMBER;
l_qty_res_on_hand NUMBER;
l_qty_res NUMBER;
l_qty_sug NUMBER;
l_qty_att NUMBER;
l_qty_available_to_reserve NUMBER;
l_sqty_on_hand NUMBER;
l_sqty_res_on_hand NUMBER;
l_sqty_res NUMBER;
l_sqty_sug NUMBER;
l_sqty_att NUMBER;
l_sqty_available_to_reserve NUMBER; l_revision_control mtl_system_items_b.revision_qty_control_code%TYPE;
l_lot_control_type mtl_system_items_b.lot_control_code%TYPE;
l_item_serial_control_code mtl_system_items_b.serial_number_control_code%TYPE; --contorl parameter
l_is_revision_control BOOLEAN;
l_is_lot_control BOOLEAN;
l_is_serial_control BOOLEAN;
BEGIN
--
-- get attribute of the item
--
SELECT msi.revision_qty_control_code, msi.lot_control_code, msi.serial_number_control_code
INTO l_revision_control, l_lot_control_type, l_item_serial_control_code
FROM mtl_system_items_b msi
WHERE msi.inventory_item_id = p_inventory_item_id
AND msi.organization_id = p_organization_id; IF l_revision_control = 2 THEN
l_is_revision_control := TRUE;
ELSE
l_is_revision_control := FALSE;
END IF; IF l_lot_control_type <> 1 AND p_lot_number IS NOT NULL THEN
l_is_lot_control := TRUE;
ELSE
l_is_lot_control := FALSE;
END IF; IF l_item_serial_control_code = 2 THEN
l_is_serial_control := TRUE;
ELSE
l_is_serial_control := FALSE;
END IF;
inv_quantity_tree_pub.query_quantities(p_api_version_number => 1.0,
p_init_msg_lst => fnd_api.g_false,
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 => 3,
p_is_revision_control => l_is_revision_control,
p_is_lot_control => l_is_lot_control,
p_is_serial_control => l_is_serial_control,
p_grade_code => NULL,
p_demand_source_type_id => -1,
p_demand_source_header_id => -1,
p_demand_source_line_id => -1,
p_demand_source_name => NULL,
p_revision => NULL,
p_lot_number => p_lot_number,
p_subinventory_code => p_subinventory,
p_locator_id => p_locator_id,
p_onhand_source => p_onhand_source,
x_qoh => l_qty_on_hand,
x_rqoh => l_qty_res_on_hand,
x_qr => l_qty_res,
x_qs => l_qty_sug,
x_att => l_qty_att,
x_atr => l_qty_available_to_reserve,
x_sqoh => l_sqty_on_hand,
x_srqoh => l_sqty_res_on_hand,
x_sqr => l_sqty_res,
x_sqs => l_sqty_sug,
x_satt => l_sqty_att,
x_satr => l_sqty_available_to_reserve);
IF l_return_status = fnd_api.g_ret_sts_success THEN IF p_qty_type = 'QOH' THEN
l_quantity := l_qty_on_hand;
ELSIF p_qty_type = 'ATT' THEN
l_quantity := l_qty_att;
ELSIF p_qty_type = 'QR' THEN
l_quantity := l_qty_res;
ELSIF p_qty_type = 'ATR' THEN
l_quantity := l_qty_available_to_reserve;
ELSE
l_quantity := l_qty_att;
END IF; --IF p_qty_type = 'QOH' THEN
ELSE
l_quantity := NULL;
END IF; dbms_output.put_line('现有量l_qty_on_hand=' || l_qty_on_hand);
dbms_output.put_line('保留现有量l_qty_res_on_hand=' || l_qty_res_on_hand);
dbms_output.put_line('保留量l_qty_res=' || l_qty_res);
dbms_output.put_line('分配量l_qty_sug=' || l_qty_sug);
dbms_output.put_line('可处理l_qty_att=' || l_qty_att);
dbms_output.put_line('可保留l_qty_available_to_reserve=' || l_qty_available_to_reserve); EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('出错' || SQLERRM);
-- RETURN NULL;
END;
Oracle EBS OPM 查询现有量的更多相关文章
- Oracle EBS OPM update material txn
--update_material_txn --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_m ...
- Oracle EBS OPM 生产批创建事务处理
--生产批创建事物处理 --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_mmli_tbl gm ...
- Oracle EBS中查询Profile的各种SQL【转载】
1.List E-Business Suite Profile Option Values For All Levels SELECT p.profile_option_name SHORT_NAME ...
- 【转】Oracle EBS中查询Profile的各种SQL
参考 http://blog.csdn.net/pan_tian/article/details/7652968#t0 Using API FND_PROFILE.save to update pro ...
- Oracle EBS INV 查询物料无值 ECO
查找物料的时候报错 没有输入值 解决方法: 针对FORM做trace 多查看几个生成的trace 搜索 MTL_SYSTEM_ITEMS_b 的信息 查看到最后面的语句(一般可直接查看) 看SQL 哪 ...
- Oracle EBS OPM close batch
--close_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (4000); x_ ...
- Oracle EBS OPM convert dtl reservation
--convert_dtl_reservation --created by jenrry DECLARE l_reservation_rec mtl_reservations%ROWTYPE; l_ ...
- Oracle EBS OPM complete step
--complete_step --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl g ...
- Oracle EBS OPM reshedule batch
--reschedule_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (2000 ...
随机推荐
- JavaScript -- Document-open
-----045-Document-open.html----- <!DOCTYPE html> <html> <head> <meta http-equiv ...
- 自制“低奢内”CSS3注册表单,包含JS验证哦。请别嫌弃,好吗?。
要求 必备知识 基本了解CSS语法,初步了解CSS3语法知识.和JS/JQuery基本语法. 开发环境 Adobe Dreamweaver CS6 演示地址 演示地址 预览截图(抬抬你的鼠标就可以看到 ...
- div或其他html控件的overflow使用滚动条
在编写html代码时, 有时候不想把控件撑大,滚动条就是个不错的选择 如下代码 <div style="height:auto !important;max-height:58px;o ...
- elasticSearch6源码分析(4)indices模块
1.indices概述 The indices module controls index-related settings that are globally managed for all ind ...
- 安装win8/win10提示无法在驱动器0分区上安装windows解决方法
在通过U盘或光盘安装win8/win8.1/win10系统时,不少用户遇到无法安装的问题,提示“无法在驱动器0的分区1上安装windows”,格式化分区1也不能解决,进而提示Windows无法安装到这 ...
- Spring事务内方法调用自身事务 增强的三种方式
ServiceA.java文件: 查看Spring Tx的相关日志: 可以看到只创建了一个事物ServiceA.service方法的事务,但是callSelf方法却没有被事务增强; 分析原因:Spr ...
- SSM整合Shiro 身份验证及密码加密简单实现
1.导入maven的相关依赖 <!-- shiro --> <dependency> <groupId>org.apache.shiro</groupId&g ...
- ASP.NET MVC5+EF6+LayUI实战教程,通用后台管理系统框架(2)
前言 本节先给大家搭建UI部分,让大家能看到点东西,就好像所有编程书里,开始都是一个Hello World一样 开始搭建 首先建立空白解决方案,我们命名为BYCMS 然后添加新项目BYCMS 我习惯用 ...
- 开源方案搭建可离线的精美矢量切片地图服务-6.Mapbox之.pbf字体库
项目成果展示(所有项目文件都在阿里云的共享云虚拟主机上,访问地图可以会有点慢,请多多包涵). 01:中国地图:http://test.sharegis.cn/mapbox/html/3china.ht ...
- .2-浅析webpack源码之打包后文件
先不进源码,分析一下打包后的文件,来一张图: 首先创建两个JS文件,内容如下: // config.js module.exports = { entry: './input.js', output: ...