635: , CAST
636: ( MULTISET
637: (
638: SELECT SYSTEM.gmf_dependency_type(a.batchstep_id, b.actual_step_qty, b.step_qty_um, NULL)
639: FROM gme_batch_step_dependencies a, gme_batch_steps b
640: WHERE a.batch_id = p_batch_id and a.dep_step_id = grsd.dep_step_id
641: AND a.batchstep_id = b.batchstep_id
642: AND a.batch_id = b.batch_id
643: ) AS SYSTEM.gmf_dependency_tab
645: )
646: FROM
647: (
648: SELECT MAX(level) seq, dep_step_id, batchstep_id
649: FROM gme_batch_step_dependencies
650: START WITH batch_id = p_batch_id
651: AND batchstep_id NOT IN (SELECT dep_step_id FROM gme_batch_step_dependencies WHERE batch_id=p_batch_id)
652: CONNECT BY PRIOR dep_step_id = batchstep_id AND batch_id = PRIOR batch_id
653: GROUP BY dep_step_id, batchstep_id
647: (
648: SELECT MAX(level) seq, dep_step_id, batchstep_id
649: FROM gme_batch_step_dependencies
650: START WITH batch_id = p_batch_id
651: AND batchstep_id NOT IN (SELECT dep_step_id FROM gme_batch_step_dependencies WHERE batch_id=p_batch_id)
652: CONNECT BY PRIOR dep_step_id = batchstep_id AND batch_id = PRIOR batch_id
653: GROUP BY dep_step_id, batchstep_id
654: ) grsd
655: , gme_batch_steps gbs
688: )
689: )
690: FROM
691: ( SELECT DISTINCT/*Bug 4320765*/ gbsd.batchstep_id, gbs2.actual_step_qty, gbs2.step_qty_um
692: FROM gme_batch_step_dependencies gbsd
693: , gme_batch_steps gbs2
694: WHERE gbsd.batch_id = p_batch_id
695: AND gbs2.batch_id = p_batch_id
696: AND gbsd.batchstep_id NOT IN
693: , gme_batch_steps gbs2
694: WHERE gbsd.batch_id = p_batch_id
695: AND gbs2.batch_id = p_batch_id
696: AND gbsd.batchstep_id NOT IN
697: (SELECT dep_step_id from gme_batch_step_dependencies where batch_id = p_batch_id)
698: AND gbsd.batchstep_id = gbs2.batchstep_id ) g
699: ORDER BY 1 desc;
700: --**********************************************************************************************
701: -- *
4364: --* 15-Dec-2004 Dinesh Vadivel Bug# 4053149
4365: --* Earlier we were handling only two cases in the step dependency chain
4366: --* 1. if no routing call the explosion_cursor_nr.
4367: --* 2. if there is routing and dependent_steps == 0 then we will create n-1
4368: --* virtual rows in gme_batch_step_dependencies
4369: --* Now changed the code to handle the following cases if there is routing present
4370: --* 1. All the steps have Dependency defined - Directly call the explosion_cursor
4371: --* 2. Single Step Batch. Obviously No Dependency - So call explosion_cursor_ss
4372: --* 3. All steps are Independent. Here create n-1 virtual rows in dependency table
4440: WHERE batch_id = p_batch_id
4441: AND batchstep_id NOT IN
4442: (
4443: SELECT batchstep_id
4444: FROM gme_batch_step_dependencies
4445: WHERE batch_id = p_batch_id
4446: UNION ALL
4447: SELECT dep_step_id
4448: FROM gme_batch_step_dependencies
4444: FROM gme_batch_step_dependencies
4445: WHERE batch_id = p_batch_id
4446: UNION ALL
4447: SELECT dep_step_id
4448: FROM gme_batch_step_dependencies
4449: WHERE batch_id = p_batch_id
4450: )
4451: ORDER BY batchstep_id
4452: ;
4521: ELSE
4522: fnd_file.put_line(fnd_file.log,' Entering else part of l_routing=0');
4523:
4524: SELECT count(*) INTO l_dep_steps
4525: FROM gme_batch_step_dependencies
4526: WHERE batch_id = transaction_row.doc_id;
4527:
4528: /******* Dinesh Vadivel - Bug 4053149 - Start ********/
4529:
4590: FOR step_row IN steps_cursor(transaction_row.doc_id)
4591: LOOP
4592: IF i > 0
4593: THEN
4594: INSERT INTO gme_batch_step_dependencies
4595: ( batch_id
4596: , batchstep_id
4597: , dep_step_id
4598: , standard_delay
4622: OPEN explosion_cursor (transaction_row.doc_id);
4623: FETCH explosion_cursor BULK COLLECT INTO l_step_lev, l_step_tab;
4624: CLOSE explosion_cursor;
4625:
4626: DELETE FROM gme_batch_step_dependencies
4627: WHERE batch_id = transaction_row.doc_id;
4628: -- END OF CASE 3
4629:
4630:
4641: END IF;
4642:
4643: SELECT MIN(dep_step_id)
4644: INTO l_min_dep_step_id
4645: FROM gme_batch_step_dependencies
4646: START WITH batch_id = transaction_row.doc_id
4647: AND batchstep_id NOT IN (SELECT dep_step_id
4648: FROM gme_batch_step_dependencies
4649: WHERE batch_id = transaction_row.doc_id)
4644: INTO l_min_dep_step_id
4645: FROM gme_batch_step_dependencies
4646: START WITH batch_id = transaction_row.doc_id
4647: AND batchstep_id NOT IN (SELECT dep_step_id
4648: FROM gme_batch_step_dependencies
4649: WHERE batch_id = transaction_row.doc_id)
4650: CONNECT BY PRIOR dep_step_id = batchstep_id
4651: AND batch_id = PRIOR batch_id;
4652:
4670:
4671:
4672: FOR i IN 1..l_independent_steps_cnt
4673: LOOP
4674: INSERT INTO gme_batch_step_dependencies
4675: ( batch_id
4676: , batchstep_id
4677: , dep_step_id
4678: , standard_delay
4713: */
4714:
4715: FOR i IN 1 .. l_independent_steps_cnt
4716: LOOP
4717: DELETE FROM gme_batch_step_dependencies
4718: WHERE batch_id = transaction_row.doc_id
4719: AND dep_step_id = l_independent_steps(i);
4720: END LOOP;
4721: