261: /* CURSOR start_ops_cur IS
262: SELECT DISTINCT from_op_seq_id start_op_seq_id,
263: from_seq_num start_op_seq_num,
264: nvl(yield, 1) start_op_yield
265: FROM bom_operation_networks_v bonv,
266: bom_operation_sequences bos
267: WHERE bonv.routing_sequence_id = p_routing_sequence_id
268: AND bonv.operation_type = p_operation_type
269: AND bonv.transition_type <> 3
268: AND bonv.operation_type = p_operation_type
269: AND bonv.transition_type <> 3
270: AND bonv.from_op_seq_id = bos.operation_sequence_id
271: AND NOT EXISTS (SELECT NULL
272: FROM bom_operation_networks net
273: WHERE net.to_op_seq_id = bonv.from_op_seq_id
274: AND net.transition_type <> 3)
275: ORDER BY from_seq_num;*/
276: -- BUG 4506235
277: CURSOR start_ops_cur IS
278: SELECT DISTINCT from_op_seq_id start_op_seq_id,
279: from_seq_num start_op_seq_num,
280: DECODE(borv.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1)) start_op_yield
281: FROM bom_operation_networks_v bonv,
282: bom_operation_sequences bos,
283: bom_operational_routings_v borv
284: WHERE bonv.routing_sequence_id = borv.routing_Sequence_id
285: AND bonv.routing_sequence_id = p_routing_sequence_id
286: AND bonv.operation_type = p_operation_type
287: AND bonv.transition_type <> 3
288: AND bonv.from_op_seq_id = bos.operation_sequence_id
289: AND NOT EXISTS (SELECT NULL
290: FROM bom_operation_networks net
291: WHERE net.to_op_seq_id = bonv.from_op_seq_id
292: AND net.transition_type <> 3)
293: ORDER BY from_seq_num;
294:
294:
295: CURSOR check_nwk_links_cur IS
296: SELECT null FROM DUAL
297: WHERE exists
298: ( SELECT null FROM bom_operation_networks_v bonv
299: WHERE bonv.routing_sequence_id = p_routing_sequence_id
300: AND bonv.operation_type = p_operation_type
301: AND bonv.transition_type <> 3 );
302: /****
309: --Modified the cursor by replacing OR with UNION ALL for bug 12652195
310:
311: CURSOR check_nwk_exists_cur( p_rtg_seq_id NUMBER ) IS -- BUG 4348554
312: SELECT 1
313: FROM BOM_OPERATION_NETWORKS
314: WHERE FROM_OP_SEQ_ID IN
315: (SELECT OPERATION_SEQUENCE_ID
316: FROM BOM_OPERATION_SEQUENCES
317: WHERE ROUTING_SEQUENCE_ID = p_rtg_seq_id
318: )
319: AND rownum=1
320: UNION ALL
321: SELECT 1
322: FROM BOM_OPERATION_NETWORKS
323: WHERE TO_OP_SEQ_ID IN
324: (SELECT OPERATION_SEQUENCE_ID
325: FROM BOM_OPERATION_SEQUENCES
326: WHERE ROUTING_SEQUENCE_ID = p_rtg_seq_id
476: /* CURSOR start_ops_cur IS
477: SELECT DISTINCT from_op_seq_id start_op_seq_id,
478: from_seq_num start_op_seq_num,
479: nvl(yield, 1) start_op_yield
480: FROM bom_operation_networks_v bonv,
481: bom_operation_sequences bos
482: WHERE bonv.routing_sequence_id = p_routing_sequence_id
483: AND bonv.operation_type = p_operation_type
484: AND bonv.transition_type <> 3
483: AND bonv.operation_type = p_operation_type
484: AND bonv.transition_type <> 3
485: AND bonv.from_op_seq_id = bos.operation_sequence_id
486: AND NOT EXISTS (SELECT NULL
487: FROM bom_operation_networks net
488: WHERE net.to_op_seq_id = bonv.from_op_seq_id
489: AND net.transition_type <> 3)
490: ORDER BY from_seq_num;*/
491: -- BUG 4506235
492: CURSOR start_ops_cur IS
493: SELECT DISTINCT from_op_seq_id start_op_seq_id,
494: from_seq_num start_op_seq_num,
495: DECODE(borv.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1)) start_op_yield
496: FROM bom_operation_networks_v bonv,
497: bom_operation_sequences bos,
498: bom_operational_routings_v borv
499: WHERE bonv.routing_sequence_id = borv.routing_Sequence_id
500: AND bonv.routing_sequence_id = p_routing_sequence_id
501: AND bonv.operation_type = p_operation_type
502: AND bonv.transition_type <> 3
503: AND bonv.from_op_seq_id = bos.operation_sequence_id
504: AND NOT EXISTS (SELECT NULL
505: FROM bom_operation_networks net
506: WHERE net.to_op_seq_id = bonv.from_op_seq_id
507: AND net.transition_type <> 3)
508: ORDER BY from_seq_num;
509:
509:
510: CURSOR check_nwk_links_cur IS
511: SELECT null FROM DUAL
512: WHERE exists
513: ( SELECT null FROM bom_operation_networks_v bonv
514: WHERE bonv.routing_sequence_id = p_routing_sequence_id
515: AND bonv.operation_type = p_operation_type
516: AND bonv.transition_type <> 3 );
517:
518: --Modified the cursor by replacing OR with UNION ALL for bug 12652195
519:
520: CURSOR check_nwk_exists_cur( p_rtg_seq_id NUMBER ) IS -- BUG 4348554
521: SELECT 1
522: FROM BOM_OPERATION_NETWORKS
523: WHERE FROM_OP_SEQ_ID IN
524: (SELECT OPERATION_SEQUENCE_ID
525: FROM BOM_OPERATION_SEQUENCES
526: WHERE ROUTING_SEQUENCE_ID = p_rtg_seq_id
527: )
528: AND rownum=1
529: UNION ALL
530: SELECT 1
531: FROM BOM_OPERATION_NETWORKS
532: WHERE TO_OP_SEQ_ID IN
533: (SELECT OPERATION_SEQUENCE_ID
534: FROM BOM_OPERATION_SEQUENCES
535: WHERE ROUTING_SEQUENCE_ID = p_rtg_seq_id
828: CURSOR next_ops_cur (cv_start_op_seq_id number) IS
829: SELECT to_op_seq_id next_op_seq_id,
830: to_seq_num next_op_seq_num,
831: transition_type
832: FROM bom_operation_networks_v bonv
833: WHERE routing_sequence_id = g_rtg_seq_id
834: AND from_op_seq_id = cv_start_op_seq_id
835: AND operation_type = g_op_type
836: -- AND transition_type <> 3
873: ) IS
874:
875: CURSOR prev_opns_cur (cv_to_seq_id number) IS
876: SELECT from_op_seq_id prev_op, planning_pct
877: FROM bom_operation_networks
878: WHERE to_op_seq_id = cv_to_seq_id
879: AND transition_type = 3;
880: j NUMBER := 0;
881: BEGIN
898:
899: PROCEDURE validate_operation(i NUMBER) is
900: CURSOR next_op_cur(cv_start_op_seq_id NUMBER) is
901: SELECT bonv.transition_type, bonv.planning_pct
902: FROM bom_operation_networks_v bonv
903: WHERE routing_sequence_id = g_rtg_seq_id
904: AND bonv.from_op_seq_id = cv_start_op_seq_id
905: AND bonv.operation_type = g_op_type
906: AND bonv.transition_type <> 3;
936: ) IS
937:
938: CURSOR end_op_cur IS
939: SELECT max(to_op_seq_id) end_op_seq_id
940: FROM bom_operation_networks_v bonv
941: WHERE bonv.routing_sequence_id = p_routing_sequence_id
942: AND bonv.operation_type = p_operation_type
943: AND bonv.transition_type <> 3
944: AND NOT EXISTS (SELECT NULL
941: WHERE bonv.routing_sequence_id = p_routing_sequence_id
942: AND bonv.operation_type = p_operation_type
943: AND bonv.transition_type <> 3
944: AND NOT EXISTS (SELECT NULL
945: FROM bom_operation_networks net
946: WHERE net.from_op_seq_id = bonv.to_op_seq_id
947: AND net.transition_type <> 3);
948:
949: -- For cv_start_op_seq_id, traverse the network to select all the
952: CURSOR next_ops_cur (cv_start_op_seq_id number) IS
953: SELECT to_op_seq_id next_op_seq_id,
954: to_seq_num next_op_seq_num,
955: transition_type
956: FROM bom_operation_networks_v bonv
957: WHERE routing_sequence_id = p_routing_sequence_id
958: AND from_op_seq_id = cv_start_op_seq_id
959: AND operation_type = p_operation_type
960: AND transition_type <> 3
963: CURSOR next_alt_ops_cur (cv_op_seq_id number) IS
964: SELECT to_op_seq_id next_op_seq_id,
965: to_seq_num next_op_seq_num,
966: transition_type
967: FROM bom_operation_networks_v bonv
968: WHERE routing_sequence_id = p_routing_sequence_id
969: AND from_op_seq_id = cv_op_seq_id
970: AND operation_type = p_operation_type
971: AND transition_type = 2
976: CURSOR rework_ops_cur (cv_start_op_seq_id number) IS
977: SELECT to_op_seq_id, to_seq_num,
978: transition_type, nvl(planning_pct, 0) planning_pct,
979: from_op_seq_id, from_seq_num
980: FROM bom_operation_networks_v bonv
981: WHERE routing_sequence_id = p_routing_sequence_id
982: AND from_op_seq_id = cv_start_op_seq_id
983: AND operation_type = p_operation_type
984: AND transition_type = 3
987: CURSOR rework_ops_cur1 (cv_start_op_seq_id number) IS
988: SELECT to_op_seq_id, to_seq_num,
989: transition_type, nvl(planning_pct, 0) planning_pct,
990: from_op_seq_id, from_seq_num
991: FROM bom_operation_networks_v bonv
992: WHERE routing_sequence_id = p_routing_sequence_id
993: AND from_op_seq_id = cv_start_op_seq_id
994: AND operation_type = p_operation_type
995: AND transition_type = 3
996: ORDER BY to_seq_num;
997:
998: cursor prim_path_cur (cv_start_op_seq_id number) is
999: select bon.to_op_seq_id prim_op_seq_id
1000: from bom_operation_networks bon
1001: connect by prior to_op_seq_id = from_op_seq_id
1002: and
1003: nvl(bon.transition_type, 0) not in (2, 3)
1004: start with from_op_seq_id = cv_start_op_seq_id
1228: ) RETURN NUMBER IS
1229:
1230: CURSOR end_op_cur IS
1231: SELECT max(to_op_seq_id) end_op_seq_id
1232: FROM bom_operation_networks_v bonv
1233: WHERE bonv.routing_sequence_id = p_routing_sequence_id
1234: AND bonv.operation_type = p_operation_type
1235: AND bonv.transition_type <> 3
1236: AND NOT EXISTS (SELECT NULL
1233: WHERE bonv.routing_sequence_id = p_routing_sequence_id
1234: AND bonv.operation_type = p_operation_type
1235: AND bonv.transition_type <> 3
1236: AND NOT EXISTS (SELECT NULL
1237: FROM bom_operation_networks net
1238: WHERE net.from_op_seq_id = bonv.to_op_seq_id
1239: AND net.transition_type <> 3);
1240:
1241: -- For cv_start_op_seq_id, traverse the network to select all the
1244: CURSOR next_ops_cur (cv_start_op_seq_id number) IS
1245: SELECT to_op_seq_id next_op_seq_id,
1246: to_seq_num next_op_seq_num,
1247: transition_type
1248: FROM bom_operation_networks_v bonv
1249: WHERE routing_sequence_id = p_routing_sequence_id
1250: AND from_op_seq_id = cv_start_op_seq_id
1251: AND operation_type = p_operation_type
1252: AND transition_type <> 3
1255: CURSOR next_alt_ops_cur (cv_op_seq_id number) IS
1256: SELECT to_op_seq_id next_op_seq_id,
1257: to_seq_num next_op_seq_num,
1258: transition_type
1259: FROM bom_operation_networks_v bonv
1260: WHERE routing_sequence_id = p_routing_sequence_id
1261: AND from_op_seq_id = cv_op_seq_id
1262: AND operation_type = p_operation_type
1263: AND transition_type = 2
1268: CURSOR rework_ops_cur (cv_start_op_seq_id number) IS
1269: SELECT to_op_seq_id, to_seq_num,
1270: transition_type, nvl(planning_pct, 0) planning_pct,
1271: from_op_seq_id, from_seq_num
1272: FROM bom_operation_networks_v bonv
1273: WHERE routing_sequence_id = p_routing_sequence_id
1274: AND from_op_seq_id = cv_start_op_seq_id
1275: AND operation_type = p_operation_type
1276: AND transition_type = 3
1278: CURSOR rework_ops_cur1 (cv_start_op_seq_id number) IS
1279: SELECT to_op_seq_id, to_seq_num,
1280: transition_type, nvl(planning_pct, 0) planning_pct,
1281: from_op_seq_id, from_seq_num
1282: FROM bom_operation_networks_v bonv
1283: WHERE routing_sequence_id = p_routing_sequence_id
1284: AND from_op_seq_id = cv_start_op_seq_id
1285: AND operation_type = p_operation_type
1286: AND transition_type = 3
1421: )
1422: IS
1423: cursor prim_path_fdr_cur (cv_start_op_seq_id number) is
1424: select bon.to_op_seq_id prim_op_seq_id
1425: from bom_operation_networks bon
1426: connect by prior to_op_seq_id = from_op_seq_id
1427: and
1428: nvl(bon.transition_type, 0) not in (2, 3)
1429: start with from_op_seq_id = cv_start_op_seq_id
1590: ) IS
1591:
1592: CURSOR prev_links_cur (cv_to_seq_id number) IS
1593: SELECT from_op_seq_id prev_op, planning_pct
1594: --FROM bom_operation_networks_v
1595: FROM bom_operation_networks
1596: WHERE to_op_seq_id = cv_to_seq_id
1597: AND transition_type <> 3;
1598:
1591:
1592: CURSOR prev_links_cur (cv_to_seq_id number) IS
1593: SELECT from_op_seq_id prev_op, planning_pct
1594: --FROM bom_operation_networks_v
1595: FROM bom_operation_networks
1596: WHERE to_op_seq_id = cv_to_seq_id
1597: AND transition_type <> 3;
1598:
1599: j NUMBER;
1650: ) IS
1651:
1652: CURSOR prev_opns_cur (cv_to_seq_id number) IS
1653: SELECT from_op_seq_id prev_op, planning_pct
1654: FROM bom_operation_networks
1655: WHERE to_op_seq_id = cv_to_seq_id
1656: AND transition_type <> 3;
1657:
1658: j NUMBER;
1696: ) IS
1697:
1698: CURSOR next_opns_cur (cv_to_seq_id number) IS
1699: SELECT to_op_seq_id next_op, planning_pct
1700: FROM bom_operation_networks
1701: WHERE from_op_seq_id = cv_to_seq_id
1702: AND transition_type <> 3;
1703:
1704: j NUMBER;
1738: RETURN BOOLEAN IS
1739: CURSOR prev_ops_cur (cv_op_seq_id number) IS
1740: SELECT from_op_seq_id prev_op_seq_id,
1741: transition_type
1742: FROM bom_operation_networks bonv
1743: --WHERE routing_sequence_id = p_routing_sequence_id
1744: WHERE to_op_seq_id = cv_op_seq_id;
1745: --AND operation_type = p_operation_type;
1746:
1746:
1747: CURSOR next_ops_cur (cv_op_seq_id number) IS
1748: SELECT to_op_seq_id next_op_seq_id,
1749: transition_type
1750: FROM bom_operation_networks bonv
1751: --WHERE routing_sequence_id = p_routing_sequence_id
1752: WHERE from_op_seq_id = cv_op_seq_id;
1753: --AND operation_type = p_operation_type;
1754: rework_in_found BOOLEAN := FALSE;
1786: ) RETURN NUMBER IS
1787:
1788: CURSOR prev_links_cur (cv_to_seq_id number) IS
1789: SELECT from_op_seq_id prev_op, planning_pct
1790: FROM bom_operation_networks
1791: WHERE to_op_seq_id = cv_to_seq_id
1792: AND transition_type = 3;
1793:
1794: j NUMBER;
1812: to_ptr IN NUMBER
1813: ) RETURN BOOLEAN IS
1814: CURSOR feeding_links_cur (cv_to_seq_id number) IS
1815: SELECT from_op_seq_id prev_op, planning_pct
1816: FROM bom_operation_networks
1817: WHERE to_op_seq_id = cv_to_seq_id
1818: AND transition_type <> 3;
1819: CURSOR fed_sum (cv_from_seq_id number) IS
1820: SELECT SUM(planning_pct) pct_sum
1817: WHERE to_op_seq_id = cv_to_seq_id
1818: AND transition_type <> 3;
1819: CURSOR fed_sum (cv_from_seq_id number) IS
1820: SELECT SUM(planning_pct) pct_sum
1821: FROM bom_operation_networks
1822: WHERE from_op_seq_id = cv_from_seq_id
1823: AND transition_type <> 3;
1824: rework_accum NUMBER := 0;
1825: grab_rework BOOLEAN := FALSE;
1853: ,dummy_pct IN NUMBER
1854: ) IS
1855: CURSOR forward_links_cur (cv_from_seq_id number) IS
1856: SELECT to_op_seq_id next_op
1857: FROM bom_operation_networks
1858: WHERE from_op_seq_id = cv_from_seq_id
1859: AND transition_type <> 3;
1860: CURSOR link_percent_cur (cv_from_seq_id number,cv_to_seq_id number) IS
1861: SELECT PLANNING_PCT npp
1858: WHERE from_op_seq_id = cv_from_seq_id
1859: AND transition_type <> 3;
1860: CURSOR link_percent_cur (cv_from_seq_id number,cv_to_seq_id number) IS
1861: SELECT PLANNING_PCT npp
1862: FROM bom_operation_networks
1863: WHERE from_op_seq_id = cv_from_seq_id
1864: AND to_op_seq_id = cv_to_seq_id
1865: AND transition_type <> 3;
1866:
1902: ,dummy_pct IN NUMBER
1903: ) IS
1904: CURSOR forward_links_cur (cv_from_seq_id number) IS
1905: SELECT to_op_seq_id next_op
1906: FROM bom_operation_networks
1907: WHERE from_op_seq_id = cv_from_seq_id
1908: AND transition_type <> 3;
1909: rows_exist number:=0;
1910: j NUMBER;
1936: dummy_plan_percent IN NUMBER
1937: ) IS
1938: CURSOR prev_links_cur (cv_to_seq_id number) IS
1939: SELECT from_op_seq_id prev_op, planning_pct
1940: FROM bom_operation_networks
1941: WHERE to_op_seq_id = cv_to_seq_id
1942: AND transition_type <> 3;
1943:
1944: CURSOR forward_links_cur (cv_from_seq_id number,cv_to_seq_id number) IS
1942: AND transition_type <> 3;
1943:
1944: CURSOR forward_links_cur (cv_from_seq_id number,cv_to_seq_id number) IS
1945: SELECT PLANNING_PCT npp
1946: FROM bom_operation_networks
1947: WHERE from_op_seq_id = cv_from_seq_id
1948: AND to_op_seq_id = cv_to_seq_id
1949: AND transition_type <> 3;
1950:
2017: j number;
2018: l_yield_nppct number;
2019: CURSOR prev_links_cur (cv_to_seq_id number) IS
2020: SELECT from_op_seq_id prev_op, planning_pct
2021: FROM bom_operation_networks
2022: WHERE to_op_seq_id = cv_to_seq_id
2023: AND transition_type <> 3;
2024:
2025: BEGIN
2058: l_count NUMBER := 0;
2059:
2060: CURSOR prev_links_count_cur (cv_to_seq_id number) IS
2061: SELECT count(*) count
2062: FROM bom_operation_networks
2063: WHERE to_op_seq_id = cv_to_seq_id
2064: AND transition_type <> 3;
2065:
2066: CURSOR prev_links_cur (cv_to_seq_id number) IS
2064: AND transition_type <> 3;
2065:
2066: CURSOR prev_links_cur (cv_to_seq_id number) IS
2067: SELECT from_op_seq_id prev_op, planning_pct
2068: FROM bom_operation_networks
2069: WHERE to_op_seq_id = cv_to_seq_id
2070: AND transition_type <> 3;
2071: BEGIN
2072: FOR count_rec in prev_links_count_cur(op_seq_id) LOOP
2099: l_npp number;
2100: j number;
2101: CURSOR rework_out_cur (cv_from_seq_id number) IS
2102: SELECT to_op_seq_id next_op, planning_pct
2103: FROM bom_operation_networks
2104: WHERE from_op_seq_id = cv_from_seq_id
2105: AND transition_type = 3;
2106:
2107: CURSOR next_rework_cur (cv_op_seq_id number) IS
2105: AND transition_type = 3;
2106:
2107: CURSOR next_rework_cur (cv_op_seq_id number) IS
2108: SELECT to_op_seq_id next_op, planning_pct
2109: FROM bom_operation_networks
2110: WHERE from_op_seq_id = cv_op_seq_id
2111: AND transition_type = 3;
2112:
2113: CURSOR next_op_cur (cv_op_seq_id number) IS
2111: AND transition_type = 3;
2112:
2113: CURSOR next_op_cur (cv_op_seq_id number) IS
2114: SELECT to_op_seq_id next_op, planning_pct
2115: FROM bom_operation_networks
2116: WHERE from_op_seq_id = cv_op_seq_id
2117: AND transition_type <> 3;
2118:
2119: CURSOR next_op_cur1 (cv_op_seq_id number) IS
2117: AND transition_type <> 3;
2118:
2119: CURSOR next_op_cur1 (cv_op_seq_id number) IS
2120: SELECT to_op_seq_id next_op, planning_pct
2121: FROM bom_operation_networks
2122: WHERE from_op_seq_id = cv_op_seq_id
2123: AND transition_type <> 3;
2124:
2125: sanity_rework_pct NUMBER ;