[Home] [Help]
PACKAGE BODY: APPS.PA_RBS_PREC_PUB
Source
1 PACKAGE BODY PA_RBS_PREC_PUB AS
2 /* $Header: PARBSPRB.pls 120.2 2011/12/27 19:20:07 sachandr noship $ */
3
4 ---------------------------------------------------
5 --calculate resource class precedence for each rule
6 ---------------------------------------------------
7 FUNCTION calc_rc_precedence
8 (
9 resource_type_id number,
10 res_class_id number
11 )
12 RETURN NUMBER
13 IS
14 TYPE res_type_rec IS RECORD
15 (res_type_id number,
16 per_rc_prec number,
17 equip_rc_prec number,
18 mat_rc_prec number,
19 fin_rc_prec number);
20 TYPE res_type_rec_tab IS TABLE OF res_type_rec INDEX BY BINARY_INTEGER;
21
22 res_type_rec_t res_type_rec_tab;
23 l_resource_class_flag VARCHAR2(1);
24
25 BEGIN
26
27 select resource_class_flag -- cbs change
28 into l_resource_class_flag
29 from pa_rbs_versions_b
30 where rbs_version_id = PA_RBS_PREC_PUB.g_rbs_version_id;
31
32 IF l_resource_class_flag = 'Y' THEN -- cbs change
33 --below precedence values for 16 resource types are taken from RBS FD
34
35 res_type_rec_t(1).res_type_id := 1;
36 res_type_rec_t(1).per_rc_prec := 2;
37 res_type_rec_t(1).equip_rc_prec := 2;
38 res_type_rec_t(1).mat_rc_prec := 2;
39 res_type_rec_t(1).fin_rc_prec := 2;
40
41 res_type_rec_t(2).res_type_id := 2;
42 res_type_rec_t(2).per_rc_prec := 4;
43 res_type_rec_t(2).equip_rc_prec := 4;
44 res_type_rec_t(2).mat_rc_prec := 4;
45 res_type_rec_t(2).fin_rc_prec := 4;
46
47 res_type_rec_t(3).res_type_id := 3;
48 res_type_rec_t(3).per_rc_prec := 1;
49 res_type_rec_t(3).equip_rc_prec := 1;
50 res_type_rec_t(3).mat_rc_prec := 1;
51 res_type_rec_t(3).fin_rc_prec := 1;
52
53 res_type_rec_t(4).res_type_id := 4;
54 res_type_rec_t(4).per_rc_prec := 10;
55 res_type_rec_t(4).equip_rc_prec := 10;
56 res_type_rec_t(4).mat_rc_prec := 10;
57 res_type_rec_t(4).fin_rc_prec := 10;
58
59 res_type_rec_t(5).res_type_id := 5;
60 res_type_rec_t(5).per_rc_prec := 11;
61 res_type_rec_t(5).equip_rc_prec := 11;
62 res_type_rec_t(5).mat_rc_prec := 11;
63 res_type_rec_t(5).fin_rc_prec := 11;
64
65 res_type_rec_t(6).res_type_id := 6;
66 res_type_rec_t(6).per_rc_prec := 9;
67 res_type_rec_t(6).equip_rc_prec := 9;
68 res_type_rec_t(6).mat_rc_prec := 9;
69 res_type_rec_t(6).fin_rc_prec := 9;
70
71 res_type_rec_t(7).res_type_id := 7;
72 res_type_rec_t(7).per_rc_prec := 8;
73 res_type_rec_t(7).equip_rc_prec := 8;
74 res_type_rec_t(7).mat_rc_prec := 8;
75 res_type_rec_t(7).fin_rc_prec := 8;
76
77 res_type_rec_t(8).res_type_id := 8;
78 res_type_rec_t(8).per_rc_prec := 5;
79 res_type_rec_t(8).equip_rc_prec := 5;
80 res_type_rec_t(8).mat_rc_prec := 5;
81 res_type_rec_t(8).fin_rc_prec := 5;
82
83 res_type_rec_t(9).res_type_id := 9;
84 res_type_rec_t(9).per_rc_prec := 6;
85 res_type_rec_t(9).equip_rc_prec := 6;
86 res_type_rec_t(9).mat_rc_prec := 6;
87 res_type_rec_t(9).fin_rc_prec := 6;
88
89 res_type_rec_t(10).res_type_id := 10;
90 res_type_rec_t(10).per_rc_prec := 13;
91 res_type_rec_t(10).equip_rc_prec := 13;
92 res_type_rec_t(10).mat_rc_prec := 15;
93 res_type_rec_t(10).fin_rc_prec := 15;
94
95 res_type_rec_t(11).res_type_id := 11;
96 res_type_rec_t(11).per_rc_prec := 14;
97 res_type_rec_t(11).equip_rc_prec := 14;
98 res_type_rec_t(11).mat_rc_prec := 14;
99 res_type_rec_t(11).fin_rc_prec := 14;
100
101 res_type_rec_t(12).res_type_id := 12;
102 res_type_rec_t(12).per_rc_prec := 3;
103 res_type_rec_t(12).equip_rc_prec := 3;
104 res_type_rec_t(12).mat_rc_prec := 3;
105 res_type_rec_t(12).fin_rc_prec := 3;
106
107 res_type_rec_t(13).res_type_id := 13;
108 res_type_rec_t(13).per_rc_prec := 16;
109 res_type_rec_t(13).equip_rc_prec := 16;
110 res_type_rec_t(13).mat_rc_prec := 16;
111 res_type_rec_t(13).fin_rc_prec := 16;
112
113 res_type_rec_t(14).res_type_id := 14;
114 res_type_rec_t(14).per_rc_prec := 12;
115 res_type_rec_t(14).equip_rc_prec := 12;
116 res_type_rec_t(14).mat_rc_prec := 12;
117 res_type_rec_t(14).fin_rc_prec := 12;
118
119 res_type_rec_t(15).res_type_id := 15;
120 res_type_rec_t(15).per_rc_prec := 7;
121 res_type_rec_t(15).equip_rc_prec := 7;
122 res_type_rec_t(15).mat_rc_prec := 7;
123 res_type_rec_t(15).fin_rc_prec := 7;
124
125 res_type_rec_t(16).res_type_id := 16;
126 res_type_rec_t(16).per_rc_prec := 15;
127 res_type_rec_t(16).equip_rc_prec := 15;
128 res_type_rec_t(16).mat_rc_prec := 13;
129 res_type_rec_t(16).fin_rc_prec := 13;
130
131 ELSE
132
133 select res_type_id, rc_prec_id, rc_prec_id, rc_prec_id, rc_prec_id
134 bulk collect into res_type_rec_t
135 from PA_PRL_RBS_PRECEDENCE;
136 END IF;
137
138
139
140 FOR i IN 1..16 LOOP
141 IF res_type_rec_t(i).res_type_id = resource_type_id THEN
142 IF res_class_id = 1 THEN
143 RETURN res_type_rec_t(i).per_rc_prec;
144 ELSIF res_class_id = 2 THEN
145 RETURN res_type_rec_t(i).equip_rc_prec;
146 ELSIF res_class_id = 3 THEN
147 RETURN res_type_rec_t(i).mat_rc_prec;
148 ELSIF res_class_id = 4 THEN
149 RETURN res_type_rec_t(i).fin_rc_prec;
150 END IF;
151 END IF;
152 END LOOP;
153
154 -- added for custom nodes
155 IF resource_type_id = 18 THEN
156 IF res_class_id = 1 THEN
157 RETURN 20; --bug#3908476
158 ELSIF res_class_id = 2 THEN
159 RETURN 20; --bug#3908476
160 ELSIF res_class_id = 3 THEN
161 RETURN 20; --bug#3908476
162 ELSIF res_class_id = 4 THEN
163 RETURN 20; --bug#3908476
164 END IF;
165 END IF;
166
167 END;
168
169 FUNCTION calc_rule_precedence
170 (
171 rule_type_id varchar,
172 res_class_id number
173 )
174 RETURN NUMBER
175 IS
176 TYPE res_type_rec IS RECORD
177 (rule_type varchar(150),
178 per_rc_prec number,
179 equip_rc_prec number,
180 mat_rc_prec number,
181 fin_rc_prec number);
182 TYPE res_type_rec_tab IS TABLE OF res_type_rec INDEX BY BINARY_INTEGER;
183
184 res_type_rec_t res_type_rec_tab;
185 l_resource_class_flag VARCHAR2(1);
186 BEGIN
187
188 select resource_class_flag -- cbs change
189 into l_resource_class_flag
190 from pa_rbs_versions_b
191 where rbs_version_id = PA_RBS_PREC_PUB.g_rbs_version_id;
192
193 IF l_resource_class_flag = 'Y' THEN -- cbs change
194 --below precedence values for 16 resource types are taken from RBS FD
195
196 res_type_rec_t(1).rule_type :='BML';
197 res_type_rec_t(1).per_rc_prec := 2;
198 res_type_rec_t(1).equip_rc_prec := 2;
199 res_type_rec_t(1).mat_rc_prec := 2;
200 res_type_rec_t(1).fin_rc_prec := 2;
201
202 res_type_rec_t(2).rule_type := 'BME';
203 res_type_rec_t(2).per_rc_prec := 4;
204 res_type_rec_t(2).equip_rc_prec := 4;
205 res_type_rec_t(2).mat_rc_prec := 4;
206 res_type_rec_t(2).fin_rc_prec := 4;
207
208 res_type_rec_t(3).rule_type := 'PER';
209 res_type_rec_t(3).per_rc_prec := 1;
210 res_type_rec_t(3).equip_rc_prec := 1;
211 res_type_rec_t(3).mat_rc_prec := 1;
212 res_type_rec_t(3).fin_rc_prec := 1;
213
214 res_type_rec_t(4).rule_type := 'EVT';
215 res_type_rec_t(4).per_rc_prec := 10;
216 res_type_rec_t(4).equip_rc_prec := 10;
217 res_type_rec_t(4).mat_rc_prec := 10;
218 res_type_rec_t(4).fin_rc_prec := 10;
219
220 res_type_rec_t(5).rule_type := 'EXC';
221 res_type_rec_t(5).per_rc_prec := 11;
222 res_type_rec_t(5).equip_rc_prec := 11;
223 res_type_rec_t(5).mat_rc_prec := 11;
224 res_type_rec_t(5).fin_rc_prec := 11;
225
226 res_type_rec_t(6).rule_type := 'EXT';
227 res_type_rec_t(6).per_rc_prec := 9;
228 res_type_rec_t(6).equip_rc_prec := 9;
229 res_type_rec_t(6).mat_rc_prec := 9;
230 res_type_rec_t(6).fin_rc_prec := 9;
231
232 res_type_rec_t(7).rule_type := 'ITC';
233 res_type_rec_t(7).per_rc_prec := 8;
234 res_type_rec_t(7).equip_rc_prec := 8;
235 res_type_rec_t(7).mat_rc_prec := 8;
236 res_type_rec_t(7).fin_rc_prec := 8;
237
238 res_type_rec_t(8).rule_type := 'ITM';
239 res_type_rec_t(8).per_rc_prec := 5;
240 res_type_rec_t(8).equip_rc_prec := 5;
241 res_type_rec_t(8).mat_rc_prec := 5;
242 res_type_rec_t(8).fin_rc_prec := 5;
243
244 res_type_rec_t(9).rule_type := 'JOB';
245 res_type_rec_t(9).per_rc_prec := 6;
246 res_type_rec_t(9).equip_rc_prec := 6;
247 res_type_rec_t(9).mat_rc_prec := 6;
248 res_type_rec_t(9).fin_rc_prec := 6;
249
250 res_type_rec_t(10).rule_type := 'ORG';
251 res_type_rec_t(10).per_rc_prec := 13;
252 res_type_rec_t(10).equip_rc_prec := 13;
253 res_type_rec_t(10).mat_rc_prec := 15;
254 res_type_rec_t(10).fin_rc_prec := 15;
255
256 res_type_rec_t(11).rule_type := 'PTP';
257 res_type_rec_t(11).per_rc_prec := 14;
258 res_type_rec_t(11).equip_rc_prec := 14;
259 res_type_rec_t(11).mat_rc_prec := 14;
260 res_type_rec_t(11).fin_rc_prec := 14;
261
262 res_type_rec_t(12).rule_type := 'NLR';
263 res_type_rec_t(12).per_rc_prec := 3;
264 res_type_rec_t(12).equip_rc_prec := 3;
265 res_type_rec_t(12).mat_rc_prec := 3;
266 res_type_rec_t(12).fin_rc_prec := 3;
267
268 res_type_rec_t(13).rule_type := 'RES';
269 res_type_rec_t(13).per_rc_prec := 16;
270 res_type_rec_t(13).equip_rc_prec := 16;
271 res_type_rec_t(13).mat_rc_prec := 16;
272 res_type_rec_t(13).fin_rc_prec := 16;
273
274 res_type_rec_t(14).rule_type := 'RVC';
275 res_type_rec_t(14).per_rc_prec := 12;
276 res_type_rec_t(14).equip_rc_prec := 12;
277 res_type_rec_t(14).mat_rc_prec := 12;
278 res_type_rec_t(14).fin_rc_prec := 12;
279
280 res_type_rec_t(15).rule_type := 'ROL';
281 res_type_rec_t(15).per_rc_prec := 7;
282 res_type_rec_t(15).equip_rc_prec := 7;
283 res_type_rec_t(15).mat_rc_prec := 7;
284 res_type_rec_t(15).fin_rc_prec := 7;
285
286 res_type_rec_t(16).rule_type :='SUP';
287 res_type_rec_t(16).per_rc_prec := 15;
288 res_type_rec_t(16).equip_rc_prec := 15;
289 res_type_rec_t(16).mat_rc_prec := 13;
290 res_type_rec_t(16).fin_rc_prec := 13;
291
292 ELSE
293
294 select rule_type, rc_prec_id, rc_prec_id, rc_prec_id, rc_prec_id
295 bulk collect into res_type_rec_t
296 from PA_ACT_RBS_PRECEDENCE;
297 END IF;
298
299
300 FOR i IN 1..16 LOOP
301 IF res_type_rec_t(i).rule_type = rule_type_id THEN
302 IF res_class_id = 1 THEN
303 RETURN res_type_rec_t(i).per_rc_prec;
304 ELSIF res_class_id = 2 THEN
305 RETURN res_type_rec_t(i).equip_rc_prec;
306 ELSIF res_class_id = 3 THEN
307 RETURN res_type_rec_t(i).mat_rc_prec;
308 ELSIF res_class_id = 4 THEN
309 RETURN res_type_rec_t(i).fin_rc_prec;
310 END IF;
311 END IF;
312 END LOOP;
313
314 -- added for custom nodes
315 IF rule_type_id in ('CU1','CU2','CU3','CU4','CU5') THEN
316 IF res_class_id = 1 THEN
317 RETURN 20; --bug#3908476
318 ELSIF res_class_id = 2 THEN
319 RETURN 20; --bug#3908476
320 ELSIF res_class_id = 3 THEN
321 RETURN 20; --bug#3908476
322 ELSIF res_class_id = 4 THEN
323 RETURN 20; --bug#3908476
324 END IF;
325 END IF;
326
327 END;
328
329 END; --end package PA_RBS_PREC_PUB