[Home] [Help]
PACKAGE BODY: APPS.INV_DIAG_GRP
Source
1 PACKAGE body INV_DIAG_GRP AS
2 /* $Header: INVDGTPB.pls 120.0.12000000.1 2007/06/22 00:49:51 musinha noship $ */
3 FUNCTION CHECK_AVAIL(p_Inventory_item_id Number
4 ,p_Organization_id Number
5 ,p_revision Varchar2
6 ,p_Subinventory_code Varchar2
7 ,p_locator_id Number
8 ) return NUMBER IS
9 L_api_return_status VARCHAR2(1);
10 l_qty_oh NUMBER;
11 l_qty_res_oh NUMBER;
12 l_qty_res NUMBER;
13 l_qty_sug NUMBER;
14 l_qty_att NUMBER;
15 l_qty_atr NUMBER;
16 l_msg_count NUMBER;
17 l_msg_data VARCHAR2(1000);
18 subinventory_code VARCHAR2(13);
19 revision varchar2(100);
20 locator_id Number;
21 is_revision_control boolean:=true;
22 QATT NUmber;
23
24 BEGIN
25 inv_quantity_tree_grp.clear_quantity_cache;
26
27 if p_revision is null then
28 revision:=null;
29 is_revision_control:=false;
30 else
31 revision := p_revision;
32 end if;
33
34 if p_subinventory_code is NULL then
35 subinventory_code:=null;
36 locator_id:=null;
37 else
38 subinventory_code:=p_subinventory_code;
39 locator_id:=p_locator_id;
40 end if;
41
42 if p_locator_id is NULL then
43 locator_id:=null;
44 else
45 locator_id:=p_locator_id;
46 end if;
47
48 apps.INV_Quantity_Tree_PUB.Query_Quantities (
49 p_api_version_number => 1.0
50 , p_init_msg_lst => apps.fnd_api.g_false
51 , x_return_status => L_api_return_status
52 , x_msg_count => l_msg_count
53 , x_msg_data => l_msg_data
54 , p_organization_id => p_organization_id
55 , p_inventory_item_id => p_inventory_item_id
56 , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode
57 , p_onhand_source => NULL
58 , p_is_revision_control=> is_revision_control
59 , p_is_lot_control => FALSE
60 , p_is_serial_control => FALSE
61 , p_revision => revision
62 , p_lot_number => NULL
63 , p_subinventory_code => subinventory_code
64 , p_locator_id => locator_id
65 , x_qoh => l_qty_oh
66 , x_rqoh => l_qty_res_oh
67 , x_qr => l_qty_res
68 , x_qs => l_qty_sug
69 , x_att => l_qty_att
70 , x_atr => l_qty_atr );
71
72 if L_api_return_status <> fnd_api.g_ret_sts_success then
73 QATT:=0;
74 else
75 QATT:=l_qty_att;
76 end if;
77 return QATT;
78
79 end;
80
81 FUNCTION CHECK_ONHAND(p_Inventory_item_id Number
82 ,p_Organization_id Number
83 ,p_revision Varchar2
84 ,p_Subinventory_code Varchar2
85 ,p_locator_id Number
86 ) return NUMBER IS
87 L_api_return_status VARCHAR2(1);
88 l_qty_oh NUMBER;
89 l_qty_res_oh NUMBER;
90 l_qty_res NUMBER;
91 l_qty_sug NUMBER;
92 l_qty_att NUMBER;
93 l_qty_atr NUMBER;
94 l_msg_count NUMBER;
95 l_msg_data VARCHAR2(1000);
96 subinventory_code VARCHAR2(13);
97 revision varchar2(100);
98 locator_id Number;
99 is_revision_control boolean:=true;
100 QOH NUmber;
101
102 BEGIN
103 inv_quantity_tree_grp.clear_quantity_cache;
104
105 if p_revision is null then
106 revision:=null;
107 is_revision_control:=false;
108 else
109 revision := p_revision;
110 end if;
111
112 if p_subinventory_code is NULL then
113 subinventory_code:=null;
114 locator_id:=null;
115 else
116 subinventory_code:=p_subinventory_code;
117 locator_id:=p_locator_id;
118 end if;
119
120 if p_locator_id is NULL then
121 locator_id:=null;
122 else
123 locator_id:=p_locator_id;
124 end if;
125
126 apps.INV_Quantity_Tree_PUB.Query_Quantities (
127 p_api_version_number => 1.0
128 , p_init_msg_lst => apps.fnd_api.g_false
129 , x_return_status => L_api_return_status
130 , x_msg_count => l_msg_count
131 , x_msg_data => l_msg_data
132 , p_organization_id => p_organization_id
133 , p_inventory_item_id => p_inventory_item_id
134 , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode
135 , p_onhand_source => NULL
136 , p_is_revision_control=> is_revision_control
137 , p_is_lot_control => FALSE
138 , p_is_serial_control => FALSE
139 , p_revision => revision
140 , p_lot_number => NULL
141 , p_subinventory_code => subinventory_code
142 , p_locator_id => locator_id
143 , x_qoh => l_qty_oh
144 , x_rqoh => l_qty_res_oh
145 , x_qr => l_qty_res
146 , x_qs => l_qty_sug
147 , x_att => l_qty_att
148 , x_atr => l_qty_atr );
149
150 if L_api_return_status <> fnd_api.g_ret_sts_success then
151 QOH:=0;
152 else
153 QOH:=l_qty_oh;
154 end if;
155 return QOH;
156
157 end;
158
159 -- to check if user has valid responsibility
160
161 FUNCTION check_responsibility(p_responsibility_name in FND_RESPONSIBILITY_TL.Responsibility_Name%type) return BOOLEAN is
162 l_dummy number;
163 begin
164
165 select count(*)
166 into l_dummy
167 from fnd_user_resp_groups fg, fnd_responsibility_vl fr
168 where fg.RESPONSIBILITY_ID=fr.RESPONSIBILITY_ID
169 and nvl(fr.START_DATE, sysdate) <= sysdate
170 and nvl(fr.END_DATE, sysdate) >= sysdate
171 and nvl(fg.START_DATE, sysdate) <=sysdate
172 and nvl(fg.END_DATE, sysdate) >=sysdate
173 and fr.RESPONSIBILITY_NAME = p_responsibility_name
174 and user_id=fnd_global.user_id;
175
176 if l_dummy >=1 then
177 return TRUE;
178 else
179 return FALSE;
180 end if;
181
182 exception when no_data_found then
183 return FALSE ;
184 end;
185
186 end;