客制的出货功能非常慢
客制的杂项出库功能非常慢,初步测试后的原因如下:
因为精细到每一片磊晶片,数据量增长非常快,期初+第一个月的数据量就达到500w。
导致有些验证程序非常缓慢。
例一:
DECLARE
v_ava_qty NUMBER;
BEGIN
v_ava_qty := inv_item_inq.get_available_qty(p_organization_id => 83,
p_inventory_item_id => 1317,
p_revision => NULL,
p_subinventory_code => 'B01',
p_locator_id => 15,
p_lot_number => 'BEHA1MX-TP1B331A01',
p_cost_group_id => -1,
p_revision_control => 'FALSE',
p_lot_control => 'TRUE',
p_serial_control => 'FALSE');
dbms_output.put_line(v_ava_qty);
END;
出货时,需要检查可用量>=出货量。
使用这个程序获得可用量,非常慢,这个在开发环境中,因为数据量比较少的原因,没有发现这个程序居然那么慢。
后面改成:
SELECT SUM(moq.transaction_quantity)
INTO p_onhand_qty
FROM mtl_onhand_quantities moq
WHERE moq.organization_id = p_inv_org_id
AND moq.subinventory_code = p_subinv
AND nvl(moq.locator_id, -1) = nvl(p_locator_id, -1)
AND moq.inventory_item_id = p_item_id
AND moq.lot_number = p_lot_number;
SELECT SUM(mr.primary_reservation_quantity)
INTO p_res_qty
FROM mtl_reservations mr
WHERE mr.organization_id = p_inv_org_id
AND mr.subinventory_code = p_subinv
AND mr.supply_source_type_id = 13
AND nvl(mr.locator_id, -1) = nvl(p_locator_id, -1)
AND mr.inventory_item_id = p_item_id
AND mr.lot_number = p_lot_number;
RETURN nvl(p_onhand_qty, 0) - nvl(p_res_qty, 0);