Пример использования API для удаления резервирований позиции:
declare
l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
l_serial_number_tbl_type inv_reservation_global.serial_number_tbl_type;
--
lx_return_status varchar2(1);
lx_msg_data varchar2(4000);
lx_msg_count number;
begin
fnd_global.apps_initialize(-1, 20634, 401); --Запасы - Запасы
for i_cur in (select * from mtl_reservations t
where 1=1
and rownum=1
-- and ...
)
loop
l_rsv_rec.reservation_id := i_cur.reservation_id;
l_rsv_rec.organization_id := i_cur.organization_id;
l_rsv_rec.inventory_item_id := i_cur.inventory_item_id;
l_rsv_rec.demand_source_type_id := i_cur.demand_source_type_id;
l_rsv_rec.demand_source_header_id := i_cur.demand_source_header_id;
l_rsv_rec.demand_source_line_id := i_cur.demand_source_line_id;
l_rsv_rec.primary_uom_code := i_cur.primary_uom_code;
l_rsv_rec.reservation_uom_code := i_cur.reservation_uom_code;
-- l_rsv_rec.reservation_quantity := 1;--i_cur.reservation_quantity;
-- l_rsv_rec.primary_reservation_quantity := 1;--i_cur.primary_reservation_quantity;
l_rsv_rec.supply_source_type_id := i_cur.supply_source_type_id;
inv_reservation_pub.delete_reservation(p_api_version_number => 1.0
,p_rsv_rec => l_rsv_rec
,p_serial_number => l_serial_number_tbl_type
,x_return_status => lx_return_status
,x_msg_count => lx_msg_count
,x_msg_data => lx_msg_data
);
dbms_output.put_line(lx_return_status);
if (lx_return_status <> 'S') then
fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
p_count => lx_msg_count,
p_data => lx_msg_data);
dbms_output.put_line('ERROR delete_reservation for reservation_id ='
||l_rsv_rec.reservation_id ||':');
if lx_msg_count = 1 then
dbms_output.put_line(lx_msg_data);
else
FOR i IN 1 .. lx_msg_count
LOOP
dbms_output.put_line(fnd_msg_pub.get(fnd_msg_pub.g_next,fnd_api.g_false));
END LOOP;
end if;
end if;
commit;
end loop;
end;
Categories: API, Oracle e-Business Suite Tags: API, delete_reservation, INV, inv_reservation_pub, inventory, inventory_item_id, OEBS, reservation, позиция, резервирование, удаление
Пример использования API для получения текущего или доступного для резервирования количества для позиции:
declare
p_organization_id NUMBER := 155;
p_inventory_item_id NUMBER := 546;
--
p_revision VARCHAR2(3);
p_lot_number VARCHAR2(80);
p_subinventory_code VARCHAR2(10) := 'VAlVALVAL';
p_locator_id NUMBER;
--
lx_qoh NUMBER; -- Total Quantity (Onhand)
lx_rqoh NUMBER;
lx_qr NUMBER;
lx_qs NUMBER;
lx_att NUMBER; -- Available to Transact
lx_atr NUMBER; -- Available to Reserve
--
lx_return_status VARCHAR2(1);
lx_msg_count NUMBER;
lx_msg_data VARCHAR2(4000);
begin
inv_quantity_tree_grp.clear_quantity_cache;
inv_quantity_tree_pub.query_quantities(
p_api_version_number => 1.0,
p_init_msg_lst => fnd_api.g_false,
x_return_status => lx_return_status,
x_msg_count => lx_msg_count,
x_msg_data => lx_msg_data,
--
p_organization_id => p_organization_id,
p_inventory_item_id => p_inventory_item_id,
p_tree_mode => apps.inv_quantity_tree_pub.g_transaction_mode,
p_is_revision_control => case when p_revision is null then FALSE else TRUE end,
p_is_lot_control => case when p_lot_number is null then FALSE else TRUE end,
p_is_serial_control => FALSE,
p_revision => p_revision,
p_lot_number => p_lot_number,
p_subinventory_code => p_subinventory_code,
p_locator_id => p_locator_id,
x_qoh => lx_qoh, -- OnHand Quantity
x_rqoh => lx_rqoh,
x_qr => lx_qr,
x_qs => lx_qs,
x_att => lx_att, -- Available To Transact
x_atr => lx_atr -- Available To Reserve
);
if lx_return_status ='S' then
DBMS_OUTPUT.put_line ('Общее количество: ' || lx_qoh);
DBMS_OUTPUT.put_line ('Доступно для резервирования: ' || lx_atr);
DBMS_OUTPUT.put_line ('Доступно для транзакции: ' || lx_att);
else
fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false,
p_count => lx_msg_count,
p_data => lx_msg_data);
dbms_output.put_line('ERROR for p_inventory_item_id='||p_inventory_item_id);
if lx_msg_count = 1 then
dbms_output.put_line(lx_msg_data);
else
FOR i IN 1 .. lx_msg_count LOOP
dbms_output.put_line(fnd_msg_pub.get(fnd_msg_pub.g_next,
fnd_api.g_false));
END LOOP;
end if;
end if;
end;
Так же есть запрос для просмотра текущего количества Модуль INV – Текущее количество для позиции
Categories: API, OEBS Tags: API, INV, inv_quantity_tree_pub, inventory, inventory_item_id, OEBS, onhand, query_quantities, доступно для резервирования, доступное, количество, текущее количество
Select moq.organization_id as org_id,
sysdate as date_val,
moq.inventory_item_id as item_id,
moq.subinventory_code as subinventory_code,
moq.locator_id as locator_id,
moq.lot_number as lot_number,
msi.segment1 as item,
msi.primary_uom_code as uom_code,
sum(moq.primary_transaction_quantity) as actual_qty
from mtl_onhand_quantities_detail moq,
mtl_system_items_b msi
where 1=1
-- msi
and msi.inventory_item_id = moq.inventory_item_id
and msi.organization_id = moq.organization_id
--and moq.inventory_item_id = :1
--and moq.organization_id = :2
--and moq.subinventory_code = :3
--and moq.lot_number = :4
group by moq.organization_id ,
sysdate,
moq.inventory_item_id,
msi.segment1,
msi.primary_uom_code,
moq.subinventory_code,
moq.locator_id,
moq.lot_number
order by moq.organization_id, moq.inventory_item_id
Так же есть API для просмотра текущего количества OEBS API INV – Текущее количество для позиции (ONHAND)
Последние комментарии