首页 > 代码库 > 账户别名接收事务处理

账户别名接收事务处理



--账户别名接收
SELECT mtl_material_transactions_s.nextval
  INTO l_mtl_txn_itf_rec.transaction_interface_id
  FROM dual;
l_mtl_txn_itf_rec.transaction_header_id := l_mtl_txn_itf_rec.transaction_interface_id;
l_mtl_txn_itf_rec.transaction_mode      := 3;
l_mtl_txn_itf_rec.process_flag          := 1;
l_mtl_txn_itf_rec.transaction_type_id   := 41;
l_mtl_txn_itf_rec.transaction_source_id := i.disposition_id;
l_mtl_txn_itf_rec.organization_id       := i.organization_id;
l_mtl_txn_itf_rec.inventory_item_id     := i.n_inventory_item_id; --l_mtl_txn_int_rec.inventory_item_id;
l_mtl_txn_itf_rec.subinventory_code     := i.n_subinventory_code; --l_mtl_txn_int_rec.subinventory_code;
l_mtl_txn_itf_rec.locator_id            := i.n_locator_id; --l_mtl_txn_int_rec.locator_id;
l_mtl_txn_itf_rec.transaction_quantity  := i.n_onhand_quantity; --l_mtl_txn_int_rec.transaction_quantity;
l_mtl_txn_itf_rec.transaction_uom       := i.uom_code; --l_mtl_txn_int_rec.uom_code;
l_mtl_txn_itf_rec.transaction_date      := nvl(i.transaction_date, SYSDATE); --l_mtl_txn_int_rec.onhand_creation_date /*g_date*/

/*l_mtl_txn_itf_rec.source_header_id      := null;--l_mtl_txn_itf_rec.transaction_header_id;
        l_mtl_txn_itf_rec.source_line_id        := null;--l_mtl_txn_itf_rec.transaction_header_id;
        l_mtl_txn_itf_rec.source_code           := null;--‘cux_wms_mtl_txn_in‘;*/

-- Who Column
l_mtl_txn_itf_rec.last_update_date  := SYSDATE;
l_mtl_txn_itf_rec.last_updated_by   := g_user_id;
l_mtl_txn_itf_rec.creation_date     := SYSDATE;
l_mtl_txn_itf_rec.created_by        := g_user_id;
l_mtl_txn_itf_rec.last_update_login := g_login_id;

l_mtl_txn_itf_rec.source_code      := p_source_code;
l_mtl_txn_itf_rec.source_header_id := p_source_line_id;
l_mtl_txn_itf_rec.source_line_id   := p_source_line_id;
INSERT INTO mtl_transactions_interface VALUES l_mtl_txn_itf_rec;

--批次
l_mtl_txn_lot_rec.transaction_interface_id := l_mtl_txn_itf_rec.transaction_header_id;
l_mtl_txn_lot_rec.lot_number               := i.n_lot_number;
l_mtl_txn_lot_rec.transaction_quantity     := i.n_onhand_quantity;
l_mtl_txn_lot_rec.last_update_date         := SYSDATE;
l_mtl_txn_lot_rec.last_updated_by          := g_user_id;
l_mtl_txn_lot_rec.creation_date            := SYSDATE;
l_mtl_txn_lot_rec.created_by               := g_user_id;
l_mtl_txn_lot_rec.last_update_login        := g_login_id;
INSERT INTO mtl_transaction_lots_interface VALUES l_mtl_txn_lot_rec;

--账户别名接收事务处理
x_retval := inv_txn_manager_pub.process_transactions(p_api_version      => 1,
                                                     p_init_msg_list    => fnd_api.g_true,
                                                     p_commit           => fnd_api.g_false, --not commit
                                                     p_validation_level => fnd_api.g_valid_level_full,
                                                     x_return_status    => l_return_status,
                                                     x_msg_count        => l_msg_count,
                                                     x_msg_data         => l_msg_data,
                                                     x_trans_count      => x_trans_count,
                                                     p_table            => 1,
                                                     p_header_id        => l_mtl_txn_itf_rec.transaction_interface_id);

IF x_retval <> 0 THEN
  SELECT mti.error_explanation
    INTO l_error_explanation
    FROM mtl_transactions_interface mti
   WHERE 1 = 1
     AND mti.transaction_interface_id =
         l_mtl_txn_itf_rec.transaction_interface_id
     AND rownum = 1;
  x_msg_data := ‘Error in inv_txn_manager_pub.process_transactions:‘ ||
                ‘transaction header id: ‘ ||
                l_mtl_txn_itf_rec.transaction_interface_id || ‘ . 接收处理失败.‘ ||
                l_error_explanation;
  RAISE transaction_error;
END IF;

账户别名接收事务处理