Hi,
I have a function like the one below that keeps the fifo conditions under control.
1-------------------------------------
FOR rec_ IN get_stock_
LOOP
IF order_ref_ IS NOT NULL THEN
-- fifo control
IF substr(rec_.lot_batch_no,1,1) IN ('Y','A','K')
THEN rec_.receipt_date := to_date('01.01.2000','dd.MM.yyyy'); -- If they give LOT_NO, let's accept the receipt_date as 01.01.2000.
END IF;
FOR fifo_ IN (SELECT decode(substr(a.lot_batch_no,1,1),
'Y',to_date('01.01.2000','dd.MM.yyyy'),
'A',to_date('01.01.2000','dd.MM.yyyy'),
'K',to_date('01.01.2000','dd.MM.yyyy'),
trunc(a.receipt_date)) receipt_date
a.lot_batch_no
a.waiv_dev_rej_no,
a.location_no from IFSAPP.Inventory_Part_In_Stock_Total a
WHERE a.contract = barcode_rec_.contract
AND a.part_no = barcode_rec_.part_no
AND ifsapp.report_sys.parse_parameter(a.part_no,fifo_part_list_) = 'TRUE'
AND (a.location_no LIKE 'DP%' or a.location_no LIKE 'VGM%' or a.location_no LIKE 'VGD%' or a.location_no LIKE 'VARIS%')
AND a.qty_onhand > 0
AND a.part_order_issue_control_db = 'ORDER ISSUE'
AND decode(substr(a.lot_batch_no,1,1),
'Y',to_date('01.01.2000','dd.MM.yyyy'),
'A',to_date('01.01.2000','dd.MM.yyyy'),
'K',to_date('01.01.2000','dd.MM.yyyy'),
trunc(a.receipt_date)) + 7 < trunc(rec_.receipt_date)
ORDER BY decode(substr(a.lot_batch_no,1,1),
'Y',to_date('01.01.2000','dd.MM.yyyy'),
'A',to_date('01.01.2000','dd.MM.yyyy'),
'K',to_date('01.01.2000','dd.MM.yyyy'),
trunc(a.receipt_date)))
LOOP
IFSAPP.Error_SYS.system_general(fifo_.location_no||' lokasyonunda :P1 tarihli :P2 lot numarasina :P3 USR numarasina sahip daha eski bir stok kalemi mevcut',to_char(fifo_.receipt_date,'dd.MM.yyyy'),fifo_.lot_batch_no,fifo_.waiv_dev_rej_no);
END LOOP;
END IF;
2----------------------------How can I write this select statement in the fifo function?
I want to write this selection 1 period data in the condition and prevent it from getting stuck in the fifo function.
select 1 from object_property_tab x where
x.object_lu = 'ElkMobile' and x.object_key = 'FIFO_CONTROL' and x.property_name = 'LOT_CODE_DISABLED' and
x.property_value like '%' || '^' || '331305-*-*-1' || '^' || '%'