49: sql_stmt_num := 1;
50:
51: SELECT COUNT (*)
52: INTO total_opseqs
53: FROM bom_operation_sequences
54: WHERE routing_sequence_id = from_rtg_seq_id
55: AND NVL (eco_for_production, 2) = 2
56: AND (display_option = 1
57: OR (display_option = 2
70: sql_stmt_num := 2;
71:
72: SELECT COUNT (*)
73: INTO total_resources
74: FROM bom_operation_sequences a,
75: bom_operation_resources b
76: WHERE a.routing_sequence_id = from_rtg_seq_id
77: AND NVL (a.eco_for_production, 2) = 2
78: AND (display_option = 1
95: sql_stmt_num := 4;
96:
97: SELECT DISTINCT COUNT (*)
98: INTO total_sub_resources
99: FROM bom_operation_sequences a,
100: bom_operation_resources b,
101: bom_sub_operation_resources c
102: WHERE a.routing_sequence_id = from_rtg_seq_id
103: AND NVL (a.eco_for_production, 2) = 2
123: sql_stmt_num := 3;
124:
125: SELECT COUNT (*)
126: INTO total_instructions
127: FROM bom_operation_sequences a,
128: fnd_attached_documents b
129: WHERE a.routing_sequence_id = from_rtg_seq_id
130: AND NVL (a.eco_for_production, 2) = 2
131: AND (display_option = 1
141: )
142: )
143: )
144: AND a.operation_sequence_id = b.pk1_value
145: AND b.entity_name = 'BOM_OPERATION_SEQUENCES';
146:
147: --begin bug fix 3473851
148: sql_stmt_num := 5;
149:
261: CURSOR source_rtg
262: IS
263: SELECT operation_sequence_id,
264: last_updated_by
265: FROM bom_operation_sequences
266: WHERE routing_sequence_id = to_sequence_id
267: AND NVL (eco_for_production, 2) = 2;
268:
269: CURSOR process_op
269: CURSOR process_op
270: IS
271: SELECT operation_sequence_id,
272: operation_seq_num
273: FROM bom_operation_sequences
274: WHERE routing_sequence_id = x_from_sequence_id -- Bug 2642427
275: AND NVL (eco_for_production, 2) = 2
276: AND operation_type = 2;
277:
278: CURSOR line_op
279: IS
280: SELECT operation_sequence_id,
281: operation_seq_num
282: FROM bom_operation_sequences
283: WHERE routing_sequence_id = x_from_sequence_id -- Bug 2642427
284: AND NVL (eco_for_production, 2) = 2
285: AND operation_type = 3;
286:
288: CURSOR update_st_op
289: IS
290: SELECT standard_operation_id,
291: operation_sequence_id
292: FROM bom_operation_sequences
293: WHERE routing_sequence_id = to_sequence_id;
294: l_from_item_id NUMBER;
295: BEGIN
296: SAVEPOINT begin_routing_copy;
340: ELSE
341: l_curr_date := p_trgt_eff_date; -- Routing can be copied to particular from TTMO flow - R12
342: END IF;
343:
344: INSERT INTO bom_operation_sequences
345: (operation_sequence_id,
346: routing_sequence_id,
347: operation_seq_num,
348: last_update_date,
417: show_scrap_code,
418: show_lot_attrib,
419: track_multiple_res_usage_dates
420: )
421: SELECT bom_operation_sequences_s.NEXTVAL,
422: to_sequence_id,
423: a.operation_seq_num,
424: l_curr_date,
425: a.operation_sequence_id,
572: a.show_next_op_by_default,
573: a.show_scrap_code,
574: a.show_lot_attrib,
575: a.track_multiple_res_usage_dates
576: FROM bom_operation_sequences a, -- from op
577: bom_departments b, -- from op's dept
578: bom_departments c -- to op's dept
579: WHERE a.routing_sequence_id = x_from_sequence_id
580: AND NVL (a.eco_for_production, 2) = 2
615: )
616: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
617: (
618: SELECT 1
619: FROM bom_operation_sequences bos
620: WHERE bos.routing_sequence_id = a.routing_sequence_id
621: AND bos.old_operation_sequence_id = a.operation_sequence_id
622: AND bos.change_notice = p_context_eco
623: AND bos.acd_type = 3
668: fnd_global.conc_request_id,
669: NULL,
670: fnd_global.conc_program_id,
671: sysdate
672: FROM bom_operation_sequences a, -- from op
673: bom_departments b, -- from op's dept
674: bom_departments c -- to op's dept
675: WHERE a.routing_sequence_id = x_from_sequence_id
676: AND (display_option = 1 /* ALL */
709: )
710: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
711: (
712: SELECT 1
713: FROM bom_operation_sequences bos
714: WHERE bos.routing_sequence_id = a.routing_sequence_id
715: AND bos.old_operation_sequence_id = a.operation_sequence_id
716: AND bos.change_notice = p_context_eco
717: AND bos.acd_type = 3
736: fnd_global.conc_request_id,
737: NULL,
738: fnd_global.conc_program_id,
739: sysdate
740: FROM bom_operation_sequences a, -- from op
741: bom_departments b, -- from op's dept
742: bom_departments c -- to op's dept
743: WHERE a.routing_sequence_id = x_from_sequence_id
744: AND (display_option = 1 /* ALL */
777: )
778: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
779: (
780: SELECT 1
781: FROM bom_operation_sequences bos
782: WHERE bos.routing_sequence_id = a.routing_sequence_id
783: AND bos.old_operation_sequence_id = a.operation_sequence_id
784: AND bos.change_notice = p_context_eco
785: AND bos.acd_type = 3
820: fnd_global.conc_request_id,
821: NULL,
822: fnd_global.conc_program_id,
823: sysdate
824: FROM bom_operation_sequences a
825: WHERE a.routing_sequence_id = x_from_sequence_id
826: AND (display_option = 1 /* ALL */
827: OR (display_option = 2 /* CURRENT */
828: AND a.effectivity_date <= rev_date
855: )
856: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
857: (
858: SELECT 1
859: FROM bom_operation_sequences bos
860: WHERE bos.routing_sequence_id = a.routing_sequence_id
861: AND bos.old_operation_sequence_id = a.operation_sequence_id
862: AND bos.change_notice = p_context_eco
863: AND bos.acd_type = 3
898: fnd_global.conc_request_id,
899: NULL,
900: fnd_global.conc_program_id,
901: sysdate
902: FROM bom_operation_sequences a
903: WHERE a.routing_sequence_id = x_from_sequence_id
904: AND (display_option = 1 /* ALL */
905: OR (display_option = 2 /* CURRENT */
906: AND a.effectivity_date <= rev_date
974: -- BUG 3936049
975: AND NVL (a.operation_type, -99) = NVL (b.operation_type,
976: -99); -- BUG 3936049
977:
978: UPDATE bom_operation_sequences
979: SET standard_operation_id = new_st_op_id,
980: minimum_transfer_quantity = min_qty,
981: backflush_flag = back_flag,
982: option_dependent_flag = opt_flag,
988: copy_ops_update := copy_ops_update + 1;
989: EXCEPTION
990: WHEN NO_DATA_FOUND
991: THEN
992: UPDATE bom_operation_sequences
993: SET standard_operation_id = NULL
994: WHERE routing_sequence_id = to_sequence_id
995: AND operation_sequence_id = p_op_seq_id;
996: END;
1009:
1010: BEGIN
1011: SELECT operation_sequence_id
1012: INTO new_p_op_seq_id
1013: FROM bom_operation_sequences
1014: WHERE routing_sequence_id = to_sequence_id
1015: AND operation_type = 2
1016: AND NVL (eco_for_production, 2) = 2
1017: AND operation_seq_num = p_op_seq_num;
1020: THEN
1021: NULL;
1022: END;
1023:
1024: UPDATE bom_operation_sequences
1025: SET process_op_seq_id = new_p_op_seq_id
1026: WHERE operation_type = 1
1027: AND routing_sequence_id = to_sequence_id
1028: AND process_op_seq_id = p_op_seq_id;
1039:
1040: BEGIN
1041: SELECT operation_sequence_id
1042: INTO new_l_op_seq_id
1043: FROM bom_operation_sequences
1044: WHERE routing_sequence_id = to_sequence_id
1045: AND operation_type = 3
1046: AND NVL (eco_for_production, 2) = 2
1047: AND operation_seq_num = l_op_seq_num;
1050: THEN
1051: NULL;
1052: END;
1053:
1054: UPDATE bom_operation_sequences
1055: SET line_op_seq_id = new_l_op_seq_id
1056: WHERE operation_type = 1
1057: AND routing_sequence_id = to_sequence_id
1058: AND line_op_seq_id = l_op_seq_id;
1129: NULL,
1130: fnd_global.conc_program_id,
1131: sysdate
1132: FROM bom_operation_networks bon,
1133: bom_operation_sequences bos4, -- dest to op
1134: bom_operation_sequences bos3, -- dest from op
1135: bom_operation_sequences bos2, -- src to op
1136: bom_operation_sequences bos1 -- src from op
1137: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1130: fnd_global.conc_program_id,
1131: sysdate
1132: FROM bom_operation_networks bon,
1133: bom_operation_sequences bos4, -- dest to op
1134: bom_operation_sequences bos3, -- dest from op
1135: bom_operation_sequences bos2, -- src to op
1136: bom_operation_sequences bos1 -- src from op
1137: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1138: AND bon.to_op_seq_id = bos2.operation_sequence_id
1131: sysdate
1132: FROM bom_operation_networks bon,
1133: bom_operation_sequences bos4, -- dest to op
1134: bom_operation_sequences bos3, -- dest from op
1135: bom_operation_sequences bos2, -- src to op
1136: bom_operation_sequences bos1 -- src from op
1137: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1138: AND bon.to_op_seq_id = bos2.operation_sequence_id
1139: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1132: FROM bom_operation_networks bon,
1133: bom_operation_sequences bos4, -- dest to op
1134: bom_operation_sequences bos3, -- dest from op
1135: bom_operation_sequences bos2, -- src to op
1136: bom_operation_sequences bos1 -- src from op
1137: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1138: AND bon.to_op_seq_id = bos2.operation_sequence_id
1139: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1140: AND bos1.routing_sequence_id = x_from_sequence_id
1216: NULL,
1217: fnd_global.conc_program_id,
1218: sysdate
1219: FROM bom_operation_networks bon,
1220: bom_operation_sequences bos4, -- dest to op
1221: bom_operation_sequences bos3, -- dest from op
1222: bom_operation_sequences bos2, -- src to op
1223: bom_operation_sequences bos1, -- src from op
1224: mfg_lookups mfgl
1217: fnd_global.conc_program_id,
1218: sysdate
1219: FROM bom_operation_networks bon,
1220: bom_operation_sequences bos4, -- dest to op
1221: bom_operation_sequences bos3, -- dest from op
1222: bom_operation_sequences bos2, -- src to op
1223: bom_operation_sequences bos1, -- src from op
1224: mfg_lookups mfgl
1225: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1218: sysdate
1219: FROM bom_operation_networks bon,
1220: bom_operation_sequences bos4, -- dest to op
1221: bom_operation_sequences bos3, -- dest from op
1222: bom_operation_sequences bos2, -- src to op
1223: bom_operation_sequences bos1, -- src from op
1224: mfg_lookups mfgl
1225: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1226: AND bon.to_op_seq_id = bos2.operation_sequence_id
1219: FROM bom_operation_networks bon,
1220: bom_operation_sequences bos4, -- dest to op
1221: bom_operation_sequences bos3, -- dest from op
1222: bom_operation_sequences bos2, -- src to op
1223: bom_operation_sequences bos1, -- src from op
1224: mfg_lookups mfgl
1225: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1226: AND bon.to_op_seq_id = bos2.operation_sequence_id
1227: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1258: NULL,
1259: fnd_global.conc_program_id,
1260: sysdate
1261: FROM bom_operation_networks bon,
1262: bom_operation_sequences bos4, -- dest to op
1263: bom_operation_sequences bos3, -- dest from op
1264: bom_operation_sequences bos2, -- src to op
1265: bom_operation_sequences bos1, -- src from op
1266: mfg_lookups mfgl
1259: fnd_global.conc_program_id,
1260: sysdate
1261: FROM bom_operation_networks bon,
1262: bom_operation_sequences bos4, -- dest to op
1263: bom_operation_sequences bos3, -- dest from op
1264: bom_operation_sequences bos2, -- src to op
1265: bom_operation_sequences bos1, -- src from op
1266: mfg_lookups mfgl
1267: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1260: sysdate
1261: FROM bom_operation_networks bon,
1262: bom_operation_sequences bos4, -- dest to op
1263: bom_operation_sequences bos3, -- dest from op
1264: bom_operation_sequences bos2, -- src to op
1265: bom_operation_sequences bos1, -- src from op
1266: mfg_lookups mfgl
1267: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1268: AND bon.to_op_seq_id = bos2.operation_sequence_id
1261: FROM bom_operation_networks bon,
1262: bom_operation_sequences bos4, -- dest to op
1263: bom_operation_sequences bos3, -- dest from op
1264: bom_operation_sequences bos2, -- src to op
1265: bom_operation_sequences bos1, -- src from op
1266: mfg_lookups mfgl
1267: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1268: AND bon.to_op_seq_id = bos2.operation_sequence_id
1269: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1317: NULL,
1318: fnd_global.conc_program_id,
1319: sysdate
1320: FROM bom_operation_networks bon,
1321: bom_operation_sequences bos4, -- dest to op
1322: bom_operation_sequences bos3, -- dest from op
1323: bom_operation_sequences bos2, -- src to op
1324: bom_operation_sequences bos1, -- src from op
1325: mfg_lookups mfgl
1318: fnd_global.conc_program_id,
1319: sysdate
1320: FROM bom_operation_networks bon,
1321: bom_operation_sequences bos4, -- dest to op
1322: bom_operation_sequences bos3, -- dest from op
1323: bom_operation_sequences bos2, -- src to op
1324: bom_operation_sequences bos1, -- src from op
1325: mfg_lookups mfgl
1326: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1319: sysdate
1320: FROM bom_operation_networks bon,
1321: bom_operation_sequences bos4, -- dest to op
1322: bom_operation_sequences bos3, -- dest from op
1323: bom_operation_sequences bos2, -- src to op
1324: bom_operation_sequences bos1, -- src from op
1325: mfg_lookups mfgl
1326: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1327: AND bon.to_op_seq_id = bos2.operation_sequence_id
1320: FROM bom_operation_networks bon,
1321: bom_operation_sequences bos4, -- dest to op
1322: bom_operation_sequences bos3, -- dest from op
1323: bom_operation_sequences bos2, -- src to op
1324: bom_operation_sequences bos1, -- src from op
1325: mfg_lookups mfgl
1326: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1327: AND bon.to_op_seq_id = bos2.operation_sequence_id
1328: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1359: NULL,
1360: fnd_global.conc_program_id,
1361: sysdate
1362: FROM bom_operation_networks bon,
1363: bom_operation_sequences bos4, -- dest to op
1364: bom_operation_sequences bos3, -- dest from op
1365: bom_operation_sequences bos2, -- src to op
1366: bom_operation_sequences bos1, -- src from op
1367: mfg_lookups mfgl
1360: fnd_global.conc_program_id,
1361: sysdate
1362: FROM bom_operation_networks bon,
1363: bom_operation_sequences bos4, -- dest to op
1364: bom_operation_sequences bos3, -- dest from op
1365: bom_operation_sequences bos2, -- src to op
1366: bom_operation_sequences bos1, -- src from op
1367: mfg_lookups mfgl
1368: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1361: sysdate
1362: FROM bom_operation_networks bon,
1363: bom_operation_sequences bos4, -- dest to op
1364: bom_operation_sequences bos3, -- dest from op
1365: bom_operation_sequences bos2, -- src to op
1366: bom_operation_sequences bos1, -- src from op
1367: mfg_lookups mfgl
1368: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1369: AND bon.to_op_seq_id = bos2.operation_sequence_id
1362: FROM bom_operation_networks bon,
1363: bom_operation_sequences bos4, -- dest to op
1364: bom_operation_sequences bos3, -- dest from op
1365: bom_operation_sequences bos2, -- src to op
1366: bom_operation_sequences bos1, -- src from op
1367: mfg_lookups mfgl
1368: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
1369: AND bon.to_op_seq_id = bos2.operation_sequence_id
1370: AND bos1.routing_sequence_id = bos2.routing_sequence_id
1393: FOR x_op IN source_rtg
1394: LOOP
1395: sql_stmt_num := 201;
1396: fnd_attached_documents2_pkg.copy_attachments
1397: (x_from_entity_name => 'BOM_OPERATION_SEQUENCES',
1398: x_from_pk1_value => x_op.last_updated_by,
1399: x_from_pk2_value => '',
1400: x_from_pk3_value => '',
1401: x_from_pk4_value => '',
1399: x_from_pk2_value => '',
1400: x_from_pk3_value => '',
1401: x_from_pk4_value => '',
1402: x_from_pk5_value => '',
1403: x_to_entity_name => 'BOM_OPERATION_SEQUENCES',
1404: x_to_pk1_value => x_op.operation_sequence_id,
1405: x_to_pk2_value => '',
1406: x_to_pk3_value => '',
1407: x_to_pk4_value => '',
1539: DECODE (p_routing_or_eco, 1, b.change_notice, p_e_change_notice),
1540: DECODE (p_routing_or_eco, 1, b.acd_type, 1),
1541: -- Add is the action for ECO
1542: b.original_system_reference
1543: FROM bom_operation_sequences a,
1544: bom_operation_resources b,
1545: bom_resources c,
1546: bom_resources d
1547: -- ,BOM_DEPARTMENT_RESOURCES E
1589: fnd_global.conc_request_id,
1590: NULL,
1591: fnd_global.conc_program_id,
1592: sysdate
1593: FROM bom_operation_sequences a,
1594: bom_operation_resources b,
1595: bom_operation_sequences fbor,
1596: bom_resources c,
1597: bom_resources d
1591: fnd_global.conc_program_id,
1592: sysdate
1593: FROM bom_operation_sequences a,
1594: bom_operation_resources b,
1595: bom_operation_sequences fbor,
1596: bom_resources c,
1597: bom_resources d
1598: WHERE a.routing_sequence_id = to_sequence_id
1599: AND a.last_updated_by = b.operation_sequence_id
1619: fnd_global.conc_request_id,
1620: NULL,
1621: fnd_global.conc_program_id,
1622: sysdate
1623: FROM bom_operation_sequences a,
1624: bom_operation_resources b,
1625: bom_operation_sequences fbor,
1626: bom_resources c,
1627: bom_resources d
1621: fnd_global.conc_program_id,
1622: sysdate
1623: FROM bom_operation_sequences a,
1624: bom_operation_resources b,
1625: bom_operation_sequences fbor,
1626: bom_resources c,
1627: bom_resources d
1628: WHERE a.routing_sequence_id = to_sequence_id
1629: AND a.last_updated_by = b.operation_sequence_id
1680: FROM bom_setup_types
1681: WHERE setup_id = a.setup_id))
1682: WHERE a.operation_sequence_id IN (
1683: SELECT operation_sequence_id
1684: FROM bom_operation_sequences
1685: WHERE routing_sequence_id =
1686: to_sequence_id);
1687: END IF;
1688:
1784: DECODE (p_routing_or_eco, 1, b.acd_type, 1),
1785: -- Add is the action for ECO
1786: b.original_system_reference
1787: FROM /*BOM_OPERATION_RESOURCES A, Commented for Bug 6828461*/
1788: bom_operation_sequences a, /*Added for Bug 6828461*/
1789: bom_sub_operation_resources b,
1790: bom_resources c,
1791: bom_resources d
1792: WHERE A.ROUTING_SEQUENCE_ID = to_sequence_id /*Added for performance improvement for bug 6828461*/
1833: NULL,
1834: fnd_global.conc_program_id,
1835: sysdate
1836: FROM bom_operation_resources a,
1837: bom_operation_sequences fbor,
1838: bom_sub_operation_resources b,
1839: bom_resources c,
1840: bom_resources d
1841: WHERE a.last_updated_by = b.operation_sequence_id
1863: NULL,
1864: fnd_global.conc_program_id,
1865: sysdate
1866: FROM bom_operation_resources a,
1867: bom_operation_sequences fbor,
1868: bom_sub_operation_resources b,
1869: bom_resources c,
1870: bom_resources d
1871: WHERE a.last_updated_by = b.operation_sequence_id
1915: FROM bom_setup_types
1916: WHERE setup_id = a.setup_id))
1917: WHERE a.operation_sequence_id IN (
1918: SELECT operation_sequence_id
1919: FROM bom_operation_sequences
1920: WHERE routing_sequence_id =
1921: to_sequence_id);
1922: END IF;
1923:
1925:
1926: -- UPDATE LAST_UPDATED_BY COLUMN USED TO STORE COPY_FROM OP_SEQ_IDS
1927: sql_stmt_num := 55;
1928:
1929: UPDATE bom_operation_sequences
1930: SET last_updated_by = user_id
1931: WHERE routing_sequence_id = to_sequence_id;
1932:
1933: -- Bug Fix 2991810
1937: SET last_updated_by = user_id,
1938: created_by = user_id
1939: WHERE operation_sequence_id IN (
1940: SELECT operation_sequence_id
1941: FROM bom_operation_sequences
1942: WHERE routing_sequence_id =
1943: to_sequence_id);
1944:
1945: sql_stmt_num := 39;
1946:
1947: SELECT COUNT (*)
1948: INTO copy_instrs
1949: FROM fnd_attached_documents b,
1950: bom_operation_sequences a
1951: WHERE a.routing_sequence_id = to_sequence_id
1952: AND a.operation_sequence_id = b.pk1_value
1953: AND b.entity_name = 'BOM_OPERATION_SEQUENCES';
1954:
1949: FROM fnd_attached_documents b,
1950: bom_operation_sequences a
1951: WHERE a.routing_sequence_id = to_sequence_id
1952: AND a.operation_sequence_id = b.pk1_value
1953: AND b.entity_name = 'BOM_OPERATION_SEQUENCES';
1954:
1955: --begin bug fix 3473851
1956: sql_stmt_num := 40;
1957:
2311: CURSOR source_rtg
2312: IS
2313: SELECT operation_sequence_id,
2314: last_updated_by
2315: FROM bom_operation_sequences
2316: WHERE routing_sequence_id = to_sequence_id
2317: AND NVL (eco_for_production, 2) = 2;
2318:
2319: CURSOR process_op
2319: CURSOR process_op
2320: IS
2321: SELECT operation_sequence_id,
2322: operation_seq_num
2323: FROM bom_operation_sequences
2324: WHERE routing_sequence_id = x_from_sequence_id -- Bug 2642427
2325: AND NVL (eco_for_production, 2) = 2
2326: AND operation_type = 2;
2327:
2328: CURSOR line_op
2329: IS
2330: SELECT operation_sequence_id,
2331: operation_seq_num
2332: FROM bom_operation_sequences
2333: WHERE routing_sequence_id = x_from_sequence_id -- Bug 2642427
2334: AND NVL (eco_for_production, 2) = 2
2335: AND operation_type = 3;
2336:
2338: CURSOR update_st_op
2339: IS
2340: SELECT standard_operation_id,
2341: operation_sequence_id
2342: FROM bom_operation_sequences
2343: WHERE routing_sequence_id = to_sequence_id;
2344: l_from_item_id NUMBER;
2345: BEGIN
2346: SAVEPOINT begin_routing_copy;
2390: ELSE
2391: l_curr_date := p_trgt_eff_date; -- Routing can be copied to particular from TTMO flow - R12
2392: END IF;
2393:
2394: INSERT INTO bom_operation_sequences
2395: (operation_sequence_id,
2396: routing_sequence_id,
2397: operation_seq_num,
2398: last_update_date,
2467: show_scrap_code,
2468: show_lot_attrib,
2469: track_multiple_res_usage_dates
2470: )
2471: SELECT bom_operation_sequences_s.NEXTVAL,
2472: to_sequence_id,
2473: a.operation_seq_num,
2474: l_curr_date,
2475: a.operation_sequence_id,
2553: a.show_next_op_by_default,
2554: a.show_scrap_code,
2555: a.show_lot_attrib,
2556: a.track_multiple_res_usage_dates
2557: FROM bom_operation_sequences a, -- from op
2558: bom_departments b, -- from op's dept
2559: bom_departments c -- to op's dept
2560: WHERE a.routing_sequence_id = x_from_sequence_id
2561: AND NVL (a.eco_for_production, 2) = 2
2576: )
2577: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
2578: (
2579: SELECT 1
2580: FROM bom_operation_sequences bos
2581: WHERE bos.routing_sequence_id = a.routing_sequence_id
2582: AND bos.old_operation_sequence_id = a.operation_sequence_id
2583: AND bos.change_notice = p_context_eco
2584: AND bos.acd_type = 3
2629: fnd_global.conc_request_id,
2630: NULL,
2631: fnd_global.conc_program_id,
2632: sysdate
2633: FROM bom_operation_sequences a, -- from op
2634: bom_departments b, -- from op's dept
2635: bom_departments c -- to op's dept
2636: WHERE a.routing_sequence_id = x_from_sequence_id
2637: AND ( ( p_cpy_disable_fields = 'Y' AND a.effectivity_date <= rev_date) -- For first revised item we can have past eff comps as eff on the target date
2650: )
2651: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
2652: (
2653: SELECT 1
2654: FROM bom_operation_sequences bos
2655: WHERE bos.routing_sequence_id = a.routing_sequence_id
2656: AND bos.old_operation_sequence_id = a.operation_sequence_id
2657: AND bos.change_notice = p_context_eco
2658: AND bos.acd_type = 3
2677: fnd_global.conc_request_id,
2678: NULL,
2679: fnd_global.conc_program_id,
2680: sysdate
2681: FROM bom_operation_sequences a, -- from op
2682: bom_departments b -- from op's dept
2683: WHERE a.routing_sequence_id = x_from_sequence_id
2684: AND ( ( p_cpy_disable_fields = 'Y' AND a.effectivity_date <= rev_date) -- For first revised item we can have past eff comps as eff on the target date
2685: OR ( p_cpy_disable_fields = 'N' AND a.effectivity_date = rev_date )
2693: )
2694: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
2695: (
2696: SELECT 1
2697: FROM bom_operation_sequences bos
2698: WHERE bos.routing_sequence_id = a.routing_sequence_id
2699: AND bos.old_operation_sequence_id = a.operation_sequence_id
2700: AND bos.change_notice = p_context_eco
2701: AND bos.acd_type = 3
2736: fnd_global.conc_request_id,
2737: NULL,
2738: fnd_global.conc_program_id,
2739: sysdate
2740: FROM bom_operation_sequences a
2741: WHERE a.routing_sequence_id = x_from_sequence_id
2742: AND ( ( p_cpy_disable_fields = 'Y' AND a.effectivity_date <= rev_date) -- For first revised item we can have past eff comps as eff on the target date
2743: OR ( p_cpy_disable_fields = 'N' AND a.effectivity_date = rev_date )
2744: )
2751: )
2752: AND NOT EXISTS -- Bug 5151332 Disabled operations should not get copied in ECO context
2753: (
2754: SELECT 1
2755: FROM bom_operation_sequences bos
2756: WHERE bos.routing_sequence_id = a.routing_sequence_id
2757: AND bos.old_operation_sequence_id = a.operation_sequence_id
2758: AND bos.change_notice = p_context_eco
2759: AND bos.acd_type = 3
2795: fnd_global.conc_request_id,
2796: NULL,
2797: fnd_global.conc_program_id,
2798: sysdate
2799: FROM bom_operation_sequences a
2800: WHERE a.routing_sequence_id = x_from_sequence_id
2801: AND ( ( p_cpy_disable_fields = 'Y' AND a.effectivity_date <= rev_date) -- For first revised item we can have past eff comps as eff on the target date
2802: OR ( p_cpy_disable_fields = 'N' AND a.effectivity_date = rev_date )
2803: )
2851: -- BUG 3936049
2852: AND NVL (a.operation_type, -99) = NVL (b.operation_type,
2853: -99); -- BUG 3936049
2854:
2855: UPDATE bom_operation_sequences
2856: SET standard_operation_id = new_st_op_id,
2857: minimum_transfer_quantity = min_qty,
2858: backflush_flag = back_flag,
2859: option_dependent_flag = opt_flag,
2865: copy_ops_update := copy_ops_update + 1;
2866: EXCEPTION
2867: WHEN NO_DATA_FOUND
2868: THEN
2869: UPDATE bom_operation_sequences
2870: SET standard_operation_id = NULL
2871: WHERE routing_sequence_id = to_sequence_id
2872: AND operation_sequence_id = p_op_seq_id;
2873: END;
2886:
2887: BEGIN
2888: SELECT operation_sequence_id
2889: INTO new_p_op_seq_id
2890: FROM bom_operation_sequences
2891: WHERE routing_sequence_id = to_sequence_id
2892: AND operation_type = 2
2893: AND NVL (eco_for_production, 2) = 2
2894: AND operation_seq_num = p_op_seq_num;
2897: THEN
2898: NULL;
2899: END;
2900:
2901: UPDATE bom_operation_sequences
2902: SET process_op_seq_id = new_p_op_seq_id
2903: WHERE operation_type = 1
2904: AND routing_sequence_id = to_sequence_id
2905: AND process_op_seq_id = p_op_seq_id;
2916:
2917: BEGIN
2918: SELECT operation_sequence_id
2919: INTO new_l_op_seq_id
2920: FROM bom_operation_sequences
2921: WHERE routing_sequence_id = to_sequence_id
2922: AND operation_type = 3
2923: AND NVL (eco_for_production, 2) = 2
2924: AND operation_seq_num = l_op_seq_num;
2927: THEN
2928: NULL;
2929: END;
2930:
2931: UPDATE bom_operation_sequences
2932: SET line_op_seq_id = new_l_op_seq_id
2933: WHERE operation_type = 1
2934: AND routing_sequence_id = to_sequence_id
2935: AND line_op_seq_id = l_op_seq_id;
3006: NULL,
3007: fnd_global.conc_program_id,
3008: sysdate
3009: FROM bom_operation_networks bon,
3010: bom_operation_sequences bos4, -- dest to op
3011: bom_operation_sequences bos3, -- dest from op
3012: bom_operation_sequences bos2, -- src to op
3013: bom_operation_sequences bos1 -- src from op
3014: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3007: fnd_global.conc_program_id,
3008: sysdate
3009: FROM bom_operation_networks bon,
3010: bom_operation_sequences bos4, -- dest to op
3011: bom_operation_sequences bos3, -- dest from op
3012: bom_operation_sequences bos2, -- src to op
3013: bom_operation_sequences bos1 -- src from op
3014: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3015: AND bon.to_op_seq_id = bos2.operation_sequence_id
3008: sysdate
3009: FROM bom_operation_networks bon,
3010: bom_operation_sequences bos4, -- dest to op
3011: bom_operation_sequences bos3, -- dest from op
3012: bom_operation_sequences bos2, -- src to op
3013: bom_operation_sequences bos1 -- src from op
3014: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3015: AND bon.to_op_seq_id = bos2.operation_sequence_id
3016: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3009: FROM bom_operation_networks bon,
3010: bom_operation_sequences bos4, -- dest to op
3011: bom_operation_sequences bos3, -- dest from op
3012: bom_operation_sequences bos2, -- src to op
3013: bom_operation_sequences bos1 -- src from op
3014: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3015: AND bon.to_op_seq_id = bos2.operation_sequence_id
3016: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3017: AND bos1.routing_sequence_id = x_from_sequence_id
3094: NULL,
3095: fnd_global.conc_program_id,
3096: sysdate
3097: FROM bom_operation_networks bon,
3098: bom_operation_sequences bos4, -- dest to op
3099: bom_operation_sequences bos3, -- dest from op
3100: bom_operation_sequences bos2, -- src to op
3101: bom_operation_sequences bos1, -- src from op
3102: mfg_lookups mfgl
3095: fnd_global.conc_program_id,
3096: sysdate
3097: FROM bom_operation_networks bon,
3098: bom_operation_sequences bos4, -- dest to op
3099: bom_operation_sequences bos3, -- dest from op
3100: bom_operation_sequences bos2, -- src to op
3101: bom_operation_sequences bos1, -- src from op
3102: mfg_lookups mfgl
3103: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3096: sysdate
3097: FROM bom_operation_networks bon,
3098: bom_operation_sequences bos4, -- dest to op
3099: bom_operation_sequences bos3, -- dest from op
3100: bom_operation_sequences bos2, -- src to op
3101: bom_operation_sequences bos1, -- src from op
3102: mfg_lookups mfgl
3103: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3104: AND bon.to_op_seq_id = bos2.operation_sequence_id
3097: FROM bom_operation_networks bon,
3098: bom_operation_sequences bos4, -- dest to op
3099: bom_operation_sequences bos3, -- dest from op
3100: bom_operation_sequences bos2, -- src to op
3101: bom_operation_sequences bos1, -- src from op
3102: mfg_lookups mfgl
3103: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3104: AND bon.to_op_seq_id = bos2.operation_sequence_id
3105: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3137: NULL,
3138: fnd_global.conc_program_id,
3139: sysdate
3140: FROM bom_operation_networks bon,
3141: bom_operation_sequences bos4, -- dest to op
3142: bom_operation_sequences bos3, -- dest from op
3143: bom_operation_sequences bos2, -- src to op
3144: bom_operation_sequences bos1, -- src from op
3145: mfg_lookups mfgl
3138: fnd_global.conc_program_id,
3139: sysdate
3140: FROM bom_operation_networks bon,
3141: bom_operation_sequences bos4, -- dest to op
3142: bom_operation_sequences bos3, -- dest from op
3143: bom_operation_sequences bos2, -- src to op
3144: bom_operation_sequences bos1, -- src from op
3145: mfg_lookups mfgl
3146: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3139: sysdate
3140: FROM bom_operation_networks bon,
3141: bom_operation_sequences bos4, -- dest to op
3142: bom_operation_sequences bos3, -- dest from op
3143: bom_operation_sequences bos2, -- src to op
3144: bom_operation_sequences bos1, -- src from op
3145: mfg_lookups mfgl
3146: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3147: AND bon.to_op_seq_id = bos2.operation_sequence_id
3140: FROM bom_operation_networks bon,
3141: bom_operation_sequences bos4, -- dest to op
3142: bom_operation_sequences bos3, -- dest from op
3143: bom_operation_sequences bos2, -- src to op
3144: bom_operation_sequences bos1, -- src from op
3145: mfg_lookups mfgl
3146: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3147: AND bon.to_op_seq_id = bos2.operation_sequence_id
3148: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3197: NULL,
3198: fnd_global.conc_program_id,
3199: sysdate
3200: FROM bom_operation_networks bon,
3201: bom_operation_sequences bos4, -- dest to op
3202: bom_operation_sequences bos3, -- dest from op
3203: bom_operation_sequences bos2, -- src to op
3204: bom_operation_sequences bos1, -- src from op
3205: mfg_lookups mfgl
3198: fnd_global.conc_program_id,
3199: sysdate
3200: FROM bom_operation_networks bon,
3201: bom_operation_sequences bos4, -- dest to op
3202: bom_operation_sequences bos3, -- dest from op
3203: bom_operation_sequences bos2, -- src to op
3204: bom_operation_sequences bos1, -- src from op
3205: mfg_lookups mfgl
3206: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3199: sysdate
3200: FROM bom_operation_networks bon,
3201: bom_operation_sequences bos4, -- dest to op
3202: bom_operation_sequences bos3, -- dest from op
3203: bom_operation_sequences bos2, -- src to op
3204: bom_operation_sequences bos1, -- src from op
3205: mfg_lookups mfgl
3206: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3207: AND bon.to_op_seq_id = bos2.operation_sequence_id
3200: FROM bom_operation_networks bon,
3201: bom_operation_sequences bos4, -- dest to op
3202: bom_operation_sequences bos3, -- dest from op
3203: bom_operation_sequences bos2, -- src to op
3204: bom_operation_sequences bos1, -- src from op
3205: mfg_lookups mfgl
3206: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3207: AND bon.to_op_seq_id = bos2.operation_sequence_id
3208: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3240: NULL,
3241: fnd_global.conc_program_id,
3242: sysdate
3243: FROM bom_operation_networks bon,
3244: bom_operation_sequences bos4, -- dest to op
3245: bom_operation_sequences bos3, -- dest from op
3246: bom_operation_sequences bos2, -- src to op
3247: bom_operation_sequences bos1, -- src from op
3248: mfg_lookups mfgl
3241: fnd_global.conc_program_id,
3242: sysdate
3243: FROM bom_operation_networks bon,
3244: bom_operation_sequences bos4, -- dest to op
3245: bom_operation_sequences bos3, -- dest from op
3246: bom_operation_sequences bos2, -- src to op
3247: bom_operation_sequences bos1, -- src from op
3248: mfg_lookups mfgl
3249: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3242: sysdate
3243: FROM bom_operation_networks bon,
3244: bom_operation_sequences bos4, -- dest to op
3245: bom_operation_sequences bos3, -- dest from op
3246: bom_operation_sequences bos2, -- src to op
3247: bom_operation_sequences bos1, -- src from op
3248: mfg_lookups mfgl
3249: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3250: AND bon.to_op_seq_id = bos2.operation_sequence_id
3243: FROM bom_operation_networks bon,
3244: bom_operation_sequences bos4, -- dest to op
3245: bom_operation_sequences bos3, -- dest from op
3246: bom_operation_sequences bos2, -- src to op
3247: bom_operation_sequences bos1, -- src from op
3248: mfg_lookups mfgl
3249: WHERE bon.from_op_seq_id = bos1.operation_sequence_id
3250: AND bon.to_op_seq_id = bos2.operation_sequence_id
3251: AND bos1.routing_sequence_id = bos2.routing_sequence_id
3368: DECODE (p_routing_or_eco, 1, b.change_notice, p_e_change_notice),
3369: DECODE (p_routing_or_eco, 1, b.acd_type, 1),
3370: -- Add is the action for ECO
3371: b.original_system_reference
3372: FROM bom_operation_sequences a,
3373: bom_operation_resources b,
3374: bom_resources c,
3375: bom_resources d
3376: -- ,BOM_DEPARTMENT_RESOURCES E
3419: fnd_global.conc_request_id,
3420: NULL,
3421: fnd_global.conc_program_id,
3422: sysdate
3423: FROM bom_operation_sequences a,
3424: bom_operation_resources b,
3425: bom_operation_sequences fbor,
3426: bom_resources c,
3427: bom_resources d
3421: fnd_global.conc_program_id,
3422: sysdate
3423: FROM bom_operation_sequences a,
3424: bom_operation_resources b,
3425: bom_operation_sequences fbor,
3426: bom_resources c,
3427: bom_resources d
3428: WHERE a.routing_sequence_id = to_sequence_id
3429: AND a.last_updated_by = b.operation_sequence_id
3450: fnd_global.conc_request_id,
3451: NULL,
3452: fnd_global.conc_program_id,
3453: sysdate
3454: FROM bom_operation_sequences a,
3455: bom_operation_resources b,
3456: bom_operation_sequences fbor,
3457: bom_resources c,
3458: bom_resources d
3452: fnd_global.conc_program_id,
3453: sysdate
3454: FROM bom_operation_sequences a,
3455: bom_operation_resources b,
3456: bom_operation_sequences fbor,
3457: bom_resources c,
3458: bom_resources d
3459: WHERE a.routing_sequence_id = to_sequence_id
3460: AND a.last_updated_by = b.operation_sequence_id
3512: FROM bom_setup_types
3513: WHERE setup_id = a.setup_id))
3514: WHERE a.operation_sequence_id IN (
3515: SELECT operation_sequence_id
3516: FROM bom_operation_sequences
3517: WHERE routing_sequence_id =
3518: to_sequence_id);
3519: END IF;
3520:
3618: FROM bom_operation_resources a,
3619: bom_sub_operation_resources b,
3620: bom_resources c,
3621: bom_resources d,
3622: bom_operation_sequences bos
3623: WHERE a.last_updated_by = b.operation_sequence_id
3624: AND bos.operation_sequence_id = b.operation_sequence_id
3625: AND bos.revised_item_sequence_id = p_rev_item_seq_id
3626: AND a.created_by = b.schedule_seq_num
3665: NULL,
3666: fnd_global.conc_program_id,
3667: sysdate
3668: FROM bom_operation_resources a,
3669: bom_operation_sequences fbor,
3670: bom_sub_operation_resources b,
3671: bom_resources c,
3672: bom_resources d
3673: WHERE a.last_updated_by = b.operation_sequence_id
3696: NULL,
3697: fnd_global.conc_program_id,
3698: sysdate
3699: FROM bom_operation_resources a,
3700: bom_operation_sequences fbor,
3701: bom_sub_operation_resources b,
3702: bom_resources c,
3703: bom_resources d
3704: WHERE a.last_updated_by = b.operation_sequence_id
3749: FROM bom_setup_types
3750: WHERE setup_id = a.setup_id))
3751: WHERE a.operation_sequence_id IN (
3752: SELECT operation_sequence_id
3753: FROM bom_operation_sequences
3754: WHERE routing_sequence_id =
3755: to_sequence_id);
3756: END IF;
3757:
3759:
3760: -- UPDATE LAST_UPDATED_BY COLUMN USED TO STORE COPY_FROM OP_SEQ_IDS
3761: sql_stmt_num := 55;
3762:
3763: UPDATE bom_operation_sequences
3764: SET last_updated_by = user_id
3765: WHERE routing_sequence_id = to_sequence_id;
3766:
3767: -- Bug Fix 2991810
3771: SET last_updated_by = user_id,
3772: created_by = user_id
3773: WHERE operation_sequence_id IN (
3774: SELECT operation_sequence_id
3775: FROM bom_operation_sequences
3776: WHERE routing_sequence_id =
3777: to_sequence_id);
3778:
3779: sql_stmt_num := 39;
3780:
3781: SELECT COUNT (*)
3782: INTO copy_instrs
3783: FROM fnd_attached_documents b,
3784: bom_operation_sequences a
3785: WHERE a.routing_sequence_id = to_sequence_id
3786: AND a.operation_sequence_id = b.pk1_value
3787: AND b.entity_name = 'BOM_OPERATION_SEQUENCES';
3788:
3783: FROM fnd_attached_documents b,
3784: bom_operation_sequences a
3785: WHERE a.routing_sequence_id = to_sequence_id
3786: AND a.operation_sequence_id = b.pk1_value
3787: AND b.entity_name = 'BOM_OPERATION_SEQUENCES';
3788:
3789: --begin bug fix 3473851
3790: sql_stmt_num := 40;
3791:
3836: CURSOR source_rtg
3837: IS
3838: SELECT operation_sequence_id,
3839: last_updated_by
3840: FROM bom_operation_sequences
3841: WHERE routing_sequence_id = p_to_sequence_id
3842: AND NVL (eco_for_production, 2) = 2;
3843: BEGIN
3844:
3845: BEGIN
3846: FOR x_op IN source_rtg
3847: LOOP
3848: fnd_attached_documents2_pkg.copy_attachments
3849: (x_from_entity_name => 'BOM_OPERATION_SEQUENCES',
3850: x_from_pk1_value => x_op.last_updated_by,
3851: x_from_pk2_value => '',
3852: x_from_pk3_value => '',
3853: x_from_pk4_value => '',
3851: x_from_pk2_value => '',
3852: x_from_pk3_value => '',
3853: x_from_pk4_value => '',
3854: x_from_pk5_value => '',
3855: x_to_entity_name => 'BOM_OPERATION_SEQUENCES',
3856: x_to_pk1_value => x_op.operation_sequence_id,
3857: x_to_pk2_value => '',
3858: x_to_pk3_value => '',
3859: x_to_pk4_value => '',
3896: ,p_to_sequence_id IN NUMBER )
3897: IS
3898: BEGIN
3899:
3900: UPDATE bom_operation_sequences bos
3901: SET last_updated_by = p_user_id
3902: WHERE bos.routing_sequence_id = p_to_sequence_id;
3903:
3904: END;