EBS获取物料现有量API

创建存储过程调用标准API获取现有量

PROCEDURE get_inv_quantity(p_organization_id   IN NUMBER,
                             p_inventory_item_id IN NUMBER,
                             p_subinventory_code IN VARCHAR2,
                             p_locator_id        IN NUMBER,
                             p_lot_number        IN VARCHAR2,
                             x_onhand_qty        OUT NUMBER,
                             x_reservable_qty    OUT NUMBER,
                             x_transactable_qty  OUT NUMBER) AS
    l_return_status     VARCHAR2(1);
    l_msg_count         NUMBER;
    l_msg_data          VARCHAR2(2000);
    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;
  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.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           => inv_quantity_tree_pvt.g_transaction_mode,
                                           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_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,
                                           x_qoh                 => l_qoh,
                                           x_rqoh                => l_rqoh,
                                           x_qr                  => l_qr,
                                           x_qs                  => l_qs,
                                           x_att                 => l_att,
                                           x_atr                 => l_atr);
  
    --qoh          quantity on hand
    --rqoh         reservable quantity on hand
    --qr           quantity reserved
    --qs           quantity suggested
    --att          available to transact
    --atr          available to reserve
    IF (l_return_status = 'S') THEN
      x_onhand_qty       := l_qoh;
      x_reservable_qty   := l_atr;
      x_transactable_qty := l_att;
    ELSE
      l_return_status := 'F';
      RETURN;
    END IF;
  END get_inv_quantity;

其中x_onhand_qty 为现有量
x_reservable_qty 为可保留量
x_transactable_qty 为可处理量

你可能感兴趣的:(EBS常用API)