[Home] [Help]
583: WHEN NO_DATA_FOUND THEN
584: NULL;
585: END;
586:
587: INSERT INTO mtl_transaction_lots_temp
588: (
589: transaction_temp_id
590: , last_update_date
591: , last_updated_by
934: , l_trx_type_id
935: , l_subinventory_code
936: , l_locator_id
937: , l_lot_number
938: FROM mtl_transaction_lots_temp mtlt, mtl_material_transactions_temp mmtt
939: WHERE mtlt.serial_transaction_temp_id = p_trx_tmp_id
940: AND mtlt.transaction_temp_id = mmtt.transaction_temp_id;
941:
942: l_serial_trx_tmp_id := p_trx_tmp_id;
1929:
1930: UPDATE mtl_serial_numbers
1931: SET group_mark_id = NULL, line_mark_id = NULL, lot_line_mark_id = NULL
1932: WHERE group_mark_id IN (SELECT serial_transaction_temp_id
1933: FROM mtl_transaction_lots_temp
1934: WHERE transaction_temp_id = p_transaction_temp_id)
1935: OR group_mark_id = l_txn_hdr_id ; --Bug#6211912
1936:
1937: l_unmarked_count := SQL%ROWCOUNT;
1937: l_unmarked_count := SQL%ROWCOUNT;
1938:
1939: DELETE mtl_serial_numbers_temp
1940: WHERE transaction_temp_id IN (SELECT serial_transaction_temp_id
1941: FROM mtl_transaction_lots_temp
1942: WHERE transaction_temp_id = p_transaction_temp_id);
1943:
1944: ELSE -- only serial controlled but not lot controlled.
1945:
1962: END IF;
1963:
1964: -- Deleting all the Lots associated with the Transaction
1965: IF l_lot_control_code = 2 THEN
1966: DELETE mtl_transaction_lots_temp
1967: WHERE transaction_temp_id = p_transaction_temp_id;
1968:
1969: IF l_debug = 1 THEN
1970: TRACE('Records deleted in MTLT = ' || SQL%ROWCOUNT, 'INV_TRX_UTIL_PUB.DELETE_TRANSACTION');
2006: WHERE transaction_temp_id = l_txn_tmp_id;
2007:
2008: CURSOR c_lot(l_txn_tmp_id IN NUMBER) IS
2009: SELECT serial_transaction_temp_id
2010: FROM mtl_transaction_lots_temp
2011: WHERE transaction_temp_id = l_txn_tmp_id;
2012: BEGIN
2013: x_return_status := fnd_api.g_ret_sts_success;
2014: TRACE('parameters passed to delete_lot_ser_trx', 'INVTRXUB', 9);
2057: --Delete records from MSNT and MTLT
2058: DELETE FROM mtl_serial_numbers_temp msnt
2059: WHERE msnt.transaction_temp_id IN(
2060: SELECT mtlt.serial_transaction_temp_id
2061: FROM mtl_transaction_lots_temp mtlt
2062: WHERE mtlt.serial_transaction_temp_id = msnt.transaction_temp_id
2063: AND mtlt.transaction_temp_id = p_trx_tmp_id);
2064:
2065: DELETE FROM mtl_transaction_lots_temp WHERE transaction_temp_id = p_trx_tmp_id;
2061: FROM mtl_transaction_lots_temp mtlt
2062: WHERE mtlt.serial_transaction_temp_id = msnt.transaction_temp_id
2063: AND mtlt.transaction_temp_id = p_trx_tmp_id);
2064:
2065: DELETE FROM mtl_transaction_lots_temp WHERE transaction_temp_id = p_trx_tmp_id;
2066:
2067: --Item is only lot controlled. Not serial controlled.
2068: ELSIF(p_serctrl = 1 AND p_lotctrl = 2) THEN
2069:
2066:
2067: --Item is only lot controlled. Not serial controlled.
2068: ELSIF(p_serctrl = 1 AND p_lotctrl = 2) THEN
2069:
2070: DELETE mtl_transaction_lots_temp
2071: WHERE transaction_temp_id = p_trx_tmp_id;
2072:
2073:
2074: TRACE('Records deleted in MTLT = ' || SQL%ROWCOUNT, 'INV_TRX_UTIL_PUB.delete_lot_ser_trx');
2137: -- Delete the Serials
2138: IF p_serial_control_code NOT IN (1,6) THEN
2139: IF p_lot_control_code = 2 THEN
2140: DELETE mtl_serial_numbers_temp
2141: WHERE transaction_temp_id IN (SELECT serial_transaction_temp_id FROM mtl_transaction_lots_temp
2142: WHERE transaction_temp_id = p_parent_line_id)
2143: AND fm_serial_number IN (SELECT msnt.fm_serial_number
2144: FROM mtl_serial_numbers_temp msnt, mtl_transaction_lots_temp mtlt
2145: WHERE mtlt.transaction_temp_id = p_child_line_id
2140: DELETE mtl_serial_numbers_temp
2141: WHERE transaction_temp_id IN (SELECT serial_transaction_temp_id FROM mtl_transaction_lots_temp
2142: WHERE transaction_temp_id = p_parent_line_id)
2143: AND fm_serial_number IN (SELECT msnt.fm_serial_number
2144: FROM mtl_serial_numbers_temp msnt, mtl_transaction_lots_temp mtlt
2145: WHERE mtlt.transaction_temp_id = p_child_line_id
2146: AND msnt.transaction_temp_id = mtlt.serial_transaction_temp_id)
2147: RETURNING fm_serial_number BULK COLLECT INTO l_serials_tbl;
2148:
2147: RETURNING fm_serial_number BULK COLLECT INTO l_serials_tbl;
2148:
2149: IF SQL%ROWCOUNT = 0 THEN
2150: DELETE mtl_serial_numbers_temp
2151: WHERE transaction_temp_id IN (SELECT serial_transaction_temp_id FROM mtl_transaction_lots_temp
2152: WHERE transaction_temp_id = p_parent_line_id)
2153: AND ROWNUM <= l_child_pri_qty
2154: RETURNING fm_serial_number BULK COLLECT INTO l_serials_tbl;
2155: END IF;
2178: END IF;
2179:
2180: -- Delete the Lots
2181: IF p_lot_control_code = 2 THEN
2182: UPDATE mtl_transaction_lots_temp p
2183: SET (p.primary_quantity, p.transaction_quantity) =
2184: (SELECT p.primary_quantity - SUM(c.primary_quantity)
2185: , p.transaction_quantity - inv_convert.inv_um_convert(l_item_id, NULL, SUM(c.transaction_quantity), l_child_uom, l_parent_uom, NULL, NULL)
2186: FROM mtl_transaction_lots_temp c
2182: UPDATE mtl_transaction_lots_temp p
2183: SET (p.primary_quantity, p.transaction_quantity) =
2184: (SELECT p.primary_quantity - SUM(c.primary_quantity)
2185: , p.transaction_quantity - inv_convert.inv_um_convert(l_item_id, NULL, SUM(c.transaction_quantity), l_child_uom, l_parent_uom, NULL, NULL)
2186: FROM mtl_transaction_lots_temp c
2187: WHERE c.transaction_temp_id = p_child_line_id
2188: AND c.lot_number = p.lot_number
2189: GROUP BY c.lot_number)
2190: WHERE p.transaction_temp_id = p_parent_line_id;
2188: AND c.lot_number = p.lot_number
2189: GROUP BY c.lot_number)
2190: WHERE p.transaction_temp_id = p_parent_line_id;
2191:
2192: DELETE mtl_transaction_lots_temp
2193: WHERE transaction_temp_id = p_parent_line_id
2194: AND primary_quantity <= 0;
2195: END IF;
2196: