[Home] [Help]
19: E - Error
20: U - Unexpected error
21: =============================================================================================*/
22: PROCEDURE update_step_qty (
23: p_batch_step_rec IN gme_batch_steps%ROWTYPE
24: ,x_message_count OUT NOCOPY NUMBER
25: ,x_message_list OUT NOCOPY VARCHAR2
26: ,x_return_status OUT NOCOPY VARCHAR2
27: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
23: p_batch_step_rec IN gme_batch_steps%ROWTYPE
24: ,x_message_count OUT NOCOPY NUMBER
25: ,x_message_list OUT NOCOPY VARCHAR2
26: ,x_return_status OUT NOCOPY VARCHAR2
27: ,x_batch_step_rec OUT NOCOPY gme_batch_steps%ROWTYPE
28: ,p_routing_scale_factor IN NUMBER DEFAULT NULL
29: ,p_backflush_factor IN NUMBER DEFAULT NULL
30: ,p_dependency_type IN NUMBER DEFAULT NULL
31: ,p_material_step_id IN NUMBER DEFAULT NULL)
32: IS
33: l_api_name CONSTANT VARCHAR2 (30) := 'update_step_qty';
34: /* Buffers for database reads/writes */
35: l_batch_header gme_batch_header%ROWTYPE;
36: l_batch_step gme_batch_steps%ROWTYPE;
37: l_step_tbl gmd_auto_step_calc.step_rec_tbl;
38: /* Exception definitions */
39: batch_step_fetch_error EXCEPTION;
40: invalid_step_status EXCEPTION;
47: l_rec NUMBER;
48:
49: CURSOR dependent_steps (
50: v_batch_id gme_batch_header.batch_id%TYPE
51: ,v_batchstep_id gme_batch_steps.batchstep_id%TYPE)
52: IS
53: SELECT d.batchstep_id
54: FROM gme_batch_step_dependencies d
55: WHERE d.batch_id = v_batch_id
83: || l_api_name||'p_dependency_type ' || p_dependency_type);
84: END IF;
85:
86: /* Initialize output batch step row */
87: IF NOT (gme_batch_steps_dbl.fetch_row (p_batch_step_rec
88: ,x_batch_step_rec) ) THEN
89: RAISE batch_step_fetch_error;
90: END IF;
91:
259: l_batch_step.batchstep_id := dep_steps.batchstep_id;
260: --Bug#5606089 Filtering out the null row.
261: IF l_batch_step.batchstep_id IS NOT NULL THEN
262: /* Initialize output batch step row */
263: IF NOT (gme_batch_steps_dbl.fetch_row (l_batch_step
264: ,l_batch_step) ) THEN
265: RAISE batch_step_fetch_error;
266: END IF;
267:
375: Parameters
376: p_batch_step_rec The batch step row to identify the step.
377: =============================================================================================*/
378: PROCEDURE calculate_mass_vol_qty (
379: p_batch_step_rec IN OUT NOCOPY gme_batch_steps%ROWTYPE)
380: IS
381: /* Cursor definition */
382: CURSOR cur_get_uom
383: IS
458: Pass in the new step qty to calc_char so that charges are calculated properly.
459: =============================================================================================*/
460: PROCEDURE calculate_quantities (
461: p_batch_hdr_rec IN gme_batch_header%ROWTYPE
462: ,p_batch_step_rec IN OUT NOCOPY gme_batch_steps%ROWTYPE
463: ,x_return_status OUT NOCOPY VARCHAR2
464: ,p_routing_scale_factor IN NUMBER DEFAULT NULL
465: ,p_backflush_factor IN NUMBER DEFAULT NULL
466: ,p_dependency_type IN NUMBER DEFAULT NULL)
538: RAISE compute_resource_error;
539: END IF;
540:
541: /* Now update the batch step to the database */
542: IF NOT (gme_batch_steps_dbl.update_row (p_batch_step_rec) ) THEN
543: RAISE batch_step_upd_err;
544: END IF;
545:
546: IF NOT (gme_batch_steps_dbl.fetch_row (p_batch_step_rec
542: IF NOT (gme_batch_steps_dbl.update_row (p_batch_step_rec) ) THEN
543: RAISE batch_step_upd_err;
544: END IF;
545:
546: IF NOT (gme_batch_steps_dbl.fetch_row (p_batch_step_rec
547: ,p_batch_step_rec) ) THEN
548: RAISE batch_step_fetch_err;
549: END IF;
550:
589: G. Muratore 27-JUN-2011 Bug 12568872
590: Initialize charge to 1 if necessary. This usually happens when step qty is less than capacity.
591: =============================================================================================*/
592: PROCEDURE calc_charge (
593: p_step_id IN gme_batch_steps.batchstep_id%TYPE
594: ,p_resources IN gme_batch_step_resources.resources%TYPE
595: DEFAULT NULL
596: ,p_mass_qty IN gme_batch_steps.plan_mass_qty%TYPE
597: ,p_vol_qty IN gme_batch_steps.plan_volume_qty%TYPE
592: PROCEDURE calc_charge (
593: p_step_id IN gme_batch_steps.batchstep_id%TYPE
594: ,p_resources IN gme_batch_step_resources.resources%TYPE
595: DEFAULT NULL
596: ,p_mass_qty IN gme_batch_steps.plan_mass_qty%TYPE
597: ,p_vol_qty IN gme_batch_steps.plan_volume_qty%TYPE
598: ,p_step_qty IN NUMBER DEFAULT NULL --Bug#5231180
599: ,p_max_capacity IN NUMBER DEFAULT NULL --Bug#5231180
600: ,x_charge OUT NOCOPY gme_batch_steps.plan_charges%TYPE
593: p_step_id IN gme_batch_steps.batchstep_id%TYPE
594: ,p_resources IN gme_batch_step_resources.resources%TYPE
595: DEFAULT NULL
596: ,p_mass_qty IN gme_batch_steps.plan_mass_qty%TYPE
597: ,p_vol_qty IN gme_batch_steps.plan_volume_qty%TYPE
598: ,p_step_qty IN NUMBER DEFAULT NULL --Bug#5231180
599: ,p_max_capacity IN NUMBER DEFAULT NULL --Bug#5231180
600: ,x_charge OUT NOCOPY gme_batch_steps.plan_charges%TYPE
601: ,x_return_status OUT NOCOPY VARCHAR2)
596: ,p_mass_qty IN gme_batch_steps.plan_mass_qty%TYPE
597: ,p_vol_qty IN gme_batch_steps.plan_volume_qty%TYPE
598: ,p_step_qty IN NUMBER DEFAULT NULL --Bug#5231180
599: ,p_max_capacity IN NUMBER DEFAULT NULL --Bug#5231180
600: ,x_charge OUT NOCOPY gme_batch_steps.plan_charges%TYPE
601: ,x_return_status OUT NOCOPY VARCHAR2)
602: IS
603: x_step_no gme_batch_steps.batchstep_no%TYPE;
604: x_std_factor NUMBER;
599: ,p_max_capacity IN NUMBER DEFAULT NULL --Bug#5231180
600: ,x_charge OUT NOCOPY gme_batch_steps.plan_charges%TYPE
601: ,x_return_status OUT NOCOPY VARCHAR2)
602: IS
603: x_step_no gme_batch_steps.batchstep_no%TYPE;
604: x_std_factor NUMBER;
605: x_um_type mtl_units_of_measure.uom_class%TYPE;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
602: IS
603: x_step_no gme_batch_steps.batchstep_no%TYPE;
604: x_std_factor NUMBER;
605: x_um_type mtl_units_of_measure.uom_class%TYPE;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
608: x_max_cap_uom gme_batch_steps.max_step_capacity_um%TYPE;
609: x_step_qty gme_batch_steps.plan_step_qty%TYPE;
610: x_step_qty_uom gme_batch_steps.step_qty_um%TYPE;
603: x_step_no gme_batch_steps.batchstep_no%TYPE;
604: x_std_factor NUMBER;
605: x_um_type mtl_units_of_measure.uom_class%TYPE;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
608: x_max_cap_uom gme_batch_steps.max_step_capacity_um%TYPE;
609: x_step_qty gme_batch_steps.plan_step_qty%TYPE;
610: x_step_qty_uom gme_batch_steps.step_qty_um%TYPE;
611: x_temp_qty NUMBER;
604: x_std_factor NUMBER;
605: x_um_type mtl_units_of_measure.uom_class%TYPE;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
608: x_max_cap_uom gme_batch_steps.max_step_capacity_um%TYPE;
609: x_step_qty gme_batch_steps.plan_step_qty%TYPE;
610: x_step_qty_uom gme_batch_steps.step_qty_um%TYPE;
611: x_temp_qty NUMBER;
612: x_tolerance NUMBER;
605: x_um_type mtl_units_of_measure.uom_class%TYPE;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
608: x_max_cap_uom gme_batch_steps.max_step_capacity_um%TYPE;
609: x_step_qty gme_batch_steps.plan_step_qty%TYPE;
610: x_step_qty_uom gme_batch_steps.step_qty_um%TYPE;
611: x_temp_qty NUMBER;
612: x_tolerance NUMBER;
613: x_stdum_tolerance NUMBER;
606: x_std_capacity gme_batch_steps.max_step_capacity%TYPE;
607: x_max_cap gme_batch_steps.max_step_capacity%TYPE;
608: x_max_cap_uom gme_batch_steps.max_step_capacity_um%TYPE;
609: x_step_qty gme_batch_steps.plan_step_qty%TYPE;
610: x_step_qty_uom gme_batch_steps.step_qty_um%TYPE;
611: x_temp_qty NUMBER;
612: x_tolerance NUMBER;
613: x_stdum_tolerance NUMBER;
614: pmass_qty_std NUMBER;
618: CURSOR cur_get_max_capacity
619: IS
620: SELECT max_step_capacity, max_step_capacity_um, batchstep_no
621: ,plan_step_qty, step_qty_um
622: FROM gme_batch_steps
623: WHERE batchstep_id = p_step_id;
624:
625: CURSOR cur_get_std_factor (v_um_code VARCHAR2)
626: IS
630:
631: CURSOR cur_get_tolerance
632: IS
633: SELECT NVL (MIN (gbsr.capacity_tolerance), 0)
634: FROM gme_batch_steps gbs, gme_batch_step_resources gbsr
635: WHERE gbs.batchstep_id = gbsr.batchstep_id
636: AND gbsr.calculate_charges = 1
637: AND gbsr.batchstep_id = p_step_id;
638:
646:
647: CURSOR cur_get_batch_id (v_batchstep_id NUMBER)
648: IS
649: SELECT batch_id
650: FROM gme_batch_steps
651: WHERE batchstep_id = v_batchstep_id;
652:
653: CURSOR cur_get_scale_type (
654: v_resources gme_batch_step_resources.resources%TYPE)
665: l_scale_type gme_batch_step_resources.scale_type%TYPE;
666: l_remaining_quantity NUMBER;
667: l_batch_step_charges_in gme_batch_step_charges%ROWTYPE;
668: l_return_status VARCHAR2 (1);
669: l_charge gme_batch_steps.plan_charges%TYPE;
670: l_batch_id NUMBER;
671: l_rsrc_plan_start_date DATE;
672: l_rsrc_plan_cmplt_date DATE;
673: error_charge_insert EXCEPTION;
995: U - Unexpected error
996: =============================================================================================*/
997: PROCEDURE update_activities (
998: p_batch_hdr_rec IN gme_batch_header%ROWTYPE
999: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
1000: ,x_return_status OUT NOCOPY VARCHAR2
1001: ,p_routing_scale_factor IN NUMBER DEFAULT NULL
1002: ,p_backflush_factor IN NUMBER DEFAULT NULL
1003: ,p_charge_diff IN NUMBER
1165: History
1166: =============================================================================================*/
1167: PROCEDURE update_resources (
1168: p_batch_hdr_rec IN gme_batch_header%ROWTYPE
1169: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
1170: ,p_batchstep_activities_rec IN gme_batch_step_activities%ROWTYPE
1171: ,x_return_status OUT NOCOPY VARCHAR2
1172: ,p_routing_scale_factor IN NUMBER DEFAULT NULL
1173: ,p_backflush_factor IN NUMBER DEFAULT NULL
1226:
1227: CURSOR cur_prev_plan_charge
1228: IS
1229: SELECT plan_charges
1230: FROM gme_batch_steps
1231: WHERE batchstep_id = p_batch_step_rec.batchstep_id;
1232:
1233: /* Exceptions */
1234: activity_resource_fetch_error EXCEPTION;
2462:
2463: CURSOR cur_get_step_status (v_batchstep_id NUMBER)
2464: IS
2465: SELECT step_status
2466: FROM gme_batch_steps
2467: WHERE batchstep_id = v_batchstep_id;
2468:
2469: --nsinghi bug#5609683 Modified the cursor to also query resource plan start date and changed cursor name
2470: CURSOR cur_get_rsrc_dtl (v_batchstep_resource_id NUMBER)
2758: HISTORY
2759: SivakumarG Bug#5231180
2760: Procedure Created
2761: =============================================================================================*/
2762: PROCEDURE recalculate_charges( p_batchstep_rec IN gme_batch_steps%ROWTYPE
2763: ,p_cal_type IN VARCHAR2
2764: ,x_batchstep_rec OUT NOCOPY gme_batch_steps%ROWTYPE
2765: ,x_return_status OUT NOCOPY VARCHAR2 )
2766: IS
2760: Procedure Created
2761: =============================================================================================*/
2762: PROCEDURE recalculate_charges( p_batchstep_rec IN gme_batch_steps%ROWTYPE
2763: ,p_cal_type IN VARCHAR2
2764: ,x_batchstep_rec OUT NOCOPY gme_batch_steps%ROWTYPE
2765: ,x_return_status OUT NOCOPY VARCHAR2 )
2766: IS
2767: l_api_name VARCHAR2(30) := 'RECALCULATE_CHARGES';
2768:
2768:
2769: CURSOR c_get_step_qty(v_step_id NUMBER) IS
2770: SELECT batchstep_id, step_status, plan_step_qty, actual_step_qty,
2771: max_step_capacity, max_step_capacity_um, step_qty_um
2772: FROM gme_batch_steps
2773: WHERE batchstep_id = v_step_id;
2774:
2775: CURSOR c_get_step_resources(v_step_id NUMBER) IS
2776: SELECT resources
2942: x_batchstep_rec.plan_charges := l_charge;
2943: END IF;
2944: END IF; /*l_calc_step_qty */
2945: /* update the batch step record */
2946: IF NOT gme_batch_steps_dbl.update_row(p_batch_step => x_batchstep_rec) THEN
2947: RAISE error_in_update_step;
2948: END IF;
2949:
2950: IF g_debug <= gme_debug.g_log_procedure THEN