1 PACKAGE BODY WIP_JOB_DTLS_VALIDATIONS AS
2 /* $Header: wipjdvdb.pls 120.1 2005/12/22 02:39:11 panagara noship $ */
3 procedure jobs (p_group_id IN number,
4 p_parent_header_id IN number) is
5 cursor c_ml_invalid_rows is
6 select interface_id
7 from wip_job_dtls_interface wjdi
8 where wjdi.group_id = p_group_id
9 and wjdi.parent_header_id = p_parent_header_id
10 and wjdi.process_phase = wip_constants.ml_validation
11 and wjdi.process_status in (wip_constants.running, wip_constants.warning)
12 and not exists (select 1
13 from wip_job_schedule_interface wjsi
14 where wjdi.group_id = wjsi.group_id
15 and wjdi.parent_header_id = wjsi.header_id);
16
17 cursor c_wdj_invalid_rows is
18 select interface_id
19 from wip_job_dtls_interface wjdi
20 where wjdi.group_id = p_group_id
21 and wjdi.process_phase = wip_constants.ml_validation
22 and wjdi.process_status in (wip_constants.running,
23 wip_constants.warning)
24 and not exists (select 1
25 from wip_discrete_jobs wdj
26 where wjdi.wip_entity_id = wdj.wip_entity_id
27 and wjdi.organization_id = wdj.organization_id);
28
29 l_interface_id NUMBER;
30 l_error_exists boolean := false;
31 begin
32 if(wip_job_details.std_alone = 0) then
33 open c_ml_invalid_rows;
34 else
35 open c_wdj_invalid_rows;
36 end if;
37
38 loop
39 if(wip_job_details.std_alone = 0) then
40 fetch c_ml_invalid_rows into l_interface_id;
41 exit when c_ml_invalid_rows%NOTFOUND;
42 else
43 fetch c_wdj_invalid_rows into l_interface_id;
44 exit when c_wdj_invalid_rows%NOTFOUND;
45 end if;
46 l_error_exists := true; --loop executes only for invalid rows!
47 fnd_message.set_name('WIP', 'WIP_JOB_DOES_NOT_EXIST');
48 fnd_message.set_token('INTERFACE', to_char(l_interface_id));
49 if(wip_job_details.std_alone = 1) then
50 wip_interface_err_Utils.add_error(p_interface_id => l_interface_id,
51 p_text => substr(fnd_message.get,1,500),
52 p_error_type => wip_jdi_utils.msg_error);
53 else
54 wip_interface_err_Utils.add_error(p_interface_id => wip_jsi_utils.current_interface_id,
55 p_text => substr(fnd_message.get,1,500),
56 p_error_type => wip_jdi_utils.msg_error);
57 end if;
58
59
60 end loop;
61 if(c_ml_invalid_rows%ISOPEN) then
62 close c_ml_invalid_rows;
63 elsif(c_wdj_invalid_rows%ISOPEN) then
64 close c_wdj_invalid_rows;
65 end if;
66
67 if(l_error_exists) then
68 if(wip_job_details.std_alone = 1) then
69 update wip_job_dtls_interface wjdi
70 set process_status = wip_constants.error
71 where wjdi.group_id = p_group_id
72 and process_phase = wip_constants.ml_validation
73 and process_status in (wip_constants.running,
74 wip_constants.warning)
75 and not exists (select 1
76 from wip_discrete_jobs wdj
77 where wjdi.wip_entity_id = wdj.wip_entity_id
78 and wjdi.organization_id = wdj.organization_id);
79 else
80 update wip_job_dtls_interface wjdi
81 set process_status = wip_constants.error
82 where group_id = p_group_id
83 and parent_header_id = p_parent_header_id
84 and process_phase = wip_constants.ml_validation
85 and process_status in (wip_constants.running,
86 wip_constants.warning)
87 and not exists (select 1
88 from wip_job_schedule_interface wjsi
89 where wjsi.group_id = p_group_id
90 and wjdi.parent_header_id = wjsi.header_id);
91 end if;
92 end if;
93 end jobs;
94
95 procedure job_status (p_group_id in number,
96 p_parent_header_id in number) is
97 cursor c_ml_invalid_rows is
98 select interface_id
99 from wip_job_dtls_interface wjdi
100 where wjdi.group_id = p_group_id
101 and wjdi.parent_header_id = p_parent_header_id
102 and wjdi.process_phase = wip_constants.ml_validation
103 and wjdi.process_status in (wip_constants.running,
104 wip_constants.warning)
105 and not exists (select 1
106 from wip_discrete_jobs wdj
107 where wjdi.wip_entity_id = wdj.wip_entity_id
108 and wjdi.organization_id = wdj.organization_id
109 and wdj.status_type in (wip_constants.unreleased,
110 wip_constants.released,
111 wip_constants.comp_chrg,
112 wip_constants.hold));
113 l_error_exists boolean := false;
114 begin
115
116 -- 1: unreleased, no charges allowed
117 -- 3: released, charges allowed
118 -- 4: complete, charges allowed
119 -- 6: hold, no charges allowed
120 if(wip_job_details.std_alone = 1) then
121 for l_inv_row in c_ml_invalid_rows loop
122 l_error_exists := true; --loop executes only for invalid rows!
123 fnd_message.set_name('WIP', 'WIP_JOB_INVALID_STATUS');
124 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
125 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
126 p_text => substr(fnd_message.get,1,500),
127 p_error_type => wip_jdi_utils.msg_error);
128 end loop;
129 end if;
130
131 if(l_error_exists) then
132 update wip_job_dtls_interface wjdi
133 set process_status = wip_constants.error
134 where group_id = p_group_id
135 and parent_header_id = p_parent_header_id
136 and process_phase = wip_constants.ml_validation
137 and process_status in (wip_constants.running,
138 wip_constants.warning)
139 and not exists (select 1
140 from wip_discrete_jobs wdj
141 where wjdi.wip_entity_id = wdj.wip_entity_id
142 and wjdi.organization_id = wdj.organization_id
143 and wdj.status_type in (wip_constants.unreleased,
144 wip_constants.released,
145 wip_constants.comp_chrg,
146 wip_constants.hold));
147 end if;
148 end job_status;
149
150 procedure is_firm (p_group_id number,
151 p_parent_header_id number) is
152 cursor c_invalid_rows is
153 select interface_id
154 from wip_job_dtls_interface wjdi
155 where wjdi.group_id = p_group_id
156 and wjdi.parent_header_id = p_parent_header_id
157 and wjdi.process_phase = wip_constants.ml_validation
158 and wjdi.process_status in (wip_constants.running,
159 wip_constants.warning)
160 and exists (select 1
161 from wip_discrete_jobs wdj
162 where wjdi.wip_entity_id = wdj.wip_entity_id
163 and wjdi.organization_id = wdj.organization_id
164 and wdj.status_type in (wip_constants.unreleased,
165 wip_constants.released,
166 wip_constants.comp_chrg,
167 wip_constants.hold)
168 and wdj.firm_planned_flag = wip_constants.yes);
169
170 l_error_exists boolean := false;
171 begin
172 -- If firmed, we can't do any further change
173 if(wip_job_details.std_alone = 1) then
174 for l_inv_row in c_invalid_rows loop
175 l_error_exists := true;
176 fnd_message.set_name('WIP', 'WIP_JOB_FIRMED');
177 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
178 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
179 p_text => substr(fnd_message.get,1,500),
180 p_error_type => wip_jdi_utils.msg_error);
181 end loop;
182 end if;
183
184 if(l_error_exists) then
185 update wip_job_dtls_interface wjdi
186 set process_status = wip_constants.error
187 where group_id = p_group_id
188 and parent_header_id = p_parent_header_id
189 and process_phase = wip_constants.ml_validation
190 and process_status in (wip_constants.running,
191 wip_constants.warning)
192 and exists (select 1
193 from wip_discrete_jobs wdj
194 where wjdi.wip_entity_id = wdj.wip_entity_id
195 and wjdi.organization_id = wdj.organization_id
196 and wdj.status_type in (wip_constants.unreleased,
197 wip_constants.released,
198 wip_constants.comp_chrg,
199 wip_constants.hold)
200 and wdj.firm_planned_flag = wip_constants.yes);
201 end if;
202 end is_firm;
203
204 procedure op_seq_num(p_group_id IN number,
205 p_parent_header_id IN number,
206 p_wip_entity_id IN number,
207 p_organization_id IN number) is
208
209 cursor c_first_operation is
210 select min(operation_seq_num)
211 from wip_operations
212 where organization_id = p_organization_id
213 and wip_entity_id = p_wip_entity_id;
214
215 cursor c_ml_invalid_rows is
216 select interface_id
217 from wip_job_dtls_interface wjdi
218 where wjdi.group_id = p_group_id
219 and wjdi.parent_header_id = p_parent_header_id
220 and wjdi.process_phase = wip_constants.ml_validation
221 and wjdi.process_status in (wip_constants.running,
222 wip_constants.warning)
223 and ( wjdi.load_type in (wip_job_details.wip_resource,
224 wip_job_details.wip_sub_res,
225 wip_job_details.wip_res_usage)
226
227 or ( wjdi.load_type = wip_job_details.wip_mtl_requirement
228 and wjdi.operation_seq_num <> 1
229 )
230 )
231 and not exists (select 1
232 from wip_operations wo
233 where wjdi.wip_entity_id = wo.wip_entity_id
234 and wjdi.organization_id = wo.organization_id
235 and wjdi.operation_seq_num = wo.operation_seq_num);
236
237 cursor c_wdj_invalid_rows is
238 select interface_id
239 from wip_job_dtls_interface wjdi
240 where wjdi.group_id = p_group_id
241 and wjdi.process_phase = wip_constants.ml_validation
242 and wjdi.process_status in (wip_constants.running,
243 wip_constants.warning)
244 and wjdi.wip_entity_id = p_wip_entity_id
245 and wjdi.organization_id = p_organization_id
246 and ( wjdi.load_type in (wip_job_details.wip_resource,
247 wip_job_details.wip_sub_res,
248 wip_job_details.wip_res_usage)
249
250 or ( wjdi.load_type = wip_job_details.wip_mtl_requirement
251 and wjdi.operation_seq_num <> 1
252 )
253 )
254 and not exists (select 1
255 from wip_operations wo
256 where wjdi.wip_entity_id = wo.wip_entity_id
257 and wjdi.organization_id = wo.organization_id
258 and wjdi.operation_seq_num = wo.operation_seq_num);
259
260 l_num_first_op_rows number := 0;
261 l_first_op_seq_num number := 1;
262
263 l_interface_id NUMBER;
264 l_error_exists boolean := false;
265 begin
266
267 -- For add requirement only: If the operation sequence number given by the
268 -- user is one, then we should treat it as the first operation.
269 select count(*)
270 into l_num_first_op_rows
271 from wip_job_dtls_interface
272 where group_id = p_group_id
273 and parent_header_id = p_parent_header_id
274 and process_phase = wip_constants.ml_validation
275 and process_status in (wip_constants.running,wip_constants.warning)
276 and wip_entity_id = p_wip_entity_id
277 and organization_id = p_organization_id
278 and load_type = wip_job_details.wip_mtl_requirement
279 and substitution_type = wip_job_details.wip_add
280 and operation_seq_num = 1;
281
282 if(l_num_first_op_rows > 0) then
283 --get the first op seq number
284 open c_first_operation;
285 fetch c_first_operation into l_first_op_seq_num;
286
287 --update the details rows to the first op seq.
288 if(c_first_operation%FOUND) then
289 if l_first_op_seq_num is NOT NULL then /* Fix for Bug#3247891*/
290 update wip_job_dtls_interface
291 set operation_seq_num = l_first_op_seq_num
292 where group_id = p_group_id
293 and parent_header_id = p_parent_header_id
294 and process_phase = wip_constants.ml_validation
295 and process_status in (wip_constants.running, wip_constants.warning)
296 and wip_entity_id = p_wip_entity_id
297 and organization_id = p_organization_id
298 and load_type = wip_job_details.wip_mtl_requirement
299 and substitution_type = wip_job_details.wip_add
300 and operation_seq_num = 1;
301 end if ;
302 end if;
303 close c_first_operation;
304 end if;
305 -- operation_seq_num must be in job
306 if(wip_job_details.std_alone = 1) then
307 open c_wdj_invalid_rows;
308 else
309 open c_ml_invalid_rows;
310 end if;
311
312 loop
313 if(wip_job_details.std_alone = 0) then
314 fetch c_ml_invalid_rows into l_interface_id;
315 exit when c_ml_invalid_rows%NOTFOUND;
316 else
317 fetch c_wdj_invalid_rows into l_interface_id;
318 exit when c_wdj_invalid_rows%NOTFOUND;
319 end if;
320 l_error_exists := true; --loop executes only for invalid rows!
321 fnd_message.set_name('WIP', 'WIP_OP_NOT_FOUND');
322 fnd_message.set_token('INTERFACE', to_char(l_interface_id));
323 if(wip_job_details.std_alone = 1) then
324 wip_interface_err_Utils.add_error(p_interface_id => l_interface_id,
325 p_text => substr(fnd_message.get,1,500),
326 p_error_type => wip_jdi_utils.msg_error);
327 else
328 wip_interface_err_Utils.add_error(p_interface_id => wip_jsi_utils.current_interface_id,
329 p_text => substr(fnd_message.get,1,500),
330 p_error_type => wip_jdi_utils.msg_error);
331 end if;
332
333
334 end loop;
335 if(c_ml_invalid_rows%ISOPEN) then
336 close c_ml_invalid_rows;
337 elsif(c_wdj_invalid_rows%ISOPEN) then
338 close c_wdj_invalid_rows;
339 end if;
340
341 if(l_error_exists) then
342 if(wip_job_details.std_alone = 1) then
343 update wip_job_dtls_interface wjdi
344 set process_status = wip_constants.error
345 where group_id = p_group_id
346 and process_phase = wip_constants.ml_validation
347 and process_status in (wip_constants.running,
348 wip_constants.warning)
349 and wip_entity_id = p_wip_entity_id
350 and organization_id = p_organization_id
351 and ( load_type in (wip_job_details.wip_resource,
352 wip_job_details.wip_sub_res,
353 wip_job_details.wip_res_usage)
354
355 or ( load_type = wip_job_details.wip_mtl_requirement
356 and operation_seq_num <> 1
357 )
358 )
359 and not exists (select 1
360 from wip_operations wo
361 where wjdi.wip_entity_id = wo.wip_entity_id
362 and wjdi.organization_id = wo.organization_id
363 and wjdi.operation_seq_num = wo.operation_seq_num);
364 else
365 update wip_job_dtls_interface wjdi
366 set process_status = wip_constants.error
367 where group_id = p_group_id
368 and parent_header_id = p_parent_header_id
369 and process_phase = wip_constants.ml_validation
370 and process_status in (wip_constants.running,
371 wip_constants.warning)
372 and ( load_type in (wip_job_details.wip_resource,
373 wip_job_details.wip_sub_res,
374 wip_job_details.wip_res_usage)
375
376 or ( load_type = wip_job_details.wip_mtl_requirement
377 and operation_seq_num <> 1
378 )
379 )
380 and not exists (select 1
381 from wip_operations wo
382 where wjdi.wip_entity_id = wo.wip_entity_id
383 and wjdi.organization_id = wo.organization_id
384 and wjdi.operation_seq_num = wo.operation_seq_num);
385 end if;
386 end if;
387 end op_seq_num;
388
389
390 procedure load_sub_types(p_group_id IN number,
391 p_parent_header_id IN number,
392 p_wip_entity_id IN number,
393 p_organization_id IN number) IS
394 cursor c_invalid_rows is
395 select interface_id
396 from wip_job_dtls_interface wjdi
397 where wjdi.group_id = p_group_id
398 and wjdi.parent_header_id = p_parent_header_id
399 and wjdi.process_phase = wip_constants.ml_validation
400 and wjdi.process_status in (wip_constants.running,
401 wip_constants.warning)
402 and wjdi.wip_entity_id = p_wip_entity_id
403 and wjdi.organization_id = p_organization_id
404 and ( wjdi.load_type not in (1, 2, 3, 4, 5, 6, 7, WIP_JOB_DETAILS.WIP_RES_INSTANCE, WIP_JOB_DETAILS.WIP_RES_INSTANCE_USAGE) -- load_type must be resource or material
405
406
407 or wjdi.substitution_type not in (1, 2, 3)); -- substitution_type must be delete or add or change
408
409
410 l_error_exists boolean := false;
411 begin
412 for l_inv_row in c_invalid_rows loop
413 l_error_exists := true;
414 fnd_message.set_name('WIP', 'WIP_INVALID_LOAD_SUB_TYPE');
415 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
416 if(wip_job_details.std_alone = 1) then
417 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
418 p_text => substr(fnd_message.get,1,500),
419 p_error_type => wip_jdi_utils.msg_error);
420 else
421 wip_interface_err_Utils.add_error(p_interface_id => wip_jsi_utils.current_interface_id,
422 p_text => substr(fnd_message.get,1,500),
423 p_error_type => wip_jdi_utils.msg_error);
424 end if;
425 end loop;
426
427 if(l_error_exists) then
428 update wip_job_dtls_interface
429 set process_status = wip_constants.error
430 where group_id = p_group_id
431 and parent_header_id = p_parent_header_id
432 and process_phase = wip_constants.ml_validation
433 and process_status in (wip_constants.running,
434 wip_constants.warning)
435 and wip_entity_id = p_wip_entity_id
436 and organization_id = p_organization_id
437 and ( load_type not in (1, 2, 3, 4, 5)
438 or substitution_type not in (1, 2, 3));
439 end if;
440 end load_sub_types;
441
442
443 procedure last_updated_by(p_group_id IN number,
444 p_parent_header_id IN number,
445 p_wip_entity_id IN number,
446 p_organization_id IN number) IS
447
448 cursor c_invalid_rows is
449 select interface_id
450 from wip_job_dtls_interface wjdi
451 where wjdi.group_id = p_group_id
452 and wjdi.parent_header_id = p_parent_header_id
453 and wjdi.process_phase = wip_constants.ml_validation
454 and wjdi.process_status in (wip_constants.running,
455 wip_constants.warning)
456 and wjdi.wip_entity_id = p_wip_entity_id
457 and wjdi.organization_id = p_organization_id
458 and not exists (select 1
459 from fnd_user_view fu
460 where fu.user_id = wjdi.last_updated_by
461 and sysdate between fu.start_date and nvl(fu.end_date,sysdate+1));
462
463 l_error_exists boolean := false;
464 begin
465
466 -- Give an error if NULL or if not a valid user
467 for l_inv_row in c_invalid_rows loop
468 l_error_exists := true;
469 fnd_message.set_name('WIP', 'WIP_ML_LAST_UPDATED_BY');
470 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
471 if(wip_job_details.std_alone = 1) then
472 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
473 p_text => substr(fnd_message.get,1,500),
474 p_error_type => wip_jdi_utils.msg_error);
475 else
476 wip_interface_err_Utils.add_error(p_interface_id => wip_jsi_utils.current_interface_id,
477 p_text => substr(fnd_message.get,1,500),
478 p_error_type => wip_jdi_utils.msg_error);
479 end if;
480 end loop;
481
482 if(l_error_exists) then
483 update wip_job_dtls_interface wjdi
484 set process_status = wip_constants.error
485 where group_id = p_group_id
486 and parent_header_id = p_parent_header_id
487 and process_phase = wip_constants.ml_validation
488 and process_status in (wip_constants.running,
489 wip_constants.warning)
490 and wip_entity_id = p_wip_entity_id
491 and organization_id = p_organization_id
492 and not exists (select 1
493 from fnd_user_view fu
494 where fu.user_id = wjdi.last_updated_by
495 and sysdate between fu.start_date and nvl(fu.end_date,sysdate+1));
496 end if;
497 end last_updated_by;
498
499 procedure created_by(p_group_id IN NUMBER,
500 p_parent_header_id IN NUMBER,
501 p_wip_entity_id IN NUMBER,
502 p_organization_id IN NUMBER) IS
503 cursor c_invalid_rows is
504 select interface_id
505 from wip_job_dtls_interface wjdi
506 where wjdi.group_id = p_group_id
507 and wjdi.parent_header_id = p_parent_header_id
508 and wjdi.process_phase = wip_constants.ml_validation
509 and wjdi.process_status in (wip_constants.running,
510 wip_constants.warning)
511 and wjdi.wip_entity_id = p_wip_entity_id
512 and wjdi.organization_id = p_organization_id
513 and not exists (select 1
514 from fnd_user_view fu
515 where fu.user_id = wjdi.created_by
516 and sysdate between fu.start_date and nvl(fu.end_date,sysdate+1));
517
518 l_error_exists boolean := false;
519 begin
520
521 -- Give an error if NULL or if not a valid user
522 for l_inv_row in c_invalid_rows loop
523 l_error_exists := true;
524 fnd_message.set_name('WIP', 'WIP_ML_CREATED_BY');
525 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
526 if(wip_job_details.std_alone = 1) then
527 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
528 p_text => substr(fnd_message.get,1,500),
529 p_error_type => wip_jdi_utils.msg_error);
530 else
531 wip_interface_err_Utils.add_error(p_interface_id => wip_jsi_utils.current_interface_id,
532 p_text => substr(fnd_message.get,1,500),
533 p_error_type => wip_jdi_utils.msg_error);
534 end if;
535 end loop;
536
537 if(l_error_exists) then
538 update wip_job_dtls_interface wjdi
539 set process_status = wip_constants.error
540 where group_id = p_group_id
541 and parent_header_id = p_parent_header_id
542 and process_phase = wip_constants.ml_validation
543 and process_status in (wip_constants.running,
544 wip_constants.warning)
545 and wip_entity_id = p_wip_entity_id
546 and organization_id = p_organization_id
547 and not exists (select 1
548 from fnd_user_view fu
549 where fu.user_id = wjdi.created_by
550 and sysdate between fu.start_date and nvl(fu.end_date,sysdate+1));
551 end if;
552 end created_by;
553
554
555 /*
556 * If any record for a job is invalid, we must error out *all*
557 * records for that job.
558 */
559 procedure error_all_if_any(p_group_id IN NUMBER,
560 p_parent_header_id IN NUMBER,
561 p_wip_entity_id IN NUMBER,
562 p_organization_id IN NUMBER) is
563 cursor c_invalid_rows is
564 select interface_id
565 from wip_job_dtls_interface wjdi
566 where wjdi.group_id = p_group_id
567 and wjdi.parent_header_id = p_parent_header_id
568 and wjdi.process_phase = wip_constants.ml_validation
569 and wjdi.process_status in (wip_constants.running,
570 wip_constants.warning)
571 and wjdi.wip_entity_id = p_wip_entity_id
572 and wjdi.organization_id = p_organization_id
573 and exists (select 1
574 from wip_job_dtls_interface wjdi2
575 where wjdi2.group_id = wjdi.group_id
576 and wjdi2.parent_header_id = wjdi.parent_header_id
577 and wjdi2.process_status = wip_constants.error
578 and wjdi2.wip_entity_id = wjdi.wip_entity_id
579 and wjdi2.organization_id = wjdi.organization_id);
580 l_error_exists boolean := false;
581 begin
582 for l_inv_row in c_invalid_rows loop
583 l_error_exists := true;
584 fnd_message.set_name('WIP', 'WIP_JDI_OTHERS_FAILED');
585 fnd_message.set_token('INTERFACE', to_char(l_inv_row.interface_id));
586 wip_interface_err_Utils.add_error(p_interface_id => l_inv_row.interface_id,
587 p_text => substr(fnd_message.get,1,500),
588 p_error_type => wip_jdi_utils.msg_error);
589 end loop;
590 if(l_error_exists) then
591 update wip_job_dtls_interface wjdi
592 set process_status = wip_constants.error
593 where group_id = p_group_id
594 and parent_header_id = p_parent_header_id
595 and process_phase = wip_constants.ml_validation
596 and process_status in (wip_constants.running,
597 wip_constants.warning)
598 and wip_entity_id = p_wip_entity_id
599 and organization_id = p_organization_id
600 and exists (select 1
601 from wip_job_dtls_interface wjdi2
602 where wjdi2.group_id = wjdi.group_id
603 and wjdi2.parent_header_id = wjdi.parent_header_id
604 and wjdi2.process_status = wip_constants.error
605 and wjdi2.wip_entity_id = wjdi.wip_entity_id
606 and wjdi2.organization_id = wjdi.organization_id);
607 end if;
608 end error_all_if_any;
609 end wip_job_dtls_validations;