1: PACKAGE BODY wms_rule_pvt AS
2: /* $Header: WMSVPPRB.pls 120.39.12010000.6 2009/01/21 10:32:10 avuppala ship $ */
3: --
4: -- File : WMSVPPRB.pls
5: -- Content : WMS_Rule_PVT package body
1: PACKAGE BODY wms_rule_pvt AS
2: /* $Header: WMSVPPRB.pls 120.39.12010000.6 2009/01/21 10:32:10 avuppala ship $ */
3: --
4: -- File : WMSVPPRB.pls
5: -- Content : WMS_Rule_PVT package body
6: -- Description : wms rule private API's
7: -- Notes :
8: -- Modified : 02/08/99 mzeckzer created
9: -- 03/29/99 bitang modified
24: -- 07/11/02 grao Modified the Rules package generating code to
25: -- conver all global variables in the rules packages to
26: -- local variables and defined Pick and Putaway cursors
27: -- as ref cursor, which is passed from the
28: -- WMS_RULE_PVT as a ref Cursor. Also modified the open,
29: -- fetch and close calls for Pick and Putaway rules
30:
31: --
32: -- Package global variable that stores the package name
29: -- fetch and close calls for Pick and Putaway rules
30:
31: --
32: -- Package global variable that stores the package name
33: g_pkg_name CONSTANT VARCHAR2(30) := 'WMS_Rule_PVT';
34: --
35: -- API versions used within this API
36: g_qty_tree_api_version CONSTANT NUMBER := 1.0; -- INV_Quantity_Tree_PVT
37: --
488: ,sub.reservable_type
489: ,nvl(loc.reservable_type,1) locreservable -- Bug 6719290
490: ,nvl(lot.reservable_type,1) lotreservable -- Bug 6719290
491: ,nvl(loc.pick_uom_code, sub.pick_uom_code) uom_code
492: ,WMS_Rule_PVT.GetConversionRate(
493: nvl(loc.pick_uom_code, sub.pick_uom_code)
494: ,msn.current_organization_id
495: ,msn.inventory_item_id) conversion_rate
496: ,msn.lpn_id lpn_id
544: ,sub.reservable_type
545: ,nvl(loc.reservable_type,1) locreservable -- Bug 6719290
546: ,nvl(lot.reservable_type,1) lotreservable -- Bug 6719290
547: ,nvl(loc.pick_uom_code, sub.pick_uom_code) uom_code
548: ,WMS_Rule_PVT.GetConversionRate(
549: nvl(loc.pick_uom_code, sub.pick_uom_code)
550: ,msn.current_organization_id
551: ,msn.inventory_item_id) conversion_rate
552: ,msn.lpn_id lpn_id
600: ,sub.reservable_type
601: ,nvl(loc.reservable_type,1) locreservable -- Bug 6719290
602: ,nvl(lot.reservable_type,1) lotreservable -- Bug 6719290
603: ,nvl(loc.pick_uom_code, sub.pick_uom_code) uom_code
604: ,WMS_Rule_PVT.GetConversionRate(
605: nvl(loc.pick_uom_code, sub.pick_uom_code)
606: ,msn.current_organization_id
607: ,msn.inventory_item_id) conversion_rate
608: ,msn.lpn_id lpn_id
908: PROCEDURE FetchCursorRows(
909: x_return_status OUT NOCOPY VARCHAR2
910: , x_msg_count OUT NOCOPY NUMBER
911: , x_msg_data OUT NOCOPY VARCHAR2
912: , p_cursor IN wms_rule_pvt.cv_pick_type
913: , p_rule_id IN NUMBER
914: );
915:
916: -- =============================================
984: Trace( ' Start IsSerialObjectUsed g_serial_objects_used ' || to_char( g_serial_objects_used));
985: */
986:
987: l_serial_object_used := 0 ;
988: IF ( wms_rule_pvt.g_serial_objects_used IS NULL ) THEN
989: --Trace( ' IsSerialObjectUsed -- If condition is true ');
990: SELECT count( DISTINCT p.object_id)
991: INTO l_serial_object_used
992: FROM wms_selection_criteria_txn wsc,
1009: OR (wrb.rule_id = s.rule_id AND s.parameter_id = p.parameter_id) OR (wrb.rule_id = c.rule_id AND c.parameter_id = p.parameter_id) )
1010: AND wrb.organization_id IN (p_organization_id, -1)
1011: AND p.object_id = 26; --- 26 is Serial object
1012:
1013: wms_rule_pvt.g_serial_objects_used := l_serial_object_used;
1014:
1015: --Trace( ' IsSerialObjectUsed -- l_serial_object_used ' || wms_rule_pvt.g_serial_object_used);
1016: ELSE
1017: l_serial_object_used := wms_rule_pvt.g_serial_objects_used;
1011: AND p.object_id = 26; --- 26 is Serial object
1012:
1013: wms_rule_pvt.g_serial_objects_used := l_serial_object_used;
1014:
1015: --Trace( ' IsSerialObjectUsed -- l_serial_object_used ' || wms_rule_pvt.g_serial_object_used);
1016: ELSE
1017: l_serial_object_used := wms_rule_pvt.g_serial_objects_used;
1018: END IF;
1019:
1013: wms_rule_pvt.g_serial_objects_used := l_serial_object_used;
1014:
1015: --Trace( ' IsSerialObjectUsed -- l_serial_object_used ' || wms_rule_pvt.g_serial_object_used);
1016: ELSE
1017: l_serial_object_used := wms_rule_pvt.g_serial_objects_used;
1018: END IF;
1019:
1020: If l_serial_object_used >= 1 THEN
1021: RETURN TRUE;
1496: || ' ,x.lotreservable lotreservable '
1497: || g_line_feed -- Bug 6719290 End
1498: || ' ,NVL(loc.pick_uom_code,sub.pick_uom_code) uom_code'
1499: || g_line_feed
1500: || ' ,WMS_Rule_PVT.GetConversionRate( '
1501: || g_line_feed
1502: || ' NVL(loc.pick_uom_code, sub.pick_uom_code) '
1503: || g_line_feed
1504: || ' ,x.organization_id '
3213: PROCEDURE fetchcursor(
3214: x_return_status OUT NOCOPY VARCHAR2
3215: , x_msg_count OUT NOCOPY NUMBER
3216: , x_msg_data OUT NOCOPY VARCHAR2
3217: , p_cursor IN wms_rule_pvt.cv_pick_type
3218: , p_rule_id IN NUMBER
3219: , x_revision OUT NOCOPY VARCHAR2
3220: , x_lot_number OUT NOCOPY VARCHAR2
3221: , x_lot_expiration_date OUT NOCOPY DATE
3259: --- and if ctr = 3 then subscript = 2, this script is added to the package
3260: --- name.
3261:
3262:
3263: l_ctr := wms_rule_pvt.g_rule_list_pick_ctr;
3264: l_list_pkg := 'wms_rule_pick_pkg' || l_ctr ;
3265:
3266: IF NOT(inv_cache.is_pickrelease AND g_debug IS NOT NULL) THEN
3267: g_debug := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
3407: PROCEDURE fetchputaway(
3408: x_return_status OUT NOCOPY VARCHAR2
3409: , x_msg_count OUT NOCOPY NUMBER
3410: , x_msg_data OUT NOCOPY VARCHAR2
3411: , p_cursor IN wms_rule_pvt.cv_put_type
3412: , p_rule_id IN NUMBER
3413: , x_subinventory_code OUT NOCOPY VARCHAR2
3414: , x_locator_id OUT NOCOPY NUMBER
3415: , x_project_id OUT NOCOPY NUMBER
3447: END IF;
3448:
3449: --get package name based on rule id
3450: getpackagename(p_rule_id, l_package_name);
3451: l_ctr := wms_rule_pvt.g_rule_list_put_ctr;
3452: l_list_pkg := 'wms_rule_put_pkg' || l_ctr ;
3453:
3454: IF (l_ctr = 1) THEN
3455: wms_rule_put_pkg1.execute_fetch_rule
3566: ---
3567: --- For Pick rules
3568:
3569: PROCEDURE pick_open_rule(
3570: p_cursor IN OUT NOCOPY wms_rule_pvt.cv_pick_type
3571: , p_rule_id IN NUMBER
3572: , p_organization_id IN NUMBER
3573: , p_inventory_item_id IN NUMBER
3574: , p_transaction_type_id IN NUMBER
3608: g_debug := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
3609: END IF;
3610: l_debug := g_debug;
3611:
3612: IF wms_rule_pvt.g_rule_list_pick_ctr IS NULL THEN
3613: wms_rule_pvt.g_rule_list_pick_ctr := wms_rule_gen_pkgs.get_count_no_lock('PICK');
3614: END IF;
3615: l_ctr := wms_rule_pvt.g_rule_list_pick_ctr;
3616:
3609: END IF;
3610: l_debug := g_debug;
3611:
3612: IF wms_rule_pvt.g_rule_list_pick_ctr IS NULL THEN
3613: wms_rule_pvt.g_rule_list_pick_ctr := wms_rule_gen_pkgs.get_count_no_lock('PICK');
3614: END IF;
3615: l_ctr := wms_rule_pvt.g_rule_list_pick_ctr;
3616:
3617: l_list_pkg := 'wms_rule_pick_pkg' || l_ctr ;
3611:
3612: IF wms_rule_pvt.g_rule_list_pick_ctr IS NULL THEN
3613: wms_rule_pvt.g_rule_list_pick_ctr := wms_rule_gen_pkgs.get_count_no_lock('PICK');
3614: END IF;
3615: l_ctr := wms_rule_pvt.g_rule_list_pick_ctr;
3616:
3617: l_list_pkg := 'wms_rule_pick_pkg' || l_ctr ;
3618: getpackagename(p_rule_id, l_package_name);
3619:
3706:
3707: EXCEPTION
3708: WHEN INVALID_PKG_STATE THEN
3709: x_result := 0;
3710: wms_rule_pvt.g_rule_list_pick_ctr := wms_rule_gen_pkgs.get_count_no_lock('PICK');
3711:
3712: WMS_ENGINE_PVT.G_SUGG_FAILURE_MESSAGE := 'Invalid Package, Contact your DBA - '|| l_list_pkg || ' / ' || l_package_name;
3713: fnd_message.set_name('WMS', 'WMS_INVALID_PKG');
3714: fnd_message.set_token('LIST_PKG', l_list_pkg);
3728:
3729: ----------------
3730:
3731: PROCEDURE put_open_rule(
3732: p_cursor IN OUT NOCOPY wms_rule_pvt.cv_put_type
3733: , p_rule_id IN NUMBER
3734: , p_organization_id IN NUMBER
3735: , p_inventory_item_id IN NUMBER
3736: , p_transaction_type_id IN NUMBER
3762: g_debug := NVL(FND_PROFILE.VALUE('INV_DEBUG_TRACE'),0);
3763: END IF;
3764: l_debug := g_debug;
3765:
3766: if wms_rule_pvt.g_rule_list_put_ctr is null then
3767: wms_rule_pvt.g_rule_list_put_ctr := wms_rule_gen_pkgs.get_count_no_lock('PUTAWAY');
3768: end if;
3769: l_ctr := wms_rule_pvt.g_rule_list_put_ctr;
3770:
3763: END IF;
3764: l_debug := g_debug;
3765:
3766: if wms_rule_pvt.g_rule_list_put_ctr is null then
3767: wms_rule_pvt.g_rule_list_put_ctr := wms_rule_gen_pkgs.get_count_no_lock('PUTAWAY');
3768: end if;
3769: l_ctr := wms_rule_pvt.g_rule_list_put_ctr;
3770:
3771: l_list_pkg := 'wms_rule_put_pkg' || l_ctr ;
3765:
3766: if wms_rule_pvt.g_rule_list_put_ctr is null then
3767: wms_rule_pvt.g_rule_list_put_ctr := wms_rule_gen_pkgs.get_count_no_lock('PUTAWAY');
3768: end if;
3769: l_ctr := wms_rule_pvt.g_rule_list_put_ctr;
3770:
3771: l_list_pkg := 'wms_rule_put_pkg' || l_ctr ;
3772: getpackagename(p_rule_id, l_package_name);
3773:
3823:
3824: EXCEPTION
3825: WHEN INVALID_PKG_STATE THEN
3826: x_result := 0;
3827: wms_rule_pvt.g_rule_list_put_ctr := wms_rule_gen_pkgs.get_count_no_lock('PUTAWAY');
3828:
3829: WMS_ENGINE_PVT.G_SUGG_FAILURE_MESSAGE := 'Invalid Package, Contact your DBA - '|| l_list_pkg || ' / ' || l_package_name;
3830: fnd_message.set_name('WMS', 'WMS_INVALID_PKG');
3831: fnd_message.set_token('LIST_PKG', l_list_pkg);
3853: l_package_name VARCHAR2(128);
3854: l_ctr NUMBER := 0;
3855:
3856: BEGIN
3857: if wms_rule_pvt.g_rule_list_op_ctr is null then
3858: wms_rule_pvt.g_rule_list_op_ctr := wms_rule_gen_pkgs.get_count_no_lock('OPERATION_PLAN');
3859: end if;
3860: l_ctr := wms_rule_pvt.g_rule_list_op_ctr;
3861:
3854: l_ctr NUMBER := 0;
3855:
3856: BEGIN
3857: if wms_rule_pvt.g_rule_list_op_ctr is null then
3858: wms_rule_pvt.g_rule_list_op_ctr := wms_rule_gen_pkgs.get_count_no_lock('OPERATION_PLAN');
3859: end if;
3860: l_ctr := wms_rule_pvt.g_rule_list_op_ctr;
3861:
3862: l_list_pkg := 'wms_rule_op_pkg' || l_ctr ;
3856: BEGIN
3857: if wms_rule_pvt.g_rule_list_op_ctr is null then
3858: wms_rule_pvt.g_rule_list_op_ctr := wms_rule_gen_pkgs.get_count_no_lock('OPERATION_PLAN');
3859: end if;
3860: l_ctr := wms_rule_pvt.g_rule_list_op_ctr;
3861:
3862: l_list_pkg := 'wms_rule_op_pkg' || l_ctr ;
3863: getpackagename(p_rule_id, l_package_name);
3864:
3875: EXCEPTION
3876: WHEN INVALID_PKG_STATE THEN
3877: --x_return_status := 0;
3878: x_return_status := -1 ;
3879: wms_rule_pvt.g_rule_list_op_ctr := wms_rule_gen_pkgs.get_count_no_lock('OPERATION_PLAN');
3880: WMS_ENGINE_PVT.G_SUGG_FAILURE_MESSAGE := 'Invalid Package, Contact your DBA - '|| l_list_pkg || ' / ' || l_package_name;
3881: x_return_status := fnd_api.g_ret_sts_unexp_error;
3882: fnd_message.set_name('WMS', 'WMS_INVALID_PKG');
3883: fnd_message.set_token('LIST_PKG', l_list_pkg);
3903: l_ctr NUMBER := 0;
3904:
3905:
3906: BEGIN
3907: if wms_rule_pvt.g_rule_list_task_ctr is null then
3908: wms_rule_pvt.g_rule_list_task_ctr := wms_rule_gen_pkgs.get_count_no_lock('TASK');
3909: end if;
3910: l_ctr := wms_rule_pvt.g_rule_list_task_ctr;
3911:
3904:
3905:
3906: BEGIN
3907: if wms_rule_pvt.g_rule_list_task_ctr is null then
3908: wms_rule_pvt.g_rule_list_task_ctr := wms_rule_gen_pkgs.get_count_no_lock('TASK');
3909: end if;
3910: l_ctr := wms_rule_pvt.g_rule_list_task_ctr;
3911:
3912: l_list_pkg := 'wms_rule_task_pkg' || l_ctr ;
3906: BEGIN
3907: if wms_rule_pvt.g_rule_list_task_ctr is null then
3908: wms_rule_pvt.g_rule_list_task_ctr := wms_rule_gen_pkgs.get_count_no_lock('TASK');
3909: end if;
3910: l_ctr := wms_rule_pvt.g_rule_list_task_ctr;
3911:
3912: l_list_pkg := 'wms_rule_task_pkg' || l_ctr ;
3913: getpackagename(p_rule_id, l_package_name);
3914:
3925: EXCEPTION
3926: WHEN INVALID_PKG_STATE THEN
3927: --x_return_status := 0;
3928: x_return_status := -1 ;
3929: wms_rule_pvt.g_rule_list_task_ctr := wms_rule_gen_pkgs.get_count_no_lock('TASK');
3930: WMS_ENGINE_PVT.G_SUGG_FAILURE_MESSAGE := 'Invalid Package, Contact your DBA - '|| l_list_pkg || ' / ' || l_package_name;
3931: x_return_status := fnd_api.g_ret_sts_unexp_error;
3932: fnd_message.set_name('WMS', 'WMS_INVALID_PKG');
3933: fnd_message.set_token('LIST_PKG', l_list_pkg);
3955: l_ctr NUMBER := 0;
3956:
3957: BEGIN
3958:
3959: if wms_rule_pvt.g_rule_list_label_ctr is null then
3960: wms_rule_pvt.g_rule_list_label_ctr := wms_rule_gen_pkgs.get_count_no_lock('LABEL');
3961: end if;
3962: l_ctr := wms_rule_pvt.g_rule_list_label_ctr;
3963:
3956:
3957: BEGIN
3958:
3959: if wms_rule_pvt.g_rule_list_label_ctr is null then
3960: wms_rule_pvt.g_rule_list_label_ctr := wms_rule_gen_pkgs.get_count_no_lock('LABEL');
3961: end if;
3962: l_ctr := wms_rule_pvt.g_rule_list_label_ctr;
3963:
3964: l_list_pkg := 'wms_rule_label_pkg' || l_ctr ;
3958:
3959: if wms_rule_pvt.g_rule_list_label_ctr is null then
3960: wms_rule_pvt.g_rule_list_label_ctr := wms_rule_gen_pkgs.get_count_no_lock('LABEL');
3961: end if;
3962: l_ctr := wms_rule_pvt.g_rule_list_label_ctr;
3963:
3964: l_list_pkg := 'wms_rule_label_pkg' || l_ctr ;
3965: getpackagename(p_rule_id, l_package_name);
3966:
3978: EXCEPTION
3979: WHEN INVALID_PKG_STATE THEN
3980: --x_return_status := 0;
3981: x_return_status := -1 ;
3982: wms_rule_pvt.g_rule_list_label_ctr := wms_rule_gen_pkgs.get_count_no_lock('LABEL');
3983: WMS_ENGINE_PVT.G_SUGG_FAILURE_MESSAGE := 'Invalid Package, Contact your DBA - '|| l_list_pkg || ' / ' || l_package_name;
3984: x_return_status := fnd_api.g_ret_sts_unexp_error;
3985: fnd_message.set_name('WMS', 'WMS_INVALID_PKG');
3986: fnd_message.set_token('LIST_PKG', l_list_pkg);
3993:
3994: --- Procedure to Close Pick rule Cursor --
3995: ---
3996:
3997: PROCEDURE close_pick_rule(p_rule_id IN NUMBER, p_cursor IN OUT NOCOPY wms_rule_pvt.cv_pick_type) IS
3998:
3999: invalid_pkg_state exception;
4000: Pragma Exception_Init(invalid_pkg_state, -6508);
4001: l_msg_data VARCHAR2(240);
4008: l_ctr NUMBER := 0;
4009:
4010: BEGIN
4011:
4012: l_ctr := wms_rule_pvt.g_rule_list_pick_ctr;
4013: l_list_pkg := 'wms_rule_pick_pkg' || l_ctr ;
4014: getpackagename(p_rule_id, l_package_name);
4015:
4016: IF (l_ctr = 1) THEN
4034: END close_pick_rule;
4035:
4036: -- Procedure to close Putaway rule Cursor ---
4037: --
4038: PROCEDURE close_put_rule(p_rule_id IN NUMBER, p_cursor IN OUT NOCOPY wms_rule_pvt.cv_put_type) IS
4039:
4040: invalid_pkg_state exception;
4041: Pragma Exception_Init(invalid_pkg_state, -6508);
4042: l_msg_data VARCHAR2(240);
4045: l_list_pkg VARCHAR2(30);
4046: l_package_name VARCHAR2(128);
4047: l_ctr NUMBER := 0;
4048: BEGIN
4049: l_ctr := wms_rule_pvt.g_rule_list_put_ctr;
4050: l_list_pkg := 'wms_rule_put_pkg' || l_ctr ;
4051: getpackagename(p_rule_id, l_package_name);
4052:
4053: IF (l_ctr = 1) THEN
6666: l_input_lpn_id NUMBER;
6667: --- Initilization of Ref cursors for Pick and putaway rules
6668: -- Added to pass into DoProjectCheck new parameter used in other apply procedure Bug3237702
6669: l_dummy_loc NUMBER;
6670: v_pick_cursor wms_rule_pvt.cv_pick_type;
6671: v_put_cursor wms_rule_pvt.cv_put_type;
6672: l_debug NUMBER; -- 1 for debug is on , 0 for debug is off
6673: l_progress VARCHAR2(10); -- local variable to track program progress,
6674: -- especially useful when exception occurs
6667: --- Initilization of Ref cursors for Pick and putaway rules
6668: -- Added to pass into DoProjectCheck new parameter used in other apply procedure Bug3237702
6669: l_dummy_loc NUMBER;
6670: v_pick_cursor wms_rule_pvt.cv_pick_type;
6671: v_put_cursor wms_rule_pvt.cv_put_type;
6672: l_debug NUMBER; -- 1 for debug is on , 0 for debug is off
6673: l_progress VARCHAR2(10); -- local variable to track program progress,
6674: -- especially useful when exception occurs
6675: l_rule_counter INTEGER;
6793: l_consider_staging_capacity := TRUE;
6794: end if;
6795:
6796: IF l_debug = 1 THEN
6797: log_procedure(l_api_name, 'start', 'Start wms_rule_pvt.Apply');
6798: log_event(l_api_name, 'Apply ', 'org_id '||p_organization_id);
6799: log_event(l_api_name, 'Apply ', 'item_id '||p_inventory_item_id);
6800: END IF;
6801: -- end of debugging section
7618: END IF;
7619: EXIT;
7620: END IF;
7621: --log_statement(l_api_name, ' Before = l_rule_result ' , l_rule_result );
7622: --log_statement(l_api_name, ' Before = wms_rule_pvt.g_rule_list_pick_ctr ' , wms_rule_pvt.g_rule_list_pick_ctr);
7623: IF (l_rule_result = 0) and l_rule_counter = 2 THEN --error
7624: IF l_debug = 1 THEN
7625: log_statement(l_api_name, 'open_curs_err', 'Error calling open_curs');
7626: log_error_msg(l_api_name, 'rule_package_missing');
7863: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
7864: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
7865: IF l_max_tolerance >= 0 THEN
7866: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
7867: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
7868: ELSE
7869: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
7870: END IF;
7871: END IF;
7865: IF l_max_tolerance >= 0 THEN
7866: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
7867: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
7868: ELSE
7869: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
7870: END IF;
7871: END IF;
7872: EXIT WHEN l_cur_consist_group = 0;
7873: --IF g_consists(l_cur_consist_group).quantity = l_needed_quantity THEN
7998: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
7999: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8000: IF l_max_tolerance >= 0 THEN
8001: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8002: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8003: ELSE
8004: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8005: END IF;
8006: END IF;
8000: IF l_max_tolerance >= 0 THEN
8001: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8002: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8003: ELSE
8004: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8005: END IF;
8006: END IF;
8007: l_cur_lpn_group := g_lpns(l_cur_lpn_group).next_consist_lpn_id;
8008: EXIT WHEN l_cur_lpn_group = 0;
8021: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8022: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8023: IF l_max_tolerance >= 0 THEN
8024: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8025: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8026: ELSE
8027: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8028: END IF;
8029: END IF;
8023: IF l_max_tolerance >= 0 THEN
8024: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8025: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8026: ELSE
8027: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8028: END IF;
8029: END IF;
8030: END IF; -- enough quantity to allocate
8031:
8060: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8061: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8062: IF l_max_tolerance >= 0 THEN
8063: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8064: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8065: ELSE
8066: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8067: END IF;
8068: END IF;
8062: IF l_max_tolerance >= 0 THEN
8063: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8064: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8065: ELSE
8066: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8067: END IF;
8068: END IF;
8069: EXIT WHEN l_cur_lpn_group = 0;
8070:
8193: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8194: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8195: IF l_max_tolerance >= 0 THEN
8196: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8197: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8198: ELSE
8199: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8200: END IF;
8201: END IF;
8195: IF l_max_tolerance >= 0 THEN
8196: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8197: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8198: ELSE
8199: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8200: END IF;
8201: END IF;
8202: l_cur_lpn_rec := g_locs(l_cur_lpn_rec).next_rec;
8203: --end loop through lpn recs
8212: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8213: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8214: IF l_max_tolerance >= 0 THEN
8215: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8216: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8217: ELSE
8218: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8219: END IF;
8220: END IF;
8214: IF l_max_tolerance >= 0 THEN
8215: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8216: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8217: ELSE
8218: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8219: END IF;
8220: END IF;
8221: END IF; --needed qty > lpn.quantity
8222:
8842: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8843: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8844: IF l_max_tolerance >= 0 THEN
8845: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8846: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8847: ELSE
8848: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8849: END IF;
8850: END IF;
8844: IF l_max_tolerance >= 0 THEN
8845: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8846: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8847: ELSE
8848: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8849: END IF;
8850: END IF;
8851:
8852: --Once LPN has been allocated, remove it from the LPN list
8866: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
8867: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
8868: IF l_max_tolerance >= 0 THEN
8869: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8870: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8871: ELSE
8872: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8873: END IF;
8874: END IF;
8868: IF l_max_tolerance >= 0 THEN
8869: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
8870: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8871: ELSE
8872: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
8873: END IF;
8874: END IF;
8875:
8876: <
9195: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
9196: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
9197: IF l_max_tolerance >= 0 THEN
9198: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9199: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9200: ELSE
9201: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9202: END IF;
9203: END IF;
9197: IF l_max_tolerance >= 0 THEN
9198: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9199: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9200: ELSE
9201: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9202: END IF;
9203: END IF;
9204: --end loop (pick UOM)
9205: l_cur_uom_rec := g_locs(l_cur_uom_rec).next_rec;
9213: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
9214: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
9215: IF l_max_tolerance >= 0 THEN
9216: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9217: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9218: ELSE
9219: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9220: END IF;
9221: END IF;
9215: IF l_max_tolerance >= 0 THEN
9216: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9217: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9218: ELSE
9219: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9220: END IF;
9221: END IF;
9222: END IF; --allocation mode in 3,4
9223:
9460: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
9461: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
9462: IF l_max_tolerance >= 0 THEN
9463: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9464: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9465: ELSE
9466: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9467: END IF;
9468: END IF;
9462: IF l_max_tolerance >= 0 THEN
9463: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9464: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9465: ELSE
9466: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9467: END IF;
9468: END IF;
9469: l_cur_uom_rec := g_locs(l_cur_uom_rec).next_rec;
9470: --end loop (pick UOM)
9486: EXIT WHEN l_needed_quantity <= 0 or l_needed_quantity <= l_max_tolerance;
9487: ELSIF g_over_allocation = 'Y' AND p_type_code = 2 AND WMS_Engine_PVT.g_move_order_type = 3 THEN
9488: IF l_max_tolerance >= 0 THEN
9489: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9490: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9491: ELSE
9492: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9493: END IF;
9494: END IF;
9488: IF l_max_tolerance >= 0 THEN
9489: EXIT WHEN (l_needed_quantity <= l_max_tolerance)
9490: OR (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9491: ELSE
9492: EXIT WHEN (l_initial_pri_quantity - l_needed_quantity >= WMS_RULE_PVT.g_min_qty_to_allocate);
9493: END IF;
9494: END IF;
9495:
9496: IF NVL(l_cur_order_by_string, '@@@') <> NVL(v_current_row.order_by_string, '@@@') THEN
10604: OR
10605: (g_over_allocation = 'Y' AND NOT (p_type_code = 2 AND l_lot_divisible_flag = 'N' and l_lot_control_code <> 1)
10606: AND WMS_Engine_PVT.g_move_order_type = 3 and p_type_code = 2
10607: AND ((l_max_tolerance >= 0 AND (l_needed_quantity > l_max_tolerance)
10608: AND (l_initial_pri_quantity - l_needed_quantity < WMS_RULE_PVT.g_min_qty_to_allocate))
10609: OR (l_max_tolerance < 0
10610: AND l_initial_pri_quantity - l_needed_quantity < WMS_RULE_PVT.g_min_qty_to_allocate)
10611: )
10612: )
10606: AND WMS_Engine_PVT.g_move_order_type = 3 and p_type_code = 2
10607: AND ((l_max_tolerance >= 0 AND (l_needed_quantity > l_max_tolerance)
10608: AND (l_initial_pri_quantity - l_needed_quantity < WMS_RULE_PVT.g_min_qty_to_allocate))
10609: OR (l_max_tolerance < 0
10610: AND l_initial_pri_quantity - l_needed_quantity < WMS_RULE_PVT.g_min_qty_to_allocate)
10611: )
10612: )
10613: THEN
10614: -- notice, that at least one input record couldn't get satisfied
13035: 'CREATE OR REPLACE PACKAGE '
13036: || l_package_name
13037: || ' AS
13038: procedure open_curs (
13039: p_cursor IN OUT NOCOPY WMS_RULE_PVT.CV_PUT_TYPE,
13040: p_organization_id IN NUMBER,
13041: p_inventory_item_id IN NUMBER,
13042: p_transaction_type_id IN NUMBER,
13043: p_subinventory_code IN VARCHAR2,
13049: p_task_id IN NUMBER,
13050: x_result OUT NOCOPY NUMBER);
13051:
13052: PROCEDURE fetch_one_row (
13053: p_cursor IN WMS_RULE_PVT.CV_PUT_TYPE,
13054: x_subinventory_code OUT NOCOPY VARCHAR2,
13055: x_locator_id OUT NOCOPY NUMBER,
13056: x_project_id OUT NOCOPY NUMBER,
13057: x_task_id OUT NOCOPY NUMBER,
13056: x_project_id OUT NOCOPY NUMBER,
13057: x_task_id OUT NOCOPY NUMBER,
13058: x_return_status OUT NOCOPY NUMBER);
13059:
13060: PROCEDURE close_curs(p_cursor IN WMS_RULE_PVT.CV_PUT_TYPE );
13061:
13062: end '
13063: || l_package_name
13064: || ';';
13089: || l_package_name
13090: || ' AS
13091:
13092: PROCEDURE open_curs (
13093: p_cursor IN OUT NOCOPY WMS_RULE_PVT.cv_put_type,
13094: p_organization_id IN NUMBER,
13095: p_inventory_item_id IN NUMBER,
13096: p_transaction_type_id IN NUMBER,
13097: p_subinventory_code IN VARCHAR2,
13298:
13299: END open_curs;
13300:
13301: PROCEDURE fetch_one_row(
13302: p_cursor IN WMS_RULE_PVT.cv_put_type,
13303: x_subinventory_code OUT NOCOPY VARCHAR2,
13304: x_locator_id OUT NOCOPY NUMBER,
13305: x_project_id OUT NOCOPY NUMBER,
13306: x_task_id OUT NOCOPY NUMBER,
13321: end if;
13322:
13323: END fetch_one_row;
13324:
13325: PROCEDURE close_curs( p_cursor IN WMS_RULE_PVT.cv_put_type) IS
13326: BEGIN
13327: if p_cursor%ISOPEN then
13328: CLOSE p_cursor;
13329: end if;
13367: 'CREATE OR REPLACE PACKAGE '
13368: || l_package_name
13369: || ' AS
13370: procedure open_curs (
13371: p_cursor IN OUT NOCOPY WMS_RULE_PVT.cv_pick_type,
13372: p_organization_id IN NUMBER,
13373: p_inventory_item_id IN NUMBER,
13374: p_transaction_type_id IN NUMBER,
13375: p_revision IN VARCHAR2,
13389: p_task_id IN NUMBER,
13390: x_result OUT NOCOPY NUMBER);
13391:
13392: PROCEDURE fetch_one_row (
13393: p_cursor IN WMS_RULE_PVT.cv_pick_type,
13394: x_revision OUT NOCOPY VARCHAR2,
13395: x_lot_number OUT NOCOPY VARCHAR2,
13396: x_lot_expiration_date OUT NOCOPY DATE,
13397: x_subinventory_code OUT NOCOPY VARCHAR2,
13406: x_consist_string OUT NOCOPY VARCHAR2,
13407: x_order_by_string OUT NOCOPY VARCHAR2,
13408: x_return_status OUT NOCOPY NUMBER);
13409:
13410: PROCEDURE close_curs( p_cursor IN WMS_RULE_PVT.cv_pick_type);
13411:
13412: PROCEDURE fetch_available_rows (
13413: p_cursor IN WMS_RULE_PVT.cv_pick_type,
13414: x_return_status OUT NOCOPY NUMBER);
13409:
13410: PROCEDURE close_curs( p_cursor IN WMS_RULE_PVT.cv_pick_type);
13411:
13412: PROCEDURE fetch_available_rows (
13413: p_cursor IN WMS_RULE_PVT.cv_pick_type,
13414: x_return_status OUT NOCOPY NUMBER);
13415:
13416:
13417:
13445: || ' AS
13446:
13447: PROCEDURE open_curs
13448: (
13449: p_cursor IN OUT NOCOPY WMS_RULE_PVT.cv_pick_type,
13450: p_organization_id IN NUMBER,
13451: p_inventory_item_id IN NUMBER,
13452: p_transaction_type_id IN NUMBER,
13453: p_revision IN VARCHAR2,
13535:
13536: END open_curs;
13537:
13538: PROCEDURE fetch_one_row(
13539: p_cursor IN WMS_RULE_PVT.cv_pick_type,
13540: x_revision OUT NOCOPY VARCHAR2,
13541: x_lot_number OUT NOCOPY VARCHAR2,
13542: x_lot_expiration_date OUT NOCOPY DATE,
13543: x_subinventory_code OUT NOCOPY VARCHAR2,
13583:
13584:
13585: END fetch_one_row;
13586:
13587: PROCEDURE close_curs( p_cursor IN WMS_RULE_PVT.cv_pick_type) IS
13588: BEGIN
13589: if (p_cursor%ISOPEN) THEN
13590: CLOSE p_cursor;
13591: END IF;
13592: END close_curs;
13593:
13594: -- LG convergence new procedure for the new manual picking select screen
13595: PROCEDURE fetch_available_rows(
13596: p_cursor IN WMS_RULE_PVT.cv_pick_type,
13597: x_return_status OUT NOCOPY NUMBER) IS
13598:
13599:
13600: BEGIN
13826: if (inv_control.g_current_release_level >= inv_release.g_j_release_level
13827: and wms_ui_tasks_apis.g_wms_patch_level >= wms_ui_tasks_apis.g_patchset_j)
13828: then
13829: -- ### Outbound for patchset 'J'
13830: wms_rule_pvt_ext_psetj.assign_operation_plan_psetj
13831: (p_api_version => 1.0,
13832: x_return_status => l_return_status,
13833: x_msg_count => l_msg_count,
13834: x_msg_data => l_msg_data,
14915: LOOP
14916: FETCH l_enabled_rules INTO l_rule_id;
14917: EXIT WHEN l_enabled_rules%NOTFOUND;
14918: --fnd_file.put_line(fnd_file.LOG, 'Compiling Rule ID= ' || l_rule_id);
14919: wms_rule_pvt.generaterulepackage(
14920: p_api_version => 1.0
14921: , p_init_msg_list => fnd_api.g_true
14922: , p_validation_level => fnd_api.g_valid_level_full
14923: , x_return_status => l_return_status
15846: --- Initilization of Ref cursors for Pick and putaway rules
15847: -- Added to pass into DoProjectCheck new parameter used in other apply procedure Bug3237702
15848: l_dummy_loc NUMBER;
15849:
15850: v_pick_cursor wms_rule_pvt.cv_pick_type;
15851: v_put_cursor wms_rule_pvt.cv_put_type;
15852:
15853: l_debug NUMBER; -- 1 for debug is on , 0 for debug is off
15854: l_progress VARCHAR2(10); -- local variable to track program progress,
15847: -- Added to pass into DoProjectCheck new parameter used in other apply procedure Bug3237702
15848: l_dummy_loc NUMBER;
15849:
15850: v_pick_cursor wms_rule_pvt.cv_pick_type;
15851: v_put_cursor wms_rule_pvt.cv_put_type;
15852:
15853: l_debug NUMBER; -- 1 for debug is on , 0 for debug is off
15854: l_progress VARCHAR2(10); -- local variable to track program progress,
15855: -- especially useful when exception occurs
16478: PROCEDURE FetchCursorRows(
16479: x_return_status OUT NOCOPY VARCHAR2
16480: , x_msg_count OUT NOCOPY NUMBER
16481: , x_msg_data OUT NOCOPY VARCHAR2
16482: , p_cursor IN wms_rule_pvt.cv_pick_type
16483: , p_rule_id IN NUMBER
16484: ) IS
16485: invalid_pkg_state exception;
16486: Pragma Exception_Init(invalid_pkg_state, -6508);
16586: -- end of debugging section
16587: END FetchCursorRows;
16588: -- end LG convergence
16589:
16590: END wms_rule_pvt;