[Home] [Help]
16: -- [g_use_rule VARCHAR2(1) := 'Y'; used to track if stg/rule
17: -- search API is required to be called or not ]
18:
19: --
20: SUBTYPE g_wms_txn_temp_rec_type IS wms_transactions_temp%ROWTYPE;
21:
22: TYPE g_wms_txn_temp_tbl_type IS TABLE OF g_wms_txn_temp_rec_type
23: INDEX BY BINARY_INTEGER;
24:
23: INDEX BY BINARY_INTEGER;
24:
25: -- a record type used in the combine_transfer procedure
26: TYPE g_combine_rec_type IS RECORD(
27: revision wms_transactions_temp.revision%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
24:
25: -- a record type used in the combine_transfer procedure
26: TYPE g_combine_rec_type IS RECORD(
27: revision wms_transactions_temp.revision%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
25: -- a record type used in the combine_transfer procedure
26: TYPE g_combine_rec_type IS RECORD(
27: revision wms_transactions_temp.revision%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
26: TYPE g_combine_rec_type IS RECORD(
27: revision wms_transactions_temp.revision%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
27: revision wms_transactions_temp.revision%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
28: , from_subinventory_code wms_transactions_temp.from_subinventory_code%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
29: , from_locator_id wms_transactions_temp.from_locator_id%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
30: , from_cost_group_id wms_transactions_temp.from_cost_group_id%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
31: , to_subinventory_code wms_transactions_temp.to_subinventory_code%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
32: , to_locator_id wms_transactions_temp.to_locator_id%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
33: , to_cost_group_id wms_transactions_temp.to_cost_group_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
34: , lot_number wms_transactions_temp.lot_number%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
35: , lot_expiration_date wms_transactions_temp.lot_expiration_date%TYPE
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
43: , lpn_id wms_transactions_temp.lpn_id%TYPE);
36: , serial_number wms_transactions_temp.serial_number%TYPE
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
43: , lpn_id wms_transactions_temp.lpn_id%TYPE);
44:
37: , transaction_quantity wms_transactions_temp.transaction_quantity%TYPE
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
43: , lpn_id wms_transactions_temp.lpn_id%TYPE);
44:
45: TYPE g_combine_tbl_type IS TABLE OF g_combine_rec_type
38: , primary_quantity wms_transactions_temp.primary_quantity%TYPE
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
43: , lpn_id wms_transactions_temp.lpn_id%TYPE);
44:
45: TYPE g_combine_tbl_type IS TABLE OF g_combine_rec_type
46: INDEX BY BINARY_INTEGER;
39: , secondary_quantity wms_transactions_temp.secondary_quantity%TYPE
40: , grade_code wms_transactions_temp.grade_code%TYPE
41: , rule_id wms_transactions_temp.rule_id%TYPE
42: , reservation_id wms_transactions_temp.reservation_id%TYPE
43: , lpn_id wms_transactions_temp.lpn_id%TYPE);
44:
45: TYPE g_combine_tbl_type IS TABLE OF g_combine_rec_type
46: INDEX BY BINARY_INTEGER;
47:
113: END log_statement;
114:
115:
116: -- Description
117: -- Insert all records in p_wms_txn_temp_tbl into wms_transactions_temp.
118: -- Value for column pp_transaction_temp_id will be derived in the
119: -- procedure
120: --
121: PROCEDURE insert_detail_temp_records
127:
128: --
129: /* Bug 5265024
130: CURSOR l_wms_txn_temp_id_csr IS
131: SELECT wms_transactions_temp_s.NEXTVAL
132: FROM DUAL;
133: */
134:
135: l_wms_txn_temp_tbl_size NUMBER;
170: */
171:
172: -- insert to the table
173: FOR l_counter IN 1 .. l_wms_txn_temp_tbl_size LOOP
174: INSERT INTO wms_transactions_temp
175: (
176: pp_transaction_temp_id
177: , transaction_temp_id
178: , type_code
197: , to_cost_group_id
198: , lpn_id
199: )
200: VALUES (
201: wms_transactions_temp_s.NEXTVAL
202: -- l_temp_id_tbl(l_counter)
203: , p_wms_txn_temp_tbl(l_counter).transaction_temp_id
204: , p_wms_txn_temp_tbl(l_counter).type_code
205: , p_wms_txn_temp_tbl(l_counter).line_type_code
277: END insert_detail_temp_records;
278:
279: --
280: -- Description
281: -- Purges all records from WMS_TRANSACTIONS_TEMP for the move
282: -- order line
283: PROCEDURE purge_detail_temp_records
284: ( x_return_status OUT NOCOPY VARCHAR2
285: , p_request_line_rec IN inv_detail_util_pvt.g_request_line_rec_type
298: -- Initialisize API return status to success
299: x_return_status := fnd_api.g_ret_sts_success;
300:
301: --
302: DELETE FROM wms_transactions_temp
303: WHERE transaction_temp_id = p_request_line_rec.line_id;
304:
305: --
306: DELETE FROM wms_txn_context_temp
388: END LOOP;
389:
390: l_wms_txn_temp_tbl_size := l_to_num - l_fm_num + 1;
391: ELSE
392: -- Insert record for single serial number into wms_transactions_temp
393: l_wms_txn_temp_tbl(1).serial_number := p_request_line_rec.serial_number_start;
394: l_wms_txn_temp_tbl_size := 1;
395: END IF;
396:
447: END resolve_serials;
448:
449: --
450: -- Procedure : Prepare
451: -- FUNCTION : Creates records in WMS_TRANSACTIONS_TEMP for
452: -- each single lot and/or serial number and splits
453: -- transfer transactions into issue and receipt
454: -- transaction
455: PROCEDURE prepare(
730:
731: --
732: --
733: -- Procedure : Prepare_Transfer_Receipt
734: -- Pre-reqs : Record(s) exist(s) in WMS_TRANSACTIONS_TEMP with
735: -- p_transaction_temp_id = the move order line id
736: -- and type_code = 2 (pick) and
737: -- line_type_code = 2 (output line)
738: -- Function : Copies issue output record(s) into
735: -- p_transaction_temp_id = the move order line id
736: -- and type_code = 2 (pick) and
737: -- line_type_code = 2 (output line)
738: -- Function : Copies issue output record(s) into
739: -- WMS_TRANSACTIONS_TEMP as input records
740: -- for receipt portion within transfer transactions
741: --
742: PROCEDURE prepare_transfer_receipt
743: (
762: , wtt.from_subinventory_code from_subinventory_code
763: , wtt.from_locator_id from_locator_id
764: , wtt.from_cost_group_id from_cost_group_id
765: , wtt.lpn_id lpn_id
766: FROM wms_transactions_temp wtt
767: WHERE wtt.transaction_temp_id = p_request_line_rec.line_id
768: AND wtt.line_type_code = 2 -- output line
769: AND wtt.type_code = 2 -- pick
770: GROUP BY wtt.lot_number
817: EXIT WHEN l_put_input_csr%NOTFOUND;
818: -- Note: serial number here is ignored here. The assumption
819: -- is that the put away side will not care about the serial number.
820: -- The purpose is to reduce the number of records as input in
821: -- wms_transactions_temp for put away since the more records
822: -- it is, the more runs the engine has to run, and thus the slower.
823: -- The assumption stated might not be valid for some situations.
824: -- So this might need to be enhanced later.
825: l_wms_txn_temp_tbl_size := l_wms_txn_temp_tbl_size + 1;
936: END prepare_transfer_receipt;
937:
938: --
939: -- debugging routine
940: -- display the output records in wms_transactions_temp
941: -- when called
942: PROCEDURE display_temp_records IS
943: CURSOR l_cur IS
944: SELECT transaction_temp_id
956: , reservation_id
957: , to_subinventory_code
958: , to_locator_id
959: , lpn_id
960: FROM wms_transactions_temp
961: ORDER BY transaction_temp_id
962: , line_type_code
963: , type_code
964: , revision
1061: END display_temp_records;
1062:
1063: --
1064: -- create output suggestion records for issue or receipt but not transfer
1065: -- read from the table wms_transactions_temp by the order of
1066: -- revision, from_sub, to_sub, from_loc, to_loc, lot_number, serial_number
1067: PROCEDURE output_issue_or_receipt(
1068: x_return_status OUT NOCOPY VARCHAR2
1069: , p_request_line_rec IN inv_detail_util_pvt.g_request_line_rec_type
1114: , wtt.pp_transaction_temp_id
1115: , wtt.from_cost_group_id
1116: , wtt.to_cost_group_id
1117: , wtt.lpn_id
1118: FROM wms_transactions_temp wtt
1119: WHERE wtt.transaction_temp_id = l_transaction_temp_id
1120: AND wtt.line_type_code = 2 -- output line
1121: ) x
1122: GROUP BY x.revision
1259: , grade_code
1260: , MIN(rule_id) pick_rule_id
1261: , reservation_id
1262: , lpn_id
1263: FROM wms_transactions_temp
1264: WHERE transaction_temp_id = l_transaction_temp_id
1265: AND line_type_code = 2 -- output line
1266: AND type_code = 2 -- pick
1267: GROUP BY serial_number
1307: , grade_code
1308: , MIN(rule_id) put_away_rule_id
1309: , NULL reservation_id
1310: , lpn_id lpn_id
1311: FROM wms_transactions_temp
1312: WHERE transaction_temp_id = l_transaction_temp_id
1313: AND line_type_code = 2 -- output line
1314: AND type_code = 1 -- put away
1315: GROUP BY serial_number
1796: WHERE organization_id = l_request_line_rec.organization_id;
1797:
1798: /* Bug # 5265024
1799: CURSOR l_wms_txn_temp_id_csr IS
1800: SELECT wms_transactions_temp_s.NEXTVAL
1801: FROM DUAL;
1802: */
1803:
1804: --BUG14517947
2415: log_event(l_api_name, 'start_pick', 'getting the context ');
2416: END IF;
2417:
2418: -- clean up the input records first
2419: DELETE FROM wms_transactions_temp
2420: WHERE transaction_temp_id = p_transaction_temp_id
2421: AND line_type_code = 1;
2422:
2423: --
2436: RAISE fnd_api.g_exc_error;
2437: END IF;
2438: ELSE
2439: -- Treat receipt for transfers, ie. copy the issue output data in
2440: -- WMS_TRANSACTIONS_TEMP as new input records for receipt part
2441: prepare_transfer_receipt(l_return_status
2442: , l_request_line_rec
2443: , l_request_context);
2444: --
2448: END IF;
2449: END IF;
2450: -- LG convergence add
2451: -- Since we may not have a reservation when p_simulation_mode is 10 for all move order types
2452: -- so insert fake data into wms_transactions_temp
2453: IF p_simulation_mode = g_available_inventory
2454: THEN
2455: /* 5265024
2456: OPEN l_wms_txn_temp_id_csr;
2457: FETCH l_wms_txn_temp_id_csr INTO l_pp_transaction_temp_id ;
2458: CLOSE l_wms_txn_temp_id_csr;
2459: */
2460: log_event(l_api_name, '','insert into wtt '||l_pp_transaction_temp_id);
2461: INSERT INTO wms_transactions_temp
2462: (
2463: pp_transaction_temp_id
2464: , transaction_temp_id -- mo_line_id
2465: , type_code -- mo
2467: , transaction_quantity
2468: , primary_quantity
2469: , secondary_quantity
2470: )
2471: VALUES ( wms_transactions_temp_s.NEXTVAL
2472: -- l_pp_transaction_temp_id
2473: , l_request_line_rec.line_id
2474: , 2
2475: , 1
2887: , p_insert_serial_flag => inv_detail_util_pvt.g_insert_serial_flag
2888: );
2889: END IF;
2890:
2891: -- Delete records from WMS_TRANSACTIONS_TEMP
2892: purge_detail_temp_records(l_return_status, l_request_line_rec);
2893:
2894: IF l_return_status <> fnd_api.g_ret_sts_success THEN
2895: RAISE fnd_api.g_exc_error;