--查询现有量
--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 查询现有量的更多相关文章

  1. Oracle EBS OPM update material txn

    --update_material_txn --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_m ...

  2. Oracle EBS OPM 生产批创建事务处理

    --生产批创建事物处理 --created by jenrry DECLARE p_mmti_rec mtl_transactions_interface%ROWTYPE; p_mmli_tbl gm ...

  3. Oracle EBS中查询Profile的各种SQL【转载】

    1.List E-Business Suite Profile Option Values For All Levels SELECT p.profile_option_name SHORT_NAME ...

  4. 【转】Oracle EBS中查询Profile的各种SQL

    参考 http://blog.csdn.net/pan_tian/article/details/7652968#t0 Using API FND_PROFILE.save to update pro ...

  5. Oracle EBS INV 查询物料无值 ECO

    查找物料的时候报错 没有输入值 解决方法: 针对FORM做trace 多查看几个生成的trace 搜索 MTL_SYSTEM_ITEMS_b 的信息 查看到最后面的语句(一般可直接查看) 看SQL 哪 ...

  6. Oracle EBS OPM close batch

    --close_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (4000); x_ ...

  7. Oracle EBS OPM convert dtl reservation

    --convert_dtl_reservation --created by jenrry DECLARE l_reservation_rec mtl_reservations%ROWTYPE; l_ ...

  8. Oracle EBS OPM complete step

    --complete_step --created by jenrry DECLARE x_return_status VARCHAR2 (1); l_exception_material_tbl g ...

  9. Oracle EBS OPM reshedule batch

    --reschedule_batch --created by jenrry DECLARE x_message_count NUMBER; x_message_list VARCHAR2 (2000 ...

随机推荐

  1. Gen对于数组Array的处理

    举个例子,如下: public void t() { String[][] a = new String[][] { { "x", "y" } }; Strin ...

  2. JavaScript -- FileSystemObject-文件夹

    -----057-FileSystemObject-文件夹.html----- <!DOCTYPE html> <html> <head> <meta htt ...

  3. Spring开发步骤

    1) 源码, jar文件:此处用的是spring-framework-3.2.5.RELEASE commons-logging-1.1.3.jar                日志 spring- ...

  4. mybatis JdbcTypeInterceptor - 运行时自动添加 jdbcType 属性

    上代码: package tk.mybatis.plugin; import org.apache.ibatis.executor.ErrorContext; import org.apache.ib ...

  5. java日期互转:LocalDateTime、String、TimeStamp、Long、Instant、Date

    由于java版本的迭代,一个使用java开发的项目中可能出现多种日期对象,例如LocalDateTime.LocalDate.Date,不像C#只有一个DateTime,因此在各种日期格式或者对象之间 ...

  6. 程序员必知的8大排序(四)-------归并排序,基数排序(java实现)

    程序员必知的8大排序(一)-------直接插入排序,希尔排序(java实现) 程序员必知的8大排序(二)-------简单选择排序,堆排序(java实现) 程序员必知的8大排序(三)-------冒 ...

  7. Docker基础教程(命令详解)

    # docker --help Usage: docker [OPTIONS] COMMAND [arg...] docker daemon [ --help | ... ] docker [ -h ...

  8. multiset多重集合容器(常用的使用方法总结)

    关于C++STL中multiset集合容器的学习,看别人的代码一百遍,不如自己动手写一遍. multiset多重集合容器和set集合容器的使用方法大多相同,不同的是multiset多重集合容器允许重复 ...

  9. C# 集合 特殊集合

    一集合 1.可为不同类型,不固定长度 2.集合类型分为泛型集合(强类型集合)与非泛型集合(弱类型集合). 3.非泛型集合的类和接口位于using System.Collections命名空间. 4.泛 ...

  10. 乐字节-Java8新特性-接口默认方法之Stream流(下)

    接上一篇:<Java8新特性之stream>,下面继续接着讲Stream 5.流的中间操作 常见的流的中间操作,归为以下三大类:筛选和切片流操作.元素映射操作.元素排序操作: 操作 描述 ...