1: PACKAGE BODY inv_label_pvt1 AS
2: /* $Header: INVLAP1B.pls 120.50.12020000.3 2013/03/01 12:39:19 ashsisin ship $ */
3:
4: label_b CONSTANT VARCHAR2(50) := '' || fnd_global.local_chr(10);
9: );
10: tag_e CONSTANT VARCHAR2(50) := '>' || fnd_global.local_chr(10);
11: l_debug NUMBER;
12: -- Bug 2795525 : This mask is used to mask all date fields.
13: g_date_format_mask VARCHAR2(100) := inv_label.g_date_format_mask;
14: g_header_printed BOOLEAN := FALSE;
15: g_user_name fnd_user.user_name%TYPE := fnd_global.user_name;
16:
17: PROCEDURE trace(p_message IN VARCHAR2) IS
16:
17: PROCEDURE trace(p_message IN VARCHAR2) IS
18: BEGIN
19: IF (g_header_printed = FALSE) THEN
20: inv_label.trace('$Header: INVLAP1B.pls 120.50.12020000.3 2013/03/01 12:39:19 ashsisin ship $', 'LABEL_MATRL');
21: g_header_printed := TRUE;
22: END IF;
23:
24: inv_label.trace(g_user_name || ': ' || p_message, 'LABEL_MATRL');
20: inv_label.trace('$Header: INVLAP1B.pls 120.50.12020000.3 2013/03/01 12:39:19 ashsisin ship $', 'LABEL_MATRL');
21: g_header_printed := TRUE;
22: END IF;
23:
24: inv_label.trace(g_user_name || ': ' || p_message, 'LABEL_MATRL');
25: END trace;
26:
27: FUNCTION get_uom_code(
28: p_organization_id IN NUMBER
104: END get_origination_type;
105:
106:
107: PROCEDURE get_variable_data(
108: x_variable_content OUT NOCOPY inv_label.label_tbl_type
109: , x_msg_count OUT NOCOPY NUMBER
110: , x_msg_data OUT NOCOPY VARCHAR2
111: , x_return_status OUT NOCOPY VARCHAR2
112: , p_label_type_info IN inv_label.label_type_rec
108: x_variable_content OUT NOCOPY inv_label.label_tbl_type
109: , x_msg_count OUT NOCOPY NUMBER
110: , x_msg_data OUT NOCOPY VARCHAR2
111: , x_return_status OUT NOCOPY VARCHAR2
112: , p_label_type_info IN inv_label.label_type_rec
113: , p_transaction_id IN NUMBER
114: , p_input_param IN mtl_material_transactions_temp%ROWTYPE
115: , p_transaction_identifier IN NUMBER
116: ) IS
525: , rti.to_organization_id organization_id
526: , rti.cost_group_id cost_group_id
527: , pol.project_id project_id
528: , pol.task_id task_id
529: , inv_label_pvt1.get_uom_code(
530: rti.to_organization_id
531: , rti.item_id
532: , rti.unit_of_measure
533: ) uom
576: AND hrl1.location_id(+) = rti.deliver_to_location_id
577: AND rrh.routing_header_id(+) = rti.routing_header_id
578: AND hrl2.location_id(+) = rti.location_id) rti2
579: /***************************************/
580: WHERE inv_label_pvt1.check_rti_id(
581: rti2.interface_transaction_id
582: , mtlt.lot_number
583: , rti.item_revision
584: ) = 'N'
648: , SUM(NVL(rls.quantity, rt.quantity)) quantity -- Reverted to original code as part of Bug#4516067
649: -- Commented as part of the Bug#4516067 and added the code to fetch secondary_quantity from rls instead of mtln
650: -- , SUM(NVL(mtln.SECONDARY_TRANSACTION_QUANTITY, rt.SECONDARY_QUANTITY)) secondary_quantity -- fabdi 4373856
651: , SUM(NVL(rls.SECONDARY_QUANTITY, rt.SECONDARY_QUANTITY)) secondary_quantity -- fabdi 4373856
652: , (inv_label_pvt1.get_uom_code(
653: rt.organization_id
654: , rsl.item_id
655: , rsl.unit_of_measure
656: )
654: , rsl.item_id
655: , rsl.unit_of_measure
656: )
657: ) uom
658: , (inv_label_pvt1.get_uom2_code(
659: rt.organization_id
660: , rsl.item_id
661: )
662: ) secondary_uom -- bug 4373856
787: -- , pod.task_id --Commented as part of Bug# 3586116
788: -- Added by joabraha bug 3472150
789: , rsh.receipt_num
790: --
791: , inv_label_pvt1.get_uom_code(
792: rt.organization_id
793: , rsl.item_id
794: , rsl.unit_of_measure
795: )
792: rt.organization_id
793: , rsl.item_id
794: , rsl.unit_of_measure
795: )
796: , (inv_label_pvt1.get_uom2_code(
797: rt.organization_id
798: , rsl.item_id
799: ) -- bug 4373856
800: )
797: rt.organization_id
798: , rsl.item_id
799: ) -- bug 4373856
800: )
801: , (inv_label_pvt1.get_uom2_code(
802: rt.organization_id
803: , rsl.item_id
804: )
805: ) -- bug 4373856
855: , rsh.receipt_num
856: --
857: , SUM(NVL(mtln.transaction_quantity, rt.quantity)) quantity
858: , SUM(NVL(mtln.SECONDARY_TRANSACTION_QUANTITY, rt.SECONDARY_QUANTITY)) secondary_quantity -- fabdi 4373856
859: , (inv_label_pvt1.get_uom_code(
860: rt.organization_id
861: , rsl.item_id
862: , rsl.unit_of_measure
863: )
861: , rsl.item_id
862: , rsl.unit_of_measure
863: )
864: ) uom
865: , (inv_label_pvt1.get_uom2_code(
866: rt.organization_id
867: , rsl.item_id
868: )
869: ) secondary_uom -- bug 4373856
974: --, pod.task_id --Commented as part of Bug# 3586116
975: -- Added by joabraha bug 3472150
976: , rsh.receipt_num
977: --
978: , (inv_label_pvt1.get_uom_code(
979: rt.organization_id
980: , rsl.item_id
981: , rsl.unit_of_measure
982: )
980: , rsl.item_id
981: , rsl.unit_of_measure
982: )
983: )
984: , (inv_label_pvt1.get_uom2_code(
985: rt.organization_id
986: , rsl.item_id
987: )
988: ) -- bug 4373856
1039: , rsh.receipt_num
1040: --
1041: , SUM(NVL(mtln.transaction_quantity, rt.quantity)) quantity
1042: , SUM(NVL(mtln.SECONDARY_TRANSACTION_QUANTITY, rt.SECONDARY_QUANTITY)) secondary_quantity
1043: , (inv_label_pvt1.get_uom_code(
1044: rt.organization_id
1045: , rsl.item_id
1046: , rsl.unit_of_measure
1047: )
1045: , rsl.item_id
1046: , rsl.unit_of_measure
1047: )
1048: ) uom
1049: , (inv_label_pvt1.get_uom2_code(
1050: rt.organization_id
1051: , rsl.item_id
1052: )
1053: ) secondary_uom -- bug 4373856
1150: --, pod.task_id --Commented as part of Bug# 3586116
1151: -- Added by joabraha bug 3472150
1152: , rsh.receipt_num
1153: --
1154: , (inv_label_pvt1.get_uom_code(
1155: rt.organization_id
1156: , rsl.item_id
1157: , rsl.unit_of_measure
1158: )
1156: , rsl.item_id
1157: , rsl.unit_of_measure
1158: )
1159: )
1160: , (inv_label_pvt1.get_uom2_code(
1161: rt.organization_id
1162: , rsl.item_id
1163: )
1164: ) -- bug 4373856
2064: l_so_header_id NUMBER;
2065: l_so_line_id NUMBER;
2066: /*Bug11818438-end*/
2067:
2068: l_selected_fields inv_label.label_field_variable_tbl_type;
2069: l_selected_fields_count NUMBER;
2070: l_return_status VARCHAR2(240);
2071: l_msg_count NUMBER;
2072: l_msg_data VARCHAR2(240);
2076: l_transaction_id NUMBER := p_transaction_id;
2077: l_business_flow_code NUMBER := p_label_type_info.business_flow_code;
2078: l_count NUMBER;
2079: l_lpn_id NUMBER;
2080: l_label_info inv_label.label_type_rec;
2081: l_material_data LONG := '';
2082: l_label_format_id NUMBER := 0;
2083: l_label_format VARCHAR2(100) := NULL;
2084: l_printer VARCHAR2(30) := NULL;
2084: l_printer VARCHAR2(30) := NULL;
2085: l_label_request_id NUMBER := 0;
2086: l_get_org_id NUMBER;
2087: l_is_wms_org BOOLEAN;
2088: l_material_input inv_label.material_label_input_tbl;
2089: l_material_input_index NUMBER;
2090: l_purchase_order po_headers_all.segment1%TYPE;
2091: rti_material_lpn_rec rti_material_lpn_cur%ROWTYPE;
2092: rti_material_mtlt_rec rti_material_mtlt_cur%ROWTYPE;
2145: l_transaction_type NUMBER;--added for bug 6646793
2146:
2147:
2148: BEGIN
2149: l_debug := inv_label.l_debug;
2150: x_return_status := fnd_api.g_ret_sts_success;
2151: l_label_err_msg := NULL;
2152:
2153: IF (l_debug = 1) THEN
3501: || ',task=' || l_task_name
3502: );
3503: END IF;
3504:
3505: l_label_status := INV_LABEL.G_SUCCESS;
3506:
3507: IF (l_debug = 1) THEN
3508: TRACE('Apply Rules engine for format,'
3509: || ',manual_format_id=' || p_label_type_info.manual_format_id
3515: call the label rules engine to get appropriate label
3516: In this call if this happens to be for the label-set, the record
3517: from wms_label_request will be deleted inside following API*/
3518:
3519: inv_label.get_format_with_rule(
3520: p_document_id => p_label_type_info.label_type_id
3521: , p_label_format_id => p_label_type_info.manual_format_id
3522: , p_organization_id => l_organization_id
3523: , p_inventory_item_id => l_inventory_item_id
3590:
3591: --In R12 call this API for the format AGAIN without calling Rules ENGINE
3592: /* insert a record into wms_label_requests entity */
3593:
3594: inv_label.get_format_with_rule
3595: (
3596: p_document_id => p_label_type_info.label_type_id
3597: , p_label_format_id => l_label_formats_in_set.label_format_id --considers manual printer also
3598: , p_organization_id => l_organization_id
3701: TRACE(' Getting variables for new format '|| l_label_format);
3702: END IF;
3703:
3704: -- Changed for R12 RFID project
3705: inv_label.get_variables_for_format
3706: ( x_variables => l_selected_fields
3707: , x_variables_count => l_selected_fields_count
3708: , x_is_variable_exist => l_is_epc_exist
3709: , p_format_id => l_label_format_id
3738: END IF;
3739:
3740:
3741: -- Added for UCC 128 J Bug #3067059
3742: inv_label.is_item_gtin_enabled(
3743: x_return_status => l_return_status
3744: , x_gtin_enabled => l_gtin_enabled
3745: , x_gtin => l_gtin
3746: , x_gtin_desc => l_gtin_desc
3811: IF (l_debug =1) THEN
3812: trace('*****************passing l_label_format_id :' ||l_label_format_id);
3813: END IF;
3814:
3815: inv_label.get_format_with_rule
3816: (
3817: p_document_id => p_label_type_info.label_type_id
3818: , p_label_format_id => l_label_formats_in_set.label_format_id --keep current format id
3819: , p_organization_id => l_organization_id
3870:
3871: WMS_EPC_PVT.generate_epc
3872: (p_org_id => l_organization_id,
3873: p_label_type_id => p_label_type_info.label_type_id, -- 1
3874: p_group_id => inv_label.EPC_group_id,
3875: p_label_format_id => l_label_format_id,
3876: p_item_id => l_inventory_item_id, --For Material label
3877: p_txn_qty => l_quantity, --For Material Label
3878: p_txn_uom => l_uom, --For Material Label
3884: );
3885:
3886: IF (l_debug = 1) THEN
3887: trace('Called generate_epc with ');
3888: trace('l_inventory_item_id='||l_inventory_item_id||',p_group_id='||inv_label.epc_group_id);
3889: trace('l_quantity='||l_quantity||',l_uom='||l_uom);
3890: trace('l_label_format_id='||l_label_format_id||',p_user_id='||fnd_global.user_id);
3891: trace('p_org_id='||l_organization_id);
3892: trace('l_label_request_id= '||l_label_request_id);
4016: END LOOP;
4017:
4018: IF (c_sql_stmt%rowcount=1 AND l_sql_stmt_result IS NULL) THEN
4019: x_return_status := FND_API.G_RET_STS_SUCCESS;
4020: l_custom_sql_ret_status := INV_LABEL.G_WARNING;
4021: fnd_message.set_name('WMS','WMS_CS_NULL_VALUE_RETURNED');
4022: fnd_msg_pub.ADD;
4023: -- Fix for bug: 4179593 Start
4024: --fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => l_custom_sql_ret_msg);
4038: trace('Custom Labels Trace [INVLAP1B.pls]: At Breadcrumb 3');
4039: trace('Custom Labels Trace [INVLAP1B.pls]: WARNING: No row returned by the Custom SQL query');
4040: END IF;
4041: x_return_status := FND_API.G_RET_STS_SUCCESS;
4042: l_custom_sql_ret_status := INV_LABEL.G_WARNING;
4043: fnd_message.set_name('WMS','WMS_CS_NO_DATA_FOUND');
4044: fnd_msg_pub.ADD;
4045: -- Fix for bug: 4179593 Start
4046: --fnd_msg_pub.count_and_get(p_encoded => fnd_api.g_false, p_count => x_msg_count, p_data => l_custom_sql_ret_msg);
4105: l_material_data := l_material_data
4106: || variable_b
4107: || l_selected_fields(i).variable_name
4108: || '">'
4109: || inv_label.g_date
4110: || variable_e;
4111: ELSIF LOWER(l_selected_fields(i).column_name) = 'current_time' THEN
4112: l_material_data := l_material_data
4113: || variable_b
4112: l_material_data := l_material_data
4113: || variable_b
4114: || l_selected_fields(i).variable_name
4115: || '">'
4116: || inv_label.g_time
4117: || variable_e;
4118: ELSIF LOWER(l_selected_fields(i).column_name) = 'request_user' THEN
4119: l_material_data := l_material_data
4120: || variable_b
4119: l_material_data := l_material_data
4120: || variable_b
4121: || l_selected_fields(i).variable_name
4122: || '">'
4123: || inv_label.g_user
4124: || variable_e;
4125: ELSIF LOWER(l_selected_fields(i).column_name) = 'item' THEN
4126: l_material_data := l_material_data
4127: || variable_b
5045: || variable_e;
5046:
5047: l_label_err_msg := l_epc_ret_msg;
5048: IF l_epc_ret_status = 'U' THEN
5049: l_label_status := INV_LABEL.G_ERROR;
5050: ELSIF l_epc_ret_status = 'E' THEN
5051: l_label_status := INV_LABEL.G_WARNING;
5052: END IF;
5053: END IF;
5047: l_label_err_msg := l_epc_ret_msg;
5048: IF l_epc_ret_status = 'U' THEN
5049: l_label_status := INV_LABEL.G_ERROR;
5050: ELSIF l_epc_ret_status = 'E' THEN
5051: l_label_status := INV_LABEL.G_WARNING;
5052: END IF;
5053: END IF;
5054: END LOOP;
5055:
5060: ------------------------Start of changes for Custom Labels project code------------------
5061:
5062: -- Fix for bug: 4179593 Start
5063: IF (l_CustSqlWarnFlagSet) THEN
5064: l_custom_sql_ret_status := INV_LABEL.G_WARNING;
5065: l_custom_sql_ret_msg := l_CustSqlWarnMsg;
5066: END IF;
5067:
5068: IF (l_CustSqlErrFlagSet) THEN
5962: x_variable_content OUT NOCOPY LONG
5963: , x_msg_count OUT NOCOPY NUMBER
5964: , x_msg_data OUT NOCOPY VARCHAR2
5965: , x_return_status OUT NOCOPY VARCHAR2
5966: , p_label_type_info IN inv_label.label_type_rec
5967: , p_transaction_id IN NUMBER
5968: , p_input_param IN mtl_material_transactions_temp%ROWTYPE
5969: , p_transaction_identifier IN NUMBER
5970: ) IS
5967: , p_transaction_id IN NUMBER
5968: , p_input_param IN mtl_material_transactions_temp%ROWTYPE
5969: , p_transaction_identifier IN NUMBER
5970: ) IS
5971: l_variable_data_tbl inv_label.label_tbl_type;
5972: BEGIN
5973: get_variable_data(
5974: x_variable_content => l_variable_data_tbl
5975: , x_msg_count => x_msg_count
6112:
6113: RETURN l_return_flag;
6114: END IF;
6115: END;
6116: END inv_label_pvt1;