[Home] [Help]
PACKAGE BODY: APPS.WSMPVLDT
Source
1 PACKAGE BODY WSMPVLDT AS
2 /* $Header: WSMVLDTB.pls 115.139 2004/09/20 12:00:22 sthangad ship $ */
3
4 /*==========================================================================+
5 | Copyright (c) 1993 Oracle Corporation Belmont, California, USA |
6 | All rights reserved. |
7 +===========================================================================+
8 | |
9 | File Name : wsmvldtb.pls
10 | Description : Contains following procedures
11 | VALIDATE_RECORDS
12 | CHECK_MERGE_OP
13 | CHECK_NUMBER_OF_LOTS
14 | CHECK_TOTAL_QTY
15 | MATCH_START_RESULT_LOT
16 | POPULATE_COLUMNS
17 |
18 | Revision
19 | 04/10/00 Vaishali Jambhekar Initial Creation
20 |
21 +==========================================================================*/
22
23 /*BA WLTEnh */
24
25
26 l_wsmti_error_flag NUMBER default 0;
27 l_wsji_error_flag NUMBER default 0;
28 l_wrji_error_flag NUMBER default 0;
29
30 PROCEDURE set_wsmti_error IS
31 Begin
32 If l_wsmti_error_flag <> 1 Then
33 l_wsmti_error_flag := 1; -- ERROR
34 End If;
35 End set_wsmti_error;
36
37 PROCEDURE set_wsmti_warning IS
38 Begin
39 If l_wsmti_error_flag NOT IN (1, 2) Then
40 l_wsmti_error_flag := 2; -- WARNING
41 End If;
42 End set_wsmti_warning;
43
44 PROCEDURE set_wsji_error IS
45 Begin
46 If l_wsji_error_flag <> 1 Then
47 l_wsji_error_flag := 1; -- ERROR
48 End If;
49 End set_wsji_error;
50
51 PROCEDURE set_wsji_warning IS
52 Begin
53 If l_wsji_error_flag NOT IN (1, 2) Then
54 l_wsji_error_flag := 2; -- WARNING
55 End If;
56 End set_wsji_warning;
57
58 PROCEDURE set_wrji_error IS
59 Begin
60 If l_wrji_error_flag <> 1 Then
61 l_wrji_error_flag := 1; -- ERROR
62 End If;
63 End set_wrji_error;
64
65 PROCEDURE set_wrji_warning IS
66 Begin
67 If l_wrji_error_flag NOT IN (1, 2) Then
68 l_wrji_error_flag := 2; -- WARNING
69 End If;
70 End set_wrji_warning;
71
72 /*-------------------------------------------------------------+
73 | POPULATE_COLUMNS :
74 | populates - class_code,
75 | net_quantity,
76 | coproducts_supply,
77 | starting_intraoperation_step,
78 | forward_op_option,
79 | completion_subinventory,
80 | completion_locator_id
81 ---------------------------------------------------------------*/
82 ----------------------------------------------------------------
83
84 PROCEDURE POPULATE_COLUMNS(p_header_id IN OUT NOCOPY NUMBER,
85 p_wrji_rowid IN ROWID --SpUA
86 , p_err_msg IN OUT NOCOPY VARCHAR2,
87 p_err_num IN OUT NOCOPY NUMBER) IS
88
89 -- CURSOR C_NO_CLASS_CODE_RJ(p_header_id NUMBER) is
90 -- SELECT rj.header_id header_id,
91 -- txn.organization_id org_id,
92 -- rj.primary_item_id item_id,
93 -- rj.completion_subinventory subinv_name,
94 -- rj.rowid rj_rowid --SpUA Add
95 -- FROM wsm_resulting_jobs_interface rj,
96 -- wsm_split_merge_txn_interface txn
97 -- WHERE rj.header_id = p_header_id -- WLTEnh Add
98 -- AND txn.header_id = rj.header_id
99 -- AND (txn.transaction_type_id in
100 -- (WSMPCNST.BONUS))
101 -- (WSMPCNST.UPDATE_ASSEMBLY,
102 -- WSMPCNST.BONUS,
103 -- WSMPCNST.UPDATE_ROUTING)
104 -- --SpUA begin
105 -- OR (txn.transaction_type_id in (WSMPCNST.SPLIT) AND rj.split_has_update_assy = 1))
106 -- --SpUA end
107 -- AND rj.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
108 -- AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
109 -- AND rj.process_status = WIP_CONSTANTS.RUNNING
110 -- ORDER BY TXN.TRANSACTION_DATE;
111
112 -- Changed the cursor to fix bug #3150692--
113 CURSOR C_NO_CLASS_CODE_RJ(p_header_id NUMBER) is
114 SELECT rj.header_id header_id,
115 txn.organization_id org_id,
116 txn.transaction_type_id txn_type_id, /* ST bug fix : 3150692 Added */
117 rj.class_code class_code, /* ST bug fix 3150692 review comments : Added */
118 rj.primary_item_id item_id,
119 rj.completion_subinventory subinv_name,
120 rj.rowid rj_rowid --SpUA Add
121 FROM wsm_resulting_jobs_interface rj,
122 wsm_split_merge_txn_interface txn
123 WHERE rj.header_id = p_header_id
124 AND txn.header_id = rj.header_id
125 AND rj.job_type = WIP_CONSTANTS.STANDARD
126 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
127 AND rj.process_status = WIP_CONSTANTS.RUNNING
128 ORDER BY TXN.TRANSACTION_DATE;
129
130 CURSOR C_VLDT_CLASS_CODE_RJ(p_header_id NUMBER) is
131 SELECT rj.class_code class_code,
132 rj.job_type job_type,
133 txn.organization_id org_id,
134 rj.header_id header_id
135 FROM wsm_resulting_jobs_interface rj,
136 wsm_split_merge_txn_interface txn
137 WHERE txn.header_id = rj.header_id
138 AND rj.header_id = p_header_id -- WLTEnh Add
139 AND txn.transaction_type_id = WSMPCNST.BONUS
140 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
141 AND rj.process_status = WIP_CONSTANTS.RUNNING
142 ORDER BY TXN.TRANSACTION_DATE;
143
144 CURSOR C_NONSTD_NO_CLASS_CODE_RJ(p_header_id NUMBER) is
145 SELECT rj.header_id header_id,
146 txn.organization_id org_id,
147 rj.primary_item_id item_id,
148 rj.completion_subinventory subinv_name,
149 txn.transaction_type_id txn_type_id
150 FROM wsm_resulting_jobs_interface rj,
151 wsm_split_merge_txn_interface txn
152 -- WHERE rj.class_code is null -- Commented to fix bug #3150692--
153 -- AND rj.header_id = p_header_id -- Commented to fix bug #3150692--
154 WHERE rj.header_id = p_header_id
155 AND txn.header_id = rj.header_id
156 AND rj.job_type = WIP_CONSTANTS.NONSTANDARD
157 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
158 AND rj.process_status = WIP_CONSTANTS.RUNNING
159 ORDER BY TXN.TRANSACTION_DATE;
160
161 CURSOR C_NET_QUANTITY(p_header_id NUMBER) is
162 SELECT distinct (rj.header_id) header_id, txn.organization_id org_id,
163 txn.transaction_type_id transaction_type_id,
164 rj.start_quantity start_quantity,
165 rj.net_quantity net_quantity,
166 rj.wip_entity_name,
167 /* ST : fix bug 3766859 : added job type */
168 rj.job_type
169 FROM wsm_resulting_jobs_interface rj,
170 wsm_split_merge_txn_interface txn
171 WHERE rj.net_quantity is NULL
172 AND rj.header_id = p_header_id
173 AND txn.header_id = rj.header_id
174 AND txn.transaction_type_id in
175 (WSMPCNST.SPLIT,
176 WSMPCNST.MERGE,
177 WSMPCNST.BONUS,
178 WSMPCNST.UPDATE_QUANTITY)
179 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
180 AND rj.process_status = WIP_CONSTANTS.RUNNING;
181
182
183 CURSOR C_COPRODUCTS_SUPPLY(p_header_id NUMBER) is
184 SELECT distinct (rj.header_id) header_id,
185 txn.organization_id org_id
186 FROM wsm_resulting_jobs_interface rj,
187 wsm_split_merge_txn_interface txn
188 WHERE ( rj.coproducts_supply is NULL OR
189 rj.coproducts_supply NOT IN (1,2))
190 AND txn.header_id = rj.header_id
191 AND rj.header_id = p_header_id
192 AND txn.transaction_type_id in
193 (WSMPCNST.SPLIT,
194 WSMPCNST.MERGE,
195 WSMPCNST.BONUS)
196 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
197 AND rj.process_status = WIP_CONSTANTS.RUNNING;
198
199 /*BA#1732786*/
200 CURSOR C_NET_QUANTITY_MERGE(hdr_id wsm_starting_jobs_interface.header_id%TYPE) is
201 select (wdj.net_quantity - wdj.quantity_scrapped)
202 potential_supply,
203 wdj.quantity_scrapped, --FP bugfix 3403087
204 we.wip_entity_name
205 from wsm_starting_jobs_interface wsji,
206 wip_discrete_jobs wdj, wip_entities we
207 WHERE wsji.header_id = hdr_id
208 AND wsji.wip_entity_id = wdj.wip_entity_id
209 AND we.wip_entity_id = wsji.wip_entity_id;
210
211 /*EA#1732786*/
212
213 l_stmt_num NUMBER;
214 l_qty_ratio NUMBER;
215 l_class_code VARCHAR2(30);
216 parent_start_quantity NUMBER := 0;
217 parent_scrap_quantity NUMBER := 0;
218 parent_net_quantity NUMBER := 0;
219 total_potential_supply NUMBER := 0;
220 sj_wip_entity_name VARCHAR2(240);
221 sj_start_quantity NUMBER :=0;
222 sj_scrap_quantity NUMBER :=0;
223 sj_net_quantity NUMBER :=0;
224 rj_scrap_quantity NUMBER :=0;
225 match_wip_entity boolean := FALSE;
226 rj_net_quantity NUMBER :=0; /* ST : added for fix 3766859 */
227
228 rec c_net_quantity_merge%rowtype;
229 l_fnd_err_msg VARCHAR2(2000);
230 l_fnd_generic_err_msg VARCHAR2(2000);
231
232 l_comp_sub_inv VARCHAR2(10);
233 l_comp_sub_inv_r VARCHAR2(10);
234 l_comp_loc_id NUMBER;
235 l_comp_loc_id_r NUMBER;
236 l_count NUMBER;
237
238 l_err_occurred NUMBER := 0; --VJ: Added for NSLBJ--
239 l_txn_type_id NUMBER := 0; --VJ: Added for NSLBJ--
240
241 e_proc_error exception;
242 failed_get_class_code exception;
243
244 -- abb H begin
245 p_est_scrap_acc NUMBER;
246 p_est_scrap_account NUMBER;
247 p_est_scrap_var_account NUMBER;
248 -- abb H end
249
250 l_temp_csi VARCHAR2(10);
251 l_temp_loc_id NUMBER;
252 l_quantity_scrapped NUMBER; --FP bugfix 3403087
253
254 l_wrji_rowid ROWID; --SpUA
255
256 BEGIN
257 /*-----------------------------------------------------------------+
258 | For Standard Lot Based Jobs : |
259 | Default class_code in wsm_resulting_jobs_interface table. If |
260 | transaction type is bonus, then default the class_code as defined|
261 | in wip_parameters, otherwise, copying over the class_code from |
262 | parent lots. |
263 +-----------------------------------------------------------------*/
264
265 p_err_num := 0;
266 FND_MESSAGE.SET_NAME('WSM', 'WSM_ERRORS_IN_WIE');
267 l_fnd_generic_err_msg := FND_MESSAGE.GET;
268
269 l_wrji_rowid := p_wrji_rowid; --SpUA
270
271
272 FOR c_no_class_code_rj_rec in c_no_class_code_rj(p_header_id) LOOP
273
274 l_stmt_num := 1;
275 l_class_code := WSMPUTIL.GET_DEF_ACCT_CLASS_CODE(
276 c_no_class_code_rj_rec.org_id,
277 c_no_class_code_rj_rec.item_id,
278 c_no_class_code_rj_rec.subinv_name,
279 p_err_num,
280 p_err_msg
281 );
282 IF (p_err_num <> 0) THEN
283 raise failed_get_class_code;
284 END IF;
285
286 IF (l_debug = 'Y') THEN
287 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
288 '): l_class_code from GET_DEF_ACCT_CLASS_CODE='||l_class_code);
289 END IF;
290
291 IF (l_class_code IS NOT NULL ) THEN
292 l_stmt_num := 2;
293 -- UPDATE wsm_resulting_jobs_interface rj
294 -- SET class_code = l_class_code
295 -- WHERE rj.class_code is null
296 -- AND rj.header_id = c_no_class_code_rj_rec.header_id
297 -- AND EXISTS ( SELECT null
298 -- FROM wsm_split_merge_txn_interface txn
299 -- WHERE txn.header_id = rj.header_id
300 -- AND (txn.transaction_type_id in
301 -- (WSMPCNST.BONUS)))
302 -- (WSMPCNST.UPDATE_ASSEMBLY,
303 -- WSMPCNST.BONUS,
304 -- WSMPCNST.UPDATE_ROUTING)
305 -- --SpUA begin
306 -- OR (txn.transaction_type_id in (WSMPCNST.SPLIT) AND
307 -- rj.split_has_update_assy = 1)))
308 -- --SpUA end
309 -- AND rj.rowid = c_no_class_code_rj_rec.rj_rowid --SpUA Add
310 -- AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
311 -- AND rj.process_status = WIP_CONSTANTS.RUNNING;
312
313 -- Changed to fix bug #3150692 --
314 l_stmt_num := 3;
315 /* ST bug fix 3150692 review comments : Move the class code check to the IF condition */
316 IF c_no_class_code_rj_rec.txn_type_id = WSMPCNST.BONUS and c_no_class_code_rj_rec.class_code IS NULL THEN /* ST bug fix 3150692 Added check for the txn type */
317
318 UPDATE wsm_resulting_jobs_interface rj
319 SET class_code = l_class_code
320 WHERE rj.header_id = c_no_class_code_rj_rec.header_id
321 -- AND rj.class_code IS NULL /* ST bug fix 3150692 Added check for class_code to prevent overwrite of user entered value for Std Bonus txn*/
322 /* ST bug fix 3150692 review comments : Commented the class code check */
323 AND rj.rowid = c_no_class_code_rj_rec.rj_rowid --SpUA Add
324 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
325 AND rj.process_status = WIP_CONSTANTS.RUNNING;
326
327
328 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
329 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
330 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'class_code in Resulting Jobs');
331 l_fnd_err_msg := FND_MESSAGE.GET;
332 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
333
334 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
335 p_header_id => c_no_class_code_rj_rec.header_id,
336 p_message => substr(l_fnd_err_msg,1,2000),
337 p_request_id => fnd_global.conc_request_id,
338 p_program_id => fnd_global.conc_program_id,
339 p_program_application_id => fnd_global.prog_appl_id,
340 p_message_type => 2, --WARNING
341 x_err_code => p_err_num,
342 x_err_msg => p_err_msg);
343 IF(p_err_num <> 0) THEN
344 raise e_proc_error;
345 END IF;
346 END IF;
347 END IF; /* ST bug fix 3150692 end */
348
349 ELSE -- l_class_code IS NULL
350 l_stmt_num := 4; --this l_stmt_num was 15 before
351 l_err_occurred := 1; --VJ: Added for NSLBJ--
352
353 /* ST bug fix 3150692 review comments : Added this check */
354 IF c_no_class_code_rj_rec.txn_type_id = WSMPCNST.BONUS THEN
355 UPDATE wsm_resulting_jobs_interface wrji
356 SET wrji.error_message = l_fnd_generic_err_msg
357 WHERE wrji.class_code is null
358 AND wrji.header_id = c_no_class_code_rj_rec.header_id
359
360 /* ST bug fix 3150692 review comments : Start : We check for the txn type outside.. hence Commenting out the below check
361 AND EXISTS ( SELECT null
362 FROM wsm_split_merge_txn_interface txn
363 WHERE txn.header_id = wrji.header_id
364 AND (txn.transaction_type_id in
365 -- Start : Fix for bug #3150692 --
366 (WSMPCNST.BONUS)))
367 -- (WSMPCNST.UPDATE_ASSEMBLY,
368 -- WSMPCNST.BONUS,
369 -- WSMPCNST.UPDATE_ROUTING)
370 -- --SpUA begin
371 -- OR (txn.transaction_type_id in (WSMPCNST.SPLIT) AND
372 -- wrji.split_has_update_assy = 1)))
373 -- --SpUA end
374 -- End : Fix for bug #3150692 --
375
376 ST bug fix 3150692 review comments end */
377 AND wrji.rowid = c_no_class_code_rj_rec.rj_rowid --SpUA add
378 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
379 AND wrji.process_status = WIP_CONSTANTS.RUNNING;
380
381 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
382 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'class_code');
383 l_fnd_err_msg := FND_MESSAGE.GET;
384 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
385
386 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => c_no_class_code_rj_rec.header_id,
387 p_message => substr(l_fnd_err_msg,1,2000),
388 p_request_id => fnd_global.conc_request_id,
389 p_program_id => fnd_global.conc_program_id,
390 p_program_application_id => fnd_global.prog_appl_id,
391 p_message_type => 1, --ERROR
392 x_err_code => p_err_num,
393 x_err_msg => p_err_msg);
394 IF(p_err_num <> 0) THEN
395 raise e_proc_error;
396 END IF;
397 END IF; /* ST bug fix 3150692 review comments : c_no_class_code_rj_rec.txn_type = WSMPCNST.BONUS end */
398 END IF;
399 END LOOP;
400 --abb H Optional Scrap addition begin
401 --validation of existance of WAC scrap accounts
402
403 FOR c_vldt_class_code_rj_rec in c_vldt_class_code_rj(p_header_id) LOOP
404 l_stmt_num := 5;
405
406 if wsmputil.WSM_ESA_ENABLED(p_wip_entity_id => null,
407 err_code => p_err_num,
408 err_msg => p_err_msg,
409 p_org_id => c_vldt_class_code_rj_rec.org_id,
410 p_job_type => c_vldt_class_code_rj_rec.job_type
411 ) = 1 then
412
413 l_stmt_num := 6;
414 select est_scrap_account,
415 est_scrap_var_account
416 into p_est_scrap_account,
417 p_est_scrap_var_account
418 from wip_accounting_classes
419 where class_code = c_vldt_class_code_rj_rec.class_code
420 and organization_id = c_vldt_class_code_rj_rec.org_id;
421
422 l_stmt_num := 7;
423 if p_est_scrap_account is null or p_est_scrap_var_account is null then
424 l_err_occurred := 1; --VJ: Added for NSLBJ--
425 l_stmt_num := 8;
426
427 UPDATE wsm_resulting_jobs_interface wrji
428 SET wrji.error_message = l_fnd_generic_err_msg
429 WHERE wrji.header_id = c_vldt_class_code_rj_rec.header_id;
430
431 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_WAC_SCRAP_ACC');
432 FND_MESSAGE.SET_TOKEN('CC', c_vldt_class_code_rj_rec.class_code);
433 l_fnd_err_msg := FND_MESSAGE.GET;
434 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
435 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => c_vldt_class_code_rj_rec.header_id,
436 p_message => substr(l_fnd_err_msg,1,2000),
437 p_request_id => fnd_global.conc_request_id,
438 p_program_id => fnd_global.conc_program_id,
439 p_program_application_id => fnd_global.prog_appl_id,
440 p_message_type => 1, --ERROR
441 x_err_code => p_err_num,
442 x_err_msg => p_err_msg);
443 IF(p_err_num <> 0) THEN
444 raise e_proc_error;
445 END IF;
446 end if;
447 end if;
448 END LOOP;
449
450 --abb H Optional Scrap addition end
451
452 -- for txn not in bonus
453 l_stmt_num := 9;
454 update wsm_resulting_jobs_interface rj
455 set class_code = (select dis.class_code
456 from wip_discrete_jobs dis,
457 wsm_starting_jobs_interface sj
458 where sj.header_id = rj.header_id
459 and sj.wip_entity_id = dis.wip_entity_id
460 and sj.representative_flag = 'Y')
461 /* where rj.class_code is null -- ST bug fix 3150692 Overwrite the class code in the resulting jobs with the parent jobs's value
462 and rj.process_status = WIP_CONSTANTS.RUNNING */ /* ST bug fix 3150692 : Commented the where condition */
463 where rj.process_status = WIP_CONSTANTS.RUNNING
464 and rj.internal_group_id = WSMPLOAD.G_GROUP_ID
465 and rj.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
466 and exists (
467 SELECT null
468 FROM wsm_split_merge_txn_interface txn2
469 WHERE txn2.header_id = rj.header_id
470 AND (txn2.transaction_type_id not in
471 -- Start : Fix for bug #3150692 --
472 (WSMPCNST.BONUS)));
473 -- (WSMPCNST.UPDATE_ASSEMBLY,
474 -- WSMPCNST.BONUS,
475 -- WSMPCNST.UPDATE_ROUTING)
476 -- --SpUA begin
477 -- OR (txn2.transaction_type_id in (WSMPCNST.SPLIT)
478 -- AND rj.split_has_update_assy = 0)));
479 -- --SpUA end
480 -- End : Fix for bug #3150692 --
481
482 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
483 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
484 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'class_code in Resulting Jobs');
485 l_fnd_err_msg := FND_MESSAGE.GET;
486 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
487 END IF;
488
489 /*-------------------------------------------------------------------+
490 | For Non-Standard Lot Based Jobs : |
491 | If class_code in wsm_resulting_jobs_interface table is NULL, error.|
492 +-------------------------------------------------------------------*/
493
494 --VJ: Start Additions for NSLBJ--
495 FOR C_NONSTD_NO_CLASS_CODE_RJ_rec in C_NONSTD_NO_CLASS_CODE_RJ(p_header_id) LOOP
496 l_stmt_num := 10;
497
498 IF (C_NONSTD_NO_CLASS_CODE_RJ_rec.txn_type_id = WSMPCNST.BONUS) THEN --VJ: CodeRVW: Added for NSLBJ--
499
500 l_stmt_num := 11;
501
502 /* ST : commeting this for bug 3722383 */
503 /* l_err_occurred := 1; --VJ: 0313: Changed position for NSLBJ-- */
504 UPDATE wsm_resulting_jobs_interface wrji
505 SET wrji.error_message = l_fnd_generic_err_msg
506 WHERE wrji.class_code is null
507 AND wrji.header_id = C_NONSTD_NO_CLASS_CODE_RJ_rec.header_id
508 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
509 AND wrji.process_status = WIP_CONSTANTS.RUNNING;
510
511 IF (SQL%ROWCOUNT > 0) THEN
512 /* Added if stmt to fix bug #3722383 */
513
514 /* ST : moved this inside the IF condition */
515 l_err_occurred := 1; --VJ: 0313: Changed position for NSLBJ--
516
517 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
518 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'class_code');
519 l_fnd_err_msg := FND_MESSAGE.GET;
520 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
521
522 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => C_NONSTD_NO_CLASS_CODE_RJ_rec.header_id,
523 p_message => substr(l_fnd_err_msg,1,2000),
524 p_request_id => fnd_global.conc_request_id,
525 p_program_id => fnd_global.conc_program_id,
526 p_program_application_id => fnd_global.prog_appl_id,
527 p_message_type => 1, --ERROR
528 x_err_code => p_err_num,
529 x_err_msg => p_err_msg);
530 IF(p_err_num <> 0) THEN
531 raise e_proc_error;
532 END IF;
533 END IF;
534 /* VJ: CodeRVW: Start Additions for NSLBJ */
535 ELSE -- if transaction <> BONUS
536 --Representative Flag would be set for one starting job in Merge,
537 --as well as for the starting job in other transactions (except Bonus)
538 l_stmt_num := 12;
539 UPDATE wsm_resulting_jobs_interface wrji
540 SET wrji.class_code = (SELECT wdj.class_code
541 FROM wip_discrete_jobs wdj,
542 wsm_starting_jobs_interface wsji
543 WHERE wsji.wip_entity_id = wdj.wip_entity_id
544 AND wsji.representative_flag = 'Y'
545 AND wsji.header_id = wrji.header_id)
546 -- WHERE wrji.class_code is null -- Commented to fix bug #3150692
547 WHERE wrji.header_id = C_NONSTD_NO_CLASS_CODE_RJ_rec.header_id
548 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
549 AND wrji.process_status = WIP_CONSTANTS.RUNNING;
550
551 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
552 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'class_code in Resulting Jobs');
553 l_fnd_err_msg := FND_MESSAGE.GET;
554
555 If l_debug = 'Y' Then
556
557 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
558
559 End If;
560
561 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => C_NONSTD_NO_CLASS_CODE_RJ_rec.header_id,
562 p_message => substr(l_fnd_err_msg,1,2000),
563 p_request_id => fnd_global.conc_request_id,
564 p_program_id => fnd_global.conc_program_id,
565 p_program_application_id => fnd_global.prog_appl_id,
566 p_message_type => 2, --Warning
567 x_err_code => p_err_num,
568 x_err_msg => p_err_msg);
569
570 END IF;
571 --VJ: CodeRVW: End Additions for NSLBJ--
572
573 END LOOP;
574 --VJ: End Additions for NSLBJ--
575
576
577 /*-----------------------------------------------------------------+
578 | Populate net_quantity in resulting jobs
579 | interface tables where it is null
580 | FP bugfix 3403087 modify populate net_qty, make sure net_qty is
581 | getting populated for all txn types if net_qty is null.
582 +-----------------------------------------------------------------*/
583
584 FOR c_net_quantity_rec IN c_net_quantity(p_header_id) LOOP
585
586 IF (c_net_quantity_rec.transaction_type_id = WSMPCNST.SPLIT) THEN
587 l_stmt_num := 13;
588 select we.wip_entity_name,
589 wdj.start_quantity,
590 wdj.net_quantity,
591 wdj.quantity_scrapped
592 into sj_wip_entity_name,
593 sj_start_quantity,
594 sj_net_quantity,
595 sj_scrap_quantity
596 from wsm_starting_jobs_interface wsji,
597 wip_discrete_jobs wdj, wip_entities we
598 WHERE wsji.header_id = c_net_quantity_rec.header_id
599 AND wsji.wip_entity_id = wdj.wip_entity_id
600 AND wsji.wip_entity_id = we.wip_entity_id;
601
602 /* ST bug fix 3766859 : commenting out the code to default the net qty */
603 /******************************************************************************
604 IF (sj_net_quantity < sj_scrap_quantity) THEN
605
606 IF (c_net_quantity_rec.wip_entity_name <> sj_wip_entity_name) THEN
607 l_stmt_num := 14;
608 UPDATE wsm_resulting_jobs_interface wrji
609 SET wrji.net_quantity = 0
610 WHERE wrji.net_quantity is NULL
611 AND wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
612 AND wrji.header_id = c_net_quantity_rec.header_id;
613 ELSE
614 --Start FP bugfix 3403087
615 update wsm_resulting_jobs_interface wrji
616 set wrji.net_quantity = (select wdj.net_quantity
617 from wip_discrete_jobs wdj,
618 wip_entities we
619 where wdj.wip_entity_id = we.wip_entity_id
620 and wdj.organization_id = we.organization_id
621 and we.wip_entity_name = c_net_quantity_rec.wip_entity_name)
622 where wrji.net_quantity is null
623 and wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
624 and wrji.header_id = c_net_quantity_rec.header_id;
625 --End FP bugfix 3403087
626 END IF;
627 ELSE
628 -- bugfix 2168797: While updating the net_quantity, round it to the 6 decimal place.
629 IF (c_net_quantity_rec.wip_entity_name <> sj_wip_entity_name) THEN
630 l_stmt_num := 15;
631 UPDATE wsm_resulting_jobs_interface wrji
632 SET wrji.net_quantity =
633 round(c_net_quantity_rec.start_quantity *
634 (sj_net_quantity-sj_scrap_quantity) *
635 (1/(sj_start_quantity-sj_scrap_quantity)), 6 )
636 WHERE wrji.net_quantity is NULL
637 AND wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
638 AND wrji.header_id = c_net_quantity_rec.header_id;
639 ELSE
640 --Start FP bugfix 3403087
641 update wsm_resulting_jobs_interface wrji
642 set wrji.net_quantity = (select wdj.net_quantity
643 from wip_discrete_jobs wdj,
644 wip_entities we
645 where wdj.wip_entity_id = we.wip_entity_id
646 and wdj.organization_id = we.organization_id
647 and we.wip_entity_name = c_net_quantity_rec.wip_entity_name)
648 where wrji.net_quantity is null
649 and wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
650 and wrji.header_id = c_net_quantity_rec.header_id;
651 --End FP bugfix 3403087
652 END IF;
653 END IF;
654 ******************************************************************************************/
655
656 /* ST : start fix 3766859*/
657 rj_net_quantity := round(((c_net_quantity_rec.start_quantity/(sj_start_quantity-sj_scrap_quantity))*sj_net_quantity),6);
658
659 if rj_net_quantity > c_net_quantity_rec.start_quantity then
660 rj_net_quantity := c_net_quantity_rec.start_quantity;
661 end if;
662
663 UPDATE wsm_resulting_jobs_interface wrji
664 SET wrji.net_quantity = rj_net_quantity
665 WHERE wrji.net_quantity is NULL
666 AND wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
667 AND wrji.header_id = c_net_quantity_rec.header_id;
668
669 /* ST : end fix 3766859*/
670
671 IF (SQL%ROWCOUNT > 0) THEN
672 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
673 FND_MESSAGE.SET_TOKEN('FLD_NAME','net_quantity in Resulting Jobs');
674 l_fnd_err_msg := FND_MESSAGE.GET;
675
676 If l_debug = 'Y' Then
677 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
678 '): '||l_fnd_err_msg);
679 End If;
680
681 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
682 p_header_id => c_net_quantity_rec.header_id,
683 p_message => substr(l_fnd_err_msg,1,2000),
684 p_request_id => fnd_global.conc_request_id,
685 p_program_id => fnd_global.conc_program_id,
686 p_program_application_id => fnd_global.prog_appl_id,
687 p_message_type => 2, --WARNING
688 x_err_code => p_err_num,
689 x_err_msg => p_err_msg);
690 IF(p_err_num <> 0) THEN
691 raise e_proc_error;
692 END IF;
693 END IF;
694
695 END IF;
696
697 IF (c_net_quantity_rec.transaction_type_id = WSMPCNST.UPDATE_QUANTITY) THEN
698 l_stmt_num := 16;
699
700 UPDATE wsm_resulting_jobs_interface wrji
701 SET wrji.net_quantity =
702 -- Start : Changes for bug#3181486 - Net Planned Qty --
703 -- (select (wrji.start_quantity-wdj.start_quantity+wdj.net_quantity)
704 (select (wrji.start_quantity*(wdj.net_quantity-wdj.quantity_scrapped)
705 *(1/(wdj.start_quantity-wdj.quantity_scrapped))+wdj.quantity_scrapped)
706 -- End : Changes for bug#3181486 - Net Planned Qty --
707 from wip_discrete_jobs wdj, wip_entities we
708 where wdj.wip_entity_id=we.wip_entity_id
709 and we.wip_entity_name=wrji.wip_entity_name)
710 WHERE wrji.net_quantity is NULL
711 AND wrji.header_id = c_net_quantity_rec.header_id;
712
713 select net_quantity
714 into l_stmt_num
715 from wsm_resulting_jobs_interface wrji
716 where wrji.wip_entity_name = c_net_quantity_rec.wip_entity_name
717 and wrji.header_id = c_net_quantity_rec.header_id;
718
719 IF (SQL%ROWCOUNT > 0) THEN
720 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
721 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'net_quantity '|| l_stmt_num || ' in Resulting Jobs');
722 l_fnd_err_msg := FND_MESSAGE.GET;
723
724
725 If l_debug = 'Y' Then
726 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
727 '): '||l_fnd_err_msg);
728 End If;
729
730 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
731 p_header_id => c_net_quantity_rec.header_id,
732 p_message => substr(l_fnd_err_msg,1,2000),
733 p_request_id => fnd_global.conc_request_id,
734 p_program_id => fnd_global.conc_program_id,
735 p_program_application_id => fnd_global.prog_appl_id,
736 p_message_type => 2, --WARNING
737 x_err_code => p_err_num,
738 x_err_msg => p_err_msg);
739 IF(p_err_num <> 0) THEN
740 raise e_proc_error;
741 END IF;
742 END IF;
743 END IF;
744
745 l_stmt_num := 16;
746
747 IF ( c_net_quantity_rec.transaction_type_id = WSMPCNST.MERGE) THEN
748 FOR rec in c_net_quantity_merge(c_net_quantity_rec.header_id) LOOP
749 IF (rec.potential_supply < 0) THEN
750 rec.potential_supply := 0;
751 END IF;
752 total_potential_supply := total_potential_supply + rec.potential_supply;
753
754 IF (c_net_quantity_rec.wip_entity_name = rec.wip_entity_name) THEN
755 match_wip_entity := TRUE;
756 l_quantity_scrapped := rec.quantity_scrapped; --FP bugfix 3403087
757 END IF;
758 END LOOP;
759
760 if l_debug = 'Y' then
761 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
762 ', l_quantity_scrapped: '||l_quantity_scrapped||
763 ', total_potential_supply: '||total_potential_supply);
764 end if;
765
766 IF (match_wip_entity = FALSE) THEN
767 l_stmt_num := 17;
768 UPDATE wsm_resulting_jobs_interface wrji
769 SET wrji.net_quantity = total_potential_supply
770 WHERE wrji.net_quantity is NULL
771 AND wrji.header_id = c_net_quantity_rec.header_id;
772 ELSE --Start FP bugfix 3403087
773 UPDATE wsm_resulting_jobs_interface wrji
774 SET wrji.net_quantity = total_potential_supply + l_quantity_scrapped
775 WHERE wrji.net_quantity is NULL
776 AND wrji.header_id = c_net_quantity_rec.header_id;
777 --End FP bugfix 3403087
778 END IF;
779
780 IF (SQL%ROWCOUNT > 0) THEN
781 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
782 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'net_quantity in Resulting Jobs');
783 l_fnd_err_msg := FND_MESSAGE.GET;
784 If l_debug = 'Y' Then
785 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
786 '): '||l_fnd_err_msg);
787 End If;
788
789 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
790 p_header_id => c_net_quantity_rec.header_id,
791 p_message => substr(l_fnd_err_msg,1,2000),
792 p_request_id => fnd_global.conc_request_id,
793 p_program_id => fnd_global.conc_program_id,
794 p_program_application_id => fnd_global.prog_appl_id,
795 p_message_type => 2, --WARNING
796 x_err_code => p_err_num,
797 x_err_msg => p_err_msg);
798 IF(p_err_num <> 0) THEN
799 raise e_proc_error;
800 END IF;
801 END IF;
802
803 --FP bugfix 3403087 END IF;
804 END IF;
805
806 IF ( c_net_quantity_rec.transaction_type_id = WSMPCNST.BONUS) THEN
807 l_stmt_num := 18;
808 UPDATE wsm_resulting_jobs_interface wrji
809 /* ST : fix for bug 3766859 : added decode : in case of non-std bonus default to 0 */
810 SET wrji.net_quantity = decode ( c_net_quantity_rec.job_type, WIP_CONSTANTS.STANDARD,wrji.start_quantity
811 ,0)
812 WHERE wrji.header_id = c_net_quantity_rec.header_id
813 AND wrji.net_quantity is NULL ;
814
815 IF (SQL%ROWCOUNT > 0) THEN
816 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
817 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'net_quantity in Resulting Jobs');
818 l_fnd_err_msg := FND_MESSAGE.GET;
819
820 If l_debug = 'Y' Then
821
822 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
823 '): '||l_fnd_err_msg);
824 End If;
825
826 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
827 p_header_id => c_net_quantity_rec.header_id,
828 p_message => substr(l_fnd_err_msg,1,2000),
829 p_request_id => fnd_global.conc_request_id,
830 p_program_id => fnd_global.conc_program_id,
831 p_program_application_id => fnd_global.prog_appl_id,
832 p_message_type => 2, --WARNING
833 x_err_code => p_err_num,
834 x_err_msg => p_err_msg);
835 IF(p_err_num <> 0) THEN
836 raise e_proc_error;
837 END IF;
838 END IF;
839
840 END IF;
841
842 END LOOP;
843
844
845 /*-----------------------------------------------------------------+
846 | Default coproducts_supply from wsm_parameters if |
847 | it is null in wsm_resulting_jobs_interface |
848 +-----------------------------------------------------------------*/
849
850
851 FOR c_coproducts_supply_rec IN c_coproducts_supply(p_header_id) LOOP
852
853
854 l_stmt_num := 19;
855 UPDATE wsm_resulting_jobs_interface wrji
856 SET wrji.coproducts_supply =
857 (SELECT decode(coproducts_supply_default, NULL, 2
858 , coproducts_supply_default)
859 FROM wsm_parameters
860 WHERE organization_id = c_coproducts_supply_rec.org_id )
861 WHERE wrji.header_id = c_coproducts_supply_rec.header_id
862 AND ( wrji.coproducts_supply is NULL OR
863 wrji.coproducts_supply NOT IN (1,2));
864
865 IF (SQL%ROWCOUNT > 0) THEN
866 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
867 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'coproducts_supply in Resulting Jobs');
868 l_fnd_err_msg := FND_MESSAGE.GET;
869
870 If l_debug = 'Y' Then
871 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
872 End If;
873
874 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
875 p_header_id => c_coproducts_supply_rec.header_id,
876 p_message => substr(l_fnd_err_msg,1,2000),
877 p_request_id => fnd_global.conc_request_id,
878 p_program_id => fnd_global.conc_program_id,
879 p_program_application_id => fnd_global.prog_appl_id,
880 p_message_type => 2, --WARNING
881 x_err_code => p_err_num,
882 x_err_msg => p_err_msg);
883 IF(p_err_num <> 0) THEN
884 raise e_proc_error;
885 END IF;
886 END IF;
887
888 END LOOP;
889
890
891 /*----------------------------------------------------------------------------+
892 | Default starting_intraoperation_step in wsm_resulting_jobs_interface table. |
893 | from intraoperation_stepin wsm_starting_jobs_interface table |
894 +----------------------------------------------------------------------------*/
895
896 l_stmt_num := 20;
897 UPDATE wsm_resulting_jobs_interface rj
898 SET rj.starting_intraoperation_step =
899 (select sj.intraoperation_step
900 from wsm_starting_jobs_interface sj
901 where sj.header_id = rj.header_id
902 and sj.representative_flag = 'Y')
903 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
904 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
905 AND rj.header_id = p_header_id -- WLTEnh
906 AND rj.starting_intraoperation_step is null;
907
908 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
909 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
910 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_intraoperation_step in Resulting Jobs');
911 l_fnd_err_msg := FND_MESSAGE.GET;
912 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
913
914 END IF;
915
916 --VJ: Start Additions for NSLBJ--
917 --Moved the following sql from MATCH_START_RESULT_LOT to here--
918 /*----------------------------------------------------------+
919 | Default starting_intraoperation_step for Bonus to 'Queue' |
920 +----------------------------------------------------------*/
921 l_stmt_num := 21;
922 UPDATE wsm_resulting_jobs_interface wrji
923 SET wrji.starting_intraoperation_step = WIP_CONSTANTS.QUEUE
924 WHERE wrji.starting_intraoperation_step IS NULL
925 AND wrji.process_status = WIP_CONSTANTS.RUNNING
926 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
927 AND wrji.header_id = p_header_id -- WLTEnh
928 AND EXISTS(SELECT 1
929 FROM wsm_split_merge_txn_interface sji
930 WHERE sji.header_id = wrji.header_id
931 AND sji.transaction_type_id = WSMPCNST.BONUS
932 AND sji.process_status = WIP_CONSTANTS.RUNNING);
933
934 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
935 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
936 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_intraoperation_step in Resulting Jobs');
937 l_fnd_err_msg := FND_MESSAGE.GET;
938 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
939
940 END IF;
941
942 --VJ: End Additions for NSLBJ--
943
944 /*-----------------------------------------------------------------+
945 | Default forward_op_option to 4 in |
946 | wsm_resulting_jobs_interface table for Bonus/Split txns. |
947 +-----------------------------------------------------------------*/
948
949 l_stmt_num := 22;
950 UPDATE wsm_resulting_jobs_interface rj
951 SET rj.forward_op_option = 4
952 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
953 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
954 AND rj.forward_op_option <> 4
955 AND rj.header_id = p_header_id -- WLTEnh
956 AND rj.header_id IN (SELECT header_id
957 FROM wsm_split_merge_txn_interface
958 WHERE internal_group_id = WSMPLOAD.G_GROUP_ID
959 AND process_status = WIP_CONSTANTS.RUNNING
960 AND (transaction_type_id IN
961 --SpUA begin
962 ( --WSMPCNST.SPLIT,
963 WSMPCNST.BONUS)
964 OR (transaction_type_id IN (WSMPCNST.SPLIT)
965 AND rj.split_has_update_assy = 0)));
966 --SpUA end
967
968 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
969 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
970 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'forward_op_option in Resulting Jobs');
971 l_fnd_err_msg := FND_MESSAGE.GET;
972 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||l_fnd_err_msg);
973
974 END IF;
975
976 /*---------------------------------------------------------------+
977 | Default completion_subinventory |
978 +---------------------------------------------------------------*/
979
980 l_stmt_num := 23;
981 IF (l_debug = 'Y') THEN
982 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||
983 '): B4 updating completion_subinventory and completion_locator_id');
984 END IF;
985
986 l_stmt_num := 24;
987
988 /* ST bugfix 3336844 comment out check for locator control with MSI. populate locator_id from BOR regardless
989 the locator control, will validate it later. */
990 UPDATE wsm_resulting_jobs_interface rj
991 SET (rj.completion_subinventory,
992 rj.completion_locator_id) =
993 (SELECT bor.completion_subinventory,
994 /* decode(msi.locator_type, 1, NULL, */ /* ST bugfix 3336844 */
995 bor.completion_locator_id /*ST bug 3336844 ) */ -- BBK- Bug#2795951
996 -- NULL) -- CZH.BUG2398718
997 -- This is for other locator types like Dynamic Entry (3) and
998 -- Item level control (4), which are not supported by OSFM.
999 FROM bom_operational_routings bor,
1000 mtl_secondary_inventories msi -- CZH.BUG2398718
1001 WHERE bor.common_routing_sequence_id = rj.common_routing_sequence_id
1002 AND bor.organization_id = rj.organization_id
1003 --VJ: Start Changes for NSLBJ--
1004 AND bor.assembly_item_id = decode(rj.job_type,
1005 WIP_CONSTANTS.STANDARD, rj.primary_item_id,
1006 WIP_CONSTANTS.NONSTANDARD, rj.routing_reference_id,
1007 rj.primary_item_id)
1008 AND msi.secondary_inventory_name = bor.completion_subinventory -- CZH.BUG2398718
1009 AND msi.organization_id = bor.organization_id -- CZH.BUG2398718
1010 )
1011 --VJ: End Changes for NSLBJ--
1012 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
1013 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
1014 AND rj.rowid = l_wrji_rowid --SpUA Add
1015 AND rj.completion_subinventory is null
1016 AND rj.common_routing_sequence_id is not null -- CZH.BUG2398718
1017 AND rj.header_id IN (SELECT header_id
1018 FROM wsm_split_merge_txn_interface
1019 WHERE internal_group_id = WSMPLOAD.G_GROUP_ID
1020 and header_id = p_header_id -- WLTEnh
1021 AND process_status = WIP_CONSTANTS.RUNNING
1022 AND (transaction_type_id IN (WSMPCNST.UPDATE_ASSEMBLY,
1023 WSMPCNST.BONUS,
1024 WSMPCNST.UPDATE_ROUTING)
1025 --SpUA begin
1026 OR (transaction_type_id IN (WSMPCNST.SPLIT)
1027 AND rj.split_has_update_assy = 1)))
1028 --SpUA end
1029 RETURNING rj.completion_subinventory,
1030 rj.completion_locator_id
1031 INTO l_temp_csi,
1032 l_temp_loc_id;
1033 --VJ: End Changes for NSLBJ--
1034
1035 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
1036 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||
1037 'l_temp_csi='||l_temp_csi||
1038 ', l_temp_loc_id='||l_temp_loc_id);
1039 fnd_message.set_name('WSM', 'WSM_MODIFIED_FIELD');
1040 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Subinventory and Locator from Routing');
1041 l_fnd_err_msg := FND_MESSAGE.GET;
1042 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMN('||l_stmt_num||'): '||l_fnd_err_msg);
1043 END IF;
1044
1045 l_stmt_num := 25;
1046 /* ST bugfix 3336844 comment out check for locator control with MSI. populate locator_id from BOR regardless
1047 the locator control, will validate it later. */
1048 UPDATE wsm_resulting_jobs_interface rj
1049 SET (rj.completion_subinventory,
1050 rj.completion_locator_id) =
1051 (SELECT wdj.completion_subinventory,
1052 /*decode(msi.locator_type, 1, NULL,*/ /* ST bug 3336844 */
1053 wdj.completion_locator_id /* ST bug 3336844 ) */ -- BBK- Bug#2795951
1054 -- NULL) -- CZH.BUG2398718
1055 -- This is for other locator types like Dynamic Entry (3) and
1056 -- Item level control (4), which are not supported by OSFM.
1057 FROM wip_discrete_jobs wdj,
1058 wsm_starting_jobs_interface sj,
1059 mtl_secondary_inventories msi -- CZH.BUG2398718
1060 WHERE wdj.wip_entity_id = sj.wip_entity_id
1061 AND wdj.organization_id = sj.organization_id --VJ: Added for NSLBJ--
1062 AND sj.header_id = rj.header_id --VJ: Added for NSLBJ--
1063 AND sj.internal_group_id = WSMPLOAD.G_GROUP_ID
1064 AND msi.secondary_inventory_name = wdj.completion_subinventory -- CZH.BUG2398718
1065 AND msi.organization_id = wdj.organization_id -- CZH.BUG2398718
1066 )
1067 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
1068 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
1069 AND rj.header_id = p_header_id -- WLTEnh
1070 AND rj.completion_subinventory is null
1071 AND rj.header_id IN (SELECT header_id
1072 FROM wsm_split_merge_txn_interface
1073 WHERE internal_group_id = WSMPLOAD.G_GROUP_ID
1074 and header_id = p_header_id -- WLTEnh
1075 AND process_status = WIP_CONSTANTS.RUNNING
1076 --SpUA begin
1077 AND (transaction_type_id IN ( --WSMPCNST.SPLIT,
1078 WSMPCNST.UPDATE_LOT_NAME,
1079 WSMPCNST.UPDATE_QUANTITY)
1080 OR (transaction_type_id IN (WSMPCNST.SPLIT)
1081 AND rj.split_has_update_assy = 0)));
1082 --SpUA end
1083
1084 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
1085 fnd_message.set_name('WSM', 'WSM_MODIFIED_FIELD');
1086 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Subinventory and Locator from Starting Jobs');
1087 l_fnd_err_msg := FND_MESSAGE.GET;
1088 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMN('||l_stmt_num||'): '||l_fnd_err_msg);
1089 END IF;
1090 -- end 2099827
1091
1092 -- CZH.BUG2398718, added code to check locator_type,
1093 -- if mtl_secondary_inventories.locator_type is none(=1),
1094 -- set completion_locator_id to NULL, else default it
1095 l_stmt_num := 26;
1096
1097 /* ST bugfix 3336844 comment out check for locator control with MSI. populate locator_id from BOR regardless
1098 the locator control, will validate it later. */
1099
1100 UPDATE wsm_resulting_jobs_interface rj
1101 SET (rj.completion_subinventory,
1102 rj.completion_locator_id) =
1103 (SELECT wdj.completion_subinventory,
1104 /* decode(msi.locator_type, 1, NULL,*/ /* St bug 3336844 */
1105 wdj.completion_locator_id /* ST bug fix 3336844 ) */ -- BBK- Bug#2795951
1106 -- NULL) -- CZH.BUG2398718
1107 -- This is for other locator types like Dynamic Entry (3) and
1108 -- Item level control (4), which are not supported by OSFM.
1109 FROM wip_discrete_jobs wdj,
1110 wsm_starting_jobs_interface sj,
1111 mtl_secondary_inventories msi -- CZH.BUG2398718
1112 WHERE wdj.wip_entity_id = sj.wip_entity_id
1113 AND sj.header_id = p_header_id -- WLTEnh --rj.header_id
1114 AND sj.internal_group_id = WSMPLOAD.G_GROUP_ID
1115 AND sj.representative_flag = 'Y'
1116 AND msi.secondary_inventory_name = wdj.completion_subinventory -- CZH.BUG2398718
1117 AND msi.organization_id = wdj.organization_id -- CZH.BUG2398718
1118 )
1119 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
1120 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
1121 AND rj.completion_subinventory is null
1122 AND rj.header_id IN (SELECT header_id
1123 FROM wsm_split_merge_txn_interface
1124 WHERE internal_group_id = WSMPLOAD.G_GROUP_ID
1125 and header_id = p_header_id -- WLTEnh
1126 AND process_status = WIP_CONSTANTS.RUNNING
1127 AND transaction_type_id IN ( WSMPCNST.MERGE ))
1128 RETURNING rj.completion_subinventory, -- WLTEnh
1129 rj.completion_locator_id
1130 INTO l_temp_csi,
1131 l_temp_loc_id;
1132
1133 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
1134 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): '||
1135 ' p_header_id='||p_header_id||
1136 ' l_temp_csi='||l_temp_csi||
1137 ', l_temp_loc_id='||l_temp_loc_id);
1138 fnd_message.set_name('WSM', 'WSM_MODIFIED_FIELD');
1139 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Subinventory and Locator from Starting Jobs for Merge');
1140 l_fnd_err_msg := FND_MESSAGE.GET;
1141 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMN('||l_stmt_num||'): '||l_fnd_err_msg);
1142 END IF;
1143
1144 l_stmt_num := 27;
1145 IF (l_err_occurred = 1) THEN
1146 raise e_proc_error;
1147 END IF;
1148
1149 --VJ: End Additions for NSLBJ--
1150
1151 p_err_num := 0;
1152 p_err_msg := 'WSMPVLDT.POPULATE_COLUMNS: Returned Success';
1153 IF (l_debug = 'Y') THEN
1154 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
1155 END IF;
1156
1157 EXCEPTION
1158 WHEN e_proc_error THEN
1159 p_err_num := 1;
1160 p_err_msg := 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||'): Error';
1161 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
1162
1163 WHEN failed_get_class_code THEN
1164 p_err_msg := 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||');'|| p_err_msg;
1165 FND_FILE.PUT_LINE(FND_FILE.LOG, 'failed_get_class_code error-'||p_err_msg);
1166
1167 WHEN others THEN
1168
1169 p_err_num := SQLCODE;
1170 p_err_msg := 'WSMPVLDT.POPULATE_COLUMNS('||l_stmt_num||');'|| SUBSTR(SQLERRM,1,1000);
1171 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
1172
1173 END POPULATE_COLUMNS;
1174
1175 /*EA WLTEnh */
1176
1177 /*-------------------------------------------------------------+
1178 | VALIDATE_RECORDS
1179 ---------------------------------------------------------------*/
1180
1181 PROCEDURE VALIDATE_RECORDS(p_err_msg IN OUT NOCOPY VARCHAR2,
1182 p_err_num IN OUT NOCOPY NUMBER) IS
1183
1184 l_count NUMBER := 0;
1185 l_temp NUMBER;
1186 l_stmt_num NUMBER;
1187 l_wip_id NUMBER;
1188 l_header_id NUMBER;
1189 l_txn_id NUMBER;
1190 /*BA#1623701*/
1191 l_rtg_seq_id NUMBER;
1192 l_bom_seq_id NUMBER;
1193 l_wsji_rtg_seq_id NUMBER;
1194 l_wrji_rtg_seq_id NUMBER;
1195 l_wrji_bom_seq_id NUMBER;
1196 l_alt_rtg_desig VARCHAR2(25);
1197 l_alt_bom_desig VARCHAR2(25);
1198 l_rep_flag VARCHAR2(1);
1199 l_wrji_alt_rtg_desig VARCHAR2(25);
1200 l_wrji_alt_bom_desig VARCHAR2(25);
1201 l_nslbj_alt_rtg_desig VARCHAR2(25);
1202 l_nslbj_alt_bom_desig VARCHAR2(25);
1203 /*EA#1623701*/
1204 l_errored_rows NUMBER := 0;
1205 l_txn_date DATE;
1206 l_job_name VARCHAR2(240);
1207 l_start_we_name VARCHAR2(240); --Added to fix bug #2352364--
1208
1209 l_start_std_op_id NUMBER;
1210 l_start_op_code VARCHAR2(4);
1211 l_start_op_seq_num NUMBER;
1212
1213 l_bos_op_seq_id NUMBER;
1214 l_bso_op_code VARCHAR2(4);
1215 l_bos_op_seq_num NUMBER;
1216 l_txn_type NUMBER;
1217 l_sch_comp_date DATE;
1218 l_comp_sub_inv VARCHAR2(10);
1219 l_bos_std_op_id NUMBER;
1220
1221 --Start : Additions for APS-WLT--
1222 l_wrji_starting_op_seq_num NUMBER;
1223 l_wrji_starting_op_code VARCHAR2(4);
1224 l_profile_value NUMBER;
1225 l_st_iop NUMBER;
1226 l_execute_this NUMBER;
1227 --End : Additions for APS-WLT--
1228
1229 --VJ: Start Additions for NSLBJ--
1230 l_job_type NUMBER;
1231 l_min_job_type NUMBER;
1232 l_max_job_type NUMBER;
1233 l_we_name VARCHAR2(240);
1234 l_primary_item_id NUMBER;
1235 l_routing_reference_id NUMBER;
1236 l_bom_reference_id NUMBER;
1237 l_scheduled_start_date DATE;
1238 l_scheduled_completion_date DATE;
1239 l_start_quantity NUMBER;
1240 l_net_quantity NUMBER;
1241 l_class_code VARCHAR2(10);
1242 l_completion_subinventory VARCHAR2(10);
1243 l_completion_locator_id NUMBER;
1244 l_nsj_routing_seq_id NUMBER;
1245 l_nsj_bom_seq_id NUMBER := -1;
1246 l_firm_flag NUMBER;
1247 l_we_st_we_id NUMBER;
1248 l_we_st_we_name VARCHAR2(240);
1249 l_we_org_id NUMBER;
1250 l_routing_rev VARCHAR2(3);
1251 l_rev_date DATE;
1252 l_bom_revision VARCHAR2(3);
1253 l_bom_revision_date DATE;
1254 l_sch_start_date DATE;
1255 l_sch_completion_date DATE;
1256 l_wdj_bom_ref_id NUMBER;
1257 l_wdj_bom_seq_id NUMBER;
1258 l_wdj_alt_bom_desig VARCHAR2(25);
1259 l_wdj_bom_rev VARCHAR2(3);
1260 l_wdj_bom_rev_dt DATE;
1261 l_wdj_rtg_rev VARCHAR2(3);
1262 l_wdj_rtg_rev_dt DATE;
1263 l_st_bom_ref_id NUMBER;
1264 l_st_alt_bom_desig VARCHAR2(25);
1265 l_st_bom_seq_id NUMBER;
1266 l_st_rtg_ref_id NUMBER;
1267 l_st_alt_rtg_desig VARCHAR2(25);
1268 l_st_rtg_seq_id NUMBER;
1269 l_start_op_seq_id NUMBER; --Added to fix bug #2358370
1270 l_locator_control_type NUMBER; -- CZH.BUG2398718
1271 l_osp_start_op_seq_id NUMBER;
1272 l_split_has_update_assy NUMBER; --SpUA
1273 l_sj_item_id NUMBER; --SpUA
1274 l_acct_period_id NUMBER; --NL Bugfix 3126650
1275
1276 /* ST bugfix 3336844 (2793501) */
1277 l_sub_loc_control NUMBER;
1278 l_org_loc_control NUMBER;
1279 l_restrict_locators_code NUMBER;
1280 l_item_loc_control NUMBER;
1281 l_segs VARCHAR2(10000);
1282 l_loc_success BOOLEAN;
1283 l_locator_id NUMBER;
1284 /* endfix 3336844 */
1285
1286 CURSOR C_ST_WE_ID(l_header_id NUMBER) IS
1287 SELECT we.wip_entity_id,
1288 we.wip_entity_name,
1289 we.organization_id --VJ: CodeRVW: Added for NSLBJ--
1290 FROM wip_entities we,
1291 wsm_STARTING_JOBS_INTERFACE wsji
1292 WHERE wsji.header_id = l_header_id
1293 AND wsji.wip_entity_name IS NOT NULL
1294 AND we.organization_id = wsji.organization_id
1295 AND we.wip_entity_name = wsji.wip_entity_name;
1296
1297 CURSOR C_SCHEDULED_DATE(l_header_id NUMBER) IS
1298 SELECT rj.scheduled_start_date scheduled_start_date,
1299 rj.scheduled_completion_date scheduled_completion_date,rj.start_quantity,
1300 rj.organization_id org_id,
1301 rj.primary_item_id item_id
1302 FROM wsm_resulting_jobs_interface rj
1303 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
1304 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
1305 AND rj.header_id = l_header_id
1306 AND (rj.scheduled_start_date is null
1307 or rj.scheduled_completion_date is null)
1308 AND rownum < 2;
1309
1310 CURSOR BOM_RTG_REVISION(l_header_id NUMBER, l_we_name VARCHAR2) IS --VJ: Added param to fix bug #2315397--
1311 SELECT wrji.primary_item_id item_id,
1312 nvl(wrji.bom_reference_id, -1) bom_ref_id,
1313 wrji.routing_reference_id rtg_ref_id,
1314 wrji.job_type job_type,
1315 wrji.wip_entity_name we_name
1316 /*BA WLTEnh */
1317 , wrji.bom_revision_date
1318 , wrji.bom_revision
1319 , wrji.routing_revision_date
1320 , wrji.routing_revision
1321 /*EA WLTEnh */
1322 FROM wsm_resulting_jobs_interface wrji
1323 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
1324 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
1325 AND wrji.header_id = l_header_id
1326 AND wrji.wip_entity_name = l_we_name; --VJ: Added condition to fix bug #2315397--
1327
1328
1329 -- BA NSO-WLT
1330 l_merge_std_op_id NUMBER;
1331 l_rl_rtg_seq_id NUMBER;
1332 l_op_is_std_op NUMBER;
1333 l_op_repeated_times NUMBER;
1334 l_upd_rtg_asly_err NUMBER;
1335 x_op_err_code NUMBER;
1336 x_op_err_msg VARCHAR2(1000);
1337 -- EA NSO-WLT
1338 --bug2099827
1339 l_comp_sub_inv_r VARCHAR2(10);
1340 l_comp_loc_id NUMBER;
1341 l_comp_loc_id_r NUMBER;
1342 l_err_count NUMBER;
1343 -- end
1344 l_organization_id NUMBER; -- bugfix 1922146
1345 l_wdj_st_qty NUMBER; -- bugfix 2448428
1346 l_rtg_rev VARCHAR2(10); -- ADD: CZH.I_OED-1
1347 l_rtg_rev_date DATE := SYSDATE;-- ADD: CZH.I_OED-1, default to SYSDATE
1348 l_item_id NUMBER; -- ADD: CZH.I_OED-1
1349
1350 l_fnd_err_msg VARCHAR2(2000); -- for fnd_messages
1351 l_fnd_generic_err_msg VARCHAR2(2000); -- for fnd_message WSM_ERRORS_IN_WIE
1352
1353 proc_error EXCEPTION;
1354
1355 --VJ: Start Changes for NSLBJ--
1356 --Changed the sql since org_id has been added to WRJI now--
1357 CURSOR REV_CUR(p_header_id NUMBER) IS -- WLTEnh to fix incorrect update
1358 SELECT ROWIDTOCHAR(RJ.ROWID) "X_ROWID", RJ.ORGANIZATION_ID, RJ.HEADER_ID
1359 FROM WSM_RESULTING_JOBS_INTERFACE RJ
1360 WHERE RJ.HEADER_ID = p_header_id
1361 AND RJ.GROUP_ID = WSMPLOAD.G_GROUP_ID
1362 AND RJ.PROCESS_STATUS = WIP_CONSTANTS.RUNNING
1363 AND (RJ.BOM_REVISION IS NOT NULL OR RJ.BOM_REVISION_DATE IS NOT NULL)
1364 AND RJ.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
1365
1366 --VJ: End Changes for NSLBJ--
1367
1368 -- Start : Comments to fix bug #3453139 --
1369 /********************************************
1370 CURSOR C_STARTING_JOB is
1371 SELECT SJ.WIP_ENTITY_ID,
1372 TXN.TRANSACTION_DATE,
1373 TXN.TRANSACTION_ID,
1374 TXN.HEADER_ID
1375 , TXN.ORGANIZATION_ID -- 2804945
1376 FROM WSM_SPLIT_MERGE_TXN_INTERFACE TXN,
1377 WSM_STARTING_JOBS_INTERFACE SJ
1378 WHERE TXN.INTERNAL_GROUP_ID = WSMPLOAD.G_GROUP_ID
1379 AND SJ.HEADER_ID = TXN.HEADER_ID
1380 AND TXN.header_id = WSMPLOAD.G_HEADER_ID -- XleSplits
1381 AND TXN.PROCESS_STATUS = WIP_CONSTANTS.RUNNING
1382 AND SJ.PROCESS_STATUS = WIP_CONSTANTS.RUNNING
1383 ORDER BY TXN.TRANSACTION_DATE;
1384
1385 CURSOR C_RESULTING_JOB IS
1386 SELECT RJ.WIP_ENTITY_NAME,
1387 TXN.TRANSACTION_DATE,
1388 TXN.TRANSACTION_ID,
1389 TXN.HEADER_ID
1390 , TXN.ORGANIZATION_ID -- 2804945
1391 FROM WSM_SPLIT_MERGE_TXN_INTERFACE TXN,
1392 WSM_RESULTING_JOBS_INTERFACE RJ
1393 WHERE TXN.INTERNAL_GROUP_ID = WSMPLOAD.G_GROUP_ID
1394 AND RJ.HEADER_ID = TXN.HEADER_ID
1395 AND TXN.header_id = WSMPLOAD.G_HEADER_ID -- XleSplits
1396 AND TXN.PROCESS_STATUS = WIP_CONSTANTS.RUNNING
1397 AND RJ.PROCESS_STATUS = WIP_CONSTANTS.RUNNING
1398 ORDER BY TXN.TRANSACTION_DATE;
1399 ********************************************/
1400 -- End : Comments to fix bug #3453139 --
1401
1402 CURSOR C_WSMTI IS
1403 SELECT header_id /* BA WLTEnh */
1404 , transaction_type_id
1405 , transaction_date
1406 , reason_id
1407 , organization_id
1408 , rowid /*EA WLTEnh */
1409 FROM wsm_split_merge_txn_interface
1410 WHERE process_status = WIP_CONSTANTS.RUNNING
1411 AND internal_group_id = WSMPLOAD.G_GROUP_ID
1412 AND header_id = WSMPLOAD.G_HEADER_ID -- XleSplits
1413 ORDER BY TRANSACTION_DATE; --VJ: Added for NSLBJ--
1414
1415 CURSOR C_WSJI IS
1416 SELECT wsji.header_id wsji_header_id ,
1417 wsji.wip_entity_id ,
1418 nvl(wsji.routing_seq_id, -1) routing_seq_id,
1419 nvl(wsji.representative_flag, 'N') representative_flag,
1420 wsmti.transaction_type_id --VJ: CodeRVW: Added for NSLBJ--
1421 /*BA WLTEnh*/
1422 , wsji.rowid wsji_rowid
1423 , wsji.wip_entity_name
1424 , wsji.organization_id
1425 , wsji.primary_item_id
1426 , wsji.intraoperation_step
1427 , wsji.operation_seq_num
1428 /*EA WLTEnh*/
1429 FROM wsm_starting_jobs_interface wsji,
1430 wsm_split_merge_txn_interface wsmti --VJ: CodeRVW: Added for NSLBJ--
1431 WHERE wsji.process_status = WIP_CONSTANTS.RUNNING
1432 AND wsji.internal_group_id = WSMPLOAD.G_GROUP_ID
1433 AND wsmti.internal_group_id = WSMPLOAD.G_GROUP_ID --VJ: CodeRVW: Added for NSLBJ--
1434 AND wsji.header_id = wsmti.header_id --VJ: CodeRVW: Added for NSLBJ--
1435 AND wsmti.header_id = WSMPLOAD.G_HEADER_ID
1436 AND wsmti.process_status = WIP_CONSTANTS.RUNNING;
1437
1438 CURSOR C_WRJI IS
1439 SELECT wsmti.header_id ,
1440 nvl(common_routing_sequence_id, -1) common_routing_sequence_id,
1441 nvl(alternate_routing_designator, '-1') alternate_routing_designator,
1442 nvl(common_bom_sequence_id, -1) common_bom_sequence_id,
1443 nvl(alternate_bom_designator, '-1') alternate_bom_designator,
1444 wsmti.transaction_type_id ,
1445 nvl(wrji.organization_id , wsmti.organization_id), /*ST bugfix 3336844 add nvl */ --VJ: Changed for NSLBJ--
1446 wrji.wip_entity_name job_name, --bugfix2099827
1447 wrji.routing_revision , -- ADD: CZH.I_OED-1
1448 wrji.routing_revision_date , -- ADD: CZH.I_OED-1
1449 wrji.bom_revision , -- Bug#2662639
1450 wrji.bom_revision_date, -- Bug#2662639
1451 --VJ: CodeRVW: Start Additions for NSLBJ--
1452 wrji.job_type job_type,
1453 wrji.wip_entity_name wip_entity_name,
1454 wrji.primary_item_id,
1455 wrji.routing_reference_id,
1456 wrji.bom_reference_id,
1457 wrji.scheduled_start_date,
1458 wrji.scheduled_completion_date,
1459 wrji.start_quantity,
1460 wrji.net_quantity,
1461 wrji.class_code,
1462 wrji.completion_subinventory,
1463 wrji.completion_locator_id
1464 --VJ: CodeRVW: End Additions for NSLBJ--
1465 , wrji.rowid wrji_rowid
1466 , nvl(wrji.split_has_update_assy, 0) --SpUA add
1467 FROM wsm_resulting_jobs_interface wrji,
1468 wsm_split_merge_txn_interface wsmti
1469 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
1470 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
1471 AND wsmti.internal_group_id = WSMPLOAD.G_GROUP_ID
1472 AND wrji.header_id=wsmti.header_id
1473 AND wsmti.header_id = WSMPLOAD.G_HEADER_ID
1474 AND wsmti.process_status = WIP_CONSTANTS.RUNNING;
1475 --end modification
1476
1477 l_error_num NUMBER ;
1478
1479 -- FamiyPackI Changes - Identifier Tag WLTEnh
1480 -- WLTEnhStart
1481
1482 l_cur_wsmti_rec C_WSMTI%ROWTYPE;
1483 l_cur_wsji_rec C_WSJI%ROWTYPE;
1484 -- l_cur_wrji_rec C_WRJI%ROWTYPE;
1485
1486 l_wrji_rowid ROWID;
1487
1488 e_wsmti_exception EXCEPTION;
1489 e_wsji_exception EXCEPTION;
1490 e_wrji_exception EXCEPTION;
1491 e_too_many_rep_lot_exception EXCEPTION;
1492
1493
1494 l_dummy NUMBER default NULL;
1495
1496 l_wsji_job_type NUMBER; -- Bug# 2679705
1497 l_wsji_routing_reference_id NUMBER ;-- Bug#2679705
1498
1499 -- WLTEnhEnd
1500
1501 l_int_copy_type NUMBER; --to fix bug #3512105
1502
1503 BEGIN
1504
1505
1506 -------------------------------------------------------------------
1507 -------------------------------------------------------------------
1508 ------- Begin validations wSMti -------------
1509 -------------------------------------------------------------------
1510 -------------------------------------------------------------------
1511
1512 l_stmt_num := 1;
1513
1514
1515 ---------------------------------------------------------------------------------
1516 -- WLTEhn change notes.
1517 -- If there is an error in validating the Header WSMTI then mark that row as ERROR.
1518 -- Hence, when we fetch the C_WSJI and C_WRJI records, we only get the ones that
1519 -- has passed previous validations OR NON-ERRORED WSMTI Records..
1520 ---------------------------------------------------------------------------------
1521
1522 p_err_num := 0;
1523
1524 IF (l_debug = 'Y') THEN
1525 FND_FILE.PUT_LINE(FND_FILE.LOG,
1526 'WSMPVLDT.VALIDATE_RECORDS(START): WSMPLOAD.G_HEADER_ID='||WSMPLOAD.G_HEADER_ID);
1527 fnd_file.put_line(fnd_file.log, 'WSMPVLDT.VALIDATE_RECORDS:Start Time:'
1528 ||to_char(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
1529
1530 END IF;
1531
1532 FND_MESSAGE.SET_NAME('WSM', 'WSM_ERRORS_IN_WIE');
1533 l_fnd_generic_err_msg := FND_MESSAGE.GET;
1534
1535 OPEN C_WSMTI;
1536 -- 1685779 : indented the code
1537 LOOP
1538 FETCH C_WSMTI
1539 into
1540 l_cur_wsmti_rec;
1541
1542 l_header_id := l_cur_wsmti_rec.header_id; -- Widely used and hence assign it here.
1543
1544 /* BD WLTEhn */
1545 /* l_header_id, c_wsmti_rowid;
1546 */
1547 /*ED WLTEnh */
1548
1549 EXIT WHEN C_WSMTI%NOTFOUND;
1550
1551 IF (l_debug = 'Y') THEN
1552 FND_FILE.PUT_LINE(FND_FILE.LOG,
1553 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): Processing WSMTI header_id='||l_header_id);
1554 END IF;
1555
1556 ----------- Start of WSMTI Validations - Inside cursor C_WSMTI ------------
1557
1558 WSMPVLDT.l_wsmti_error_flag := 0; -- Important to reset this for every header.
1559
1560 l_stmt_num := 2;
1561
1562 /*-----------------------------------------------------------------+
1563 | validate transaction_type in wsm_split_merge_txn_interface table |
1564 +-----------------------------------------------------------------*/
1565
1566 Begin
1567 l_stmt_num := 3;
1568
1569 select null into l_dummy
1570 from mfg_lookups mfg
1571 where mfg.lookup_code = l_cur_wsmti_rec.transaction_type_id
1572 and mfg.lookup_type = 'WSM_WIP_LOT_TXN_TYPE';
1573
1574 Exception
1575
1576 When NO_DATA_FOUND Then
1577
1578 set_wsmti_error;
1579
1580 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
1581 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'transaction_type_id in Split Merge Transactions');
1582 l_fnd_err_msg := FND_MESSAGE.GET;
1583
1584 FND_FILE.PUT_LINE(FND_FILE.LOG,
1585 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1586
1587
1588 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1589 p_message => substr(l_fnd_err_msg,1,2000),
1590 p_request_id => fnd_global.conc_request_id,
1591 p_program_id => fnd_global.conc_program_id,
1592 p_program_application_id => fnd_global.prog_appl_id,
1593 p_message_type => 1, --ERROR
1594 x_err_code => p_err_num,
1595 x_err_msg => p_err_msg);
1596 IF(p_err_num <> 0) THEN
1597 raise proc_error;
1598 END IF;
1599
1600 When TOO_MANY_ROWS Then
1601 NULL;
1602
1603 End;
1604
1605 /*-----------------------------------------------------------------+
1606 | validate organization_id in wsm_split_merge_txn_interface table |
1607 +-----------------------------------------------------------------*/
1608
1609 l_stmt_num := 4;
1610
1611 Begin
1612 l_stmt_num := 5;
1613
1614 select null into l_dummy
1615 from wsm_parameters para
1616 where para.organization_id = l_cur_wsmti_rec.organization_id
1617 and exists ( select null
1618 from mtl_parameters mtl
1619 where mtl.organization_id = para.organization_id)
1620 and trunc(nvl(l_cur_wsmti_rec.transaction_date, sysdate)) <
1621 (select nvl(disable_date, sysdate + 1)
1622 from org_organization_definitions org
1623 where org.organization_id = para.organization_id) ;
1624
1625 Exception
1626 When NO_DATA_FOUND Then
1627
1628 set_wsmti_error;
1629
1630 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
1631 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'organization_id in Split Merge Transactions');
1632 l_fnd_err_msg := FND_MESSAGE.GET;
1633 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1634
1635 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1636 p_message => substr(l_fnd_err_msg,1,2000),
1637 p_request_id => fnd_global.conc_request_id,
1638 p_program_id => fnd_global.conc_program_id,
1639 p_program_application_id => fnd_global.prog_appl_id,
1640 p_message_type => 1, --ERROR
1641 x_err_code => p_err_num,
1642 x_err_msg => p_err_msg);
1643 IF(p_err_num <> 0) THEN
1644 raise proc_error;
1645 END IF;
1646
1647 When TOO_MANY_ROWS Then
1648 NULL;
1649
1650 End;
1651
1652 /*-----------------------------------------------------------------+
1653 | validate acct_period in wsm_split_merge_txn_interface table |
1654 +-----------------------------------------------------------------*/
1655
1656 l_stmt_num := 6;
1657
1658 --Start NL Bugfix 3126650 : Moved acct_period check to WSMPUTIL API
1659
1660 l_acct_period_id := WSMPUTIL.GET_INV_ACCT_PERIOD(p_err_num, p_err_msg, l_cur_wsmti_rec.organization_id, l_cur_wsmti_rec.transaction_date);
1661 l_fnd_err_msg := p_err_msg;
1662
1663 IF (l_acct_period_id = 0) THEN
1664
1665 set_wsmti_error;
1666
1667 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1668 p_message => substr(l_fnd_err_msg,1,2000),
1669 p_request_id => fnd_global.conc_request_id,
1670 p_program_id => fnd_global.conc_program_id,
1671 p_program_application_id => fnd_global.prog_appl_id,
1672 p_message_type => 1, --ERROR
1673 x_err_code => p_err_num,
1674 x_err_msg => p_err_msg);
1675 IF(p_err_num <> 0) THEN
1676 raise proc_error;
1677 END IF;
1678 END IF;
1679
1680 --End NL Bugfix 3126650
1681
1682 /*-----------------------------------------------------------------+
1683 | validate reason_id in wsm_split_merge_txn_interface table |
1684 +-----------------------------------------------------------------*/
1685
1686 l_stmt_num := 7;
1687
1688 If l_cur_wsmti_rec.reason_id is not null Then
1689
1690 Begin
1691 l_stmt_num := 8;
1692
1693 select null into l_dummy
1694 from mtl_transaction_reasons mtl
1695 where mtl.reason_id = l_cur_wsmti_rec.reason_id
1696 and nvl(mtl.disable_date, sysdate+1) > sysdate;
1697
1698 Exception
1699
1700 WHEN NO_DATA_FOUND Then
1701
1702 set_wsmti_error;
1703
1704 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
1705 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'reason_id in Split Merge Transactions');
1706 l_fnd_err_msg := FND_MESSAGE.GET;
1707 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1708
1709 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1710 p_message => substr(l_fnd_err_msg,1,2000),
1711 p_request_id => fnd_global.conc_request_id,
1712 p_program_id => fnd_global.conc_program_id,
1713 p_program_application_id => fnd_global.prog_appl_id,
1714 p_message_type => 1, --ERROR
1715 x_err_code => p_err_num,
1716 x_err_msg => p_err_msg);
1717 IF(p_err_num <> 0) THEN
1718 raise proc_error;
1719 END IF;
1720
1721 When TOO_MANY_ROWS Then
1722 Null;
1723
1724 End;
1725 End If; --reasond_id not null
1726
1727 /*-----------------------------------------------------------------+
1728 | validate header_id in wsm_split_merge_txn_nterface table: prevent|
1729 | childless records. |
1730 +-----------------------------------------------------------------*/
1731
1732 l_stmt_num := 9;
1733
1734 If l_cur_wsmti_rec.transaction_type_id <> WSMPCNST.BONUS Then
1735
1736 Begin
1737 l_stmt_num := 10;
1738
1739 Select null into l_dummy
1740 From wsm_starting_jobs_interface
1741 where header_id = l_cur_wsmti_rec.header_id;
1742
1743 Exception
1744
1745 When NO_DATA_FOUND Then
1746
1747 set_wsmti_error;
1748
1749 FND_MESSAGE.SET_NAME('WSM', 'WSM_START_LOT_REQUIRED');
1750 l_fnd_err_msg := FND_MESSAGE.GET;
1751 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1752
1753 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1754 p_message => substr(l_fnd_err_msg,1,2000),
1755 p_request_id => fnd_global.conc_request_id,
1756 p_program_id => fnd_global.conc_program_id,
1757 p_program_application_id => fnd_global.prog_appl_id,
1758 p_message_type => 1, --ERROR
1759 x_err_code => p_err_num,
1760 x_err_msg => p_err_msg);
1761 IF(p_err_num <> 0) THEN
1762 raise proc_error;
1763 END IF;
1764
1765 When TOO_MANY_ROWS Then
1766 NULL;
1767
1768 End;
1769 End If; -- <> BONUS
1770
1771
1772 l_stmt_num := 11;
1773 /*-----------------------------------------------------------------+
1774 | validate header_id in wsm_split_merge_txn_nterface table: prevent|
1775 | childless records - ALWAYS a record should be in WRJI. |
1776 +-----------------------------------------------------------------*/
1777
1778 Begin
1779 l_stmt_num := 12;
1780
1781 select null into l_dummy
1782 from wsm_resulting_jobs_interface rj
1783 where rj.header_id = l_cur_wsmti_rec.header_id;
1784
1785 Exception
1786
1787 When NO_DATA_FOUND Then
1788
1789 set_wsmti_error;
1790
1791 FND_MESSAGE.SET_NAME('WSM', 'WSM_RESULT_LOT_REQUIRED');
1792 l_fnd_err_msg := FND_MESSAGE.GET;
1793 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1794
1795 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_cur_wsmti_rec.header_id,
1796 p_message => substr(l_fnd_err_msg,1,2000),
1797 p_request_id => fnd_global.conc_request_id,
1798 p_program_id => fnd_global.conc_program_id,
1799 p_program_application_id => fnd_global.prog_appl_id,
1800 p_message_type => 1, --ERROR
1801 x_err_code => p_err_num,
1802 x_err_msg => p_err_msg);
1803 IF(p_err_num <> 0) THEN
1804 raise proc_error;
1805 END IF;
1806
1807 When TOO_MANY_ROWS Then
1808 NULL;
1809
1810 End;
1811
1812 If l_wsmti_error_flag = 1 Then -- Only a Single UPDATE on WSMTI
1813
1814 l_stmt_num := 13;
1815
1816 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
1817 SET wsmti.error_message = l_fnd_generic_err_msg
1818 , wsmti.process_status = WIP_CONSTANTS.ERROR
1819 WHERE wsmti.rowid = l_cur_wsmti_rec.rowid;
1820
1821 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
1822 ||l_stmt_num||'): '
1823 ||'Record for Header Id '
1824 ||l_cur_wsmti_rec.header_id
1825 ||' set to ERROR in WSMTI.');
1826
1827 l_stmt_num := 14; -- Bug 2682603
1828 If l_cur_wsmti_rec.transaction_type_id <> WSMPCNST.BONUS Then
1829 l_stmt_num := 15;
1830
1831 Update wsm_starting_jobs_interface wsji
1832 SET wsji.error_message = l_fnd_generic_err_msg
1833 , wsji.process_status = WIP_CONSTANTS.ERROR
1834 Where wsji.header_id = l_cur_wsmti_rec.header_id;
1835
1836 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
1837 ||l_stmt_num||'): '
1838 ||'Record for Header Id '
1839 ||l_cur_wsmti_rec.header_id
1840 ||' set to ERROR in WSJI for NON-BONUS Transaction.');
1841
1842 End If;
1843
1844 l_stmt_num := 16;
1845
1846 Update wsm_resulting_jobs_interface wrji
1847 Set wrji.error_message = l_fnd_generic_err_msg
1848 , wrji.process_status = WIP_CONSTANTS.ERROR
1849 Where wrji.header_id = l_cur_wsmti_rec.header_id;
1850
1851 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
1852 ||l_stmt_num||'): '
1853 ||'Record for Header Id '
1854 ||l_cur_wsmti_rec.header_id
1855 ||' set to ERROR in WRJI.');
1856
1857 p_err_num := WIP_CONSTANTS.ERROR;
1858 p_err_msg := l_fnd_err_msg;
1859 raise proc_error;
1860
1861 End If;
1862
1863 ----------- End of WSMTI Validations - Inside cursor C_WSMTI ------------
1864
1865 END LOOP;
1866 CLOSE C_WSMTI;
1867
1868 -------------------------------------------------------------------
1869 -------------------------------------------------------------------
1870 ------- End validations wSMti -------------
1871 -------------------------------------------------------------------
1872 -------------------------------------------------------------------
1873
1874 -------------------------------------------------------------------
1875 -------------------------------------------------------------------
1876 ------- Begin validations wSji -------------
1877 -------------------------------------------------------------------
1878 -------------------------------------------------------------------
1879
1880 l_stmt_num := 17;
1881 OPEN C_WSJI;
1882 LOOP
1883 FETCH C_WSJI INTO
1884 l_cur_wsji_rec;
1885
1886 l_header_id := l_cur_wsji_rec.wsji_header_id; -- Widely used and hence assign it here.
1887
1888 EXIT WHEN C_WSJI%NOTFOUND;
1889
1890 IF (l_debug = 'Y') THEN
1891 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
1892 ||l_stmt_num||'): Processing WSJI header_id='||l_header_id);
1893 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
1894 ||l_stmt_num||'): l_cur_wsji_rec Record'
1895 ||'; wsji_header_id='||l_cur_wsji_rec.wsji_header_id
1896 ||'; wip_entity_id='||l_cur_wsji_rec.wip_entity_id
1897 ||'; routing_seq_id='||l_cur_wsji_rec.routing_seq_id
1898 ||'; representative_flag='||l_cur_wsji_rec.representative_flag
1899 ||'; wip_entity_name='||l_cur_wsji_rec.wip_entity_name
1900 ||'; organization_id='||l_cur_wsji_rec.organization_id
1901 ||'; primary_item_id='||l_cur_wsji_rec.primary_item_id
1902 ||'; intraoperation_step='||l_cur_wsji_rec.intraoperation_step
1903 ||'; operation_seq_num='||l_cur_wsji_rec.operation_seq_num
1904 );
1905 END IF;
1906 l_stmt_num := 18;
1907 --------------------------------------------------------------------------
1908 ----------- Start of WSJI Validations - Inside cursor C_WSJI ------------
1909 --------------------------------------------------------------------------
1910
1911 WSMPVLDT.l_wsji_error_flag := 0; -- Important to reset this for every header.
1912
1913 /*-----------------------------------------------------------------+
1914 | validate header_id in wsm_starting_jobs_interface table |
1915 +-----------------------------------------------------------------*/
1916
1917
1918 l_stmt_num := 19;
1919
1920 Begin
1921 l_stmt_num := 20;
1922
1923 select null into l_dummy
1924 from wsm_split_merge_txn_interface txn
1925 where txn.header_id = l_cur_wsji_rec.wsji_header_id
1926 and txn.internal_group_id = WSMPLOAD.G_GROUP_ID;
1927
1928 Exception
1929
1930 When NO_DATA_FOUND Then
1931
1932 set_wsji_error();
1933
1934 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
1935 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'header_id in Starting Jobs');
1936 l_fnd_err_msg := FND_MESSAGE.GET;
1937 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1938
1939 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
1940 p_message => substr(l_fnd_err_msg,1,2000),
1941 p_request_id => fnd_global.conc_request_id,
1942 p_program_id => fnd_global.conc_program_id,
1943 p_program_application_id => fnd_global.prog_appl_id,
1944 p_message_type => 1, --ERROR
1945 x_err_code => p_err_num,
1946 x_err_msg => p_err_msg);
1947 IF(p_err_num <> 0) THEN
1948 raise proc_error;
1949 END IF;
1950
1951 When TOO_MANY_ROWS Then
1952 NULL;
1953
1954 End;
1955
1956
1957 --VJ: Start Additions for NSLBJ--
1958 /*----------------------------------------------------------------+
1959 | validate organization_id in wsm_starting_jobs_interface table |
1960 +-----------------------------------------------------------------*/
1961
1962 --VJ: 0314: Switched order of these 2 sqls for NSLBJ--
1963 l_stmt_num := 21;
1964
1965 If l_cur_wsji_rec.organization_id is NULL Then -- Default.
1966
1967 Begin
1968 l_stmt_num := 22;
1969
1970 SELECT organization_id into l_cur_wsji_rec.organization_id
1971 FROM wsm_split_merge_txn_interface
1972 WHERE header_id = l_cur_wsji_rec.wsji_header_id
1973 AND internal_group_id = WSMPLOAD.G_GROUP_ID;
1974
1975 Exception
1976
1977 When NO_DATA_FOUND Then
1978
1979 set_wsji_warning();
1980
1981 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
1982 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'organization_id in Starting Jobs');
1983 l_fnd_err_msg := FND_MESSAGE.GET;
1984
1985 If l_debug = 'Y' THEN
1986 FND_FILE.PUT_LINE(FND_FILE.LOG,
1987 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
1988 End If;
1989
1990 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
1991 p_header_id => l_header_id,
1992 p_message => substr(l_fnd_err_msg,1,2000),
1993 p_request_id => fnd_global.conc_request_id,
1994 p_program_id => fnd_global.conc_program_id,
1995 p_program_application_id => fnd_global.prog_appl_id,
1996 p_message_type => 2, --WARNING
1997 x_err_code => p_err_num,
1998 x_err_msg => p_err_msg);
1999 IF(p_err_num <> 0) THEN
2000 raise proc_error;
2001 END IF;
2002
2003 When TOO_MANY_ROWS Then
2004 NULL; -- ??? Should be an error condition. Check.
2005
2006 End;
2007
2008 End If; -- organization_id is NULL
2009
2010
2011 l_stmt_num := 23;
2012
2013 Begin
2014 l_stmt_num := 24;
2015
2016 select null into l_dummy
2017 from wsm_split_merge_txn_interface txn
2018 where txn.header_id = l_cur_wsji_rec.wsji_header_id
2019 and txn.organization_id = l_cur_wsji_rec.organization_id
2020 and txn.internal_group_id = WSMPLOAD.G_GROUP_ID;
2021
2022 Exception
2023
2024 When NO_DATA_FOUND Then
2025
2026 set_wsji_error();
2027
2028 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2029 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'organization_id in Starting Jobs');
2030 l_fnd_err_msg := FND_MESSAGE.GET;
2031 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2032
2033 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2034 p_message => substr(l_fnd_err_msg,1,2000),
2035 p_request_id => fnd_global.conc_request_id,
2036 p_program_id => fnd_global.conc_program_id,
2037 p_program_application_id => fnd_global.prog_appl_id,
2038 p_message_type => 1, --ERROR
2039 x_err_code => p_err_num,
2040 x_err_msg => p_err_msg);
2041 IF(p_err_num <> 0) THEN
2042 raise proc_error;
2043 END IF;
2044
2045 When TOO_MANY_ROWS Then
2046 NULL;
2047
2048 End;
2049
2050 --VJ: End Additions for NSLBJ--
2051
2052 /*-----------------------------------------------------------------+
2053 | validate rep_lot_flag in wsm_starting_jobs_interface |
2054 +-----------------------------------------------------------------*/
2055
2056 l_stmt_num := 25;
2057
2058 Begin
2059 l_stmt_num := 26;
2060
2061 select count(header_id) into l_dummy
2062 From wsm_starting_jobs_interface wsji
2063 Where wsji.header_id = l_cur_wsji_rec.wsji_header_id
2064 and wsji.representative_flag = 'Y'
2065 and exists (select 1
2066 from wsm_split_merge_txn_interface wsmti
2067 where wsmti.header_id = l_cur_wsji_rec.wsji_header_id
2068 and wsmti.transaction_type_id = WSMPCNST.MERGE);
2069
2070 If l_dummy > 1 Then
2071 raise e_too_many_rep_lot_exception;
2072 End If;
2073
2074 Exception
2075
2076 When NO_DATA_FOUND Then
2077
2078 set_wsji_error();
2079
2080 FND_MESSAGE.SET_NAME('WSM', 'WSM_REPRESENTATIVE_LOT');
2081 l_fnd_err_msg := FND_MESSAGE.GET;
2082 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2083
2084 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2085 p_message => substr(l_fnd_err_msg,1,2000),
2086 p_request_id => fnd_global.conc_request_id,
2087 p_program_id => fnd_global.conc_program_id,
2088 p_program_application_id => fnd_global.prog_appl_id,
2089 p_message_type => 1, --ERROR
2090 x_err_code => p_err_num,
2091 x_err_msg => p_err_msg);
2092 IF(p_err_num <> 0) THEN
2093 raise proc_error;
2094 END IF;
2095
2096 When e_too_many_rep_lot_exception Then
2097
2098 set_wsji_error();
2099
2100 FND_MESSAGE.SET_NAME('WSM', 'WSM_REPRESENTATIVE_LOT');
2101 l_fnd_err_msg := FND_MESSAGE.GET;
2102 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2103
2104 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2105 p_message => substr(l_fnd_err_msg,1,2000),
2106 p_request_id => fnd_global.conc_request_id,
2107 p_program_id => fnd_global.conc_program_id,
2108 p_program_application_id => fnd_global.prog_appl_id,
2109 p_message_type => 1, --ERROR
2110 x_err_code => p_err_num,
2111 x_err_msg => p_err_msg);
2112 IF(p_err_num <> 0) THEN
2113 raise proc_error;
2114 END IF;
2115
2116 End;
2117
2118 /*-----------------------------------------------------------------+
2119 | Default representative flag to 'Y' for all transactions |
2120 | except for Merge and Bonus ( Fixed Bug # 1685550 ) |
2121 +-----------------------------------------------------------------*/
2122
2123 l_stmt_num := 27;
2124
2125 Begin
2126 l_stmt_num := 28;
2127
2128 SELECT 'Y' into
2129 l_cur_wsji_rec.representative_flag
2130 FROM wsm_split_merge_txn_interface wsmti
2131 WHERE wsmti.header_id = l_cur_wsji_rec.wsji_header_id
2132 AND wsmti.transaction_type_id IN
2133 (WSMPCNST.SPLIT,
2134 WSMPCNST.UPDATE_ASSEMBLY,
2135 WSMPCNST.UPDATE_ROUTING,
2136 WSMPCNST.UPDATE_QUANTITY,
2137 WSMPCNST.UPDATE_LOT_NAME);
2138
2139 IF (SQL%ROWCOUNT > 0) THEN
2140
2141 set_wsji_warning();
2142
2143 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
2144 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'representative_flag in Starting Jobs');
2145 l_fnd_err_msg := FND_MESSAGE.GET;
2146
2147 If l_debug = 'Y' THEN
2148 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2149 End If;
2150
2151 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2152 p_header_id => l_header_id,
2153 p_message => substr(l_fnd_err_msg,1,2000),
2154 p_request_id => fnd_global.conc_request_id,
2155 p_program_id => fnd_global.conc_program_id,
2156 p_program_application_id => fnd_global.prog_appl_id,
2157 p_message_type => 2, --WARNING
2158 x_err_code => p_err_num,
2159 x_err_msg => p_err_msg);
2160 IF(p_err_num <> 0) THEN
2161 raise proc_error;
2162 END IF;
2163 END IF;
2164
2165 Exception
2166
2167 When NO_DATA_FOUND Then -- This is not a MERGE or BONUS Txns.
2168 NULL;
2169
2170 When TOO_MANY_ROWS Then
2171 NULL;
2172
2173 End;
2174
2175 l_stmt_num := 29;
2176
2177 /*-----------------------------------------------------------------+
2178 | validate wip_entity_id in wsm_starting_jobs_interface table, |
2179 | if wip_entity_name IS NULL : |
2180 | Verify wip_entity_id is a standard open WSM job. |
2181 +-----------------------------------------------------------------*/
2182
2183 /*----------------------------------------------------------------------+
2184 | IF WIP_ENTITY_ID exists, default the WIP ENTITY NAME. |
2185 | IF WIP_ENTITY_ID is NULL but NAME is NOT NULL, then default ID |
2186 | IF BOTH ARE NULL ERROR. WLEnh |
2187 +----------------------------------------------------------------------*/
2188
2189
2190 l_stmt_num := 30;
2191
2192 If l_cur_wsji_rec.wip_entity_id is NOT NULL Then
2193
2194 Begin
2195 l_stmt_num := 31;
2196
2197 select we.wip_entity_name into l_cur_wsji_rec.wip_entity_name
2198 from wip_discrete_jobs dis, wip_entities we
2199 where dis.wip_entity_id = l_cur_wsji_rec.wip_entity_id
2200 and dis.wip_entity_id = we.wip_entity_id
2201 and dis.organization_id = l_cur_wsji_rec.organization_id
2202 and dis.status_type = 3
2203 and dis.job_type in (WIP_CONSTANTS.STANDARD,
2204 WIP_CONSTANTS.NONSTANDARD) --VJ: Added for NSLBJ--
2205 and we.entity_type = 5;
2206
2207 IF (SQL%ROWCOUNT > 0) THEN
2208 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
2209 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name in Starting Jobs');
2210 l_fnd_err_msg := FND_MESSAGE.GET;
2211
2212 If l_debug = 'Y' THEN
2213 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2214 End If;
2215
2216 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2217 p_header_id => l_header_id,
2218 p_message => substr(l_fnd_err_msg,1,2000),
2219 p_request_id => fnd_global.conc_request_id,
2220 p_program_id => fnd_global.conc_program_id,
2221 p_program_application_id => fnd_global.prog_appl_id,
2222 p_message_type => 2, --WARNING
2223 x_err_code => p_err_num,
2224 x_err_msg => p_err_msg);
2225 IF(p_err_num <> 0) THEN
2226 raise proc_error;
2227 END IF;
2228 END IF;
2229
2230 Exception
2231
2232 When NO_DATA_FOUND Then
2233
2234 set_wsji_error();
2235
2236 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2237 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_id in Starting Jobs');
2238 l_fnd_err_msg := FND_MESSAGE.GET;
2239 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2240
2241 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2242 p_header_id => l_header_id,
2243 p_message => substr(l_fnd_err_msg,1,2000),
2244 p_request_id => fnd_global.conc_request_id,
2245 p_program_id => fnd_global.conc_program_id,
2246 p_program_application_id => fnd_global.prog_appl_id,
2247 p_message_type => 1, --ERROR
2248 x_err_code => p_err_num,
2249 x_err_msg => p_err_msg);
2250 IF(p_err_num <> 0) THEN
2251 raise proc_error;
2252 END IF;
2253
2254 When TOO_MANY_ROWS Then
2255 set_wsji_error();
2256
2257 End;
2258
2259
2260 ElsIf (l_cur_wsji_rec.wip_entity_name is NOT NULL
2261 and l_cur_wsji_rec.wip_entity_id is NULL) Then
2262
2263 Begin
2264 l_stmt_num := 32;
2265
2266 select dis.wip_entity_id into l_cur_wsji_rec.wip_entity_id
2267 from wip_discrete_jobs dis,
2268 wip_entities we
2269 where we.wip_entity_name = l_cur_wsji_rec.wip_entity_name
2270 and we.organization_id = l_cur_wsji_rec.organization_id
2271 and dis.wip_entity_id = we.wip_entity_id
2272 and dis.wip_entity_id = nvl(l_cur_wsji_rec.wip_entity_id, dis.wip_entity_id)
2273 and dis.organization_id = we.organization_id
2274 and dis.status_type = 3
2275 and dis.job_type in (WIP_CONSTANTS.STANDARD, WIP_CONSTANTS.NONSTANDARD)
2276 and we.entity_type = 5;
2277
2278 IF (SQL%ROWCOUNT > 0) THEN
2279 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
2280 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_id in Starting Jobs');
2281 l_fnd_err_msg := FND_MESSAGE.GET;
2282 If l_debug = 'Y' THEN
2283 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2284 End If;
2285
2286 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2287 p_header_id => l_header_id,
2288 p_message => substr(l_fnd_err_msg,1,2000),
2289 p_request_id => fnd_global.conc_request_id,
2290 p_program_id => fnd_global.conc_program_id,
2291 p_program_application_id => fnd_global.prog_appl_id,
2292 p_message_type => 2, --WARNING
2293 x_err_code => p_err_num,
2294 x_err_msg => p_err_msg);
2295 IF(p_err_num <> 0) THEN
2296 raise proc_error;
2297 END IF;
2298 END IF;
2299
2300 Exception
2301
2302 When NO_DATA_FOUND Then
2303
2304 set_wsji_error();
2305
2306 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2307 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name in Starting Jobs');
2308 l_fnd_err_msg := FND_MESSAGE.GET;
2309 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2310
2311 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2312 p_message => substr(l_fnd_err_msg,1,2000),
2313 p_request_id => fnd_global.conc_request_id,
2314 p_program_id => fnd_global.conc_program_id,
2315 p_program_application_id => fnd_global.prog_appl_id,
2316 p_message_type => 1, --ERROR
2317 x_err_code => p_err_num,
2318 x_err_msg => p_err_msg);
2319 IF(p_err_num <> 0) THEN
2320 raise proc_error;
2321 END IF;
2322
2323 When TOO_MANY_ROWS Then
2324
2325 set_wsji_error();
2326
2327 End;
2328
2329
2330 /*----------------------------------------------------+
2331 | If both wip_entity_id and wip_entity_name are NULL, |
2332 | error the record |
2333 +----------------------------------------------------*/
2334
2335 ElsIf (l_cur_wsji_rec.wip_entity_id is NULL and
2336 l_cur_wsji_rec.wip_entity_name is NULL ) Then
2337
2338 set_wsji_error();
2339
2340 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2341 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name/wip_entity_id in Starting Jobs');
2342 l_fnd_err_msg := FND_MESSAGE.GET;
2343 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2344
2345 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2346 p_message => substr(l_fnd_err_msg,1,2000),
2347 p_request_id => fnd_global.conc_request_id,
2348 p_program_id => fnd_global.conc_program_id,
2349 p_program_application_id => fnd_global.prog_appl_id,
2350 p_message_type => 1, --ERROR
2351 x_err_code => p_err_num,
2352 x_err_msg => p_err_msg);
2353 IF(p_err_num <> 0) THEN
2354 raise proc_error;
2355 END IF;
2356
2357 End If;
2358
2359 --VJ: Start Additions for NSLBJ--
2360
2361 /*-----------------------------------------------------------------+
2362 | populate wip_entity_name, if NULL, in wsm_starting_jobs_interface|
2363 | table : based on wip_entity_id |
2364 +-----------------------------------------------------------------*/
2365
2366 Begin
2367
2368 l_stmt_num := 33;
2369
2370 select null into l_dummy
2371 from wip_discrete_jobs dis
2372 where dis.wip_entity_id = l_cur_wsji_rec.wip_entity_id
2373 and dis.organization_id = l_cur_wsji_rec.organization_id
2374 and dis.status_type = 3;
2375
2376 Exception
2377
2378 When NO_DATA_FOUND Then
2379
2380 set_wsji_error();
2381
2382 FND_MESSAGE.SET_NAME('WSM', 'WSM_NOT_RELEASED_JOB');
2383 FND_MESSAGE.SET_TOKEN('FLD_NAME', '');
2384 l_fnd_err_msg := FND_MESSAGE.GET;
2385 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2386
2387 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2388 p_message => substr(l_fnd_err_msg,1,2000),
2389 p_request_id => fnd_global.conc_request_id,
2390 p_program_id => fnd_global.conc_program_id,
2391 p_program_application_id => fnd_global.prog_appl_id,
2392 p_message_type => 1, --ERROR
2393 x_err_code => p_err_num,
2394 x_err_msg => p_err_msg);
2395 IF(p_err_num <> 0) THEN
2396 raise proc_error;
2397 END IF;
2398
2399 When TOO_MANY_ROWS Then
2400 set_wsji_error();
2401
2402 End;
2403 --VJ: End additions to fix bug #2393426--
2404
2405 /*-----------------------------------------------------------------+
2406 | If site level profile indicates Option C, check if the starting |
2407 | job has a valid copy |
2408 +-----------------------------------------------------------------*/
2409
2410 -- Start : Additions to fix bug #3512105 --
2411 l_stmt_num := 33.5;
2412
2413 l_profile_value := WSMPUTIL.CREATE_LBJ_COPY_RTG_PROFILE(l_cur_wsji_rec.organization_id); -- This returns the Profile value
2414
2415 IF (l_profile_value = 2) THEN -- Option A (Old Behavior)
2416 null;
2417 ELSE -- Option C (New Behavior)
2418 l_int_copy_type := WSMPUTIL.get_internal_copy_type(p_wip_entity_id => l_cur_wsji_rec.wip_entity_id);
2419
2420 /* ST bug fix 3732580 : check for type 3 */
2421 IF (nvl(l_int_copy_type,0) = 3 /*<> 0*/) THEN -- Incorrect copies
2422 set_wsji_error();
2423
2424 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_VALID_COPY');
2425 l_fnd_err_msg := FND_MESSAGE.GET;
2426 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2427
2428 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2429 p_message => substr(l_fnd_err_msg,1,2000),
2430 p_request_id => fnd_global.conc_request_id,
2431 p_program_id => fnd_global.conc_program_id,
2432 p_program_application_id => fnd_global.prog_appl_id,
2433 p_message_type => 1, --ERROR
2434 x_err_code => p_err_num,
2435 x_err_msg => p_err_msg);
2436 IF(p_err_num <> 0) THEN
2437 raise proc_error;
2438 END IF;
2439
2440 END IF;
2441 END IF;
2442 -- End : Additions to fix bug #3512105 --
2443
2444
2445 --VJ: CodeRVW: Start Additions for NSLBJ--
2446 /*-----------------------------------------------------------------+
2447 | validate that all starting jobs have the same job_type |
2448 +-----------------------------------------------------------------*/
2449
2450 l_stmt_num := 34;
2451
2452 SELECT min(job_type), max(job_type)
2453 INTO l_min_job_type, l_max_job_type
2454 FROM wsm_starting_jobs_interface wsji,
2455 wip_discrete_jobs wdj,
2456 wip_entities we
2457 WHERE wsji.header_id = l_cur_wsji_rec.wsji_header_id
2458 AND NVL(wsji.wip_entity_name, l_cur_wsji_rec.wip_entity_name) = we.wip_entity_name
2459 AND NVL(wsji.organization_id, l_cur_wsji_rec.organization_id) = we.organization_id
2460 AND we.wip_entity_id = wdj.wip_entity_id;
2461
2462 IF (l_min_job_type <> l_max_job_type) THEN
2463 FND_MESSAGE.SET_NAME('WSM', 'WSM_DIFF_JOB_TYP_ST');
2464 l_fnd_err_msg := FND_MESSAGE.GET;
2465 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2466
2467 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2468 p_message => substr(l_fnd_err_msg,1,2000),
2469 p_request_id => fnd_global.conc_request_id,
2470 p_program_id => fnd_global.conc_program_id,
2471 p_program_application_id => fnd_global.prog_appl_id,
2472 p_message_type => 1, --ERROR
2473 x_err_code => p_err_num,
2474 x_err_msg => p_err_msg);
2475 IF(p_err_num <> 0) THEN
2476 raise proc_error;
2477 END IF;
2478 END IF;
2479
2480 --VJ: CodeRVW: End Additions for NSLBJ--
2481
2482
2483 /*-----------------------------------------------------------------+
2484 | validate operation_seq_num in wsm_starting_jobs_interface table |
2485 +-----------------------------------------------------------------*/
2486
2487 l_stmt_num := 35;
2488
2489 Begin
2490 l_stmt_num := 36;
2491
2492 select null into l_dummy
2493 from wip_operations wo
2494 where wo.organization_id = l_cur_wsji_rec.organization_id
2495 and wo.wip_entity_id = l_cur_wsji_rec.wip_entity_id
2496 and wo.operation_seq_num = l_cur_wsji_rec.operation_seq_num
2497 and decode(wo.quantity_in_queue,0, wo.quantity_waiting_to_move,
2498 wo.quantity_in_queue) > 0
2499 and l_cur_wsji_rec.transaction_type_id <> WSMPCNST.BONUS;
2500
2501 Exception
2502
2503 When NO_DATA_FOUND Then
2504
2505 set_wsji_error();
2506
2507 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2508 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'operation_seq_num in Starting Jobs');
2509 l_fnd_err_msg := FND_MESSAGE.GET;
2510 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2511
2512 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2513 p_message => substr(l_fnd_err_msg,1,2000),
2514 p_request_id => fnd_global.conc_request_id,
2515 p_program_id => fnd_global.conc_program_id,
2516 p_program_application_id => fnd_global.prog_appl_id,
2517 p_message_type => 1, --ERROR
2518 x_err_code => p_err_num,
2519 x_err_msg => p_err_msg);
2520
2521 IF(p_err_num <> 0) THEN
2522 raise proc_error;
2523 END IF;
2524
2525 End;
2526
2527
2528 /*-----------------------------------------------------------------+
2529 | Validate intraoperation_step in wsm_starting_jobs_interface |
2530 | table: For split, merge, and updates, the intraoperation step |
2531 | can only be Queue or To Move |
2532 +-----------------------------------------------------------------*/
2533
2534 l_stmt_num := 37;
2535
2536 Begin
2537 l_stmt_num := 38;
2538
2539 select null into l_dummy
2540 from wsm_split_merge_txn_interface txn
2541 where txn.header_id = l_cur_wsji_rec.wsji_header_id
2542 and txn.transaction_type_id <> WSMPCNST.BONUS
2543 AND l_cur_wsji_rec.intraoperation_step in (WIP_CONSTANTS.QUEUE, WIP_CONSTANTS.TOMOVE);
2544
2545 Exception
2546
2547 When NO_DATA_FOUND Then
2548
2549 set_wsji_error();
2550
2551 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2552 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'intraoperation_step in Starting Jobs');
2553 l_fnd_err_msg := FND_MESSAGE.GET;
2554 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2555
2556 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2557 p_message => substr(l_fnd_err_msg,1,2000),
2558 p_request_id => fnd_global.conc_request_id,
2559 p_program_id => fnd_global.conc_program_id,
2560 p_program_application_id => fnd_global.prog_appl_id,
2561 p_message_type => 1, --ERROR
2562 x_err_code => p_err_num,
2563 x_err_msg => p_err_msg);
2564
2565 IF(p_err_num <> 0) THEN
2566 raise proc_error;
2567 END IF;
2568
2569 End;
2570
2571 l_stmt_num := 39;
2572
2573 /*-----------------------------------------------------------------+
2574 | Validate that there arent any outside processing resources |
2575 | at the current operation. |
2576 | Bugfix 1797173: We need to check autocharge_type in WOR instead |
2577 | of bom_resources. Modified the following update stmt |
2578 +-----------------------------------------------------------------*/
2579
2580
2581 l_stmt_num := 40;
2582
2583 -- OSP FP I
2584 -- OSP Patchset I onwards, this condition is being relaxed. There can
2585 -- be OSP resources at an operation when a wip lot transaction is being
2586 -- carried out.
2587
2588 /*-----------------------------------------------------------------+
2589 | no wsm_starting_jobs_interface for bonus txn. |
2590 +-----------------------------------------------------------------*/
2591
2592
2593 -- WLTEnh. Strictly this is not necessary.
2594 -- Just check in the cursor if l_cur_wsji_rec.transaction_type_id = BONUS
2595 -- and then submit an error condition.
2596
2597 Begin
2598
2599 l_stmt_num := 41;
2600
2601 SELECT null into l_dummy
2602 FROM wsm_split_merge_txn_interface txn
2603 WHERE txn.header_id = l_cur_wsji_rec.wsji_header_id
2604 AND txn.transaction_type_id = WSMPCNST.BONUS;
2605
2606 If SQL%ROWCOUNT > 0 Then
2607 raise TOO_MANY_ROWS;
2608 End If;
2609
2610 Exception
2611
2612 When TOO_MANY_ROWS Then
2613
2614 set_wsji_error();
2615
2616 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_START_FOR_BONUS');
2617 l_fnd_err_msg := FND_MESSAGE.GET;
2618 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2619
2620 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2621 p_message => substr(l_fnd_err_msg,1,2000),
2622 p_request_id => fnd_global.conc_request_id,
2623 p_program_id => fnd_global.conc_program_id,
2624 p_program_application_id => fnd_global.prog_appl_id,
2625 p_message_type => 1, --ERROR
2626 x_err_code => p_err_num,
2627 x_err_msg => p_err_msg);
2628 IF(p_err_num <> 0) THEN
2629 raise proc_error;
2630 END IF;
2631
2632 When NO_DATA_FOUND Then
2633 NULL; -- NO ERROR Condition
2634
2635 End;
2636
2637
2638 --VJ: 0314: Start Additions for NSLBJ--
2639 /*----------------------------------------------+
2640 | Starting jobs in Merge should all be different|
2641 +----------------------------------------------*/
2642
2643 IF (l_cur_wsji_rec.transaction_type_id = WSMPCNST.MERGE) THEN
2644 l_stmt_num := 42;
2645 /* ST : Bug fix 3880193 : Commenting the below SQL as it fails when merging more than 2 jobs */
2646 /*
2647 SELECT count(*)
2648 INTO l_count
2649 FROM wsm_starting_jobs_interface wsji1,
2650 wsm_starting_jobs_interface wsji2
2651 WHERE wsji1.header_id = l_cur_wsji_rec.wsji_header_id
2652 AND wsji1.header_id = wsji2.header_id
2653 AND wsji1.rowid <> wsji2.rowid
2654 AND (l_cur_wsji_rec.wip_entity_name = wsji2.wip_entity_name
2655 OR -- Bug#2679650
2656 l_cur_wsji_rec.wip_entity_id = wsji2.wip_entity_id);
2657 -- For this sql to successfully trap this validation error ALWAYS
2658 -- atleast one record should have both columns populated at this stmt.
2659 -- For the current record use the cursor values.
2660 */
2661 /* ST : Bug fix 3880193 : Added the below SQL */
2662 SELECT count(*)
2663 INTO l_count
2664 FROM wsm_starting_jobs_interface wsji
2665 WHERE wsji.header_id = l_cur_wsji_rec.wsji_header_id
2666 AND (l_cur_wsji_rec.wip_entity_name = wsji.wip_entity_name
2667 OR
2668 l_cur_wsji_rec.wip_entity_id = wsji.wip_entity_id);
2669
2670 IF (l_count > 1) THEN
2671
2672 set_wsji_error();
2673
2674 FND_MESSAGE.SET_NAME('WSM', 'WSM_LOT_IN_USE');
2675 l_fnd_err_msg := FND_MESSAGE.GET;
2676 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2677
2678 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2679 p_message => substr(l_fnd_err_msg,1,2000),
2680 p_request_id => fnd_global.conc_request_id,
2681 p_program_id => fnd_global.conc_program_id,
2682 p_program_application_id => fnd_global.prog_appl_id,
2683 p_message_type => 1, --ERROR
2684 x_err_code => p_err_num,
2685 x_err_msg => p_err_msg);
2686 IF(p_err_num <> 0) THEN
2687 raise proc_error;
2688 END IF;
2689
2690 END IF;
2691
2692 END IF;
2693 --VJ: 0314: End Additions for NSLBJ--
2694
2695 --VJ: Start Additions for NSLBJ--
2696
2697 /*----------------------------------------------+
2698 | populate primary_item_id/routing_seq_id in |
2699 | wsm_starting_jobs_interface table, if NULL. |
2700 +----------------------------------------------*/
2701
2702
2703 --VJ: CodeRVW: Start Changes for NSLBJ--
2704
2705 Begin
2706
2707 l_stmt_num := 43;
2708
2709 SELECT wdj.primary_item_id, wdj.common_routing_sequence_id, wdj.job_type
2710 into l_cur_wsji_rec.primary_item_id, l_cur_wsji_rec.routing_seq_id, l_wsji_job_type
2711 FROM wip_discrete_jobs wdj
2712 WHERE wdj.organization_id = l_cur_wsji_rec.organization_id
2713 AND wdj.wip_entity_id = l_cur_wsji_rec.wip_entity_id
2714 AND (
2715 wdj.primary_item_id <> nvl(l_cur_wsji_rec.primary_item_id, -9999)
2716 OR
2717 wdj.common_routing_sequence_id <> nvl(l_cur_wsji_rec.routing_seq_id, -9999)
2718 );
2719
2720
2721 IF (SQL%ROWCOUNT > 0) THEN
2722
2723 set_wsji_warning();
2724
2725 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
2726 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'primary_item_id/routing_seq_id in Starting Jobs');
2727 l_fnd_err_msg := FND_MESSAGE.GET;
2728 IF (l_debug = 'Y') THEN
2729 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
2730 ||l_stmt_num||'): '||l_fnd_err_msg);
2731 END IF;
2732 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2733 p_message => substr(l_fnd_err_msg,1,2000),
2734 p_request_id => fnd_global.conc_request_id,
2735 p_program_id => fnd_global.conc_program_id,
2736 p_program_application_id => fnd_global.prog_appl_id,
2737 p_message_type => 2, -- WARNING
2738 x_err_code => p_err_num,
2739 x_err_msg => p_err_msg);
2740 IF(p_err_num <> 0) THEN
2741 raise proc_error;
2742 END IF;
2743
2744 END IF;
2745
2746 Exception
2747
2748 When NO_DATA_FOUND Then
2749 NULL; -- No error condition. No changes.
2750
2751
2752 End;
2753
2754 l_stmt_num := 44;
2755
2756 --VJ: End Additions for NSLBJ--
2757
2758 /*-----------------------------------------------------------------+
2759 | Validate common_routing_sequence_id in wsm_starting_jobs_interface|
2760 +-----------------------------------------------------------------*/
2761
2762 /*BA#1623701*/
2763
2764
2765 if (l_cur_wsji_rec.transaction_type_id = WSMPCNST.MERGE) then
2766 l_stmt_num := 45;
2767
2768 Begin
2769 l_stmt_num := 46;
2770
2771 select common_routing_sequence_id
2772 , nvl(alternate_routing_designator, '-1')
2773 , job_type -- Bug#2679705
2774 , routing_reference_id
2775 into l_rtg_seq_id
2776 , l_alt_rtg_desig
2777 , l_wsji_job_type -- Bug# 2679705
2778 , l_wsji_routing_reference_id -- Bug#2679705
2779 from wip_discrete_jobs wdj
2780 where wdj.wip_entity_id=l_cur_wsji_rec.wip_entity_id
2781 and l_cur_wsji_rec.representative_flag='Y' ;
2782
2783
2784 Exception
2785 When no_data_found then
2786 Null;
2787 End;
2788
2789 else
2790 l_stmt_num := 47;
2791
2792 Begin
2793 l_stmt_num := 48;
2794
2795 select common_routing_sequence_id
2796 , nvl(alternate_routing_designator, '-1')
2797 , job_type -- Bug#Bug2679705
2798 , routing_reference_id
2799 into l_rtg_seq_id
2800 , l_alt_rtg_desig
2801 , l_wsji_job_type -- Bug# 2679705
2802 , l_wsji_routing_reference_id -- Bug#2679705
2803 from wip_discrete_jobs wdj
2804 where wdj.wip_entity_id=l_cur_wsji_rec.wip_entity_id
2805 and l_cur_wsji_rec.representative_flag='Y' ;
2806
2807 Exception
2808 When no_data_found then
2809 Null;
2810
2811 End;
2812
2813 end if;
2814
2815 If l_debug = 'Y' Then
2816
2817 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
2818 ||l_stmt_num
2819 ||'): l_cur_wsji_rec.wip_entity_id:'||l_cur_wsji_rec.wip_entity_id
2820 ||', l_cur_wsji_rec.routing_seq_id:'||l_cur_wsji_rec.routing_seq_id
2821 ||', l_cur_wsji_rec.primary_item_id:'||l_cur_wsji_rec.primary_item_id
2822 ||', l_cur_wsji_rec.representative_flag:'||l_cur_wsji_rec.representative_flag
2823 ||', l_rtg_seq_id:'||l_rtg_seq_id
2824 ||', l_wsji_routing_reference_id:'||l_wsji_routing_reference_id
2825 ||', l_wsji_job_type:'||l_wsji_job_type
2826 ||', l_header_id:'||l_header_id);
2827
2828 End If;
2829
2830 if (
2831 (l_cur_wsji_rec.routing_seq_id <> -1) and
2832 (l_cur_wsji_rec.routing_seq_id <> l_rtg_seq_id) and
2833 ((l_cur_wsji_rec.representative_flag='Y') or (l_cur_wsji_rec.transaction_type_id <> WSMPCNST.MERGE))
2834 )
2835 then
2836
2837 -- WSJI routing_seq_id is PROVIDED -- Bug#2679705
2838 -- And it is not the right one
2839 -- And this is the representative lot or txn is not a merge txn
2840 -- Then ERROR condition.
2841
2842
2843 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_ROUTING_ID');
2844 FND_MESSAGE.SET_TOKEN('TABLE_NAME','WSM_STARTING_JOBS_INTERFACE');
2845 l_fnd_err_msg := FND_MESSAGE.GET;
2846 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2847
2848 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2849 p_message => substr(l_fnd_err_msg,1,2000),
2850 p_request_id => fnd_global.conc_request_id,
2851 p_program_id => fnd_global.conc_program_id,
2852 p_program_application_id => fnd_global.prog_appl_id,
2853 p_message_type => 1, --ERROR
2854 x_err_code => p_err_num,
2855 x_err_msg => p_err_msg);
2856 IF(p_err_num <> 0) THEN
2857 raise proc_error;
2858 END IF;
2859
2860 elsif (
2861 (l_cur_wsji_rec.routing_seq_id <> -1) and
2862 (l_cur_wsji_rec.representative_flag<>'Y') and
2863 (l_cur_wsji_rec.transaction_type_id=WSMPCNST.MERGE)
2864 ) then
2865
2866 -- WSJI routing_seq_id is PROVIDED -- Bug#2679705
2867 -- And this is the representative lot
2868 -- And the txn is a merge txn
2869 -- Check if the routing_seq_id is valid for the routing assembly.
2870
2871 l_stmt_num := 49;
2872 --VJ: Start Changes for NSLBJ--
2873 --Changed the sql since org_id has been added to WSJI now--
2874
2875 UPDATE wsm_starting_jobs_interface wsji
2876 SET wsji.error_message = l_fnd_generic_err_msg
2877 WHERE wsji.header_id = l_header_id
2878 and NOT EXISTS (select 1
2879 from bom_operational_routings bor
2880 where bor.routing_sequence_id = l_cur_wsji_rec.routing_seq_id
2881 and ((bor.assembly_item_id = l_cur_wsji_rec.primary_item_id
2882 and l_wsji_job_type = WIP_CONSTANTS.STANDARD) -- Bug#2679705
2883 OR
2884 (bor.assembly_item_id = l_wsji_routing_reference_id
2885 and l_wsji_job_type = WIP_CONSTANTS.NONSTANDARD) -- Bug#2679705
2886 )
2887 and bor.organization_id = l_cur_wsji_rec.organization_id
2888 and bor.cfm_routing_flag=3);
2889
2890 --VJ: End Changes for NSLBJ--
2891
2892 IF (SQL%ROWCOUNT > 0) THEN
2893 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
2894 --bugfix 1922146: routing_sequence_id instead of common_routing_sequence_id
2895 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'routing_sequence_id in Starting Jobs');
2896 l_fnd_err_msg := FND_MESSAGE.GET;
2897 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2898
2899 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
2900 p_message => substr(l_fnd_err_msg,1,2000),
2901 p_request_id => fnd_global.conc_request_id,
2902 p_program_id => fnd_global.conc_program_id,
2903 p_program_application_id => fnd_global.prog_appl_id,
2904 p_message_type => 1, --ERROR
2905 x_err_code => p_err_num,
2906 x_err_msg => p_err_msg);
2907 IF(p_err_num <> 0) THEN
2908 raise proc_error;
2909 END IF;
2910 END IF;
2911 END IF;
2912
2913 /*EA#1623701*/
2914
2915
2916 -- Begin validation logic change for NSO-WLT
2917 /*---------------------------------------------------------------------+
2918 | Validate that the starting operation is a standard op when txn_type |
2919 | is merge txn in wsm_starting_jobs_interface |
2920 +---------------------------------------------------------------------*/
2921
2922
2923 if (l_cur_wsji_rec.transaction_type_id = WSMPCNST.MERGE) then
2924
2925
2926 BEGIN
2927
2928 l_stmt_num := 50;
2929
2930 SELECT bso.standard_operation_id
2931 INTO l_merge_std_op_id
2932 FROM wsm_starting_jobs_interface wsji,
2933 wip_operations wo,
2934 bom_standard_operations bso
2935 WHERE wsji.header_id = l_cur_wsji_rec.wsji_header_id
2936 --AND NVL(wsji.representative_flag, l_cur_wsji_rec.representative_flag) = 'Y'
2937 AND NVL(wsji.wip_entity_id, l_cur_wsji_rec.wip_entity_id) = wo.wip_entity_id
2938 AND wsji.operation_seq_num = wo.operation_seq_num
2939 AND wo.standard_operation_id = bso.standard_operation_id;
2940
2941 EXCEPTION
2942
2943 when NO_DATA_FOUND then
2944
2945 set_wsji_error();
2946
2947 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_MERGE_AT_NSO'); --BBK
2948 l_fnd_err_msg := FND_MESSAGE.GET;
2949
2950 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2951 l_error_num := l_stmt_num; -- Bug#2099775
2952
2953 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2954 p_header_id => l_header_id,
2955 p_message => substr(l_fnd_err_msg,1,2000),
2956 p_request_id => fnd_global.conc_request_id,
2957 p_program_id => fnd_global.conc_program_id,
2958 p_program_application_id => fnd_global.prog_appl_id,
2959 p_message_type => 1, --ERROR
2960 x_err_code => p_err_num,
2961 x_err_msg => p_err_msg);
2962
2963 IF(p_err_num <> 0) THEN
2964 raise proc_error;
2965 END IF;
2966
2967 -- Bug#2099775 added to handle too_many_rows when at a Repeated stdoperation.
2968 when too_many_rows Then
2969
2970 IF (l_debug = 'Y') THEN
2971 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
2972 ||l_stmt_num||') Standard Operation Id ' ||
2973 l_merge_std_op_id || ' Repeats. Valid for Merge;' );
2974 END IF;
2975 null;
2976
2977 -- BA: NSO-WLT
2978 when OTHERS then
2979
2980 set_wsji_error();
2981
2982 l_fnd_err_msg := SQLERRM;
2983 l_error_num := l_stmt_num;
2984 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
2985
2986 --Start Additions to fix bug #2265237--
2987 --Whenever there's error, error_message column in interface table should be updated.
2988 l_stmt_num := 51;
2989 UPDATE wsm_starting_jobs_interface wsji
2990 SET wsji.error_message = l_fnd_generic_err_msg
2991 WHERE wsji.header_id = l_header_id;
2992 --End Additions to fix bug #2265237--
2993
2994
2995 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
2996 p_header_id => l_header_id,
2997 p_message => substr(l_fnd_err_msg,1,2000),
2998 p_request_id => fnd_global.conc_request_id,
2999 p_program_id => fnd_global.conc_program_id,
3000 p_program_application_id => fnd_global.prog_appl_id,
3001 p_message_type => 1, --ERROR
3002 x_err_code => p_err_num,
3003 x_err_msg => p_err_msg);
3004
3005 IF(p_err_num <> 0) THEN
3006 raise proc_error;
3007 END IF;
3008
3009 END;
3010
3011 end if; -- if txn_type is MERGE
3012
3013 -- End validation logic change for NSO-WLT
3014
3015 -- Add Changes for OSP FP I
3016
3017 l_stmt_num := 52;
3018
3019
3020 if ( l_cur_wsji_rec.transaction_type_id in ( WSMPCNST.SPLIT,
3021 WSMPCNST.MERGE,
3022 WSMPCNST.UPDATE_ASSEMBLY,
3023 WSMPCNST.UPDATE_ROUTING )) then
3024
3025 l_stmt_num := 53;
3026
3027 if wip_osp.po_req_exists( l_cur_wsji_rec.wip_entity_id,
3028 NULL,
3029 l_cur_wsji_rec.organization_id,
3030 l_cur_wsji_rec.operation_seq_num,
3031 5 ) then
3032
3033 FND_MESSAGE.SET_NAME('WSM', 'WSM_OP_PURCHASE_REQ');
3034 l_fnd_err_msg := FND_MESSAGE.GET;
3035
3036 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
3037 p_header_id => l_header_id,
3038 p_message => substr(l_fnd_err_msg,1,2000),
3039 p_request_id => fnd_global.conc_request_id,
3040 p_program_id => fnd_global.conc_program_id,
3041 p_program_application_id => fnd_global.prog_appl_id,
3042 p_message_type => 2, -- WARNING
3043 x_err_code => p_err_num,
3044 x_err_msg => p_err_msg);
3045
3046 if (p_err_num <> 0) THEN
3047 raise proc_error;
3048 end if;
3049 end if ;
3050
3051 end if;
3052
3053 -- End Changes for OSP FP I
3054
3055
3056 /* BA WLTEnh */
3057
3058 -- Now perform a single update for all the defaulted columns;
3059 -- wip_entity_name, wip_entity_id
3060 -- respresentative_flag
3061 -- primary_item_id, routing_seq_id
3062
3063 l_stmt_num := 54;
3064
3065 Update wsm_starting_jobs_interface wsji
3066 Set wsji.wip_entity_id = l_cur_wsji_rec.wip_entity_id
3067 , wsji.wip_entity_name = l_cur_wsji_rec.wip_entity_name
3068 , wsji.representative_flag = l_cur_wsji_rec.representative_flag
3069 , wsji.primary_item_id = l_cur_wsji_rec.primary_item_id
3070 , wsji.routing_seq_id = l_cur_wsji_rec.routing_seq_id
3071 , wsji.organization_id = l_cur_wsji_rec.organization_id
3072 Where wsji.rowid = l_cur_wsji_rec.wsji_rowid
3073 and l_wsji_error_flag <> 1;
3074
3075 If SQL%ROWCOUNT > 0 and l_debug = 'Y' THEN
3076 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3077 ||l_stmt_num||'): '|| ' Populated WSJI for modified columns.');
3078 End If;
3079
3080 If l_wsji_error_flag = 1 Then -- Only a Single UPDATE on WSMTI
3081
3082 l_stmt_num := 55;
3083
3084 Update wsm_starting_jobs_interface wsji
3085 SET wsji.error_message = l_fnd_generic_err_msg
3086 , wsji.process_status = WIP_CONSTANTS.ERROR
3087 WHERE wsji.rowid = l_cur_wsji_rec.wsji_rowid;
3088
3089 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3090 ||l_stmt_num||'): '
3091 ||'Record for Header Id '
3092 ||l_cur_wsji_rec.wsji_header_id
3093 ||' set to ERROR in WSJI.');
3094
3095 l_stmt_num := 56; -- Bug#2682603
3096 Update wsm_resulting_jobs_interface wrji
3097 Set wrji.error_message = l_fnd_generic_err_msg
3098 , wrji.process_status = WIP_CONSTANTS.ERROR
3099 Where wrji.header_id = l_cur_wsji_rec.wsji_header_id;
3100
3101 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3102 ||l_stmt_num||'): '
3103 ||'Record for Header Id '
3104 ||l_cur_wsji_rec.wsji_header_id
3105 ||' set to ERROR in WRJI.');
3106
3107 l_stmt_num := 57;
3108 Update wsm_split_merge_txn_interface wsmti
3109 SET wsmti.error_message = l_fnd_generic_err_msg
3110 , wsmti.process_status = WIP_CONSTANTS.ERROR
3111 Where wsmti.header_id = l_cur_wsji_rec.wsji_header_id;
3112
3113 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3114 ||l_stmt_num||'): '
3115 ||'Record for Header Id '
3116 ||l_cur_wsji_rec.wsji_header_id
3117 ||' set to ERROR in WSMTI.');
3118
3119 p_err_num := WIP_CONSTANTS.ERROR;
3120 p_err_msg := l_fnd_err_msg;
3121 raise proc_error;
3122
3123 End If;
3124
3125 --------------------------------------------------------------------------
3126 ----------- End of WSJI Validations - Inside cursor C_WSJI ------------
3127 --------------------------------------------------------------------------
3128
3129 END LOOP;
3130
3131 CLOSE C_WSJI;
3132
3133 -------------------------------------------------------------------
3134 -------------------------------------------------------------------
3135 ------- End validations wSji -------------
3136 -------------------------------------------------------------------
3137 -------------------------------------------------------------------
3138
3139
3140
3141 -------------------------------------------------------------------
3142 -------------------------------------------------------------------
3143 ------- Begin validations wRji -------------
3144 -------------------------------------------------------------------
3145 -------------------------------------------------------------------
3146
3147 l_stmt_num := 58;
3148
3149 OPEN C_WRJI;
3150 LOOP
3151 FETCH C_WRJI into
3152 l_header_id,
3153 l_wrji_rtg_seq_id,
3154 l_wrji_alt_rtg_desig,
3155 l_wrji_bom_seq_id,
3156 l_wrji_alt_bom_desig,
3157 l_txn_type,
3158 l_organization_id, -- bugfix 1922146: added l_organization_id. --2099827
3159 l_job_name,
3160 l_rtg_rev, -- ADD: CZH.I_OED-1
3161 l_rtg_rev_date, -- ADD: CZH.I_OED-1
3162 l_bom_revision, -- Bug#2662639
3163 l_bom_revision_date, -- Bug#2662639
3164 --VJ: CodeRVW: Start Additions for NSLBJ--
3165 l_job_type,
3166 l_we_name,
3167 l_primary_item_id,
3168 l_routing_reference_id,
3169 l_bom_reference_id,
3170 l_scheduled_start_date,
3171 l_scheduled_completion_date,
3172 l_start_quantity,
3173 l_net_quantity,
3174 l_class_code,
3175 l_completion_subinventory,
3176 l_completion_locator_id
3177 , l_wrji_rowid
3178 --VJ: CodeRVW: Start Additions for NSLBJ--
3179 , l_split_has_update_assy ;
3180
3181 EXIT WHEN C_WRJI%NOTFOUND;
3182
3183 l_stmt_num := 59;
3184
3185 IF (l_debug = 'Y') THEN
3186 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): Processing WRJI header_id='||l_header_id);
3187 FND_FILE.PUT_LINE(FND_FILE.LOG, 'l_wrji_rtg_seq_id='||l_wrji_rtg_seq_id||
3188 ', l_wrji_alt_rtg_desig='||l_wrji_alt_rtg_desig||
3189 ', l_wrji_bom_seq_id='||l_wrji_bom_seq_id||
3190 ', l_wrji_alt_bom_desig='||l_wrji_alt_bom_desig||
3191 ', l_txn_type='||l_txn_type||
3192 ', l_organization_id='||l_organization_id||
3193 ', l_job_name='||l_job_name||
3194 ', l_job_type='||l_job_type||
3195 ', l_we_name='||l_we_name||
3196 ', l_primary_item_id='||l_primary_item_id||
3197 ', l_routing_reference_id='||l_routing_reference_id||
3198 ', l_bom_reference_id='||l_bom_reference_id||
3199 ', l_scheduled_start_date='||l_scheduled_start_date||
3200 ', l_scheduled_completion_date='||l_scheduled_completion_date||
3201 ', l_start_quantity='||l_start_quantity||
3202 ', l_net_quantity='||l_net_quantity||
3203 ', l_class_code='||l_class_code||
3204 ', l_completion_subinventory='||l_completion_subinventory||
3205 ', l_completion_locator_id='||l_completion_locator_id);
3206 END IF;
3207
3208 /*BA WLTEnh */
3209 WSMPVLDT.l_wrji_error_flag := 0; -- Important to reset this for every header.
3210 /*EA WLTEnh */
3211
3212 --SpUA begin
3213
3214 /*--------------------------------------------------------+
3215 | Validate Split_Has_Update_Assy Flag |
3216 +---------------------------------------------------------*/
3217
3218 l_stmt_num := 60;
3219
3220 /*For Split txns only. If flag is 1, must update assembly.
3221 If flag is 0, assembly must be same. If flag is some other value, error out*/
3222
3223 IF (l_txn_type = WSMPCNST.SPLIT) THEN
3224 l_stmt_num := 61;
3225
3226 UPDATE wsm_resulting_jobs_interface wrji
3227 SET split_has_update_assy = 0
3228 WHERE wrji.header_id = l_header_id
3229 AND wrji.split_has_update_assy IS NULL;
3230
3231 --if l_split_has_update_assy IS NULL then
3232 --l_split_has_update_assy = 0;
3233 --end if;
3234
3235 l_stmt_num := 62;
3236
3237 select primary_item_id
3238 into l_sj_item_id
3239 from wsm_starting_jobs_interface wsji
3240 where header_id = l_header_id;
3241
3242 if (l_split_has_update_assy = 0
3243 AND l_primary_item_id <> l_sj_item_id)
3244 OR
3245 (l_split_has_update_assy = 1
3246 AND l_primary_item_id = l_sj_item_id)
3247 OR
3248 (l_split_has_update_assy NOT IN (0, 1))
3249 then
3250 l_stmt_num := 63;
3251
3252 update wsm_resulting_jobs_interface wrji
3253 SET wrji.error_message = l_fnd_generic_err_msg
3254 , wrji.process_status = WIP_CONSTANTS.ERROR -- WLTEnh
3255 WHERE wrji.header_id = l_header_id;
3256
3257
3258 set_wrji_error(); -- WLTEnh
3259
3260 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3261 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Split Has Update Assy Flag in Resulting Jobs');
3262 l_fnd_err_msg := FND_MESSAGE.GET;
3263 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3264
3265 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3266 p_message => substr(l_fnd_err_msg,1,2000),
3267 p_request_id => fnd_global.conc_request_id,
3268 p_program_id => fnd_global.conc_program_id,
3269 p_program_application_id => fnd_global.prog_appl_id,
3270 p_message_type => 1, --ERROR
3271 x_err_code => p_err_num,
3272 x_err_msg => p_err_msg);
3273 IF(p_err_num <> 0) THEN
3274 raise proc_error;
3275 END IF;
3276 end if;
3277
3278 ELSE /* txn_types other than Split*/
3279 NULL;
3280
3281 END IF;
3282 --SpUA end
3283
3284 --VJ: Start move following code to start of validations to fix bug #2315397--
3285 /*------------------------------------------------------------+
3286 | validate job_type in wsm_resulting_jobs_interface table: |
3287 | It should be the same as the job_types of the starting jobs |
3288 +------------------------------------------------------------*/
3289
3290 l_stmt_num := 64;
3291 update wsm_resulting_jobs_interface wrji
3292 SET wrji.error_message = l_fnd_generic_err_msg
3293 , wrji.process_status = WIP_CONSTANTS.ERROR -- WLTEnh
3294 WHERE wrji.header_id = l_header_id
3295 AND l_txn_type = WSMPCNST.BONUS --VJ: CodeRVW: Added for NSLBJ--
3296 AND wrji.job_type IS NOT NULL
3297 AND wrji.job_type NOT IN (WIP_CONSTANTS.STANDARD, WIP_CONSTANTS.NONSTANDARD); --Fixed bug #2341915
3298
3299 IF (SQL%ROWCOUNT > 0) THEN
3300
3301 set_wrji_error(); -- WLTEnh
3302
3303 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3304 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'job_type in Resulting Jobs');
3305 l_fnd_err_msg := FND_MESSAGE.GET;
3306 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3307
3308 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3309 p_message => substr(l_fnd_err_msg,1,2000),
3310 p_request_id => fnd_global.conc_request_id,
3311 p_program_id => fnd_global.conc_program_id,
3312 p_program_application_id => fnd_global.prog_appl_id,
3313 p_message_type => 1, --ERROR
3314 x_err_code => p_err_num,
3315 x_err_msg => p_err_msg);
3316 IF(p_err_num <> 0) THEN
3317 raise proc_error;
3318 END IF;
3319 END IF;
3320
3321 l_stmt_num := 65;
3322 --VJ: Start additions to fix bug #2341915--
3323 update wsm_resulting_jobs_interface wrji
3324 SET wrji.job_type = WIP_CONSTANTS.STANDARD
3325 WHERE wrji.header_id = l_header_id
3326 AND l_txn_type = WSMPCNST.BONUS
3327 AND wrji.job_type IS NULL;
3328
3329 IF (SQL%ROWCOUNT > 0) THEN
3330 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3331 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'job_type in Resulting Jobs');
3332 l_fnd_err_msg := FND_MESSAGE.GET;
3333
3334 If l_debug = 'Y' Then
3335 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3336 ||l_stmt_num||'): '||l_fnd_err_msg);
3337 End If;
3338
3339 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3340 p_message => substr(l_fnd_err_msg,1,2000),
3341 p_request_id => fnd_global.conc_request_id,
3342 p_program_id => fnd_global.conc_program_id,
3343 p_program_application_id => fnd_global.prog_appl_id,
3344 p_message_type => 2, --WARNING
3345 x_err_code => p_err_num,
3346 x_err_msg => p_err_msg);
3347 END IF;
3348
3349 --VJ: End additions to fix bug #2341915--
3350
3351 l_stmt_num := 66;
3352 --VJ: CodeRVW: Start Changes for NSLBJ--
3353 IF (l_txn_type <> WSMPCNST.BONUS) THEN
3354 --VJ: CodeRVW: End Changes for NSLBJ--
3355
3356 l_stmt_num := 67;
3357
3358 --VJ: CodeRVW: Start Additions for NSLBJ--
3359 SELECT min(wdj.job_type), max(wdj.job_type)
3360 INTO l_min_job_type, l_max_job_type
3361 FROM wsm_starting_jobs_interface wsji,
3362 wip_discrete_jobs wdj,
3363 wip_entities we
3364 WHERE wsji.header_id = l_header_id
3365 AND (
3366 (wsji.wip_entity_id = wdj.wip_entity_id
3367 and wsji.wip_entity_id = we.wip_entity_id)
3368 OR
3369 (wsji.wip_entity_name = we.wip_entity_name
3370 AND wsji.organization_id = we.organization_id
3371 AND we.wip_entity_id = wdj.wip_entity_id
3372 and wsji.wip_entity_id is NULL)
3373 );
3374
3375 If l_debug = 'Y' Then
3376 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3377 ||l_stmt_num||'): Min Job Type: '||
3378 l_min_job_type || ', Max Job Type: '||l_max_job_type);
3379 End If;
3380
3381 IF (l_min_job_type = l_max_job_type) THEN
3382 l_stmt_num := 68;
3383
3384 update wsm_resulting_jobs_interface wrji
3385 SET wrji.job_type = l_min_job_type
3386 WHERE wrji.header_id = l_header_id
3387 and wrji.job_type IS NULL;
3388
3389 IF (SQL%ROWCOUNT > 0) THEN
3390 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3391 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'job_type in Resulting Jobs');
3392 l_fnd_err_msg := FND_MESSAGE.GET;
3393 If l_debug = 'Y' Then
3394 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3395 ||l_stmt_num||'): '||l_fnd_err_msg);
3396 End If;
3397
3398 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3399 p_message => substr(l_fnd_err_msg,1,2000),
3400 p_request_id => fnd_global.conc_request_id,
3401 p_program_id => fnd_global.conc_program_id,
3402 p_program_application_id => fnd_global.prog_appl_id,
3403 p_message_type => 2, --WARNING
3404 x_err_code => p_err_num,
3405 x_err_msg => p_err_msg);
3406 END IF;
3407
3408 l_stmt_num := 69;
3409
3410 update wsm_resulting_jobs_interface wrji
3411 SET wrji.error_message = l_fnd_generic_err_msg
3412 , wrji.process_status = WIP_CONSTANTS.ERROR -- WLTEnh
3413 WHERE wrji.header_id = l_header_id
3414 and wrji.job_type IS NOT NULL
3415 AND wrji.job_type <> l_min_job_type;
3416
3417 IF (SQL%ROWCOUNT > 0) THEN
3418 set_wrji_error(); -- WLTEnh
3419 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3420 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'job_type in Resulting Jobs');
3421 l_fnd_err_msg := FND_MESSAGE.GET;
3422 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3423
3424 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3425 p_message => substr(l_fnd_err_msg,1,2000),
3426 p_request_id => fnd_global.conc_request_id,
3427 p_program_id => fnd_global.conc_program_id,
3428 p_program_application_id => fnd_global.prog_appl_id,
3429 p_message_type => 1, --ERROR
3430 x_err_code => p_err_num,
3431 x_err_msg => p_err_msg);
3432 IF(p_err_num <> 0) THEN
3433 raise proc_error;
3434 END IF;
3435 END IF;
3436 ELSE --IF (l_min_job_type <> l_max_job_type)
3437 set_wrji_error(); -- WLTEnh
3438 FND_MESSAGE.SET_NAME('WSM', 'WSM_DIFF_JOB_TYP');
3439 l_fnd_err_msg := FND_MESSAGE.GET;
3440 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3441
3442 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3443 p_message => substr(l_fnd_err_msg,1,2000),
3444 p_request_id => fnd_global.conc_request_id,
3445 p_program_id => fnd_global.conc_program_id,
3446 p_program_application_id => fnd_global.prog_appl_id,
3447 p_message_type => 1, --ERROR
3448 x_err_code => p_err_num,
3449 x_err_msg => p_err_msg);
3450 IF(p_err_num <> 0) THEN
3451 raise proc_error;
3452 END IF;
3453
3454 END IF;
3455 --VJ: CodeRVW: End Additions for NSLBJ--
3456
3457 END IF;
3458
3459 /*----------------------------------------------------------------+
3460 | validate organization_id in wsm_resulting_jobs_interface table |
3461 +-----------------------------------------------------------------*/
3462
3463 l_stmt_num := 70;
3464 update wsm_resulting_jobs_interface wrji
3465 SET organization_id = (SELECT organization_id
3466 FROM wsm_split_merge_txn_interface
3467 WHERE header_id = wrji.header_id
3468 AND process_status = WIP_CONSTANTS.RUNNING
3469 AND internal_group_id = WSMPLOAD.G_GROUP_ID)
3470 WHERE wrji.header_id = l_header_id
3471 AND wrji.organization_id IS NULL;
3472
3473 IF (SQL%ROWCOUNT > 0) THEN
3474 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3475 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'organization_id in Resulting Jobs');
3476 l_fnd_err_msg := FND_MESSAGE.GET;
3477
3478 If l_debug = 'Y' Then
3479 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3480 ||l_stmt_num||'): '||l_fnd_err_msg);
3481 End If;
3482
3483 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
3484 p_header_id => l_header_id,
3485 p_message => substr(l_fnd_err_msg,1,2000),
3486 p_request_id => fnd_global.conc_request_id,
3487 p_program_id => fnd_global.conc_program_id,
3488 p_program_application_id => fnd_global.prog_appl_id,
3489 p_message_type => 2, --WARNING
3490 x_err_code => p_err_num,
3491 x_err_msg => p_err_msg);
3492 IF(p_err_num <> 0) THEN
3493 raise proc_error;
3494 END IF;
3495 END IF;
3496
3497 l_stmt_num := 71;
3498 update wsm_resulting_jobs_interface wrji
3499 SET wrji.error_message = l_fnd_generic_err_msg
3500 WHERE wrji.header_id = l_header_id
3501 and not exists (select null
3502 from wsm_split_merge_txn_interface txn
3503 where txn.header_id = wrji.header_id
3504 and txn.organization_id = wrji.organization_id
3505 and txn.process_status = WIP_CONSTANTS.RUNNING
3506 AND txn.internal_group_id = WSMPLOAD.G_GROUP_ID);
3507
3508
3509 IF (SQL%ROWCOUNT > 0) THEN
3510 set_wrji_error(); -- WLTEnh
3511 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3512 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'organization_id in Resulting Jobs');
3513 l_fnd_err_msg := FND_MESSAGE.GET;
3514 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3515
3516 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3517 p_message => substr(l_fnd_err_msg,1,2000),
3518 p_request_id => fnd_global.conc_request_id,
3519 p_program_id => fnd_global.conc_program_id,
3520 p_program_application_id => fnd_global.prog_appl_id,
3521 p_message_type => 1, --ERROR
3522 x_err_code => p_err_num,
3523 x_err_msg => p_err_msg);
3524 IF(p_err_num <> 0) THEN
3525 raise proc_error;
3526 END IF;
3527 END IF;
3528
3529 /* ST bug fix 3493984 : Update the resulting lot's start and completion dates */
3530 IF l_txn_type NOT IN (WSMPCNST.BONUS) THEN
3531
3532 BEGIN
3533 select dis.scheduled_start_date,
3534 dis.scheduled_completion_date
3535 into l_scheduled_start_date,
3536 l_scheduled_completion_date
3537 from wip_discrete_jobs dis,
3538 wsm_starting_jobs_interface sj
3539 where sj.header_id = l_header_id
3540 and sj.wip_entity_id = dis.wip_entity_id
3541 and sj.representative_flag = 'Y';
3542 EXCEPTION
3543 WHEN OTHERS THEN
3544
3545 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_START_END_DATES');
3546 l_fnd_err_msg := FND_MESSAGE.GET;
3547 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
3548
3549 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3550 p_message => substr(l_fnd_err_msg,1,2000),
3551 p_request_id => fnd_global.conc_request_id,
3552 p_program_id => fnd_global.conc_program_id,
3553 p_program_application_id => fnd_global.prog_appl_id,
3554 p_message_type => 1, --ERROR
3555 x_err_code => p_err_num,
3556 x_err_msg => p_err_msg);
3557
3558 raise proc_error;
3559 END;
3560
3561 update wsm_resulting_jobs_interface rj
3562 set scheduled_start_date = l_scheduled_start_date,
3563 scheduled_completion_date = l_scheduled_completion_date
3564 where rj.process_status = WIP_CONSTANTS.RUNNING
3565 and rj.internal_group_id = WSMPLOAD.G_GROUP_ID
3566 and rj.header_id = l_header_id;
3567
3568 IF (SQL%ROWCOUNT > 0) THEN
3569 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3570 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'scheduled_start_date/scheduled_completion_date in Resulting Jobs');
3571 l_fnd_err_msg := FND_MESSAGE.GET;
3572 If l_debug = 'Y' Then
3573 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3574 ||l_stmt_num||'): '||l_fnd_err_msg);
3575 End If;
3576
3577 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
3578 p_header_id => l_header_id,
3579 p_message => substr(l_fnd_err_msg,1,2000),
3580 p_request_id => fnd_global.conc_request_id,
3581 p_program_id => fnd_global.conc_program_id,
3582 p_program_application_id => fnd_global.prog_appl_id,
3583 p_message_type => 2, --WARNING
3584 x_err_code => p_err_num,
3585 x_err_msg => p_err_msg);
3586 IF(p_err_num <> 0) THEN
3587 raise proc_error;
3588 END IF;
3589 END IF;
3590
3591 END IF;
3592 /* ST bug fix 3493984 : check for the Txn type end */
3593
3594
3595 --VJ: End move following code to start of validations to fix bug #2315397--
3596
3597 --Start fix for bug #2345536, Moved this call to first populate columns--
3598 --VJ: Start Additions for NSLBJ--
3599 --Moved this call from WSMPLOAD.VALIDATE_AND_LOAD to here--
3600 /*-----------------------------------------------------------------+
3601 | Default values and populate some column values |
3602 +-----------------------------------------------------------------*/
3603 l_stmt_num := 72;
3604 populate_columns(l_header_id, -- WLTEnh
3605 l_wrji_rowid, -- SpUA
3606 p_err_msg,
3607 p_err_num);
3608
3609 IF (p_err_num <> 0) THEN
3610 FND_FILE.PUT_LINE(FND_FILE.LOG,'Errored rows in WSJI/WRJI in populate_columns='||SQL%ROWCOUNT);
3611 raise proc_error;
3612 END IF;
3613
3614 --VJ: End Additions for NSLBJ--
3615 --End fix for bug #2345536, Moved this call to first populate columns--
3616
3617 --VJ: Start Additions to fix bug #2315397--
3618 l_stmt_num := 73;
3619 SELECT wrji.job_type,
3620 wrji.organization_id,
3621 --VJ: Added foll columns to fix bug #2345536--
3622 wrji.net_quantity,
3623 wrji.class_code,
3624 wrji.completion_subinventory,
3625 wrji.completion_locator_id
3626 INTO l_job_type,
3627 l_organization_id,
3628 --VJ: Added foll columns to fix bug #2345536--
3629 l_net_quantity,
3630 l_class_code,
3631 l_completion_subinventory,
3632 l_completion_locator_id
3633 FROM wsm_resulting_jobs_interface wrji
3634 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
3635 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
3636 AND wrji.header_id = l_header_id
3637 AND wrji.wip_entity_name = l_we_name;
3638
3639 IF (l_debug = 'Y') THEN
3640 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
3641 'l_job_type='||l_job_type||
3642 ', l_organization_id='||l_organization_id||
3643 ', l_net_quantity='||l_net_quantity||
3644 ', l_class_code='||l_class_code||
3645 ', l_completion_subinventory='||l_completion_subinventory||
3646 ', l_completion_locator_id='||l_completion_locator_id);
3647 END IF;
3648 --VJ: End Additions to fix bug #2315397--
3649
3650 --VJ: Start Additions for NSLBJ--
3651
3652 IF (l_job_type = WIP_CONSTANTS.NONSTANDARD) THEN --End beforel_stmt_num := 94;--
3653
3654 l_stmt_num := 74;
3655 --VJ: 0313: Start Additions for NSLBJ--
3656 IF (l_wrji_alt_rtg_desig = '-1') THEN -- it is NULL
3657 l_nslbj_alt_rtg_desig := NULL;
3658 ELSE
3659 l_nslbj_alt_rtg_desig := l_wrji_alt_rtg_desig;
3660 END IF;
3661
3662 IF (l_wrji_alt_bom_desig = '-1') THEN -- it is NULL
3663 l_nslbj_alt_bom_desig := NULL;
3664 ELSE
3665 l_nslbj_alt_bom_desig := l_wrji_alt_bom_desig;
3666 END IF;
3667 --VJ: 0313: End Additions for NSLBJ--
3668
3669 IF (l_txn_type = WSMPCNST.UPDATE_ROUTING) THEN
3670
3671 l_stmt_num := 75;
3672 IF (l_debug = 'Y') THEN
3673 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): Processing Upd Routing');
3674 END IF;
3675 l_stmt_num := 76;
3676
3677 SELECT wdj.bom_reference_id,
3678 wdj.common_bom_sequence_id,
3679 wdj.alternate_bom_designator,
3680 wdj.bom_revision,
3681 wdj.bom_revision_date,
3682 wdj.routing_revision,
3683 wdj.routing_revision_date
3684 INTO l_wdj_bom_ref_id,
3685 l_wdj_bom_seq_id,
3686 l_wdj_alt_bom_desig,
3687 l_wdj_bom_rev,
3688 l_wdj_bom_rev_dt,
3689 l_wdj_rtg_rev,
3690 l_wdj_rtg_rev_dt
3691 FROM wip_discrete_jobs wdj,
3692 wip_entities we
3693 --VJ: CodeRVW: Start Changes for NSLBJ--
3694 WHERE wdj.wip_entity_id = we.wip_entity_id
3695 AND wdj.organization_id = we.organization_id
3696 AND we.wip_entity_name = l_we_name --wrji.wip_entity_name
3697 AND wdj.organization_id = l_organization_id; --wrji.organization_id
3698 --VJ: CodeRVW: End Changes for NSLBJ--
3699
3700 IF (l_bom_reference_id IS NOT NULL AND --Takes care of bug #2352344 for NSLBJ--
3701 (l_wdj_bom_ref_id <> l_bom_reference_id)) THEN
3702
3703 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3704 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'bom_reference_id in Resulting Jobs');
3705 l_fnd_err_msg := FND_MESSAGE.GET;
3706
3707 l_stmt_num := 78;
3708 UPDATE wsm_resulting_jobs_interface
3709 SET error_message = l_fnd_err_msg
3710 WHERE header_id = l_header_id;
3711
3712 set_wrji_error(); -- WLTEnh
3713 IF (l_debug = 'Y') THEN
3714 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3715 ||l_stmt_num||'): '||l_fnd_err_msg);
3716 END IF;
3717
3718 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3719 p_message => substr(l_fnd_err_msg,1,2000),
3720 p_request_id => fnd_global.conc_request_id,
3721 p_program_id => fnd_global.conc_program_id,
3722 p_program_application_id => fnd_global.prog_appl_id,
3723 p_message_type => 1, -- ERROR
3724 x_err_code => p_err_num,
3725 x_err_msg => p_err_msg);
3726 raise proc_error;
3727
3728 -- Start : Added code to fix bug #3196002--
3729 ELSIF l_bom_reference_id IS NULL THEN
3730 l_stmt_num := 79;
3731
3732 UPDATE wsm_resulting_jobs_interface
3733 SET bom_reference_id = l_wdj_bom_ref_id,
3734 alternate_bom_designator = l_wdj_alt_bom_desig,
3735 common_bom_sequence_id = l_wdj_bom_seq_id,
3736 bom_revision_date = l_wdj_bom_rev_dt,
3737 bom_revision = l_wdj_bom_rev
3738 WHERE header_id = l_header_id;
3739
3740 l_bom_reference_id := l_wdj_bom_ref_id;
3741 l_wrji_alt_bom_desig := l_wdj_alt_bom_desig;
3742 l_wrji_bom_seq_id := l_wdj_bom_seq_id;
3743 l_bom_revision_date := l_wdj_bom_rev_dt;
3744 l_bom_revision := l_wdj_bom_rev;
3745
3746 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3747 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Bom information in Resulting Jobs');
3748 l_fnd_err_msg := FND_MESSAGE.GET;
3749 IF (l_debug = 'Y') THEN
3750 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3751 ||l_stmt_num||'): '||l_fnd_err_msg);
3752 END IF;
3753 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3754 p_message => substr(l_fnd_err_msg,1,2000),
3755 p_request_id => fnd_global.conc_request_id,
3756 p_program_id => fnd_global.conc_program_id,
3757 p_program_application_id => fnd_global.prog_appl_id,
3758 p_message_type => 2, -- WARNING
3759 x_err_code => p_err_num,
3760 x_err_msg => p_err_msg);
3761 IF(p_err_num <> 0) THEN
3762 raise proc_error;
3763 END IF;
3764 -- End : Added code to fix bug #3196002--
3765 END IF;
3766
3767 --VJ: CodeRVW: Start Changes for NSLBJ--
3768 IF (l_nslbj_alt_bom_desig IS NOT NULL AND --Takes care of bug #2352344 for NSLBJ--
3769 (nvl(l_wdj_alt_bom_desig,'#*#*#') <> l_nslbj_alt_bom_desig)) THEN
3770 --VJ: CodeRVW: Start Changes for NSLBJ--
3771
3772 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3773 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
3774 l_fnd_err_msg := FND_MESSAGE.GET;
3775
3776 l_stmt_num := 80;
3777 UPDATE wsm_resulting_jobs_interface
3778 SET error_message = l_fnd_err_msg
3779 WHERE header_id = l_header_id;
3780
3781 set_wrji_error(); -- WLTEnh
3782 IF (l_debug = 'Y') THEN
3783 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3784 ||l_stmt_num||'): '||l_fnd_err_msg);
3785 END IF;
3786
3787 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3788 p_message => substr(l_fnd_err_msg,1,2000),
3789 p_request_id => fnd_global.conc_request_id,
3790 p_program_id => fnd_global.conc_program_id,
3791 p_program_application_id => fnd_global.prog_appl_id,
3792 p_message_type => 1, -- ERROR
3793 x_err_code => p_err_num,
3794 x_err_msg => p_err_msg);
3795 raise proc_error;
3796
3797 END IF;
3798
3799 --VJ: CodeRVW: Start Changes for NSLBJ--
3800 -- IF (l_wrji_bom_seq_id IS NOT NULL AND
3801 -- (l_wdj_bom_seq_id <> l_wrji_bom_seq_id)) THEN
3802 IF (l_wrji_bom_seq_id <> -1 AND --Fixed bug #2345536
3803 (nvl(l_wdj_bom_seq_id, -1) <> l_wrji_bom_seq_id)) THEN
3804 --VJ: CodeRVW: Start Changes for NSLBJ--
3805
3806 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
3807 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
3808 l_fnd_err_msg := FND_MESSAGE.GET;
3809
3810 l_stmt_num := 81;
3811 UPDATE wsm_resulting_jobs_interface
3812 SET error_message = l_fnd_err_msg
3813 WHERE header_id = l_header_id;
3814
3815 set_wrji_error(); -- WLTEnh
3816
3817 IF (l_debug = 'Y') THEN
3818 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3819 ||l_stmt_num||'): '||l_fnd_err_msg);
3820 END IF;
3821
3822 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3823 p_message => substr(l_fnd_err_msg,1,2000),
3824 p_request_id => fnd_global.conc_request_id,
3825 p_program_id => fnd_global.conc_program_id,
3826 p_program_application_id => fnd_global.prog_appl_id,
3827 p_message_type => 1, -- ERROR
3828 x_err_code => p_err_num,
3829 x_err_msg => p_err_msg);
3830 raise proc_error;
3831
3832 END IF;
3833
3834 END IF; --IF (l_txn_type = WSMPCNST.UPDATE_ROUTING) THEN--
3835
3836
3837 --VJ: 0313: Start Additions for NSLBJ--
3838 --SpUA begin
3839 IF (l_txn_type IN ( --WSMPCNST.SPLIT,
3840 WSMPCNST.MERGE,
3841 WSMPCNST.UPDATE_LOT_NAME, WSMPCNST.UPDATE_QUANTITY)
3842 OR (l_txn_type IN (WSMPCNST.SPLIT) AND l_split_has_update_assy = 0))
3843 --SpUA end
3844 THEN
3845 -- all bom and routing info should be same as starting (repre) lot
3846 IF (l_txn_type = WSMPCNST.MERGE) THEN
3847 l_stmt_num := 82;
3848 IF (l_debug = 'Y') THEN
3849 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): Processing Merge');
3850 END IF;
3851
3852 l_stmt_num := 83;
3853
3854 SELECT wdj.bom_reference_id,
3855 wdj.alternate_bom_designator,
3856 wdj.common_bom_sequence_id,
3857 wdj.routing_reference_id,
3858 wdj.alternate_routing_designator,
3859 wdj.common_routing_sequence_id
3860 INTO l_st_bom_ref_id,
3861 l_st_alt_bom_desig,
3862 l_st_bom_seq_id,
3863 l_st_rtg_ref_id,
3864 l_st_alt_rtg_desig,
3865 l_st_rtg_seq_id
3866 FROM wsm_starting_jobs_interface wsji,
3867 wip_discrete_jobs wdj
3868 WHERE wsji.header_id = l_header_id
3869 AND wsji.wip_entity_id = wdj.wip_entity_id
3870 AND wsji.representative_flag='Y';
3871 ELSE
3872 l_stmt_num := 84;
3873 IF (l_debug = 'Y') THEN
3874 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
3875 '): Processing Split/Upd Lot Name/Upd Qty');
3876 END IF;
3877
3878 l_stmt_num := 85;
3879
3880 SELECT wdj.bom_reference_id,
3881 wdj.alternate_bom_designator,
3882 wdj.common_bom_sequence_id,
3883 wdj.routing_reference_id,
3884 wdj.alternate_routing_designator,
3885 wdj.common_routing_sequence_id
3886 INTO l_st_bom_ref_id,
3887 l_st_alt_bom_desig,
3888 l_st_bom_seq_id,
3889 l_st_rtg_ref_id,
3890 l_st_alt_rtg_desig,
3891 l_st_rtg_seq_id
3892 FROM wsm_starting_jobs_interface wsji,
3893 wip_discrete_jobs wdj
3894 WHERE wsji.header_id = l_header_id
3895 AND wsji.wip_entity_id = wdj.wip_entity_id;
3896 END IF;
3897
3898 IF (l_debug = 'Y') THEN
3899 FND_FILE.PUT_LINE(FND_FILE.LOG, 'l_st_bom_ref_id='||l_st_bom_ref_id||
3900 ', l_st_alt_bom_desig='||l_st_alt_bom_desig||
3901 ', l_st_bom_seq_id='||l_st_bom_seq_id||
3902 ', l_st_rtg_ref_id='||l_st_rtg_ref_id||
3903 ', l_st_alt_rtg_desig='||l_st_alt_rtg_desig||
3904 ', l_st_rtg_seq_id='||l_st_rtg_seq_id);
3905 END IF;
3906
3907 IF (l_st_bom_ref_id IS NOT NULL AND l_bom_reference_id IS NULL) OR --VJ: Added condition to fix bug #2315397--
3908 (l_bom_reference_id <> l_st_bom_ref_id) OR
3909 (l_nslbj_alt_bom_desig <> l_st_alt_bom_desig) OR
3910 (l_wrji_bom_seq_id <> l_st_bom_seq_id) THEN
3911 l_stmt_num := 86;
3912 UPDATE wsm_resulting_jobs_interface
3913 SET bom_reference_id = l_st_bom_ref_id,
3914 alternate_bom_designator = l_st_alt_bom_desig,
3915 common_bom_sequence_id = l_st_bom_seq_id
3916 WHERE header_id = l_header_id
3917 AND wip_entity_name = l_we_name;
3918
3919 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3920 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Bom information in Resulting Jobs');
3921 l_fnd_err_msg := FND_MESSAGE.GET;
3922 IF (l_debug = 'Y') THEN
3923 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3924 ||l_stmt_num||'): '||l_fnd_err_msg);
3925 END IF;
3926 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3927 p_message => substr(l_fnd_err_msg,1,2000),
3928 p_request_id => fnd_global.conc_request_id,
3929 p_program_id => fnd_global.conc_program_id,
3930 p_program_application_id => fnd_global.prog_appl_id,
3931 p_message_type => 2, -- WARNING
3932 x_err_code => p_err_num,
3933 x_err_msg => p_err_msg);
3934 IF(p_err_num <> 0) THEN
3935 raise proc_error;
3936 END IF;
3937 END IF;
3938
3939 IF (l_routing_reference_id IS NULL) OR --VJ: Added condition to fix bug #2315397--
3940 (l_routing_reference_id <> l_st_rtg_ref_id) OR
3941 (l_nslbj_alt_rtg_desig <> l_st_alt_rtg_desig) OR
3942 (l_wrji_rtg_seq_id <> l_st_rtg_seq_id) THEN
3943 l_stmt_num := 87;
3944 UPDATE wsm_resulting_jobs_interface
3945 SET routing_reference_id = l_st_rtg_ref_id,
3946 alternate_routing_designator = l_st_alt_rtg_desig,
3947 common_routing_sequence_id = l_st_rtg_seq_id
3948 WHERE header_id = l_header_id
3949 AND wip_entity_name = l_we_name;
3950
3951 l_wrji_rtg_seq_id := l_st_rtg_seq_id;
3952
3953 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
3954 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Routing information in Resulting Jobs');
3955 l_fnd_err_msg := FND_MESSAGE.GET;
3956 IF (l_debug = 'Y') THEN
3957 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
3958 ||l_stmt_num||'): '||l_fnd_err_msg);
3959 END IF;
3960 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
3961 p_message => substr(l_fnd_err_msg,1,2000),
3962 p_request_id => fnd_global.conc_request_id,
3963 p_program_id => fnd_global.conc_program_id,
3964 p_program_application_id => fnd_global.prog_appl_id,
3965 p_message_type => 2, -- WARNING
3966 x_err_code => p_err_num,
3967 x_err_msg => p_err_msg);
3968 IF(p_err_num <> 0) THEN
3969 raise proc_error;
3970 END IF;
3971
3972 END IF;
3973
3974 END IF; --IF (l_txn_type IN (SPLIT, MERGE, UPDATE_LOT_NAME, UPDATE_QUANTITY)) THEN--
3975 --VJ: 0313: End Additions for NSLBJ--
3976
3977 IF (l_txn_type IN (WSMPCNST.BONUS, WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING)
3978 --SpUA begin
3979 OR (l_txn_type IN (WSMPCNST.SPLIT) AND l_split_has_update_assy = 1)) THEN
3980 --SpUA end
3981 --VJ: 0313: Changed position for NSLBJ--
3982 -- *** Error Code and Message Guide ***
3983 -- 1: Routing Reference Cannot be Null
3984 -- 2: Invalid Assembly Item Id
3985 -- 3: Invalid Routing Reference Id
3986 -- 4: Invalid Bom Reference Id
3987 -- 5: Invalid Alternate Routing Designator
3988 -- 6: Invalid Alternate Bom Designator
3989 -- 7: Start Date cannot be greater than End Date
3990 -- 8: Both Start and End Dates must be Entered
3991 -- 9: Invalid Start Quantity
3992 -- 10: Invalid Net Quantity
3993 -- 11: Invalid Class Code
3994 -- 12: Invalid Completion Locator Id
3995 -- 13: Invalid Completion Subinventory
3996 -- 14: Invalid Firm Planned Flag
3997
3998 l_stmt_num := 88;
3999 IF (l_debug = 'Y') THEN
4000 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
4001 'l_job_type='||l_job_type||
4002 ' l_primary_item_id='||l_primary_item_id||
4003
4004 ' l_routing_reference_id='||l_routing_reference_id||
4005 ' l_nslbj_alt_rtg_desig='||l_nslbj_alt_rtg_desig||
4006 ' l_nsj_routing_seq_id='||l_nsj_routing_seq_id||
4007 ' l_wdj_rtg_rev='||l_wdj_rtg_rev||
4008 ' l_wdj_rtg_rev_dt='||l_wdj_rtg_rev_dt||
4009
4010 ' l_bom_reference_id='||l_bom_reference_id||
4011 ' l_nslbj_alt_bom_desig='||l_nslbj_alt_bom_desig||
4012 ' l_nsj_bom_seq_id='||l_nsj_bom_seq_id||
4013 ' l_wdj_bom_rev='||l_wdj_bom_rev||
4014 ' l_wdj_bom_rev_dt='||l_wdj_bom_rev_dt||
4015
4016 ' l_organization_id='||l_organization_id||
4017 ' l_scheduled_start_date='||l_scheduled_start_date||
4018 ' l_scheduled_completion_date='||l_scheduled_completion_date||
4019 ' l_start_quantity='||l_start_quantity||
4020 ' l_net_quantity='||l_net_quantity||
4021 ' l_class_code='||l_class_code||
4022 ' l_completion_subinventory='||l_completion_subinventory||
4023 ' l_completion_locator_id='||l_completion_locator_id||
4024 ' l_firm_flag='||l_firm_flag
4025 );
4026 END IF;
4027
4028 l_firm_flag := '';
4029
4030 WSMPUTIL.validate_non_std_references(
4031 p_assembly_item_id => l_primary_item_id,
4032 p_routing_reference_id => l_routing_reference_id,
4033 p_bom_reference_id => l_bom_reference_id,
4034 --VJ: CodeRVW: Start Changes for NSLBJ--
4035 p_alt_routing_designator => l_nslbj_alt_rtg_desig,
4036 p_alt_bom_designator => l_nslbj_alt_bom_desig,
4037 --VJ: CodeRVW: End Changes for NSLBJ--
4038 p_organization_id => l_organization_id,
4039 p_start_date => l_scheduled_start_date,
4040 p_end_date => l_scheduled_completion_date,
4041 p_start_quantity => l_start_quantity,
4042 p_class_code => l_class_code,
4043 p_completion_subinventory => l_completion_subinventory,
4044 p_completion_locator_id => l_completion_locator_id,
4045 validation_level => 0, -- 0 for job creation
4046 p_mrp_net_quantity => l_net_quantity, --OUT param--
4047 p_firm_planned_flag => l_firm_flag, --OUT param--
4048 p_bom_revision => l_wdj_bom_rev, --OUT param--
4049 p_bom_revision_date => l_wdj_bom_rev_dt, --OUT param--
4050 p_routing_revision => l_wdj_rtg_rev, --OUT param--
4051 p_routing_revision_date => l_wdj_rtg_rev_dt, --OUT param--
4052 x_routing_seq_id => l_nsj_routing_seq_id,--OUT param--
4053 x_bom_seq_id => l_nsj_bom_seq_id, --OUT param--
4054 x_error_code => p_err_num, --OUT param--
4055 x_err_msg => p_err_msg --OUT param--
4056 );
4057 IF (p_err_num <> 0) THEN
4058
4059 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPUTIL.validate_non_std_references returned error');
4060 l_stmt_num := 89;
4061 UPDATE wsm_resulting_jobs_interface
4062 SET error_message = p_err_msg
4063 where header_id = l_header_id
4064 and rowid = l_wrji_rowid; --SpUA add
4065
4066 set_wrji_error(); -- WLTEnh
4067
4068 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||p_err_msg);
4069 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4070 p_message => substr(p_err_msg,1,2000),
4071 p_request_id => fnd_global.conc_request_id,
4072 p_program_id => fnd_global.conc_program_id,
4073 p_program_application_id => fnd_global.prog_appl_id,
4074 p_message_type => 1, --ERROR
4075 x_err_code => p_err_num,
4076 x_err_msg => p_err_msg);
4077 IF(p_err_num <> 0) THEN
4078 raise proc_error;
4079 END IF;
4080
4081 ELSE
4082 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPUTIL.validate_non_std_references returned success');
4083
4084 IF (l_wrji_rtg_seq_id = -1 AND l_nsj_routing_seq_id IS NOT NULL) THEN
4085 l_stmt_num := 90;
4086 UPDATE wsm_resulting_jobs_interface
4087 SET common_routing_sequence_id = l_nsj_routing_seq_id
4088 WHERE header_id = l_header_id
4089 AND rowid = l_wrji_rowid; --SpUA add
4090
4091 l_wrji_rtg_seq_id := l_nsj_routing_seq_id; --Added to fix bug #2352354
4092
4093 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
4094 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
4095 l_fnd_err_msg := FND_MESSAGE.GET;
4096 IF (l_debug = 'Y') THEN
4097 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4098 ||l_stmt_num||'): '||l_fnd_err_msg);
4099 END IF;
4100 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4101 p_message => substr(l_fnd_err_msg,1,2000),
4102 p_request_id => fnd_global.conc_request_id,
4103 p_program_id => fnd_global.conc_program_id,
4104 p_program_application_id => fnd_global.prog_appl_id,
4105 p_message_type => 2, -- WARNING
4106 x_err_code => p_err_num,
4107 x_err_msg => p_err_msg);
4108 IF(p_err_num <> 0) THEN
4109 raise proc_error;
4110 END IF;
4111
4112 ELSIF (l_wrji_rtg_seq_id <> l_nsj_routing_seq_id) THEN
4113 l_stmt_num := 91;
4114 UPDATE wsm_resulting_jobs_interface wrji
4115 SET wrji.error_message = l_fnd_generic_err_msg
4116 WHERE header_id = l_header_id
4117 AND rowid = l_wrji_rowid; --SpUA add
4118
4119 set_wrji_error(); -- WLTEnh
4120
4121 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4122 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
4123 l_fnd_err_msg := FND_MESSAGE.GET;
4124 IF (l_debug = 'Y') THEN
4125 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4126 ||l_stmt_num||'): '||l_fnd_err_msg);
4127 END IF;
4128 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4129 p_message => substr(l_fnd_err_msg,1,2000),
4130 p_request_id => fnd_global.conc_request_id,
4131 p_program_id => fnd_global.conc_program_id,
4132 p_program_application_id => fnd_global.prog_appl_id,
4133 p_message_type => 1, -- ERROR
4134 x_err_code => p_err_num,
4135 x_err_msg => p_err_msg);
4136 IF(p_err_num <> 0) THEN
4137 raise proc_error;
4138 END IF;
4139 END IF;
4140
4141 IF (l_wrji_bom_seq_id = -1 AND l_nsj_bom_seq_id <> -1) THEN
4142 l_stmt_num := 92;
4143 UPDATE wsm_resulting_jobs_interface
4144 SET common_bom_sequence_id = l_nsj_bom_seq_id
4145 WHERE header_id = l_header_id
4146 AND rowid = l_wrji_rowid; --SpUA add
4147
4148 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
4149 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
4150 l_fnd_err_msg := FND_MESSAGE.GET;
4151 IF (l_debug = 'Y') THEN
4152 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4153 ||l_stmt_num||'): '||l_fnd_err_msg);
4154 END IF;
4155 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4156 p_message => substr(l_fnd_err_msg,1,2000),
4157 p_request_id => fnd_global.conc_request_id,
4158 p_program_id => fnd_global.conc_program_id,
4159 p_program_application_id => fnd_global.prog_appl_id,
4160 p_message_type => 2, -- WARNING
4161 x_err_code => p_err_num,
4162 x_err_msg => p_err_msg);
4163 IF(p_err_num <> 0) THEN
4164 raise proc_error;
4165 END IF;
4166
4167 ELSIF ( (l_wrji_bom_seq_id <> l_nsj_bom_seq_id) AND
4168 (l_nsj_bom_seq_id <> -1) ) THEN
4169 l_stmt_num := 93;
4170 UPDATE wsm_resulting_jobs_interface wrji
4171 SET wrji.error_message = l_fnd_generic_err_msg
4172 WHERE header_id = l_header_id
4173 AND rowid = l_wrji_rowid; --SpUA add
4174
4175 set_wrji_error(); -- WLTEnh
4176
4177 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4178 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
4179 l_fnd_err_msg := FND_MESSAGE.GET;
4180 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4181 ||l_stmt_num||'): '||l_fnd_err_msg);
4182 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4183 p_message => substr(l_fnd_err_msg,1,2000),
4184 p_request_id => fnd_global.conc_request_id,
4185 p_program_id => fnd_global.conc_program_id,
4186 p_program_application_id => fnd_global.prog_appl_id,
4187 p_message_type => 1, -- ERROR
4188 x_err_code => p_err_num,
4189 x_err_msg => p_err_msg);
4190 IF(p_err_num <> 0) THEN
4191 raise proc_error;
4192 END IF;
4193 END IF;
4194 END IF;
4195
4196 END IF; --IF (l_txn_type IN (WSMPCNST.BONUS, WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING))
4197
4198 END IF; --(l_job_type = WIP_CONSTANTS.NONSTANDARD) Begin @ _stmt_num := 166
4199
4200 -- BA: CZH.BUG2398718
4201 IF (l_job_type = WIP_CONSTANTS.STANDARD) THEN
4202 -- We should have the same code for Standard LBJ !!!!!!!!!
4203 NULL;
4204 END IF; -- (l_job_type = WIP_CONSTANTS.STANDARD)
4205 -- EA: CZH.BUG2398718
4206
4207 --VJ: End Additions for NSLBJ--
4208
4209
4210 --VJ: Start Additions to fix bug #2358941--
4211 --Made this call here too--
4212 --This is bcos the WRJI.common_routing_sequence_id required in a stmt in populate_columns--
4213 --was being populated after the 1st call to populate_columns was made--
4214 --Hence, this second call will populate class_code, comp_si and loc correctly
4215 --CZH: please gotol_stmt_num := 136 to see more comments
4216 /*-----------------------------------------------------------------+
4217 | Default values and populate some column values |
4218 +-----------------------------------------------------------------*/
4219 l_stmt_num := 94;
4220 populate_columns(l_header_id, -- WLTEnh
4221 l_wrji_rowid, -- SpUA
4222 p_err_msg,
4223 p_err_num);
4224
4225 IF (p_err_num <> 0) THEN
4226 FND_FILE.PUT_LINE(FND_FILE.LOG,'Errored rows in WSJI/WRJI in populate_columns='||SQL%ROWCOUNT);
4227 raise proc_error;
4228 END IF;
4229
4230 l_stmt_num := 95;
4231 SELECT wrji.job_type,
4232 wrji.organization_id,
4233 wrji.net_quantity,
4234 wrji.class_code,
4235 wrji.completion_subinventory,
4236 wrji.completion_locator_id
4237 INTO l_job_type,
4238 l_organization_id,
4239 l_net_quantity,
4240 l_class_code,
4241 l_completion_subinventory,
4242 l_completion_locator_id
4243 FROM wsm_resulting_jobs_interface wrji
4244 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
4245 AND wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
4246 AND wrji.header_id = l_header_id
4247 AND wrji.wip_entity_name = l_we_name;
4248
4249 IF (l_debug = 'Y') THEN
4250 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
4251 'l_job_type='||l_job_type||
4252 ', l_organization_id='||l_organization_id||
4253 ', l_net_quantity='||l_net_quantity||
4254 ', l_class_code='||l_class_code||
4255 ', l_completion_subinventory='||l_completion_subinventory||
4256 ', l_completion_locator_id='||l_completion_locator_id);
4257 END IF;
4258 --VJ: End Additions to fix bug #2358941--
4259
4260 /*-----------------------------------------------------------------+
4261 | Verify that if the resulting lot is one of the merging lots then |
4262 | it is the same as the representative lot. |
4263 +-----------------------------------------------------------------*/
4264
4265 l_stmt_num := 96;
4266 UPDATE wsm_resulting_jobs_interface wrji
4267 SET wrji.error_message = l_fnd_generic_err_msg
4268 WHERE wrji.header_id = l_header_id
4269 AND EXISTS (select 1
4270 FROM wip_entities we,
4271 wsm_starting_jobs_interface sj
4272 WHERE we.wip_entity_name = wrji.wip_entity_name
4273 AND we.wip_entity_id = sj.wip_entity_id
4274 AND wrji.header_id = sj.header_id
4275 AND nvl(sj.representative_flag, 'N') = 'N');
4276
4277 IF (SQL%ROWCOUNT > 0) THEN
4278
4279 set_wrji_error(); -- WLTEnh
4280
4281 FND_MESSAGE.SET_NAME('WSM', 'WSM_CURRENT_REPRESENTATIVE_LOT');
4282 l_fnd_err_msg := FND_MESSAGE.GET;
4283 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4284
4285 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4286 p_message => substr(l_fnd_err_msg,1,2000),
4287 p_request_id => fnd_global.conc_request_id,
4288 p_program_id => fnd_global.conc_program_id,
4289 p_program_application_id => fnd_global.prog_appl_id,
4290 p_message_type => 1, --ERROR
4291 x_err_code => p_err_num,
4292 x_err_msg => p_err_msg);
4293 IF(p_err_num <> 0) THEN
4294 raise proc_error;
4295 END IF;
4296 END IF;
4297
4298
4299 /*-----------------------------------------------------------------+
4300 | no scheduled start date and no scheduled completion date |
4301 +-----------------------------------------------------------------*/
4302
4303 l_stmt_num := 97;
4304 UPDATE wsm_resulting_jobs_interface wrji
4305 SET wrji.error_message = l_fnd_generic_err_msg
4306 WHERE wrji.header_id = l_header_id
4307 AND wrji.SCHEDULED_START_DATE IS NULL
4308 AND wrji.SCHEDULED_COMPLETION_DATE IS NULL;
4309
4310 IF (SQL%ROWCOUNT > 0) THEN
4311 set_wrji_error(); -- WLTEnh
4312
4313 FND_MESSAGE.SET_NAME('WSM', 'WSM_NO_START_END_DATES');
4314 l_fnd_err_msg := FND_MESSAGE.GET;
4315 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4316
4317 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4318 p_message => substr(l_fnd_err_msg,1,2000),
4319 p_request_id => fnd_global.conc_request_id,
4320 p_program_id => fnd_global.conc_program_id,
4321 p_program_application_id => fnd_global.prog_appl_id,
4322 p_message_type => 1, --ERROR
4323 x_err_code => p_err_num,
4324 x_err_msg => p_err_msg);
4325 IF(p_err_num <> 0) THEN
4326 raise proc_error;
4327 END IF;
4328 END IF;
4329
4330 --VJ: Start Additions for NSLBJ--
4331 --Moved this piece of code from WSMPPTAB.sm_table to here--
4332 /*--------------------------------------------------------------------+
4333 | If either scheduled start date or scheduled completion date is |
4334 | given, default the other one by calling WSMPUTIL.GET_SCHEDULED_DATE |
4335 +--------------------------------------------------------------------*/
4336
4337 /* ST bug fix 3493984 : Add a check for the txn type */
4338 IF l_txn_type = WSMPCNST.BONUS THEN
4339
4340 FOR c_null_scheduled_date_rec IN c_scheduled_date(l_header_id) LOOP
4341
4342 l_stmt_num := 98;
4343 IF (c_null_scheduled_date_rec.scheduled_start_date is not null)
4344 and (c_null_scheduled_date_rec.scheduled_completion_date is null) THEN
4345
4346 l_sch_completion_date := WSMPUTIL.GET_SCHEDULED_DATE(
4347 p_organization_id => c_null_scheduled_date_rec.org_id,
4348 p_primary_item_id => c_null_scheduled_date_rec.item_id,
4349 p_schedule_method => 'F',
4350 p_input_date => c_null_scheduled_date_rec.scheduled_start_date,
4351 p_quantity => c_null_scheduled_date_rec.start_quantity,
4352 x_err_code => p_err_num,
4353 x_err_msg => p_err_msg);
4354
4355 l_stmt_num := 99;
4356
4357 UPDATE wsm_resulting_jobs_interface wrji
4358 SET wrji.scheduled_completion_date = l_sch_completion_date
4359 WHERE wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
4360 AND wrji.header_id = l_header_id;
4361
4362 IF (SQL%ROWCOUNT > 0) THEN
4363 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
4364 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'scheduled_completion_date in Resulting Jobs');
4365 l_fnd_err_msg := FND_MESSAGE.GET;
4366 If l_debug = 'Y' Then
4367 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4368 ||l_stmt_num||'): '||l_fnd_err_msg);
4369 End If;
4370
4371 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
4372 p_header_id => l_header_id,
4373 p_message => substr(l_fnd_err_msg,1,2000),
4374 p_request_id => fnd_global.conc_request_id,
4375 p_program_id => fnd_global.conc_program_id,
4376 p_program_application_id => fnd_global.prog_appl_id,
4377 p_message_type => 2, --WARNING
4378 x_err_code => p_err_num,
4379 x_err_msg => p_err_msg);
4380 IF(p_err_num <> 0) THEN
4381 raise proc_error;
4382 END IF;
4383 END IF;
4384
4385 END IF;
4386
4387 l_stmt_num := 100;
4388 IF (c_null_scheduled_date_rec.scheduled_start_date is null)
4389 and (c_null_scheduled_date_rec.scheduled_completion_date is not null) THEN
4390
4391 l_sch_start_date := WSMPUTIL.GET_SCHEDULED_DATE(
4392 p_organization_id => c_null_scheduled_date_rec.org_id,
4393 p_primary_item_id => c_null_scheduled_date_rec.item_id,
4394 p_schedule_method => 'B',
4395 p_input_date => c_null_scheduled_date_rec.scheduled_completion_date,
4396 p_quantity => c_null_scheduled_date_rec.start_quantity,
4397 x_err_code => p_err_num,
4398 x_err_msg => p_err_msg);
4399
4400 l_stmt_num := 101;
4401
4402 UPDATE wsm_resulting_jobs_interface wrji
4403 SET wrji.scheduled_start_date = l_sch_start_date
4404 WHERE wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
4405 AND wrji.header_id = l_header_id;
4406
4407 IF (SQL%ROWCOUNT > 0) THEN
4408 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
4409 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'scheduled_start_date in Resulting Jobs');
4410 l_fnd_err_msg := FND_MESSAGE.GET;
4411 If l_debug = 'Y' Then
4412 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4413 ||l_stmt_num||'): '||l_fnd_err_msg);
4414 End If;
4415
4416 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
4417 p_header_id => l_header_id,
4418 p_message => substr(l_fnd_err_msg,1,2000),
4419 p_request_id => fnd_global.conc_request_id,
4420 p_program_id => fnd_global.conc_program_id,
4421 p_program_application_id => fnd_global.prog_appl_id,
4422 p_message_type => 2, --WARNING
4423 x_err_code => p_err_num,
4424 x_err_msg => p_err_msg);
4425 IF(p_err_num <> 0) THEN
4426 raise proc_error;
4427 END IF;
4428 END IF;
4429
4430 END IF;
4431 END LOOP;
4432 END IF; /* ST bug fix 3493984 : End -- check for the txn type */
4433 --VJ: End Additions for NSLBJ--
4434
4435
4436
4437 /*----------------------------------------------------------------------+
4438 | Verify that scheduled_completion_date comes after scheduled_start_date|
4439 +----------------------------------------------------------------------*/
4440
4441 l_stmt_num := 102;
4442 UPDATE wsm_resulting_jobs_interface wrji
4443 SET wrji.error_message = l_fnd_generic_err_msg
4444 WHERE wrji.header_id = l_header_id
4445 AND wrji.SCHEDULED_START_DATE is not null
4446 AND wrji.SCHEDULED_COMPLETION_DATE is not null
4447 AND wrji.SCHEDULED_START_DATE > wrji.SCHEDULED_COMPLETION_DATE;
4448
4449 IF (SQL%ROWCOUNT > 0) THEN
4450 set_wrji_error(); -- WLTEnh
4451
4452 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_DATES');
4453 l_fnd_err_msg := FND_MESSAGE.GET;
4454 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4455
4456 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4457 p_message => substr(l_fnd_err_msg,1,2000),
4458 p_request_id => fnd_global.conc_request_id,
4459 p_program_id => fnd_global.conc_program_id,
4460 p_program_application_id => fnd_global.prog_appl_id,
4461 p_message_type => 1, --ERROR
4462 x_err_code => p_err_num,
4463 x_err_msg => p_err_msg);
4464 IF(p_err_num <> 0) THEN
4465 raise proc_error;
4466 END IF;
4467 END IF;
4468
4469
4470 /*-----------------------------------------------------------------+
4471 | validate header_id in wsm_resulting_jobs_interface table |
4472 +-----------------------------------------------------------------*/
4473
4474 l_stmt_num := 103;
4475 UPDATE wsm_resulting_jobs_interface wrji
4476 SET wrji.error_message = l_fnd_generic_err_msg
4477 WHERE wrji.header_id = l_header_id
4478 and not exists (select null
4479 from wsm_split_merge_txn_interface txn
4480 where txn.header_id = wrji.header_id
4481 and txn.process_status = WIP_CONSTANTS.RUNNING);
4482
4483 IF (SQL%ROWCOUNT > 0) THEN
4484 set_wrji_error(); -- WLTEnh
4485
4486 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4487 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'header_id in Resulting Jobs');
4488 l_fnd_err_msg := FND_MESSAGE.GET;
4489 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4490
4491 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4492 p_message => substr(l_fnd_err_msg,1,2000),
4493 p_request_id => fnd_global.conc_request_id,
4494 p_program_id => fnd_global.conc_program_id,
4495 p_program_application_id => fnd_global.prog_appl_id,
4496 p_message_type => 1, --ERROR
4497 x_err_code => p_err_num,
4498 x_err_msg => p_err_msg);
4499 IF(p_err_num <> 0) THEN
4500 raise proc_error;
4501 END IF;
4502 END IF;
4503
4504 --VJ: Start Additions for NSLBJ--
4505
4506
4507 /*-----------------------------------------------------------------+
4508 | validate that wip_entity_name in wsm_resulting_jobs_interface |
4509 | table has a maximum length of 30 characters. |
4510 +-----------------------------------------------------------------*/
4511
4512 l_stmt_num := 104;
4513 UPDATE wsm_resulting_jobs_interface wrji
4514 SET wrji.error_message = l_fnd_generic_err_msg
4515 WHERE header_id = l_header_id
4516 AND wip_entity_name IS NOT NULL
4517 AND length(wip_entity_name) > 30;
4518
4519 IF (SQL%ROWCOUNT > 0) THEN
4520 set_wrji_error(); -- WLTEnh
4521
4522 FND_MESSAGE.SET_NAME('WSM', 'WSM_EXCEED_MAX_LEN');
4523 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name in Resulting Jobs');
4524 FND_MESSAGE.SET_TOKEN('VALUE', '30');
4525 l_fnd_err_msg := FND_MESSAGE.GET;
4526 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4527
4528 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4529 p_message => substr(l_fnd_err_msg,1,2000),
4530 p_request_id => fnd_global.conc_request_id,
4531 p_program_id => fnd_global.conc_program_id,
4532 p_program_application_id => fnd_global.prog_appl_id,
4533 p_message_type => 1, --ERROR
4534 x_err_code => p_err_num,
4535 x_err_msg => p_err_msg);
4536 IF(p_err_num <> 0) THEN
4537 raise proc_error;
4538 END IF;
4539 END IF;
4540
4541 --VJ: End Additions for NSLBJ--
4542
4543
4544 /*-----------------------------------------------------------------+
4545 | validate wip_entity_name in wsm_resulting_jobs_interface table: |
4546 | wip_entity_name cannot duplicate existing job name except when |
4547 | the job name is also a starting lot. |
4548 +-----------------------------------------------------------------*/
4549
4550 l_stmt_num := 105;
4551 --VJ: Start Changes for NSLBJ--
4552 --Changed the sql since org_id has been added to WRJI now--
4553 If l_debug = 'Y' Then
4554 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
4555 ||l_stmt_num
4556 ||'): l_header_id='||l_header_id
4557 ||'; WSMPLOAD.G_HEADER_ID='||WSMPLOAD.G_HEADER_ID);
4558 End If;
4559 l_stmt_num := 106;
4560
4561 UPDATE wsm_resulting_jobs_interface wrji
4562 SET wrji.error_message = l_fnd_generic_err_msg
4563 WHERE wrji.header_id = l_header_id
4564 and exists (select null
4565 from wip_discrete_jobs_all_v we
4566 where we.wip_entity_name = wrji.wip_entity_name
4567 and we.organization_id = wrji.organization_id
4568 and not exists (select null
4569 from wsm_starting_jobs_interface sj
4570 where sj.header_id = wrji.header_id
4571 and ( sj.wip_entity_id = we.wip_entity_id OR
4572 (sj.wip_entity_name = we.wip_entity_name
4573 and sj.organization_id = we.organization_id)
4574 )
4575 and we.status_type in (3)));
4576
4577 --VJ: End Changes for NSLBJ--
4578
4579 IF (SQL%ROWCOUNT > 0) THEN
4580 set_wrji_error(); -- WLTEnh
4581
4582 FND_MESSAGE.SET_NAME('WSM', 'WSM_DUPLICATE_ENT_NAME');
4583 l_fnd_err_msg := FND_MESSAGE.GET;
4584 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4585
4586 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4587 p_message => substr(l_fnd_err_msg,1,2000),
4588 p_request_id => fnd_global.conc_request_id,
4589 p_program_id => fnd_global.conc_program_id,
4590 p_program_application_id => fnd_global.prog_appl_id,
4591 p_message_type => 1, --ERROR
4592 x_err_code => p_err_num,
4593 x_err_msg => p_err_msg);
4594 IF(p_err_num <> 0) THEN
4595 raise proc_error;
4596 END IF;
4597 END IF;
4598
4599
4600 /*-----------------------------------------------------------------+
4601 | validate wip_entity_name in wsm_resulting_jobs_interface table: |
4602 | wip_entity_name must be the same as the starting job name when |
4603 | doing updates. |
4604 +-----------------------------------------------------------------*/
4605
4606 l_stmt_num := 107;
4607 UPDATE wsm_resulting_jobs_interface wrji
4608 SET wrji.error_message = l_fnd_generic_err_msg
4609 WHERE wrji.header_id = l_header_id
4610 and not exists ((select null
4611 from wsm_starting_jobs_interface sj,
4612 wsm_split_merge_txn_interface txn,
4613 wip_entities we
4614 where txn.header_id = wrji.header_id
4615 and sj.header_id = txn.header_id
4616 and wrji.wip_entity_name = we.wip_entity_name
4617 and we.organization_id = txn.organization_id
4618 and txn.transaction_type_id in
4619 (WSMPCNST.UPDATE_ASSEMBLY,
4620 WSMPCNST.UPDATE_ROUTING,
4621 WSMPCNST.UPDATE_QUANTITY)
4622 and we.wip_entity_id = sj.wip_entity_id)
4623 union
4624 select null
4625 from wsm_split_merge_txn_interface txn
4626 where txn.header_id = wrji.header_id
4627 and txn.transaction_type_id IN
4628 (WSMPCNST.SPLIT,
4629 WSMPCNST.MERGE,
4630 WSMPCNST.BONUS,
4631 WSMPCNST.UPDATE_LOT_NAME));
4632
4633 IF (SQL%ROWCOUNT > 0) THEN
4634 set_wrji_error(); -- WLTEnh
4635
4636 FND_MESSAGE.SET_NAME('WSM', 'WSM_RESULTING_DIFFERENT');
4637 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name');
4638 l_fnd_err_msg := FND_MESSAGE.GET;
4639 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4640
4641 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4642 p_message => substr(l_fnd_err_msg,1,2000),
4643 p_request_id => fnd_global.conc_request_id,
4644 p_program_id => fnd_global.conc_program_id,
4645 p_program_application_id => fnd_global.prog_appl_id,
4646 p_message_type => 1, --ERROR
4647 x_err_code => p_err_num,
4648 x_err_msg => p_err_msg);
4649 IF(p_err_num <> 0) THEN
4650 raise proc_error;
4651 END IF;
4652 END IF;
4653
4654 --VJ: Start Additions to fix bug #2352364--
4655 IF (l_txn_type = (WSMPCNST.UPDATE_LOT_NAME)) THEN
4656 l_stmt_num := 108;
4657 SELECT we.wip_entity_name
4658 INTO l_start_we_name
4659 FROM wip_entities we,
4660 wsm_starting_jobs_interface wsji
4661 WHERE wsji.wip_entity_id = we.wip_entity_id
4662 AND wsji.header_id = l_header_id;
4663
4664 IF (l_start_we_name = l_job_name) THEN -- Start and resulting job name are same--
4665 set_wrji_error(); -- WLTEnh
4666
4667 FND_MESSAGE.SET_NAME('WSM', 'WSM_RESULTING_SAME');
4668 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name');
4669 l_fnd_err_msg := FND_MESSAGE.GET;
4670 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4671
4672 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4673 p_message => substr(l_fnd_err_msg,1,2000),
4674 p_request_id => fnd_global.conc_request_id,
4675 p_program_id => fnd_global.conc_program_id,
4676 p_program_application_id => fnd_global.prog_appl_id,
4677 p_message_type => 1, --ERROR
4678 x_err_code => p_err_num,
4679 x_err_msg => p_err_msg);
4680 IF(p_err_num <> 0) THEN
4681 raise proc_error;
4682 END IF;
4683
4684 END IF;
4685 END IF;
4686 --VJ: End Additions to fix bug #2352364--
4687
4688 --VJ: Start Additions for NSLBJ--
4689 /*-----------------------------------------------------------------+
4690 | validate wip_entity_name in wsm_resulting_jobs_interface table: |
4691 | For split, there cannot be multiple occurences of a job_name |
4692 +-----------------------------------------------------------------*/
4693
4694 IF (l_txn_type = WSMPCNST.SPLIT) THEN
4695 l_stmt_num := 109;
4696 select count(*)
4697 into l_count
4698 from wsm_resulting_jobs_interface
4699 where header_id = l_header_id
4700 and wip_entity_name = l_job_name;
4701
4702 IF (l_count > 1) THEN
4703 set_wrji_error(); -- WLTEnh
4704
4705 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4706 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'wip_entity_name in Resulting Jobs');
4707 l_fnd_err_msg := FND_MESSAGE.GET;
4708 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4709
4710 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4711 p_message => substr(l_fnd_err_msg,1,2000),
4712 p_request_id => fnd_global.conc_request_id,
4713 p_program_id => fnd_global.conc_program_id,
4714 p_program_application_id => fnd_global.prog_appl_id,
4715 p_message_type => 1, --ERROR
4716 x_err_code => p_err_num,
4717 x_err_msg => p_err_msg);
4718 IF(p_err_num <> 0) THEN
4719 raise proc_error;
4720 END IF;
4721
4722 END IF;
4723 END IF;
4724 --VJ: End Additions for NSLBJ--
4725
4726 /*-----------------------------------------------------------------+
4727 | validate primary_item_id in wsm_resulting_jobs_interface table |
4728 +-----------------------------------------------------------------*/
4729
4730 l_stmt_num := 110;
4731 UPDATE wsm_resulting_jobs_interface wrji
4732 SET wrji.error_message = l_fnd_generic_err_msg
4733 WHERE wrji.header_id = l_header_id
4734 and not exists (select null
4735 from mtl_system_items mtl,
4736 wsm_split_merge_txn_interface txn
4737 where txn.header_id = wrji.header_id
4738 and txn.transaction_type_id in
4739 (WSMPCNST.SPLIT,
4740 WSMPCNST.MERGE,
4741 WSMPCNST.UPDATE_ASSEMBLY,
4742 WSMPCNST.BONUS)
4743 and mtl.organization_id = txn.organization_id
4744 and mtl.inventory_item_id = wrji.primary_item_id
4745 and mtl.build_in_wip_flag = 'Y'
4746 and mtl.pick_components_flag = 'N'
4747 and mtl.eng_item_flag = 'N'
4748 union
4749 select null
4750 from wsm_split_merge_txn_interface txn1
4751 where txn1.header_id = wrji.header_id
4752 and txn1.transaction_type_id in
4753 (WSMPCNST.UPDATE_ROUTING,
4754 WSMPCNST.UPDATE_QUANTITY,
4755 WSMPCNST.UPDATE_LOT_NAME ));
4756
4757 IF (SQL%ROWCOUNT > 0) THEN
4758 set_wrji_error(); -- WLTEnh
4759
4760 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4761 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'primary_item_id in Resulting Jobs');
4762 l_fnd_err_msg := FND_MESSAGE.GET;
4763 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4764
4765 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4766 p_message => substr(l_fnd_err_msg,1,2000),
4767 p_request_id => fnd_global.conc_request_id,
4768 p_program_id => fnd_global.conc_program_id,
4769 p_program_application_id => fnd_global.prog_appl_id,
4770 p_message_type => 1, --ERROR
4771 x_err_code => p_err_num,
4772 x_err_msg => p_err_msg);
4773 IF(p_err_num <> 0) THEN
4774 raise proc_error;
4775 END IF;
4776 END IF;
4777
4778
4779 -- bug 1882366 start changes
4780
4781 /*-----------------------------------------------------------------+
4782 | validate primary_item_id in wsm_resulting_jobs_interface table
4783 | is lot controlled
4784 +-----------------------------------------------------------------*/
4785
4786 l_stmt_num := 111;
4787 UPDATE wsm_resulting_jobs_interface wrji
4788 SET wrji.error_message = l_fnd_generic_err_msg
4789 WHERE wrji.header_id = l_header_id
4790 and not exists (select null
4791 from mtl_system_items mtl,
4792 wsm_split_merge_txn_interface txn
4793 where txn.header_id = wrji.header_id
4794 and txn.transaction_type_id in
4795 (WSMPCNST.SPLIT,
4796 WSMPCNST.MERGE,
4797 WSMPCNST.UPDATE_ASSEMBLY,
4798 WSMPCNST.BONUS)
4799 and mtl.organization_id = txn.organization_id
4800 and mtl.inventory_item_id = wrji.primary_item_id
4801 and mtl.lot_control_code = 2
4802 union
4803 select null
4804 from wsm_split_merge_txn_interface txn1
4805 where txn1.header_id = wrji.header_id
4806 and txn1.transaction_type_id in
4807 (WSMPCNST.UPDATE_ROUTING,
4808 WSMPCNST.UPDATE_QUANTITY,
4809 WSMPCNST.UPDATE_LOT_NAME ));
4810
4811 IF (SQL%ROWCOUNT > 0) THEN
4812 set_wrji_error(); -- WLTEnh
4813
4814 FND_MESSAGE.SET_NAME('WSM', 'WSM_ASSEMBLY_NO_LOT');
4815 l_fnd_err_msg := FND_MESSAGE.GET;
4816 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4817
4818 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4819 -- p_message => substr(l_fnd_err_msg,1,240),
4820 p_message => substr(l_fnd_err_msg,1,2000),
4821 p_request_id => fnd_global.conc_request_id,
4822 p_program_id => fnd_global.conc_program_id,
4823 p_program_application_id => fnd_global.prog_appl_id,
4824 p_message_type => 1, --ERROR
4825 x_err_code => p_err_num,
4826 x_err_msg => p_err_msg);
4827 IF(p_err_num <> 0) THEN
4828 raise proc_error;
4829 END IF;
4830 END IF;
4831
4832
4833 /*-----------------------------------------------------------------+
4834 | validate primary_item_id in wsm_resulting_jobs_interface table
4835 | is not serial controlled
4836 +-----------------------------------------------------------------*/
4837
4838 l_stmt_num := 112;
4839 UPDATE wsm_resulting_jobs_interface wrji
4840 SET wrji.error_message = l_fnd_generic_err_msg
4841 WHERE wrji.header_id = l_header_id
4842 and not exists (select null
4843 from mtl_system_items mtl,
4844 wsm_split_merge_txn_interface txn
4845 where txn.header_id = wrji.header_id
4846 and txn.transaction_type_id in
4847 (WSMPCNST.SPLIT,
4848 WSMPCNST.MERGE,
4849 WSMPCNST.UPDATE_ASSEMBLY,
4850 WSMPCNST.BONUS)
4851 and mtl.organization_id = txn.organization_id
4852 and mtl.inventory_item_id = wrji.primary_item_id
4853 and mtl.serial_number_control_code = 1
4854 union
4855 select null
4856 from wsm_split_merge_txn_interface txn1
4857 where txn1.header_id = wrji.header_id
4858 and txn1.transaction_type_id in
4859 (WSMPCNST.UPDATE_ROUTING,
4860 WSMPCNST.UPDATE_QUANTITY,
4861 WSMPCNST.UPDATE_LOT_NAME ));
4862
4863 IF (SQL%ROWCOUNT > 0) THEN
4864 set_wrji_error(); -- WLTEnh
4865
4866 FND_MESSAGE.SET_NAME('WSM', 'WSM_ASSEMBLY_NOT_SERIAL');
4867 l_fnd_err_msg := FND_MESSAGE.GET;
4868 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4869
4870 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4871 -- p_message => substr(l_fnd_err_msg,1,240),
4872 p_message => substr(l_fnd_err_msg,1,2000),
4873 p_request_id => fnd_global.conc_request_id,
4874 p_program_id => fnd_global.conc_program_id,
4875 p_program_application_id => fnd_global.prog_appl_id,
4876 p_message_type => 1, --ERROR
4877 x_err_code => p_err_num,
4878 x_err_msg => p_err_msg);
4879 IF(p_err_num <> 0) THEN
4880 raise proc_error;
4881 END IF;
4882 END IF;
4883
4884 -- End Changes for Bug 1882366
4885
4886
4887
4888 /*-----------------------------------------------------------------+
4889 | validate starting lot item is different from resulting lot item |
4890 | if transaction is update assembly. |
4891 +-----------------------------------------------------------------*/
4892
4893 l_stmt_num := 113;
4894 UPDATE wsm_resulting_jobs_interface wrji
4895 SET wrji.error_message = l_fnd_generic_err_msg
4896 WHERE wrji.header_id = l_header_id
4897 and exists (select null
4898 from wsm_starting_jobs_interface sj,
4899 wsm_split_merge_txn_interface txn,
4900 wip_discrete_jobs dj
4901 where sj.wip_entity_id = dj.wip_entity_id
4902 and dj.primary_item_id = nvl(wrji.primary_item_id,dj.primary_item_id)
4903 and txn.header_id = wrji.header_id
4904 and sj.header_id = txn.header_id
4905 and txn.transaction_type_id = WSMPCNST.UPDATE_ASSEMBLY);
4906
4907 IF (SQL%ROWCOUNT > 0) THEN
4908 set_wrji_error(); -- WLTEnh
4909
4910 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_ITEM_FOR_UPDASSY');
4911 l_fnd_err_msg := FND_MESSAGE.GET;
4912 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4913
4914 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4915 p_message => substr(l_fnd_err_msg,1,2000),
4916 p_request_id => fnd_global.conc_request_id,
4917 p_program_id => fnd_global.conc_program_id,
4918 p_program_application_id => fnd_global.prog_appl_id,
4919 p_message_type => 1, --ERROR
4920 x_err_code => p_err_num,
4921 x_err_msg => p_err_msg);
4922 IF(p_err_num <> 0) THEN
4923 raise proc_error;
4924 END IF;
4925 END IF;
4926
4927
4928 /*-----------------------------------------------------------------+
4929 | Validate bonus account in wsm_resulting_jobs_interface table |
4930 +-----------------------------------------------------------------*/
4931
4932 l_stmt_num := 114;
4933 UPDATE wsm_resulting_jobs_interface wrji
4934 SET wrji.error_message = l_fnd_generic_err_msg
4935 WHERE wrji.header_id = l_header_id
4936 and not exists (select 1
4937 from gl_code_combinations gcc,
4938 org_organization_definitions ood,
4939 wsm_split_merge_txn_interface txn
4940 where txn.organization_id = ood.organization_id
4941 and txn.header_id = wrji.header_id
4942 and txn.transaction_type_id IN
4943 (WSMPCNST.BONUS,
4944 WSMPCNST.UPDATE_QUANTITY)
4945 and ood.chart_of_accounts_id = gcc.chart_of_accounts_id
4946 and nvl (wrji.bonus_acct_id, -1) = gcc.code_combination_id
4947 and gcc.enabled_flag = 'Y'
4948 and txn.transaction_date between
4949 nvl(gcc.start_date_active, txn.transaction_date)
4950 and nvl(gcc.end_date_active, txn.transaction_date)
4951 union
4952 select 1
4953 from wsm_split_merge_txn_interface txn1
4954 where txn1.transaction_type_id NOT IN
4955 (WSMPCNST.BONUS,
4956 WSMPCNST.UPDATE_QUANTITY)
4957 and txn1.header_id = wrji.header_id);
4958
4959 IF (SQL%ROWCOUNT > 0) THEN
4960 set_wrji_error(); -- WLTEnh
4961
4962 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
4963 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'bonus_acct_id in Resulting Jobs');
4964 l_fnd_err_msg := FND_MESSAGE.GET;
4965 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
4966
4967 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
4968 p_message => substr(l_fnd_err_msg,1,2000),
4969 p_request_id => fnd_global.conc_request_id,
4970 p_program_id => fnd_global.conc_program_id,
4971 p_program_application_id => fnd_global.prog_appl_id,
4972 p_message_type => 1, --ERROR
4973 x_err_code => p_err_num,
4974 x_err_msg => p_err_msg);
4975 IF(p_err_num <> 0) THEN
4976 raise proc_error;
4977 END IF;
4978 END IF;
4979
4980
4981 /*-----------------------------------------------------------------+
4982 | validate start_quantity in wsm_resulting_jobs_interface table |
4983 +-----------------------------------------------------------------*/
4984
4985 l_stmt_num := 115;
4986 UPDATE wsm_resulting_jobs_interface wrji
4987 SET wrji.error_message = l_fnd_generic_err_msg
4988 WHERE wrji.header_id = l_header_id
4989 and ( (wrji.start_quantity < 0 OR nvl(wrji.start_quantity,0) = 0)
4990 or (exists (select null
4991 from wsm_split_merge_txn_interface txn,
4992 wsm_starting_jobs_interface sj,
4993 wip_discrete_jobs dj
4994 where txn.header_id = wrji.header_id
4995 and txn.header_id = sj.header_id
4996 and txn.transaction_type_id = WSMPCNST.UPDATE_QUANTITY
4997 and sj.wip_entity_id = dj.wip_entity_id
4998 and wrji.start_quantity <= (dj.start_quantity -
4999 dj.quantity_scrapped - dj.quantity_completed))));
5000
5001 IF (SQL%ROWCOUNT > 0) THEN
5002 set_wrji_error(); -- WLTEnh
5003
5004 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
5005 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'start_quantity in Resulting Jobs');
5006 l_fnd_err_msg := FND_MESSAGE.GET;
5007 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5008
5009 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5010 p_message => substr(l_fnd_err_msg,1,2000),
5011 p_request_id => fnd_global.conc_request_id,
5012 p_program_id => fnd_global.conc_program_id,
5013 p_program_application_id => fnd_global.prog_appl_id,
5014 p_message_type => 1, --ERROR
5015 x_err_code => p_err_num,
5016 x_err_msg => p_err_msg);
5017 IF(p_err_num <> 0) THEN
5018 raise proc_error;
5019 END IF;
5020 END IF;
5021
5022 --Start fix for bug #2448428--
5023 l_stmt_num := 116;
5024 IF (l_txn_type IN (WSMPCNST.UPDATE_ASSEMBLY,
5025 WSMPCNST.UPDATE_ROUTING,
5026 WSMPCNST.UPDATE_LOT_NAME)) THEN
5027 l_stmt_num := 117;
5028 SELECT wdj.start_quantity
5029 INTO l_wdj_st_qty
5030 FROM wip_discrete_jobs wdj,
5031 wsm_starting_jobs_interface wsji
5032 WHERE wsji.header_id = l_header_id
5033 AND wsji.wip_entity_id = wdj.wip_entity_id;
5034
5035 l_stmt_num := 118;
5036
5037 UPDATE wsm_resulting_jobs_interface wrji
5038 SET wrji.start_quantity = l_wdj_st_qty
5039 WHERE wrji.header_id = l_header_id
5040 AND wrji.start_quantity <> l_wdj_st_qty;
5041
5042 IF (SQL%ROWCOUNT > 0) THEN
5043
5044 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5045 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'start_quantity in Resulting Jobs');
5046 l_fnd_err_msg := FND_MESSAGE.GET;
5047 IF (l_debug = 'Y') THEN
5048 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5049 ||l_stmt_num||'): '||l_fnd_err_msg);
5050 END IF;
5051 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5052 p_message => substr(l_fnd_err_msg,1,2000),
5053 p_request_id => fnd_global.conc_request_id,
5054 p_program_id => fnd_global.conc_program_id,
5055 p_program_application_id => fnd_global.prog_appl_id,
5056 p_message_type => 2, -- WARNING
5057 x_err_code => p_err_num,
5058 x_err_msg => p_err_msg);
5059 IF(p_err_num <> 0) THEN
5060 raise proc_error;
5061 END IF;
5062 END IF;
5063 END IF;
5064 --End fix for bug #2448428--
5065
5066 --VJ: 0313: Start Additions for NSLBJ--
5067 /*---------------------------------------------------------+
5068 | routing_reference_id and bom_reference_id should be NULL |
5069 | for a STANDARD Job |
5070 +---------------------------------------------------------*/
5071
5072 l_stmt_num := 119;
5073 IF (l_job_type = WIP_CONSTANTS.STANDARD) THEN
5074 l_stmt_num := 120;
5075 UPDATE wsm_resulting_jobs_interface wrji
5076 SET routing_reference_id = NULL,
5077 bom_reference_id = NULL
5078 WHERE wrji.header_id = l_header_id
5079 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5080 and wrji.process_status = WIP_CONSTANTS.RUNNING
5081 and wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
5082 and (wrji.routing_reference_id IS NOT NULL
5083 OR wrji.bom_reference_id IS NOT NULL);
5084
5085 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5086 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'routing_reference_id/bom_reference_id in Resulting Jobs');
5087 l_fnd_err_msg := FND_MESSAGE.GET;
5088 IF (l_debug = 'Y') THEN
5089 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5090 ||l_stmt_num||'): '||l_fnd_err_msg);
5091 END IF;
5092 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5093 p_message => substr(l_fnd_err_msg,1,2000),
5094 p_request_id => fnd_global.conc_request_id,
5095 p_program_id => fnd_global.conc_program_id,
5096 p_program_application_id => fnd_global.prog_appl_id,
5097 p_message_type => 2, -- WARNING
5098 x_err_code => p_err_num,
5099 x_err_msg => p_err_msg);
5100 IF(p_err_num <> 0) THEN
5101 raise proc_error;
5102 END IF;
5103
5104 END IF;
5105 --VJ: 0313: End Additions for NSLBJ--
5106
5107 /*-----------------------------------------------------------------+
5108 | Populate common_routing_sequence_id, alternate_routing_designator|
5109 | mark the record with warning message if no bom or routing is |
5110 | found. |
5111 +-----------------------------------------------------------------*/
5112
5113 /*BA#1623701*/
5114
5115 --SpUA begin
5116 if (l_txn_type in ( --WSMPCNST.SPLIT,
5117 WSMPCNST.MERGE,
5118 WSMPCNST.UPDATE_QUANTITY,
5119 WSMPCNST.UPDATE_LOT_NAME
5120 )
5121 OR (l_txn_type in (WSMPCNST.SPLIT) and l_split_has_update_assy = 0)) then
5122 --SpUA end
5123
5124 if (l_txn_type = WSMPCNST.MERGE) then
5125 l_stmt_num := 121;
5126 select common_routing_sequence_id, nvl(alternate_routing_designator, '-1')
5127 into l_rtg_seq_id, l_alt_rtg_desig
5128 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
5129 where wdj.wip_entity_id=wsji.wip_entity_id
5130 and wsji.representative_flag='Y'
5131 and wsji.header_id = l_header_id;
5132 else
5133 l_stmt_num := 122;
5134 select common_routing_sequence_id, nvl(alternate_routing_designator, '-1')
5135 into l_rtg_seq_id, l_alt_rtg_desig
5136 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
5137 where wdj.wip_entity_id=wsji.wip_entity_id
5138 and wsji.header_id=l_header_id;
5139 end if;
5140
5141 if ((l_wrji_rtg_seq_id <> -1) and
5142 (l_wrji_rtg_seq_id <> l_rtg_seq_id))
5143 then
5144
5145 --VJ: Start Additions for NSLBJ--
5146 --Also a fix for bug #2265237--
5147 l_stmt_num := 123;
5148 UPDATE wsm_resulting_jobs_interface wrji
5149 SET wrji.error_message = l_fnd_generic_err_msg
5150 WHERE wrji.header_id = l_header_id
5151 AND wrji.rowid = l_wrji_rowid;
5152 --VJ: End Additions for NSLBJ--
5153
5154 set_wrji_error(); -- WLTEnh
5155
5156 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_ROUTING_ID');
5157 FND_MESSAGE.SET_TOKEN('TABLE_NAME', 'WSM_RESULTING_JOBS_INTERFACE');
5158 l_fnd_err_msg := FND_MESSAGE.GET;
5159 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5160
5161 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5162 p_message => substr(l_fnd_err_msg,1,2000),
5163 p_request_id => fnd_global.conc_request_id,
5164 p_program_id => fnd_global.conc_program_id,
5165 p_program_application_id => fnd_global.prog_appl_id,
5166 p_message_type => 1, --ERROR
5167 x_err_code => p_err_num,
5168 x_err_msg => p_err_msg);
5169 IF(p_err_num <> 0) THEN
5170 raise proc_error;
5171 END IF;
5172 end if;
5173
5174 if ((l_alt_rtg_desig <> l_wrji_alt_rtg_desig) and
5175 (l_wrji_alt_rtg_desig <> '-1') and
5176 (l_alt_rtg_desig <> '-1'))
5177 then
5178
5179 --VJ: Start Additions for NSLBJ--
5180 --Also a fix for bug #2265237--
5181 l_stmt_num := 124;
5182 UPDATE wsm_resulting_jobs_interface wrji
5183 SET wrji.error_message = l_fnd_generic_err_msg
5184 WHERE wrji.header_id = l_header_id
5185 AND wrji.rowid = l_wrji_rowid;
5186 --VJ: End Additions for NSLBJ--
5187
5188 set_wrji_error(); -- WLTEnh
5189
5190 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_ALT_RTG_DESIG');
5191 FND_MESSAGE.SET_TOKEN('TABLE_NAME', 'WSM_RESULTING_JOBS_INTERFACE');
5192 l_fnd_err_msg := FND_MESSAGE.GET;
5193 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5194
5195 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5196 p_message => substr(l_fnd_err_msg,1,2000),
5197 p_request_id => fnd_global.conc_request_id,
5198 p_program_id => fnd_global.conc_program_id,
5199 p_program_application_id => fnd_global.prog_appl_id,
5200 p_message_type => 1, --ERROR
5201 x_err_code => p_err_num,
5202 x_err_msg => p_err_msg);
5203 IF(p_err_num <> 0) THEN
5204 raise proc_error;
5205 END IF;
5206 end if;
5207
5208 if (l_wrji_rtg_seq_id = -1) then
5209 l_stmt_num := 125;
5210 UPDATE wsm_resulting_jobs_interface wrji
5211 SET common_routing_sequence_id=l_rtg_seq_id
5212 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
5213 AND wrji.header_id=l_header_id
5214 AND wrji.rowid = l_wrji_rowid;
5215
5216 l_wrji_rtg_seq_id := l_rtg_seq_id;
5217
5218 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5219 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
5220 l_fnd_err_msg := FND_MESSAGE.GET;
5221 IF (l_debug = 'Y') THEN
5222 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5223 END IF;
5224 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5225 p_message => substr(l_fnd_err_msg,1,2000),
5226 p_request_id => fnd_global.conc_request_id,
5227 p_program_id => fnd_global.conc_program_id,
5228 p_program_application_id => fnd_global.prog_appl_id,
5229 p_message_type => 2, -- WARNING
5230 x_err_code => p_err_num,
5231 x_err_msg => p_err_msg);
5232 IF(p_err_num <> 0) THEN
5233 raise proc_error;
5234 END IF;
5235
5236 end if;
5237
5238 if ((l_wrji_alt_rtg_desig = '-1') and
5239 (l_alt_rtg_desig <> '-1'))
5240 then
5241 l_stmt_num := 126;
5242 UPDATE wsm_resulting_jobs_interface wrji
5243 SET alternate_routing_designator=l_alt_rtg_desig
5244 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
5245 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5246 AND wrji.header_id=l_header_id
5247 AND wrji.rowid = l_wrji_rowid;
5248
5249 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5250 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_routing_designator in Resulting Jobs');
5251 l_fnd_err_msg := FND_MESSAGE.GET;
5252 IF (l_debug = 'Y') THEN
5253 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5254 END IF;
5255 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5256 p_message => substr(l_fnd_err_msg,1,2000),
5257 p_request_id => fnd_global.conc_request_id,
5258 p_program_id => fnd_global.conc_program_id,
5259 p_program_application_id => fnd_global.prog_appl_id,
5260 p_message_type => 2, -- WARNING
5261 x_err_code => p_err_num,
5262 x_err_msg => p_err_msg);
5263 IF(p_err_num <> 0) THEN
5264 raise proc_error;
5265 END IF;
5266
5267 end if;
5268
5269 --Start NL Bugfix 3112243. If alt_rtg_desig is null in sj but non-null in rj, default the null into rj
5270
5271 if ((l_wrji_alt_rtg_desig <> '-1') and
5272 (l_alt_rtg_desig = '-1'))
5273 then
5274 l_stmt_num := 127;
5275 UPDATE wsm_resulting_jobs_interface wrji
5276 SET alternate_routing_designator=NULL
5277 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
5278 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5279 AND wrji.header_id=l_header_id
5280 AND wrji.rowid = l_wrji_rowid;
5281
5282 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5283 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_routing_designator in Resulting Jobs');
5284 l_fnd_err_msg := FND_MESSAGE.GET;
5285 IF (l_debug = 'Y') THEN
5286 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5287 END IF;
5288 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5289 p_message => substr(l_fnd_err_msg,1,2000),
5290 p_request_id => fnd_global.conc_request_id,
5291 p_program_id => fnd_global.conc_program_id,
5292 p_program_application_id => fnd_global.prog_appl_id,
5293 p_message_type => 2, -- WARNING
5294 x_err_code => p_err_num,
5295 x_err_msg => p_err_msg);
5296 IF(p_err_num <> 0) THEN
5297 raise proc_error;
5298 END IF;
5299
5300 end if;
5301 --End NL Bugfix 3112243
5302
5303 else /* ie. l_txn_type in (WSMPCNST.BONUS, WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING)) */
5304 /*SpUA: Split and Update Assy is now part of this list*/
5305
5306 if ((l_wrji_rtg_seq_id=-1) and
5307 (l_wrji_alt_rtg_desig='-1'))
5308 then
5309 l_stmt_num := 128;
5310 UPDATE wsm_resulting_jobs_interface wrji
5311 SET common_routing_sequence_id=
5312 (select bor.common_routing_sequence_id
5313 from bom_operational_routings bor
5314 where bor.assembly_item_id = decode(wrji.job_type,
5315 WIP_CONSTANTS.STANDARD, wrji.primary_item_id,
5316 wrji.routing_reference_id) -- Fix for bug #2369822
5317 and bor.alternate_routing_designator is null
5318 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5319 and bor.cfm_routing_flag = 3)
5320 WHERE wrji.header_id = l_header_id
5321 AND wrji.rowid = l_wrji_rowid --SpUA add
5322 RETURNING wrji.common_routing_sequence_id INTO l_wrji_rtg_seq_id; --Added to fix bug #2358370
5323
5324 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5325 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
5326 l_fnd_err_msg := FND_MESSAGE.GET;
5327 IF (l_debug = 'Y') THEN
5328 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5329 END IF;
5330 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5331 p_message => substr(l_fnd_err_msg,1,2000),
5332 p_request_id => fnd_global.conc_request_id,
5333 p_program_id => fnd_global.conc_program_id,
5334 p_program_application_id => fnd_global.prog_appl_id,
5335 p_message_type => 2, -- WARNING
5336 x_err_code => p_err_num,
5337 x_err_msg => p_err_msg);
5338 IF(p_err_num <> 0) THEN
5339 raise proc_error;
5340 END IF;
5341
5342 elsif ((l_wrji_rtg_seq_id<>-1) and
5343 (l_wrji_alt_rtg_desig<>'-1')) then
5344 l_stmt_num := 129;
5345 UPDATE wsm_resulting_jobs_interface wrji
5346 SET wrji.error_message = l_fnd_generic_err_msg
5347 WHERE wrji.header_id = l_header_id
5348 AND wrji.rowid = l_wrji_rowid --SpUA add
5349 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5350 AND NOT EXISTS (select 1
5351 from bom_operational_routings bor
5352 where bor.routing_sequence_id = wrji.common_routing_sequence_id
5353 and bor.alternate_routing_designator = wrji.alternate_routing_designator
5354 --and bor.assembly_item_id=wrji.primary_item_id --bugfix 2077930
5355 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5356 and bor.cfm_routing_flag=3);
5357
5358 IF (SQL%ROWCOUNT > 0) THEN
5359 set_wrji_error(); -- WLTEnh
5360
5361 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
5362 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
5363 l_fnd_err_msg := FND_MESSAGE.GET;
5364 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5365
5366 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5367 p_message => substr(l_fnd_err_msg,1,2000),
5368 p_request_id => fnd_global.conc_request_id,
5369 p_program_id => fnd_global.conc_program_id,
5370 p_program_application_id => fnd_global.prog_appl_id,
5371 p_message_type => 1, --ERROR
5372 x_err_code => p_err_num,
5373 x_err_msg => p_err_msg);
5374 IF(p_err_num <> 0) THEN
5375 raise proc_error;
5376 END IF;
5377 END IF;
5378
5379 elsif ( (l_wrji_rtg_seq_id<>-1) and
5380 (l_wrji_alt_rtg_desig='-1')) then
5381
5382 l_stmt_num := 130;
5383 UPDATE wsm_resulting_jobs_interface wrji
5384 SET wrji.error_message = l_fnd_generic_err_msg
5385 WHERE wrji.header_id = l_header_id
5386 AND wrji.rowid = l_wrji_rowid --SpUA add
5387 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5388 AND NOT EXISTS (select 1
5389 from bom_operational_routings bor
5390 where bor.routing_sequence_id = wrji.common_routing_sequence_id
5391 --and bor.assembly_item_id=wrji.primary_item_id --bugfix 2077930
5392 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5393 and bor.cfm_routing_flag=3);
5394
5395 if (SQL%ROWCOUNT=0) then
5396 l_stmt_num := 131;
5397 UPDATE wsm_resulting_jobs_interface wrji
5398 SET wrji.alternate_routing_designator =
5399 (select bor.alternate_routing_designator
5400 from bom_operational_routings bor
5401 where bor.routing_sequence_id = wrji.common_routing_sequence_id
5402 --and bor.assembly_item_id=wrji.primary_item_id --bugfix 2077930
5403 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5404 and bor.cfm_routing_flag=3)
5405 WHERE wrji.header_id = l_header_id
5406 AND wrji.rowid = l_wrji_rowid --SpUA add
5407 AND wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
5408
5409 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5410 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_routing_designator in Resulting Jobs');
5411 l_fnd_err_msg := FND_MESSAGE.GET;
5412 IF (l_debug = 'Y') THEN
5413 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5414 END IF;
5415 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5416 p_message => substr(l_fnd_err_msg,1,2000),
5417 p_request_id => fnd_global.conc_request_id,
5418 p_program_id => fnd_global.conc_program_id,
5419 p_program_application_id => fnd_global.prog_appl_id,
5420 p_message_type => 2, -- WARNING
5421 x_err_code => p_err_num,
5422 x_err_msg => p_err_msg);
5423 IF(p_err_num <> 0) THEN
5424 raise proc_error;
5425 END IF;
5426
5427 else
5428
5429 set_wrji_error(); -- WLTEnh
5430
5431 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_ROUTING_ID');
5432 FND_MESSAGE.SET_TOKEN('TABLE_NAME', 'WSM_RESULTING_JOBS_INTERFACE');
5433 l_fnd_err_msg := FND_MESSAGE.GET;
5434 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5435
5436 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5437 p_message => substr(l_fnd_err_msg,1,2000),
5438 p_request_id => fnd_global.conc_request_id,
5439 p_program_id => fnd_global.conc_program_id,
5440 p_program_application_id => fnd_global.prog_appl_id,
5441 p_message_type => 1, --ERROR
5442 x_err_code => p_err_num,
5443 x_err_msg => p_err_msg);
5444 IF(p_err_num <> 0) THEN
5445 raise proc_error;
5446 END IF;
5447 END IF;
5448
5449 elsif ( (l_wrji_rtg_seq_id=-1) and
5450 (l_wrji_alt_rtg_desig<>'-1')) then
5451
5452 l_stmt_num := 132;
5453 UPDATE wsm_resulting_jobs_interface wrji
5454 SET wrji.error_message = l_fnd_generic_err_msg
5455 WHERE wrji.header_id = l_header_id
5456 AND wrji.rowid = l_wrji_rowid --SpUA add
5457 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
5458 AND NOT EXISTS (select 1
5459 from bom_operational_routings bor
5460 where bor.alternate_routing_designator = wrji.alternate_routing_designator
5461 and bor.assembly_item_id = wrji.primary_item_id
5462 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5463 and bor.cfm_routing_flag=3);
5464
5465 if (SQL%ROWCOUNT=0) then
5466 l_stmt_num := 133;
5467 UPDATE wsm_resulting_jobs_interface wrji
5468 SET wrji.common_routing_sequence_id =
5469 (select bor.common_routing_sequence_id
5470 from bom_operational_routings bor
5471 where bor.alternate_routing_designator = wrji.alternate_routing_designator
5472 and bor.assembly_item_id = wrji.primary_item_id
5473 and bor.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
5474 and bor.cfm_routing_flag=3)
5475 WHERE wrji.header_id = l_header_id
5476 AND wrji.rowid = l_wrji_rowid --SpUA add
5477 AND wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
5478
5479 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5480 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
5481 l_fnd_err_msg := FND_MESSAGE.GET;
5482 IF (l_debug = 'Y') THEN
5483 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5484 END IF;
5485 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5486 p_message => substr(l_fnd_err_msg,1,2000),
5487 p_request_id => fnd_global.conc_request_id,
5488 p_program_id => fnd_global.conc_program_id,
5489 p_program_application_id => fnd_global.prog_appl_id,
5490 p_message_type => 2, -- WARNING
5491 x_err_code => p_err_num,
5492 x_err_msg => p_err_msg);
5493 IF(p_err_num <> 0) THEN
5494 raise proc_error;
5495 END IF;
5496
5497 else
5498
5499 set_wrji_error(); -- WLTEnh
5500
5501 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
5502 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_routing_sequence_id in Resulting Jobs');
5503 l_fnd_err_msg := FND_MESSAGE.GET;
5504 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5505
5506 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5507 p_message => substr(l_fnd_err_msg,1,2000),
5508 p_request_id => fnd_global.conc_request_id,
5509 p_program_id => fnd_global.conc_program_id,
5510 p_program_application_id => fnd_global.prog_appl_id,
5511 p_message_type => 1, --ERROR
5512 x_err_code => p_err_num,
5513 x_err_msg => p_err_msg);
5514 IF(p_err_num <> 0) THEN
5515 raise proc_error;
5516 END IF;
5517 END IF; /* sql%rowcount=0 condition ends */
5518
5519 END IF; /* l_wrji_rtg_seq_id and l_wrji_alt_rtg_desig condition ends */
5520
5521 --VJ: Start additions to fix bug #2352354--
5522 IF (l_txn_type in (WSMPCNST.UPDATE_ROUTING)) THEN
5523 l_stmt_num := 134;
5524 select nvl(common_routing_sequence_id, -1), nvl(alternate_routing_designator, '-1')
5525 , routing_revision, routing_revision_date -- Added for APS-WLT
5526 into l_rtg_seq_id, l_alt_rtg_desig
5527 , l_wdj_rtg_rev, l_wdj_rtg_rev_dt -- Added for APS-WLT
5528 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
5529 where wdj.wip_entity_id=wsji.wip_entity_id
5530 and wsji.header_id=l_header_id;
5531
5532 SELECT nvl(common_routing_sequence_id, -1), nvl(alternate_routing_designator, '-1')
5533 INTO l_wrji_rtg_seq_id, l_wrji_alt_rtg_desig
5534 FROM wsm_resulting_jobs_interface
5535 WHERE header_id = l_header_id;
5536
5537 --Start: Additions for APS-WLT--
5538 BOM_REVISIONS.Get_Revision(
5539 type => 'PROCESS',
5540 eco_status => 'ALL',
5541 examine_type => 'ALL',
5542 org_id => l_organization_id,
5543 item_id => l_primary_item_id,
5544 rev_date => nvl(l_rtg_rev_date,sysdate),
5545 itm_rev => l_rtg_rev);
5546
5547 IF(l_rtg_rev_date IS NULL) THEN
5548 /* ST : commenting this out for bug 3327459 */
5549 /* If no revision date is specified default to sysdate */
5550 /* BOM_REVISIONS.Get_High_Date(
5551 type => 'PROCESS',
5552 eco_status => 'ALL',
5553 org_id => l_organization_id,
5554 item_id => l_primary_item_id,
5555 itm_rev => l_rtg_rev,
5556 rev_date => l_rtg_rev_date); */
5557 /* Get the start date of the job and default it as the routing revision date */
5558 /* ST bug fix 3493984 : The routing revision date is defaulted to sysdate if NULL */
5559 /* l_rtg_rev_date := nvl(nvl(l_scheduled_start_date, l_sch_start_date),sysdate); */
5560
5561 l_rtg_rev_date := sysdate;
5562
5563 END IF;
5564
5565 l_stmt_num := 135;
5566 UPDATE wsm_resulting_jobs_interface
5567 SET routing_revision = l_rtg_rev,
5568 routing_revision_date = l_rtg_rev_date
5569 WHERE header_id = l_header_id;
5570 --End: Additions for APS-WLT--
5571
5572 IF (l_rtg_seq_id = l_wrji_rtg_seq_id) AND
5573 (l_alt_rtg_desig = l_wrji_alt_rtg_desig)
5574 AND (l_wdj_rtg_rev = l_rtg_rev) --Added for APS-WLT
5575 AND (l_wdj_rtg_rev_dt = l_rtg_rev_date) --Added for APS-WLT
5576 THEN
5577 FND_MESSAGE.SET_NAME('WSM', 'WSM_RESULTING_SAME');
5578 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Routing');
5579 l_fnd_err_msg := FND_MESSAGE.GET;
5580 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
5581
5582 set_wrji_error(); -- WLTEnh
5583
5584
5585 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
5586 p_message => substr(l_fnd_err_msg,1,2000),
5587 p_request_id => fnd_global.conc_request_id,
5588 p_program_id => fnd_global.conc_program_id,
5589 p_program_application_id => fnd_global.prog_appl_id,
5590 p_message_type => 1, --ERROR
5591 x_err_code => p_err_num,
5592 x_err_msg => p_err_msg);
5593 IF(p_err_num <> 0) THEN
5594 raise proc_error;
5595 END IF;
5596
5597 END IF;
5598
5599 END IF;
5600 --VJ: End additions to fix bug #2352354--
5601
5602 END IF; /* l_txn_type condition ends */
5603
5604
5605 --BA: CZH.BUG2398718
5606 -- the following code is part of populate_columns, call it again here after
5607 -- common_routing_seq_id is populated
5608 -- !!!!!!!! this might be a temp fix
5609 l_stmt_num := 136;
5610 /* ST bugfix 3336844 (2793501) commenting out check for locator control in MSI. Instead, populate locator_id from BOR
5611 --regardless of the locator control type. We will validate the locator info later.*/
5612 UPDATE wsm_resulting_jobs_interface rj
5613 SET (rj.completion_subinventory,
5614 rj.completion_locator_id) =
5615 (SELECT bor.completion_subinventory,
5616 /*decode(msi.locator_type, 1, NULL,*/ /*ST bug fix 3336844 */
5617 bor.completion_locator_id /*bug 3336844 )*/ -- BBK- Bug#2795951
5618 -- NULL) -- CZH.BUG2398718
5619 -- This is for other locator types like Dynamic Entry (3) and
5620 -- Item level control (4), which are not supported by OSFM.
5621 FROM bom_operational_routings bor,
5622 mtl_secondary_inventories msi -- CZH.BUG2398718
5623 WHERE bor.common_routing_sequence_id = rj.common_routing_sequence_id
5624 AND bor.organization_id = rj.organization_id
5625 AND bor.assembly_item_id = decode(rj.job_type,
5626 WIP_CONSTANTS.STANDARD, rj.primary_item_id,
5627 WIP_CONSTANTS.NONSTANDARD, rj.routing_reference_id,
5628 rj.primary_item_id)
5629 AND msi.secondary_inventory_name = bor.completion_subinventory -- CZH.BUG2398718
5630 AND msi.organization_id = bor.organization_id -- CZH.BUG2398718
5631 )
5632 WHERE rj.process_status = WIP_CONSTANTS.RUNNING
5633 AND rj.internal_group_id = WSMPLOAD.G_GROUP_ID
5634 AND rj.completion_subinventory is null
5635 AND rj.common_routing_sequence_id is not null -- CZH.BUG2398718
5636 AND rj.rowid = l_wrji_rowid --SpUA add
5637 AND rj.header_id IN (SELECT header_id
5638 FROM wsm_split_merge_txn_interface
5639 WHERE internal_group_id = WSMPLOAD.G_GROUP_ID
5640 AND process_status = WIP_CONSTANTS.RUNNING
5641 AND (transaction_type_id IN (WSMPCNST.UPDATE_ASSEMBLY,
5642 WSMPCNST.BONUS,
5643 WSMPCNST.UPDATE_ROUTING)
5644 --SpUA begin
5645 OR (transaction_type_id = WSMPCNST.SPLIT
5646 AND l_split_has_update_assy = 1)));
5647 --SpUA end
5648
5649 IF (SQL%ROWCOUNT > 0) and l_debug = 'Y' THEN
5650 fnd_message.set_name('WSM', 'WSM_MODIFIED_FIELD');
5651 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Subinventory and Locator from Routing');
5652 l_fnd_err_msg := FND_MESSAGE.GET;
5653 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.POPULATE_COLUMN('||l_stmt_num||'): '||l_fnd_err_msg);
5654 END IF;
5655 --EA: CZH.BUG2398718
5656
5657 -- BA: CZH.I_OED-1
5658 /*-----------------------------------------------------------------+
5659 | get routing revision date. |
5660 | for split, updAsm, updQty, get it form staring lot |
5661 | for merge, get it from representity lot |
5662 | for bonus, updAsm, updRtg if not populated, default it according |
5663 | to routing revision, or sysdate |
5664 +-----------------------------------------------------------------*/
5665 l_stmt_num := 137;
5666 /* ST bug fix 3327459 : In case of split with no change of assembly the routing rev date should default from the parent job,
5667 in case of a job with change of assembly the routing rev date should honour user entered date */
5668
5669 IF (l_txn_type IN (--WSMPCNST.SPLIT, /* ST fix for bug 3327459 */
5670 WSMPCNST.UPDATE_QUANTITY,
5671 WSMPCNST.UPDATE_LOT_NAME))
5672 OR (l_txn_type = WSMPCNST.SPLIT and l_split_has_update_assy = 0 ) /* ST fix for bug 3327459 */
5673 THEN
5674 l_stmt_num := 138;
5675 select wdj.routing_revision,
5676 wdj.routing_revision_date
5677 into l_rtg_rev,
5678 l_rtg_rev_date
5679 from wip_discrete_jobs wdj,
5680 wsm_starting_jobs_interface wsji
5681 where wdj.wip_entity_id=wsji.wip_entity_id
5682 and wsji.header_id=l_header_id;
5683
5684 ELSIF (l_txn_type = WSMPCNST.MERGE) THEN
5685 l_stmt_num := 139;
5686 select wdj.routing_revision,
5687 wdj.routing_revision_date
5688 into l_rtg_rev,
5689 l_rtg_rev_date
5690 from wip_discrete_jobs wdj,
5691 wsm_starting_jobs_interface wsji
5692 where wdj.wip_entity_id=wsji.wip_entity_id
5693 and wsji.representative_flag='Y'
5694 and wsji.header_id=l_header_id;
5695
5696 ELSE -- updAsm, updRtg, bonus,
5697 /* ST bug fix 3327459 also jobs in split with change of assembly */
5698 IF (l_job_type = WIP_CONSTANTS.STANDARD) THEN
5699 l_item_id := l_primary_item_id;
5700 ELSIF (l_job_type = WIP_CONSTANTS.NONSTANDARD) THEN
5701 l_item_id := l_routing_reference_id;
5702 END IF;
5703
5704 If (l_debug = 'Y') Then
5705 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
5706 ' l_organization_id='||l_organization_id||
5707 ', l_item_id='||l_item_id||
5708 ', l_rtg_rev_date='||l_rtg_rev_date||
5709 ', l_routing_rev='||l_rtg_rev||
5710 ', l_scheduled_start_date='||l_scheduled_start_date
5711 );
5712 End If;
5713
5714 /* BA 2662639 */
5715
5716 If WSMPVLDT.l_wrji_error_flag = 0 Then -- This is needed to avoid ORA-01001 Invalid CURSOR error.
5717
5718 /* ST bug fix 3493984 Added */
5719 if l_rtg_rev is null then
5720 l_rtg_rev_date := nvl(l_rtg_rev_date,sysdate);
5721 end if;
5722
5723 wip_revisions.routing_revision (
5724 p_organization_id => l_organization_id
5725 , p_item_id => l_item_id
5726 , p_revision => l_rtg_rev
5727 , p_revision_date => l_rtg_rev_date
5728 , p_start_date => nvl(l_scheduled_start_date, l_sch_start_date)
5729 );
5730
5731 /* ST bug fix 3493984 Update the resulting job interface */
5732 l_stmt_num := 139.1;
5733 update wsm_resulting_jobs_interface wrji
5734 set routing_revision_date = l_rtg_rev_date,
5735 routing_revision = l_rtg_rev
5736 where wrji.header_id = l_header_id
5737 and wrji.rowid = l_wrji_rowid;
5738
5739 IF (SQL%ROWCOUNT > 0) THEN
5740 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
5741 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'routing revision date/routing revision in Resulting Jobs');
5742 l_fnd_err_msg := FND_MESSAGE.GET;
5743 If l_debug = 'Y' Then
5744 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5745 ||l_stmt_num||'): '||l_fnd_err_msg);
5746 End If;
5747
5748 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
5749 p_header_id => l_header_id,
5750 p_message => substr(l_fnd_err_msg,1,2000),
5751 p_request_id => fnd_global.conc_request_id,
5752 p_program_id => fnd_global.conc_program_id,
5753 p_program_application_id => fnd_global.prog_appl_id,
5754 p_message_type => 2, --WARNING
5755 x_err_code => p_err_num,
5756 x_err_msg => p_err_msg);
5757 IF(p_err_num <> 0) THEN
5758 raise proc_error;
5759 END IF;
5760 END IF;
5761 /* ST bug fix 3493984 end */
5762
5763
5764 End If;
5765
5766 /* EA 2662639 */
5767
5768 END IF; -- transaction type
5769 -- EA: CZH.I_OED-1
5770
5771 l_stmt_num := 140;
5772 If (l_debug = 'Y') Then
5773 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
5774 ' l_organization_id='||l_organization_id||
5775 ', l_item_id='||l_item_id||
5776 ', l_rtg_rev_date='||l_rtg_rev_date||
5777 ', l_routing_rev='||l_rtg_rev||
5778 ', l_scheduled_start_date='||l_scheduled_start_date
5779 );
5780 End If;
5781
5782
5783 --Start: Additions for APS-WLT--
5784 l_profile_value := WSMPUTIL.CREATE_LBJ_COPY_RTG_PROFILE(l_organization_id); -- This returns the Profile value
5785 --End: Additions for APS-WLT--
5786
5787
5788 -- begin bugfix 1776002
5789 /*-----------------------------------------------------------------+
5790 | Disallow update txn from "ToMove" intraop if that operation is |
5791 | the last operation of the new routing. |
5792 | CZH.I_OED-1, we also check whether routing end is effective. |
5793 +-----------------------------------------------------------------*/
5794
5795 DECLARE
5796
5797 l_op_seq_id NUMBER;
5798 l_bos_opseq_num NUMBER; -- BBK NSOWLT
5799 l_bos_stdop_id NUMBER; -- BBK NSOWLT
5800 l_bso_stdop_code BOM_STANDARD_OPERATIONS.OPERATION_CODE%TYPE default NULL; -- BBK NSOWLT
5801 l_sj_intraoperation_step WSM_STARTING_JOBS_INTERFACE.INTRAOPERATION_STEP%TYPE default NULL; -- BBK NSOWLT
5802 l_rj_rout_seq_id NUMBER;
5803 l_end_op_seq_id NUMBER;
5804 x_error_code NUMBER;
5805 x_error_msg VARCHAR2(255);
5806 l_start_op_seq_id NUMBER; -- ADD: CZH.I_OED
5807 l_wrji_starting_op_seq_num NUMBER; -- ADD: CZH.I_OED
5808
5809 BEGIN
5810
5811 -- See if this std op id is in the new routing, if so, get its opseq id.
5812 -- If this std op id does not exist in the new routing, ignore.
5813
5814
5815 l_stmt_num := 141;
5816 --BA: CZH.I_OED-1, validate routing information here
5817 SELECT nvl(common_routing_sequence_id, -1)
5818 INTO l_wrji_rtg_seq_id
5819 FROM wsm_resulting_jobs_interface
5820 WHERE header_id = l_header_id and rowid = l_wrji_rowid; -- WLTEnh.
5821
5822 -- For Bonus, check routing start/end, if disabled error out
5823 IF (l_txn_type = WSMPCNST.BONUS and l_wrji_rtg_seq_id <> -1) THEN -- 4=Bns
5824 WSMPUTIL.find_routing_start (
5825 l_wrji_rtg_seq_id,
5826 l_rtg_rev_date,
5827 l_start_op_seq_id,
5828 x_error_code,
5829 x_error_msg);
5830 IF (x_error_code <> 0) THEN
5831 l_fnd_err_msg := x_error_msg;
5832 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5833 ||l_stmt_num||'): '||l_fnd_err_msg);
5834
5835 set_wrji_error(); -- WLTEnh
5836
5837 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
5838 p_header_id => l_header_id,
5839 p_message => substr(l_fnd_err_msg,1,2000),
5840 p_request_id => fnd_global.conc_request_id,
5841 p_program_id => fnd_global.conc_program_id,
5842 p_program_application_id => fnd_global.prog_appl_id,
5843 p_message_type => 1, --ERROR
5844 x_err_code => p_err_num,
5845 x_err_msg => p_err_msg);
5846 IF(p_err_num <> 0) THEN
5847 raise proc_error;
5848 END IF;
5849 END IF;
5850
5851 -- CZH.I_OED-2, even though x_error_code = 0, here, l_start_op_seq_id is
5852 -- still the one defined in BON, not the replacement, because
5853 -- WSMPUTIL.primary_path_is_effective_till need this
5854
5855 l_stmt_num := 142;
5856 -- IN WSMFJLTX.fmb, we check if the primary path is effective here,
5857 -- IF starting_operation_seq_num is specified.
5858 select wrji.starting_operation_seq_num
5859 into l_wrji_starting_op_seq_num
5860 from wsm_resulting_jobs_interface wrji
5861 where wrji.header_id = l_header_id;
5862
5863 -- Check if the primary path is effective
5864 IF(l_wrji_starting_op_seq_num IS NOT NULL
5865 and l_wrji_rtg_seq_id <> -1)
5866 THEN
5867 IF (WSMPUTIL.primary_path_is_effective_till (
5868 l_wrji_rtg_seq_id,
5869 l_rtg_rev_date,
5870 l_start_op_seq_id,
5871 l_wrji_starting_op_seq_num,
5872 x_error_code,
5873 x_error_msg) = 0)
5874 THEN
5875 FND_MESSAGE.SET_NAME('WSM', 'WSM_PRIMARY_PATH_DISABLED');
5876 l_fnd_err_msg := FND_MESSAGE.GET;
5877 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5878 ||l_stmt_num||'): '||l_fnd_err_msg);
5879
5880 set_wrji_error(); -- WLTEnh
5881
5882 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
5883 p_header_id => l_header_id,
5884 p_message => substr(l_fnd_err_msg,1,2000),
5885 p_request_id => fnd_global.conc_request_id,
5886 p_program_id => fnd_global.conc_program_id,
5887 p_program_application_id => fnd_global.prog_appl_id,
5888 p_message_type => 1, --ERROR
5889 x_err_code => p_err_num,
5890 x_err_msg => p_err_msg);
5891 IF(p_err_num <> 0) THEN
5892 raise proc_error;
5893 END IF;
5894 END IF;
5895 END IF; -- for STARTING_OPERATION_SEQ_NUM
5896 END IF; -- For Bonus
5897
5898 l_stmt_num := 143;
5899 -- For ALL transaction check routing end
5900 IF (l_wrji_rtg_seq_id <> -1) THEN
5901 WSMPUTIL.find_routing_end (
5902 l_wrji_rtg_seq_id,
5903 l_rtg_rev_date,
5904 l_end_op_seq_id,
5905 x_error_code,
5906 x_error_msg);
5907
5908 IF (x_error_code <> 0) THEN
5909 set_wrji_error(); -- WLTEnh
5910
5911 l_fnd_err_msg := x_error_msg;
5912 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5913 ||l_stmt_num||'): '||l_fnd_err_msg);
5914 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
5915 p_header_id => l_header_id,
5916 p_message => substr(l_fnd_err_msg,1,2000),
5917 p_request_id => fnd_global.conc_request_id,
5918 p_program_id => fnd_global.conc_program_id,
5919 p_program_application_id => fnd_global.prog_appl_id,
5920 p_message_type => 1, --ERROR
5921 x_err_code => p_err_num,
5922 x_err_msg => p_err_msg);
5923 IF(p_err_num <> 0) THEN
5924 raise proc_error;
5925 END IF;
5926 END IF;
5927 END IF;
5928 --EA: CZH.I_OED-1
5929
5930
5931 -- See if this std op id is in the new routing, if so, get its opseq id.
5932 -- If this std op id does not exist in the new routing, ignore.
5933
5934 l_stmt_num := 144;
5935 begin
5936 SELECT bos.operation_sequence_id,
5937 bos.operation_seq_num, -- BBK: NSO:WLT
5938 nvl(bos.standard_operation_id, -9999), -- BBK: NSO:WLT
5939 sj.intraoperation_step,
5940 nvl(rj.common_routing_sequence_id,-1) --VJ: Added for NSLBJ--
5941 --Combined with sql at stmt 345--
5942 INTO l_op_seq_id,
5943 l_bos_opseq_num,
5944 l_bos_stdop_id,
5945 l_sj_intraoperation_step, -- BBK:NSO:WLT
5946 l_rj_rout_seq_id --VJ: Added for NSLBJ--
5947 FROM bom_operation_sequences bos,
5948 wsm_resulting_jobs_interface rj,
5949 wsm_starting_jobs_interface sj,
5950 wip_operations wo
5951 WHERE sj.header_id = l_header_id
5952 AND rj.rowid = l_wrji_rowid --SpUA add
5953 AND sj.header_id = rj.header_id
5954 AND sj.operation_seq_num = wo.operation_seq_num
5955 AND sj.wip_entity_id = wo.wip_entity_id
5956 AND rj.common_routing_sequence_id = bos.routing_sequence_id
5957 AND nvl(wo.standard_operation_id, -9999) = nvl(bos.standard_operation_id, -9999) -- BBK:NSOWLT
5958 -- BC: CZH.I_OED-1, should get routing_revision date
5959 --AND bos.effectivity_date <= SYSDATE
5960 --AND nvl(bos.disable_date, SYSDATE+2) > SYSDATE ;
5961 ---HH24MISS --AND bos.effectivity_date <= l_rtg_rev_date
5962 ---HH24MISS --AND nvl(bos.disable_date, l_rtg_rev_date+2) > l_rtg_rev_date;
5963 AND l_rtg_rev_date between bos.effectivity_date and nvl(bos.disable_date, l_rtg_rev_date+2);
5964 -- EC: CZH.I_OED-1
5965
5966 exception
5967
5968 when NO_DATA_FOUND then
5969 l_op_seq_id := -99;
5970
5971 when OTHERS then -- when too_many_rows will be handled by this for repeated std ops.
5972 l_op_seq_id := -99;
5973 end;
5974
5975 IF (l_debug = 'Y') THEN
5976 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5977 ||l_stmt_num||':) l_op_seq_id = '||l_op_seq_id);
5978 END IF;
5979
5980 IF ( l_op_seq_id <> -99 ) THEN -- only when the std op id exists in the new routing,
5981 -- we need to check the following
5982 l_stmt_num := 145;
5983 IF (l_debug = 'Y') THEN
5984 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
5985 ||l_stmt_num||':) l_rtg_seq_id (from DJ)= '||l_rtg_seq_id);
5986 END IF;
5987
5988 -- Update error message col if user is performing update assembly/routing from "ToMove" of an oprn,
5989 -- which is the last oprn of the new routing. (l_op_seq_id = l_end_op_seq_id)
5990
5991 l_stmt_num := 146;
5992
5993 If (l_bos_stdop_id <> -9999) Then --Fix for bug #2358941--
5994
5995 l_stmt_num := 147;
5996 Select operation_code into l_bso_stdop_code
5997 From BOM_STANDARD_OPERATIONS
5998 Where standard_operation_id = l_bos_stdop_id;
5999
6000 End If;
6001
6002 -- Start : Fix for bug #3196985 --
6003 BEGIN
6004
6005 l_stmt_num := 148;
6006 SELECT wsji.intraoperation_step
6007 INTO l_st_iop
6008 FROM wsm_starting_jobs_interface wsji,
6009 wsm_split_merge_txn_interface wsmti
6010 WHERE wsji.header_id = l_header_id
6011 AND wsmti.header_id = l_header_id
6012 AND (wsmti.transaction_type_id in
6013 (WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING )
6014 OR (wsmti.transaction_type_id in (WSMPCNST.SPLIT)
6015 AND l_split_has_update_assy = 1));
6016
6017 IF (l_profile_value = 2) THEN -- Option A (Old Behavior)
6018 IF (l_st_iop = WIP_CONSTANTS.QUEUE) THEN -- Res St Op is mandatory.
6019 l_execute_this := 1;
6020 ELSE -- Job is at TM
6021 -- honor the user specified op seq - it may/maynot be NULL
6022 l_execute_this := 0;
6023 END IF;
6024 ELSE -- Option C (New Behavior)
6025 -- Start : Fix for bug #3154541 --
6026 -- l_execute_this := 1;
6027 IF (l_st_iop = WIP_CONSTANTS.QUEUE) THEN -- Res St Op is mandatory.
6028 l_execute_this := 1;
6029 ELSE -- Job is at TM
6030 -- User has to manually specify a starting operation
6031 l_execute_this := 2;
6032 END IF;
6033 -- End : Fix for bug #3154541 --
6034 END IF;
6035
6036 EXCEPTION
6037 WHEN OTHERS THEN
6038 l_execute_this := 0;
6039 END;
6040 -- End : Fix for bug #3196985 --
6041
6042 l_stmt_num := 149;
6043 IF (l_debug = 'Y') THEN
6044 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '
6045 ||'l_bos_stdop_id='||l_bos_stdop_id
6046 ||'l_bos_opseq_num='||l_bos_opseq_num
6047 ||', l_bso_stdop_code='||l_bso_stdop_code);
6048 END IF;
6049
6050 -- Start: Additions to fix bug #3154541--
6051 IF( l_execute_this = 2) THEN
6052 l_stmt_num := 150;
6053 UPDATE wsm_resulting_jobs_interface wrji
6054 SET wrji.error_message = l_fnd_generic_err_msg
6055 WHERE wrji.header_id = l_header_id
6056 AND wrji.rowid = l_wrji_rowid
6057 AND wrji.starting_operation_seq_num IS NULL
6058 AND wrji.starting_operation_code IS NULL;
6059
6060 IF (SQL%ROWCOUNT = 1) THEN
6061 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
6062 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_seq_num/starting_operation_code in Resulting Jobs');
6063 l_fnd_err_msg := FND_MESSAGE.GET;
6064 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6065
6066 set_wrji_error();
6067
6068 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6069 p_message => substr(l_fnd_err_msg,1,2000),
6070 p_request_id => fnd_global.conc_request_id,
6071 p_program_id => fnd_global.conc_program_id,
6072 p_program_application_id => fnd_global.prog_appl_id,
6073 p_message_type => 1, --ERROR
6074 x_err_code => p_err_num,
6075 x_err_msg => p_err_msg);
6076 IF(p_err_num <> 0) THEN
6077 raise proc_error;
6078 END IF;
6079 END IF;
6080
6081 -- End: Additions to fix bug #3154541--
6082 ELSIF( l_execute_this = 1) THEN -- Added to fix bug #3196985--
6083 l_stmt_num := 151;
6084 UPDATE wsm_resulting_jobs_interface wrji
6085 SET starting_operation_seq_num = l_bos_opseq_num,
6086 starting_operation_code = l_bso_stdop_code
6087 WHERE wrji.header_id = l_header_id
6088 and wrji.rowid = l_wrji_rowid --SpUA add
6089 and wrji.process_status = WIP_CONSTANTS.RUNNING
6090 and wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
6091 and exists (
6092 select 1
6093 from wsm_starting_jobs_interface sj,
6094 wsm_split_merge_txn_interface txn
6095 where txn.header_id = wrji.header_id
6096 and txn.header_id = sj.header_id
6097 and (txn.transaction_type_id in
6098 (WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING )
6099 --SpUA begin
6100 OR (txn.transaction_type_id in (WSMPCNST.SPLIT)
6101 AND l_split_has_update_assy = 1))
6102 --SpUA end
6103 --Start Changes to fix bug #2352369--
6104 --and sj.intraoperation_step = WIP_CONSTANTS.TOMOVE
6105 and (nvl(wrji.starting_std_op_id, l_bos_stdop_id) = l_bos_stdop_id OR
6106 nvl(wrji.starting_operation_code, l_bso_stdop_code) = l_bso_stdop_code)
6107 and wrji.starting_operation_seq_num IS NULL -- ADD: bugfix 2672003, 2682611
6108 and wrji.starting_operation_code IS NULL -- ADD: bugfix 2672003, 2682611
6109 --End Changes to fix bug #2352369--
6110 );
6111
6112 If (SQL%ROWCOUNT) > 0 then -- Bugfix 2563075 Added IF Clause
6113
6114 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6115 FND_MESSAGE.SET_TOKEN('FLD_NAME',
6116 ( ' starting operation seqnum/code in Resulting Jobs,'||
6117 ' as current operation is uniquely identified in target routing')
6118 );
6119 l_fnd_err_msg := FND_MESSAGE.GET;
6120
6121 IF (l_debug = 'Y') THEN
6122 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
6123 ||l_stmt_num||'): '||l_fnd_err_msg);
6124 END IF;
6125 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
6126 p_header_id => l_header_id,
6127 p_message => substr(l_fnd_err_msg,1,2000),
6128 p_request_id => fnd_global.conc_request_id,
6129 p_program_id => fnd_global.conc_program_id,
6130 p_program_application_id => fnd_global.prog_appl_id,
6131 p_message_type => 2, -- WARNING
6132 x_err_code => p_err_num,
6133 x_err_msg => p_err_msg);
6134 IF(p_err_num <> 0) THEN
6135 raise proc_error;
6136 END IF;
6137
6138 END IF; -- Added to fix bug #3196985--
6139
6140 End If; -- BugFix 2563075
6141
6142 -- EA NSO:WLT for unique stdopid/code in target routing --Bug#2095535 BBK
6143
6144 -- BA NSO:WLT when starting Job is at TO_MOVE nullify the starting opnum/code details.
6145 -- Bug#2095535
6146
6147
6148 ElsIf (l_sj_intraoperation_step = WIP_CONSTANTS.TOMOVE
6149 --SpUA bugfix 3161493. We should not null out starting_op for APS Option C
6150 and l_profile_value = 2) Then
6151 --End SpUA bugfix 3161493
6152
6153 l_stmt_num := 152;
6154 UPDATE wsm_resulting_jobs_interface wrji
6155 SET starting_operation_seq_num = NULL,
6156 starting_operation_code = NULL
6157 WHERE wrji.header_id = l_header_id
6158 AND wrji.rowid = l_wrji_rowid --SpUA add
6159 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6160 and wrji.process_status = WIP_CONSTANTS.RUNNING
6161 and wrji.internal_group_id = WSMPLOAD.G_GROUP_ID
6162 and exists (
6163 select 1
6164 from wsm_starting_jobs_interface sj,
6165 wsm_split_merge_txn_interface txn
6166 where txn.header_id = wrji.header_id
6167 and txn.header_id = sj.header_id
6168 and (txn.transaction_type_id in
6169 (WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING )
6170 --SpUA begin
6171 OR (txn.transaction_type_id in (WSMPCNST.SPLIT)
6172 AND l_split_has_update_assy = 1))
6173 --SpUA end
6174 and sj.intraoperation_step = WIP_CONSTANTS.TOMOVE
6175 );
6176
6177 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6178 FND_MESSAGE.SET_TOKEN('FLD_NAME',
6179 ( ' starting operation seqnum/code in Resulting Jobs to NULL,'||
6180 ' ; Job is at TO_MOVE intraoperation step.')
6181 );
6182 l_fnd_err_msg := FND_MESSAGE.GET;
6183 IF (l_debug = 'Y') THEN
6184 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
6185 ||l_stmt_num||'): '||l_fnd_err_msg);
6186 END IF;
6187 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
6188 p_header_id => l_header_id,
6189 p_message => substr(l_fnd_err_msg,1,2000),
6190 p_request_id => fnd_global.conc_request_id,
6191 p_program_id => fnd_global.conc_program_id,
6192 p_program_application_id => fnd_global.prog_appl_id,
6193 p_message_type => 2, -- WARNING
6194 x_err_code => p_err_num,
6195 x_err_msg => p_err_msg);
6196 IF(p_err_num <> 0) THEN
6197 raise proc_error;
6198 END IF;
6199
6200 -- EA BBK:NSO:WLT when starting Job is at TO_MOVE nullify the starting opnum/code details.
6201
6202 END IF; /* ( l_op_seq_id <> -99 )- ElsIf l_sj_intraoperation_step = WIP_CONSTANTS.TOMOVE */
6203
6204 END; --Disallow Upd txn at TM if that op is last op of new routing
6205 -- end bugfix 1776002
6206
6207
6208 /*-----------------------------------------------------------------+
6209 | Populate common_bom_sequence_id, alternate_bom_designator |
6210 | mark the record with warning message if no bom or routing is |
6211 | found. |
6212 +-----------------------------------------------------------------*/
6213 --SpUA begin
6214 if (l_txn_type in ( --WSMPCNST.SPLIT,
6215 WSMPCNST.MERGE,
6216 WSMPCNST.UPDATE_QUANTITY,
6217 WSMPCNST.UPDATE_LOT_NAME)
6218 OR (l_txn_type in (WSMPCNST.SPLIT) and l_split_has_update_assy = 0))
6219 then
6220 --SpUA end
6221
6222 if (l_txn_type = WSMPCNST.MERGE) then
6223 l_stmt_num := 153;
6224 select common_bom_sequence_id, nvl(alternate_bom_designator, '-1')
6225 into l_bom_seq_id, l_alt_bom_desig
6226 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
6227 where wdj.wip_entity_id=wsji.wip_entity_id
6228 and wsji.representative_flag='Y'
6229 and wsji.header_id=l_header_id;
6230 else
6231 l_stmt_num := 154;
6232 select common_bom_sequence_id, nvl(alternate_bom_designator, '-1')
6233 into l_bom_seq_id, l_alt_bom_desig
6234 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
6235 where wdj.wip_entity_id=wsji.wip_entity_id
6236 and wsji.header_id=l_header_id;
6237 end if;
6238
6239 if ((l_wrji_bom_seq_id <> -1) and
6240 (l_wrji_bom_seq_id <> l_bom_seq_id))
6241 then
6242
6243 --VJ: Start Additions for NSLBJ--
6244 --Also a fix for bug #2265237--
6245 l_stmt_num := 155;
6246 UPDATE wsm_resulting_jobs_interface wrji
6247 SET wrji.error_message = l_fnd_generic_err_msg
6248 WHERE wrji.header_id = l_header_id
6249 AND wrji.job_type = WIP_CONSTANTS.STANDARD
6250 AND wrji.rowid = l_wrji_rowid;
6251 --VJ: End Additions for NSLBJ--
6252
6253 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6254 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6255 l_fnd_err_msg := FND_MESSAGE.GET;
6256 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6257
6258 set_wrji_error(); -- WLTEnh
6259
6260 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6261 p_message => substr(l_fnd_err_msg,1,2000),
6262 p_request_id => fnd_global.conc_request_id,
6263 p_program_id => fnd_global.conc_program_id,
6264 p_program_application_id => fnd_global.prog_appl_id,
6265 p_message_type => 1, --ERROR
6266 x_err_code => p_err_num,
6267 x_err_msg => p_err_msg);
6268 IF(p_err_num <> 0) THEN
6269 raise proc_error;
6270 END IF;
6271 end if;
6272
6273 if ((l_alt_bom_desig <> l_wrji_alt_bom_desig) and
6274 (l_wrji_alt_bom_desig <> '-1') and
6275 (l_alt_bom_desig <> '-1'))
6276 then
6277
6278 --VJ: Start Additions for NSLBJ--
6279 --Also a fix for bug #2265237--
6280 l_stmt_num := 156;
6281 UPDATE wsm_resulting_jobs_interface wrji
6282 SET wrji.error_message = l_fnd_generic_err_msg
6283 WHERE wrji.header_id = l_header_id
6284 AND wrji.job_type = WIP_CONSTANTS.STANDARD
6285 AND wrji.rowid = l_wrji_rowid;
6286 --VJ: End Additions for NSLBJ--
6287
6288 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6289 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6290 l_fnd_err_msg := FND_MESSAGE.GET;
6291 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6292
6293 set_wrji_error(); -- WLTEnh
6294
6295 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6296 p_message => substr(l_fnd_err_msg,1,2000),
6297 p_request_id => fnd_global.conc_request_id,
6298 p_program_id => fnd_global.conc_program_id,
6299 p_program_application_id => fnd_global.prog_appl_id,
6300 p_message_type => 1, --ERROR
6301 x_err_code => p_err_num,
6302 x_err_msg => p_err_msg);
6303 IF(p_err_num <> 0) THEN
6304 raise proc_error;
6305 END IF;
6306 end if;
6307
6308 if (l_wrji_bom_seq_id = -1) then
6309 l_stmt_num := 157;
6310 UPDATE wsm_resulting_jobs_interface wrji
6311 SET common_bom_sequence_id=l_bom_seq_id
6312 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
6313 AND wrji.header_id=l_header_id
6314 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6315 AND wrji.rowid = l_wrji_rowid;
6316
6317 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6318 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6319 l_fnd_err_msg := FND_MESSAGE.GET;
6320 IF (l_debug = 'Y') THEN
6321 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6322 END IF;
6323 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6324 p_message => substr(l_fnd_err_msg,1,2000),
6325 p_request_id => fnd_global.conc_request_id,
6326 p_program_id => fnd_global.conc_program_id,
6327 p_program_application_id => fnd_global.prog_appl_id,
6328 p_message_type => 2, -- WARNING
6329 x_err_code => p_err_num,
6330 x_err_msg => p_err_msg);
6331 IF(p_err_num <> 0) THEN
6332 raise proc_error;
6333 END IF;
6334
6335 end if;
6336
6337 if ((l_wrji_alt_bom_desig = '-1') and (l_alt_bom_desig <> '-1'))
6338 then
6339
6340 l_stmt_num := 158;
6341 UPDATE wsm_resulting_jobs_interface wrji
6342 SET alternate_bom_designator=l_alt_bom_desig
6343 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
6344 AND wrji.header_id=l_header_id
6345 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6346 AND wrji.rowid = l_wrji_rowid;
6347
6348 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6349 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6350 l_fnd_err_msg := FND_MESSAGE.GET;
6351 IF (l_debug = 'Y') THEN
6352 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6353 END IF;
6354 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6355 p_message => substr(l_fnd_err_msg,1,2000),
6356 p_request_id => fnd_global.conc_request_id,
6357 p_program_id => fnd_global.conc_program_id,
6358 p_program_application_id => fnd_global.prog_appl_id,
6359 p_message_type => 2, -- WARNING
6360 x_err_code => p_err_num,
6361 x_err_msg => p_err_msg);
6362 IF(p_err_num <> 0) THEN
6363 raise proc_error;
6364 END IF;
6365
6366 end if;
6367
6368 --Start NL Bugfix 3112243. If alt_bom_desig is null in sj but non-null in rj, default the null into rj
6369 if ((l_wrji_alt_bom_desig <> '-1') and
6370 (l_alt_bom_desig = '-1'))
6371 then
6372
6373 l_stmt_num := 159;
6374 UPDATE wsm_resulting_jobs_interface wrji
6375 SET alternate_bom_designator=NULL
6376 WHERE wrji.process_status = WIP_CONSTANTS.RUNNING
6377 AND wrji.header_id=l_header_id
6378 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6379 AND wrji.rowid = l_wrji_rowid;
6380
6381 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6382 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6383 l_fnd_err_msg := FND_MESSAGE.GET;
6384 IF (l_debug = 'Y') THEN
6385 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6386 END IF;
6387 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6388 p_message => substr(l_fnd_err_msg,1,2000),
6389 p_request_id => fnd_global.conc_request_id,
6390 p_program_id => fnd_global.conc_program_id,
6391 p_program_application_id => fnd_global.prog_appl_id,
6392 p_message_type => 2, -- WARNING
6393 x_err_code => p_err_num,
6394 x_err_msg => p_err_msg);
6395 IF(p_err_num <> 0) THEN
6396 raise proc_error;
6397 END IF;
6398
6399 end if;
6400 --End NL Bugfix 3112243
6401
6402 else /* ie. if (l_txn_type in (WSMPCNST.BONUS, WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING)) */
6403 /* SpUA: Split and Update Assy is now part of this list */
6404
6405 l_stmt_num := 160;
6406 If (l_debug = 'Y') Then
6407 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
6408 'l_bom_seq_id='||l_bom_seq_id||
6409 ', l_wrji_bom_seq_id='||l_wrji_bom_seq_id||
6410 ', l_alt_bom_desig='||l_alt_bom_desig||
6411 ', l_wrji_alt_bom_desig='||l_wrji_alt_bom_desig);
6412 END IF;
6413
6414 if ((l_wrji_bom_seq_id=-1) and
6415 (l_wrji_alt_bom_desig='-1'))
6416 -----------------------------------------------------------------------------------
6417 -- user populated NULL for WRJI common_bom_sequence_id, alternate_bom_designator --
6418 -----------------------------------------------------------------------------------
6419 then
6420 l_stmt_num := 161;
6421 UPDATE wsm_resulting_jobs_interface wrji
6422 SET common_bom_sequence_id=
6423 (select bom.common_bill_sequence_id
6424 from bom_bill_of_materials bom,
6425 mtl_system_items msi --bugfix 1828859
6426 where bom.assembly_item_id = wrji.primary_item_id
6427 and bom.alternate_bom_designator is null
6428 and bom.organization_id = l_organization_id --bugfix 1922146: added orgn_id condn
6429 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6430 and msi.organization_id = bom.organization_id
6431 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6432 or (bom.assembly_type = 2)))
6433 -- and bom.assembly_type = 1) --endfix
6434 WHERE wrji.header_id = l_header_id
6435 AND wrji.rowid = l_wrji_rowid --SpUA add
6436 AND wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
6437
6438 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6439 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6440 l_fnd_err_msg := FND_MESSAGE.GET;
6441 IF (l_debug = 'Y') THEN
6442 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6443 END IF;
6444 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6445 p_message => substr(l_fnd_err_msg,1,2000),
6446 p_request_id => fnd_global.conc_request_id,
6447 p_program_id => fnd_global.conc_program_id,
6448 p_program_application_id => fnd_global.prog_appl_id,
6449 p_message_type => 2, -- WARNING
6450 x_err_code => p_err_num,
6451 x_err_msg => p_err_msg);
6452 IF(p_err_num <> 0) THEN
6453 raise proc_error;
6454 END IF;
6455
6456 -- Comments about bugfix 1828859
6457 -- Modified the original validation which only takes care of Mfg Bill.
6458 -- For now this part of validation will take of Mfg item with Mfg Bill or Eng Bill, as well as
6459 -- Fng item with Eng bill. But it wont work for Eng item with Mfg Bill, since now BOM does not
6460 -- support. Further modification is needed if BOM support Eng item with Mfg Bill.
6461 -- Comments ends.
6462
6463 elsif ( (l_wrji_bom_seq_id<>-1) and
6464 (l_wrji_alt_bom_desig<>'-1')) then
6465
6466 l_stmt_num := 162;
6467 UPDATE wsm_resulting_jobs_interface wrji
6468 SET wrji.error_message = l_fnd_generic_err_msg
6469 WHERE wrji.header_id = l_header_id
6470 AND wrji.rowid = l_wrji_rowid --SpUA add
6471 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6472 AND NOT EXISTS (select 1
6473 from bom_bill_of_materials bom,
6474 mtl_system_items msi --bugfix 1828859
6475 where bom.bill_sequence_id = wrji.common_bom_sequence_id
6476 and bom.alternate_bom_designator = wrji.alternate_bom_designator
6477 and bom.organization_id = l_organization_id
6478 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6479 and msi.organization_id = bom.organization_id
6480 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6481 or (bom.assembly_type = 2)));
6482
6483
6484 IF (SQL%ROWCOUNT > 0) THEN
6485 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6486 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6487 l_fnd_err_msg := FND_MESSAGE.GET;
6488 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6489
6490 set_wrji_error(); -- WLTEnh
6491
6492 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6493 p_message => substr(l_fnd_err_msg,1,2000),
6494 p_request_id => fnd_global.conc_request_id,
6495 p_program_id => fnd_global.conc_program_id,
6496 p_program_application_id => fnd_global.prog_appl_id,
6497 p_message_type => 1, --ERROR
6498 x_err_code => p_err_num,
6499 x_err_msg => p_err_msg);
6500 IF(p_err_num <> 0) THEN
6501 raise proc_error;
6502 END IF;
6503 END IF;
6504
6505 elsif ( (l_wrji_bom_seq_id<>-1) and
6506 (l_wrji_alt_bom_desig='-1')) then
6507
6508 l_stmt_num := 163;
6509 UPDATE wsm_resulting_jobs_interface wrji
6510 SET wrji.error_message = l_fnd_generic_err_msg
6511 WHERE wrji.header_id = l_header_id
6512 AND wrji.rowid = l_wrji_rowid --SpUA add
6513 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6514 AND NOT EXISTS (select 1
6515 from bom_bill_of_materials bom,
6516 mtl_system_items msi --bugfix 1828859
6517 where bom.bill_sequence_id = wrji.common_bom_sequence_id
6518 --and bom.assembly_item_id=wrji.primary_item_id --bugfix 2077930
6519 and bom.organization_id = l_organization_id -- bugfix 1922146: added orgn_id condn
6520 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6521 and msi.organization_id = bom.organization_id
6522 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6523 or (bom.assembly_type = 2)));
6524 -- and bom.assembly_type=1); --endfix
6525
6526 if (SQL%ROWCOUNT=0) then
6527 l_stmt_num := 164;
6528 UPDATE wsm_resulting_jobs_interface wrji
6529 SET wrji.alternate_bom_designator = (select bom.alternate_bom_designator
6530 from bom_bill_of_materials bom,
6531 mtl_system_items msi --bugfix 1828859
6532 where bom.bill_sequence_id = wrji.common_bom_sequence_id
6533 --and bom.assembly_item_id=wrji.primary_item_id --bugfix 2077930
6534 and bom.organization_id = l_organization_id
6535 --bugfix 1922146: added orgn_id condn
6536 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6537 and msi.organization_id = bom.organization_id
6538 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6539 or (bom.assembly_type = 2)))
6540 -- and bom.assembly_type=1) --endfix
6541 WHERE wrji.header_id = l_header_id
6542 AND wrji.rowid = l_wrji_rowid --SpUA add
6543 AND wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
6544
6545 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6546 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6547 l_fnd_err_msg := FND_MESSAGE.GET;
6548 IF (l_debug = 'Y') THEN
6549 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6550 END IF;
6551 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6552 p_message => substr(l_fnd_err_msg,1,2000),
6553 p_request_id => fnd_global.conc_request_id,
6554 p_program_id => fnd_global.conc_program_id,
6555 p_program_application_id => fnd_global.prog_appl_id,
6556 p_message_type => 2, -- WARNING
6557 x_err_code => p_err_num,
6558 x_err_msg => p_err_msg);
6559 IF(p_err_num <> 0) THEN
6560 raise proc_error;
6561 END IF;
6562
6563 else
6564 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6565 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6566 l_fnd_err_msg := FND_MESSAGE.GET;
6567 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6568
6569 set_wrji_error(); -- WLTEnh
6570
6571 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6572 p_message => substr(l_fnd_err_msg,1,2000),
6573 p_request_id => fnd_global.conc_request_id,
6574 p_program_id => fnd_global.conc_program_id,
6575 p_program_application_id => fnd_global.prog_appl_id,
6576 p_message_type => 1, --ERROR
6577 x_err_code => p_err_num,
6578 x_err_msg => p_err_msg);
6579 IF(p_err_num <> 0) THEN
6580 raise proc_error;
6581 END IF;
6582 end if;
6583
6584 elsif ((l_wrji_bom_seq_id=-1) and
6585 (l_wrji_alt_bom_desig<>'-1')) then
6586
6587 l_stmt_num := 165;
6588 UPDATE wsm_resulting_jobs_interface wrji
6589 SET wrji.error_message = l_fnd_generic_err_msg
6590 WHERE wrji.header_id = l_header_id
6591 AND wrji.rowid = l_wrji_rowid --SpUA add
6592 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6593 and NOT EXISTS (select 1
6594 from bom_bill_of_materials bom,
6595 mtl_system_items msi --bugfix 1828859
6596 where bom.alternate_bom_designator = wrji.alternate_bom_designator
6597 and bom.assembly_item_id = wrji.primary_item_id
6598 and bom.organization_id = l_organization_id -- bugfix 1922146: added orgn_id condn
6599 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6600 and msi.organization_id = bom.organization_id
6601 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6602 or (bom.assembly_type = 2)));
6603 -- and bom.assembly_type=1); --endfix
6604
6605 if (SQL%ROWCOUNT=0) then
6606 l_stmt_num := 166;
6607 UPDATE wsm_resulting_jobs_interface wrji
6608 SET wrji.common_bom_sequence_id = (select bom.common_bill_sequence_id
6609 from bom_bill_of_materials bom,
6610 mtl_system_items msi --bugfix 1828859
6611 where bom.alternate_bom_designator = wrji.alternate_bom_designator
6612 and bom.assembly_item_id = wrji.primary_item_id
6613 and bom.organization_id = l_organization_id
6614 -- bugfix 1922146: added orgn_id condn
6615 and msi.inventory_item_id = bom.assembly_item_id --bugfix 1828859
6616 and msi.organization_id = bom.organization_id
6617 and ((bom.assembly_type = 1 and msi.eng_item_flag = 'N')
6618 or (bom.assembly_type = 2)))
6619 -- and bom.assembly_type=1) --endfix
6620 WHERE wrji.header_id = l_header_id
6621 AND wrji.rowid = l_wrji_rowid
6622 AND wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
6623
6624 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6625 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id in Resulting Jobs');
6626 l_fnd_err_msg := FND_MESSAGE.GET;
6627 IF (l_debug = 'Y') THEN
6628 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6629 END IF;
6630 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6631 p_message => substr(l_fnd_err_msg,1,2000),
6632 p_request_id => fnd_global.conc_request_id,
6633 p_program_id => fnd_global.conc_program_id,
6634 p_program_application_id => fnd_global.prog_appl_id,
6635 p_message_type => 2, -- WARNING
6636 x_err_code => p_err_num,
6637 x_err_msg => p_err_msg);
6638 IF(p_err_num <> 0) THEN
6639 raise proc_error;
6640 END IF;
6641
6642 else
6643 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6644 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6645 l_fnd_err_msg := FND_MESSAGE.GET;
6646 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6647
6648 set_wrji_error(); -- WLTEnh
6649
6650 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6651 p_message => substr(l_fnd_err_msg,1,2000),
6652 p_request_id => fnd_global.conc_request_id,
6653 p_program_id => fnd_global.conc_program_id,
6654 p_program_application_id => fnd_global.prog_appl_id,
6655 p_message_type => 1, --ERROR
6656 x_err_code => p_err_num,
6657 x_err_msg => p_err_msg);
6658 IF(p_err_num <> 0) THEN
6659 raise proc_error;
6660 END IF;
6661 end if; /* sql%notfound condition check ends */
6662 end if; /* l_wrji_bom_seq_id and l_wrji_alt_bom_desig condition check ends */
6663
6664 --VJ: Start additions to fix bug #2352344--
6665 --Extra validations for Upd Rtg--
6666 if (l_txn_type in (WSMPCNST.UPDATE_ROUTING)) THEN
6667 l_stmt_num := 167;
6668 select nvl(common_bom_sequence_id, -1), nvl(alternate_bom_designator, '-1')
6669 into l_bom_seq_id, l_alt_bom_desig
6670 from wip_discrete_jobs wdj, wsm_starting_jobs_interface wsji
6671 where wdj.wip_entity_id=wsji.wip_entity_id
6672 and wsji.header_id=l_header_id;
6673
6674 l_stmt_num := 168;
6675
6676 SELECT nvl(common_bom_sequence_id, -1), nvl(alternate_bom_designator, '-1')
6677 INTO l_wrji_bom_seq_id, l_wrji_alt_bom_desig
6678 FROM wsm_resulting_jobs_interface
6679 WHERE header_id = l_header_id;
6680
6681 If (l_debug = 'Y') Then
6682 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
6683 'l_bom_seq_id='||l_bom_seq_id||
6684 ', l_wrji_bom_seq_id='||l_wrji_bom_seq_id||
6685 ', l_alt_bom_desig='||l_alt_bom_desig||
6686 ', l_wrji_alt_bom_desig='||l_wrji_alt_bom_desig);
6687 END IF;
6688
6689 IF((l_bom_seq_id <> l_wrji_bom_seq_id) OR
6690 (l_alt_bom_desig <> l_wrji_alt_bom_desig)) THEN
6691 l_stmt_num := 169;
6692 UPDATE wsm_resulting_jobs_interface wrji
6693 SET common_bom_sequence_id = l_bom_seq_id,
6694 alternate_bom_designator = l_alt_bom_desig
6695 WHERE wrji.header_id = l_header_id;
6696
6697 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6698 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'common_bom_sequence_id/alternate_bom_designator in Resulting Jobs');
6699 l_fnd_err_msg := FND_MESSAGE.GET;
6700 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6701
6702 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6703 p_message => substr(l_fnd_err_msg,1,2000),
6704 p_request_id => fnd_global.conc_request_id,
6705 p_program_id => fnd_global.conc_program_id,
6706 p_program_application_id => fnd_global.prog_appl_id,
6707 p_message_type => 2, --WARNING
6708 x_err_code => p_err_num,
6709 x_err_msg => p_err_msg);
6710 IF(p_err_num <> 0) THEN
6711 raise proc_error;
6712 END IF;
6713 END IF;
6714
6715 end if;
6716 --VJ: End additions to fix bug #2352344--
6717 end if; /* l_txn_type check ends */
6718
6719 /*EA#1623701*/
6720
6721
6722 /*-----------------------------------------------------------------+
6723 | validate alternate routing in wsm_resulting_jobs_interface table |
6724 +-----------------------------------------------------------------*/
6725
6726 l_stmt_num := 170;
6727 --VJ: Start Changes for NSLBJ--
6728 --Changed the sql since org_id has been added to WRJI now--
6729
6730 UPDATE wsm_resulting_jobs_interface wrji
6731 SET wrji.error_message = l_fnd_generic_err_msg
6732 WHERE wrji.header_id = l_header_id
6733 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6734 and not exists (select null
6735 from bom_routing_alternates_v bor
6736 where bor.assembly_item_id = wrji.primary_item_id
6737 and bor.organization_id = wrji.organization_id
6738 and bor.cfm_routing_flag = 3
6739 and (bor.alternate_routing_designator =
6740 wrji.alternate_routing_designator or
6741 wrji.alternate_routing_designator is NULL));
6742
6743 --VJ: End Changes for NSLBJ--
6744
6745 IF (SQL%ROWCOUNT > 0) THEN
6746 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6747 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_routing_designator in Resulting Jobs');
6748 l_fnd_err_msg := FND_MESSAGE.GET;
6749 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6750
6751 set_wrji_error(); -- WLTEnh
6752
6753 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6754 p_message => substr(l_fnd_err_msg,1,2000),
6755 p_request_id => fnd_global.conc_request_id,
6756 p_program_id => fnd_global.conc_program_id,
6757 p_program_application_id => fnd_global.prog_appl_id,
6758 p_message_type => 1, --ERROR
6759 x_err_code => p_err_num,
6760 x_err_msg => p_err_msg);
6761 IF(p_err_num <> 0) THEN
6762 raise proc_error;
6763 END IF;
6764 END IF;
6765
6766
6767 /*--------------------------------------------------------------+
6768 | validate alternate bill in wsm_resulting_jobs_interface table |
6769 +--------------------------------------------------------------*/
6770
6771 l_stmt_num := 171;
6772
6773 --VJ: Start Changes for NSLBJ--
6774 --Changed the sql since org_id has been added to WRJI now--
6775 UPDATE wsm_resulting_jobs_interface wrji
6776 SET wrji.error_message = l_fnd_generic_err_msg
6777 WHERE wrji.header_id = l_header_id
6778 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
6779 and not exists
6780 (select null
6781 from bom_bill_alternates_v bba,
6782 mtl_system_items msi --bugfix 1828859
6783 where bba.assembly_item_id = wrji.primary_item_id
6784 and bba.organization_id = wrji.organization_id
6785 and msi.inventory_item_id = bba.assembly_item_id --bugfix 1828859
6786 and msi.organization_id = bba.organization_id
6787 and ((bba.assembly_type = 1 and msi.eng_item_flag = 'N')
6788 or (bba.assembly_type = 2))
6789 and (bba.alternate_bom_designator =
6790 NVL(wrji.alternate_bom_designator, bba.alternate_bom_designator)) -- or
6791 -- wrji.alternate_bom_designator is NULL)); --- BugFix2627354
6792
6793 /*BA2627354*/
6794 -- It is NOT MANDATORY to have a BOM for JOB. BBK.
6795 UNION
6796 select null from dual where l_wrji_alt_bom_desig = '-1'
6797 /*EA2627354*/
6798 );
6799
6800 --VJ: End Changes for NSLBJ--
6801
6802 IF (SQL%ROWCOUNT > 0) THEN
6803 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
6804 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'alternate_bom_designator in Resulting Jobs');
6805 l_fnd_err_msg := FND_MESSAGE.GET;
6806 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
6807
6808 set_wrji_error(); -- WLTEnh
6809
6810 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6811 p_message => substr(l_fnd_err_msg,1,2000),
6812 p_request_id => fnd_global.conc_request_id,
6813 p_program_id => fnd_global.conc_program_id,
6814 p_program_application_id => fnd_global.prog_appl_id,
6815 p_message_type => 1, --ERROR
6816 x_err_code => p_err_num,
6817 x_err_msg => p_err_msg);
6818 IF(p_err_num <> 0) THEN
6819 raise proc_error;
6820 END IF;
6821 END IF;
6822
6823 --VJ: Start Additions for NSLBJ--
6824 --Moved this piece of code from WSMPPTAB.sm_table to here--
6825
6826 FOR c_bom_rtg_revision_rec IN bom_rtg_revision(l_header_id, l_we_name) LOOP
6827 --VJ: Added param to fix bug #2315397--
6828 l_stmt_num := 172;
6829 -- Get the Routing Revision and Routing Revision Date first --
6830 IF (c_bom_rtg_revision_rec.job_type = WIP_CONSTANTS.STANDARD) THEN
6831 l_temp := c_bom_rtg_revision_rec.item_id;
6832 ELSIF (c_bom_rtg_revision_rec.job_type = WIP_CONSTANTS.NONSTANDARD) THEN
6833 l_temp := c_bom_rtg_revision_rec.rtg_ref_id;
6834 END IF;
6835
6836 -- BA: CZH.I_OED-1: the following logic is not right,
6837 -- should not default routing revision date to SYSDATE, instead,
6838 -- For UpdQty, UpdLnm, Split, Merge, should take from staring job
6839 -- For UpdAsm, UpdRtg, Bonus, should honor user's entry first
6840 l_rev_date := l_rtg_rev_date;
6841 -- EA: CZH.I_OED-1
6842
6843 If (l_debug = 'Y') Then
6844 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
6845 ' l_organization_id='||l_organization_id||
6846 ', l_temp='||l_temp||
6847 ', l_rev_date='||l_rev_date||
6848 ', l_routing_rev='||l_routing_rev);
6849 End If;
6850
6851 l_stmt_num := 173;
6852
6853 /* BA 2662639 */
6854 If WSMPVLDT.l_wrji_error_flag = 0 Then -- This is needed to avoid ORA-01001 Invalid CURSOR error.
6855
6856 wip_revisions.routing_revision (
6857 p_organization_id => l_organization_id
6858 , p_item_id => l_temp
6859 , p_revision => l_routing_rev
6860 , p_revision_date => l_rev_date
6861 , p_start_date => nvl(l_scheduled_start_date, l_sch_start_date)
6862 );
6863 End If;
6864
6865 /* EA 2662639 */
6866
6867 If (l_debug = 'Y') Then
6868 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
6869 ' l_organization_id='||l_organization_id||
6870 ', l_temp='||l_temp||
6871 ', l_rev_date='||l_rev_date||
6872 ', l_routing_rev='||l_routing_rev);
6873 End If;
6874
6875 l_stmt_num := 174;
6876 UPDATE WSM_RESULTING_JOBS_INTERFACE WRJI
6877 SET WRJI.routing_revision = l_routing_rev,
6878 WRJI.routing_revision_date = l_rev_date
6879 WHERE WRJI.header_id = l_header_id
6880 AND WRJI.wip_entity_name = c_bom_rtg_revision_rec.we_name
6881 AND (WRJI.routing_revision IS NULL
6882 OR WRJI.routing_revision_date IS NULL);
6883
6884 IF (SQL%ROWCOUNT > 0) THEN
6885 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6886 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'routing_revision/routing_revision_date in Resulting Jobs');
6887 l_fnd_err_msg := FND_MESSAGE.GET;
6888 If l_debug = 'Y' Then
6889
6890 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
6891 ||l_stmt_num||'): '||l_fnd_err_msg);
6892 End If;
6893
6894 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6895 p_message => substr(l_fnd_err_msg,1,2000),
6896 p_request_id => fnd_global.conc_request_id,
6897 p_program_id => fnd_global.conc_program_id,
6898 p_program_application_id => fnd_global.prog_appl_id,
6899 p_message_type => 2, --WARNING
6900 x_err_code => p_err_num,
6901 x_err_msg => p_err_msg);
6902 IF(p_err_num <> 0) THEN
6903 raise proc_error;
6904 END IF;
6905 END IF;
6906
6907 l_stmt_num := 175;
6908 IF (c_bom_rtg_revision_rec.job_type = WIP_CONSTANTS.STANDARD) THEN
6909 l_stmt_num := 176;
6910 l_temp := c_bom_rtg_revision_rec.item_id;
6911 ELSIF (c_bom_rtg_revision_rec.job_type = WIP_CONSTANTS.NONSTANDARD) THEN
6912 l_stmt_num := 177;
6913 l_temp := c_bom_rtg_revision_rec.bom_ref_id;
6914 END IF;
6915
6916 -- CZH.??? This might need to be changed in I
6917 /*BA WLTEnh*/
6918 l_bom_revision := c_bom_rtg_revision_rec.bom_revision;
6919 l_bom_revision_date := c_bom_rtg_revision_rec.bom_revision_date;
6920 /*EA WLTEnh*/
6921
6922 If (l_debug = 'Y') Then
6923 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
6924 ' l_organization_id='||l_organization_id||
6925 ', l_temp(itemId) ='||l_temp||
6926 ', l_bom_revision_date ='||l_bom_revision_date||
6927 ', l_bom_revision ='||l_bom_revision);
6928 End If;
6929
6930
6931 IF (l_temp <> -1) THEN -- it could be = -1 for NSLBJ, if no BOM is specified
6932 -- Get the BOM Revision and BOM Revision Date now --
6933
6934 /*BA 2662639 */
6935
6936 If WSMPVLDT.l_wrji_error_flag = 0 Then -- This is needed to avoid ORA-01001 Invalid CURSOR error.
6937
6938 wip_revisions.bom_revision (
6939 p_organization_id => l_organization_id
6940 , p_item_id => l_temp
6941 , p_revision => l_bom_revision
6942 , p_revision_date => l_bom_revision_date
6943 , p_start_date => nvl(l_scheduled_start_date, l_sch_start_date)
6944 );
6945 End If;
6946
6947 /*EA 2662639 */
6948
6949 END IF;
6950
6951
6952 If (l_debug = 'Y') Then
6953 FND_FILE.PUT_LINE(FND_FILE.LOG, 'At line# '||l_stmt_num||
6954 ' l_organization_id='||l_organization_id||
6955 ', l_temp(itemId) ='||l_temp||
6956 ', l_bom_revision_date ='||l_bom_revision_date||
6957 ', l_bom_revision ='||l_bom_revision);
6958 End If;
6959
6960 l_stmt_num := 178;
6961 UPDATE WSM_RESULTING_JOBS_INTERFACE WRJI
6962 SET WRJI.bom_revision = l_bom_revision,
6963 WRJI.bom_revision_date = l_bom_revision_date
6964 WHERE WRJI.header_id = l_header_id
6965 AND WRJI.wip_entity_name = c_bom_rtg_revision_rec.we_name;
6966 /* ST : 3712972 Update in all the cases.... revision date given precedence....
6967 AND (WRJI.bom_revision IS NULL
6968 OR WRJI.bom_revision_date IS NULL);
6969 */
6970 IF (SQL%ROWCOUNT > 0) THEN
6971 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
6972 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'bom_revision/bom_revision_date in Resulting Jobs');
6973 l_fnd_err_msg := FND_MESSAGE.GET;
6974 If l_debug = 'Y' Then
6975 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
6976 ||l_stmt_num||'): '||l_fnd_err_msg);
6977 End If;
6978
6979 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
6980 p_message => substr(l_fnd_err_msg,1,2000),
6981 p_request_id => fnd_global.conc_request_id,
6982 p_program_id => fnd_global.conc_program_id,
6983 p_program_application_id => fnd_global.prog_appl_id,
6984 p_message_type => 2, --WARNING
6985 x_err_code => p_err_num,
6986 x_err_msg => p_err_msg);
6987 IF(p_err_num <> 0) THEN
6988 raise proc_error;
6989 END IF;
6990 END IF;
6991
6992 END LOOP;
6993
6994 --VJ: End Additions for NSLBJ--
6995
6996
6997 /*-------------------------------------------------+
6998 | validate routing_revision/routing_revision_date |
6999 | in wsm_resulting_jobs_interface table |
7000 +-------------------------------------------------*/
7001
7002 l_stmt_num := 179;
7003 --VJ: Start Changes for NSLBJ--
7004 --Changed the sql since org_id has been added to WRJI now--
7005 UPDATE wsm_resulting_jobs_interface wrji
7006 SET wrji.error_message = l_fnd_generic_err_msg
7007 WHERE wrji.header_id = l_header_id
7008 AND wrji.job_type = WIP_CONSTANTS.STANDARD --VJ: Added for NSLBJ--
7009 and not exists (select null
7010 from mtl_routing_rev_highdate_v rou
7011 where wrji.organization_id = rou.organization_id
7012 --VJ: Start Changes for NSLBJ--
7013 and rou.inventory_item_id = decode(l_job_type,
7014 WIP_CONSTANTS.STANDARD,
7015 wrji.primary_item_id,
7016 WIP_CONSTANTS.NONSTANDARD,
7017 wrji.routing_reference_id)
7018 --VJ: End Changes for NSLBJ--
7019 and rou.process_revision = nvl(wrji.routing_revision,
7020 rou.process_revision)
7021 --BD: CZH: OED-1, DO NOT HAVE TO
7022 --and nvl(wrji.routing_revision_date,sysdate)
7023 -- between rou.effectivity_date and rou.high_date
7024 --ED: CZH: OED-1
7025 );
7026 --VJ: End Changes for NSLBJ--
7027
7028 IF (SQL%ROWCOUNT > 0) THEN
7029 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
7030 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'routing_revision/routing_revision_date in Resulting Jobs');
7031 l_fnd_err_msg := FND_MESSAGE.GET;
7032 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7033
7034 set_wrji_error(); -- WLTEnh
7035
7036 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7037 p_message => substr(l_fnd_err_msg,1,2000),
7038 p_request_id => fnd_global.conc_request_id,
7039 p_program_id => fnd_global.conc_program_id,
7040 p_program_application_id => fnd_global.prog_appl_id,
7041 p_message_type => 1, --ERROR
7042 x_err_code => p_err_num,
7043 x_err_msg => p_err_msg);
7044 IF(p_err_num <> 0) THEN
7045 raise proc_error;
7046 END IF;
7047 END IF;
7048
7049
7050 /*-----------------------------------------+
7051 | validate bom_revision/bom_revision_date |
7052 | in wsm_resulting_jobs_interface table |
7053 +-----------------------------------------*/
7054
7055 /* ST : 3712972 validation not required as the check will be done in wip_revisions.bom_revision
7056 BEGIN
7057 FOR REV_REC in REV_CUR(l_header_id)
7058 LOOP
7059 BEGIN
7060 l_stmt_num := 180;
7061 SELECT REV_REC.HEADER_ID INTO l_temp
7062 FROM mtl_item_rev_highdate_v MIR ,
7063 wsm_resulting_jobs_interface RJ
7064 WHERE MIR.ORGANIZATION_ID = REV_REC.ORGANIZATION_ID
7065 AND RJ.ROWID = chartorowid(REV_REC.X_ROWID)
7066 AND MIR.INVENTORY_ITEM_ID = RJ.PRIMARY_ITEM_ID
7067 AND ( (MIR.REVISION = nvl(RJ.BOM_REVISION, MIR.REVISION))
7068 AND ( nvl(RJ.BOM_REVISION_DATE,MIR.EFFECTIVITY_DATE) BETWEEN
7069 MIR.EFFECTIVITY_DATE AND MIR.HIGH_DATE ) );
7070
7071 EXCEPTION
7072 WHEN NO_DATA_FOUND THEN
7073 FND_MESSAGE.SET_NAME('WSM', 'WSM_INFO_NOT_FOUND');
7074 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'bill revision in Resulting Jobs');
7075 l_fnd_err_msg := FND_MESSAGE.GET;
7076
7077 l_stmt_num := 181;
7078 UPDATE wsm_resulting_jobs_interface
7079 SET error_message = l_fnd_err_msg
7080 WHERE ROWID = chartorowid(REV_REC.X_ROWID);
7081
7082 IF (SQL%ROWCOUNT > 0) THEN
7083 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7084
7085 set_wrji_error(); -- WLTEnh
7086
7087 --WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_temp,
7088 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id, --Changed to fix bug #2345536
7089 p_message => substr(l_fnd_err_msg,1,2000),
7090 p_request_id => fnd_global.conc_request_id,
7091 p_program_id => fnd_global.conc_program_id,
7092 p_program_application_id => fnd_global.prog_appl_id,
7093 p_message_type => 1, --ERROR
7094 x_err_code => p_err_num,
7095 x_err_msg => p_err_msg);
7096 IF(p_err_num <> 0) THEN
7097 raise proc_error;
7098 END IF;
7099 END IF;
7100
7101 WHEN TOO_MANY_ROWS THEN
7102 NULL;
7103 END;
7104 END LOOP;
7105 END;
7106 */
7107
7108 -- New validation for NSO-WLT
7109 /*-------------------------------------------------------------------+
7110 | For update routing/assembly, if the starting operation for the |
7111 | resulting lot is |
7112 | . A non-std op or |
7113 | . Not present in the resulting job or |
7114 | . Appears several times in the n/w routing or |
7115 | . Does not appear in the n/w routing, |
7116 | then |
7117 | . Error out the transaction with an appropriate message. |
7118 +------------------------------------------------------------------*/
7119
7120 -- EA: NSO-WLT
7121
7122 -- ***********************************************************************
7123
7124 if (l_txn_type in (WSMPCNST.UPDATE_ASSEMBLY, WSMPCNST.UPDATE_ROUTING)
7125 --SpUA begin
7126 OR (l_txn_type in (WSMPCNST.SPLIT) AND l_split_has_update_assy = 1)) then
7127 --SpUA end
7128
7129 DECLARE
7130
7131 l_com_rtg_seq_id NUMBER;
7132 l_pri_it_id NUMBER;
7133 l_start_op_seq_num NUMBER;
7134 l_start_op_code VARCHAR2(4) := NULL;
7135 l_start_std_op_id NUMBER;
7136 l_op_is_std NUMBER;
7137 l_op_rptd_times NUMBER;
7138 l_err_code NUMBER;
7139 l_err_msg VARCHAR2(2000);
7140 l_processing_err_excp EXCEPTION;
7141 l_organization_id NUMBER; -- BBK
7142 l_sj_intraoperation_step NUMBER; --BBK:NSO:WLT:Bug#2095535
7143
7144 BEGIN
7145
7146 l_upd_rtg_asly_err := 0;
7147
7148 l_stmt_num := 182;
7149 IF(l_job_type = WIP_CONSTANTS.STANDARD) THEN --VJ: Added for NSLBJ--
7150 l_stmt_num := 183;
7151 select
7152 bor.common_routing_sequence_id,
7153 wrji.primary_item_id,
7154 wrji.starting_operation_seq_num,
7155 wrji.starting_operation_code,
7156 wrji.starting_std_op_id
7157 , wrji.organization_id
7158 , wsji.intraoperation_step
7159 into
7160 l_com_rtg_seq_id,
7161 l_pri_it_id,
7162 l_start_op_seq_num,
7163 l_start_op_code,
7164 l_start_std_op_id
7165 , l_organization_id
7166 , l_sj_intraoperation_step
7167 from
7168 bom_operational_routings bor,
7169 wsm_resulting_jobs_interface wrji,
7170 wsm_starting_jobs_interface wsji
7171 where
7172 bor.assembly_item_id = wrji.primary_item_id
7173 and nvl(bor.alternate_routing_designator, '*') = nvl(wrji.alternate_routing_designator, '*')
7174 and wrji.header_id = l_header_id
7175 and wrji.rowid = l_wrji_rowid --SpUA add
7176 and wsji.header_id = wrji.header_id
7177 and bor.organization_id = wrji.organization_id --VJ: Added for NSLBJ--
7178 --Above condition also a fix for bug #2269765--
7179 and wrji.job_type = WIP_CONSTANTS.STANDARD; --VJ: Added for NSLBJ--
7180
7181 --VJ: Start Additions for NSLBJ--
7182 ELSIF(l_job_type = WIP_CONSTANTS.NONSTANDARD) THEN
7183 l_stmt_num := 184;
7184 select
7185 wrji.common_routing_sequence_id,
7186 wrji.primary_item_id,
7187 wrji.starting_operation_seq_num,
7188 wrji.starting_operation_code,
7189 wrji.starting_std_op_id
7190 , wrji.organization_id
7191 , wsji.intraoperation_step
7192 into
7193 l_com_rtg_seq_id,
7194 l_pri_it_id,
7195 l_start_op_seq_num,
7196 l_start_op_code,
7197 l_start_std_op_id
7198 , l_organization_id
7199 , l_sj_intraoperation_step
7200 from
7201 wsm_resulting_jobs_interface wrji,
7202 wsm_starting_jobs_interface wsji
7203 where
7204 wrji.header_id = l_header_id
7205 and wrji.rowid = l_wrji_rowid --SpUA add
7206 and wsji.header_id = wrji.header_id
7207 and wrji.job_type = WIP_CONSTANTS.NONSTANDARD; --VJ: Added for NSLBJ--
7208
7209 END IF;
7210 --VJ: End Additions for NSLBJ--
7211
7212 If (l_debug = 'Y') Then
7213 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
7214 'l_com_rtg_seq_id='||l_com_rtg_seq_id||
7215 ', l_pri_it_id='||l_pri_it_id||
7216 ', l_start_op_seq_num='||l_start_op_seq_num||
7217 ', l_start_op_code='||l_start_op_code||
7218 ', l_start_std_op_id='||l_start_std_op_id||
7219 ', l_organization_id='||l_organization_id||
7220 ', l_sj_intraoperation_step='||l_sj_intraoperation_step);
7221 END IF;
7222
7223 if (
7224 (l_pri_it_id is not null) and
7225 (l_com_rtg_seq_id is not null) and
7226 (l_start_op_seq_num is null )
7227 ) then
7228
7229
7230 l_stmt_num := 185;
7231 -- This is called to get information about the starting operation --
7232 -- in the target routing --
7233 WSMPUTIL.operation_is_standard_repeats (
7234 p_routing_sequence_id => l_com_rtg_seq_id,
7235 p_routing_revision_date => l_rtg_rev_date, -- sysdate
7236 p_standard_operation_id => l_start_std_op_id,
7237 p_operation_code => l_start_op_code,
7238 p_organization_id => l_organization_id, --BBK
7239 p_op_is_std_op => l_op_is_std,
7240 p_op_repeated_times => l_op_rptd_times,
7241 x_err_code => l_err_code,
7242 x_err_msg => l_err_msg);
7243
7244 If l_err_code <> 0 Then
7245 l_stmt_num := 186;
7246 l_fnd_err_msg := l_err_msg;
7247 l_upd_rtg_asly_err := 1;
7248 raise l_processing_err_excp;
7249 End If;
7250
7251 If (l_debug = 'Y') Then
7252
7253 FND_FILE.PUT_LINE(FND_FILE.LOG,
7254 'Returned success from WSMPUTIL.operation_is_standard_repeats;'
7255 || ' Job currently at intraoperation Step: '|| l_sj_intraoperation_step
7256 ||'; l_op_is_std: ' || l_op_is_std
7257 || '; l_op_rptd_times '|| l_op_rptd_times);
7258
7259 End If;
7260
7261
7262 if (l_op_is_std = 0 and l_sj_intraoperation_step <> WIP_CONSTANTS.TOMOVE ) then
7263 l_stmt_num := 187;
7264 -- op is non-std
7265 FND_MESSAGE.SET_NAME('WSM', 'WSM_JOB_AT_NSO'); --BBK
7266 l_fnd_err_msg := FND_MESSAGE.GET;
7267 -- l_fnd_err_msg := 'Please specify the starting operation, since current operation does not exist in the target routing.';
7268 raise l_processing_err_excp;
7269
7270 elsif (l_op_rptd_times = 0 and l_sj_intraoperation_step <> WIP_CONSTANTS.TOMOVE) then
7271 l_stmt_num := 188;
7272 -- this std op does not exist in the target asly/routing
7273 fnd_message.set_name('WSM', 'WSM_NO_CURRENT_STDOP_TGTRTG'); --BBK
7274 l_fnd_err_msg := FND_MESSAGE.GET;
7275 raise l_processing_err_excp;
7276
7277 -- BA#Bug#2095535 BBK:NSO:WLT
7278
7279 --elsif (l_op_rptd_times = 1 and l_sj_intraoperation_step = WIP_CONSTANTS.TOMOVE) then
7280 elsif (l_op_rptd_times = 1) then -- CHG: BUGFIX 2686319
7281
7282 -- this std op does exist only once in the target asly/routing
7283
7284 --BA: BUGFIX 2686319 get the start_op_seq_num
7285 if( l_start_std_op_id IS NULL) then
7286 l_stmt_num := 189;
7287 select standard_operation_id
7288 into l_start_std_op_id
7289 from bom_standard_operations
7290 where organization_id = l_organization_id -- BBK
7291 and operation_type = 1 -- Standard Operation Type BBK
7292 and line_id is NULL -- Not for a WIP Line BBK
7293 and operation_code = l_start_op_code;
7294 end if;
7295
7296 l_stmt_num := 190;
7297 select bos.operation_seq_num
7298 into l_start_op_seq_num
7299 from bom_operation_sequences bos
7300 where bos.routing_sequence_id = l_com_rtg_seq_id
7301 and bos.operation_type = 1
7302 and bos.STANDARD_OPERATION_ID = l_start_std_op_id;
7303 --BA: BUGFIX 2686319 get the start_op_seq_num
7304 l_stmt_num := 191;
7305 UPDATE wsm_resulting_jobs_interface wrji
7306 SET starting_std_op_id = l_start_std_op_id,
7307 starting_operation_seq_num = l_start_op_seq_num, -- ADD: BUGFIX 2686319
7308 starting_operation_code = l_start_op_code
7309 WHERE wrji.header_id = l_header_id
7310 and wrji.rowid = l_wrji_rowid --SpUA add
7311 and wrji.process_status = WIP_CONSTANTS.RUNNING
7312 and wrji.internal_group_id = WSMPLOAD.G_GROUP_ID;
7313
7314
7315 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
7316 FND_MESSAGE.SET_TOKEN('FLD_NAME',
7317 ( ' starting operation code/std.op id in Resulting Jobs,'||
7318 ' as current operation is uniquely identified in target routing')
7319 );
7320 l_fnd_err_msg := FND_MESSAGE.GET;
7321 IF (l_debug = 'Y') THEN
7322 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
7323 ||l_stmt_num||'): '||l_fnd_err_msg);
7324 END IF;
7325 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (
7326 p_header_id => l_header_id,
7327 p_message => substr(l_fnd_err_msg,1,2000),
7328 p_request_id => fnd_global.conc_request_id,
7329 p_program_id => fnd_global.conc_program_id,
7330 p_program_application_id => fnd_global.prog_appl_id,
7331 p_message_type => 2, -- WARNING
7332 x_err_code => p_err_num,
7333 x_err_msg => p_err_msg);
7334 IF(p_err_num <> 0) THEN
7335 raise proc_error;
7336 END IF;
7337 -- EA#Bug#2095535 BBK:NSO:WLT
7338
7339 elsif (l_op_rptd_times > 1 and l_sj_intraoperation_step <> WIP_CONSTANTS.TOMOVE ) then
7340 -- this std op is repeated more than once in the routing.
7341 l_stmt_num := 192;
7342 FND_MESSAGE.SET_NAME('WSM', 'WSM_JOB_AT_REPEATED_OP'); --BBK
7343 l_fnd_err_msg := FND_MESSAGE.GET;
7344 raise l_processing_err_excp;
7345
7346 elsif (
7347 (l_op_is_std = 0 and l_sj_intraoperation_step = WIP_CONSTANTS.TOMOVE)
7348 OR (l_op_rptd_times <> 1 and l_sj_intraoperation_step = WIP_CONSTANTS.TOMOVE)
7349 ) then
7350 -- At TO_MOVE, if current operation is
7351 -- A Nonstandard operation OR
7352 -- A standard operation but is not repeated in tgrtouting
7353 -- A Standard Operation but is repeated more than once.
7354 -- Null out the starting opseqnum/code..but done already.
7355
7356 null;
7357
7358 end if;
7359
7360 end if;
7361
7362
7363 EXCEPTION
7364
7365 when no_data_found then
7366 l_upd_rtg_asly_err := 1;
7367 fnd_message.set_name('WSM', 'WSM_NO_WSM_ROUTING'); --BBK
7368 l_fnd_err_msg := FND_MESSAGE.GET;
7369
7370 when l_processing_err_excp then
7371 l_upd_rtg_asly_err := 1;
7372
7373 when others then
7374 l_upd_rtg_asly_err := 1;
7375 l_fnd_err_msg := substr((SQLCODE||SQLERRM), 1, 2000); --BBK
7376
7377 END;
7378
7379 if (l_upd_rtg_asly_err = 1) then
7380
7381 BEGIN
7382
7383 l_stmt_num := 193;
7384 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7385
7386 UPDATE wsm_resulting_jobs_interface
7387 SET error_message = l_fnd_err_msg
7388 WHERE header_id = l_header_id
7389 AND rowid = l_wrji_rowid; --SpUA add
7390
7391 --WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE(p_header_id => l_temp,
7392
7393 set_wrji_error(); -- WLTEnh
7394
7395 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE(p_header_id => l_header_id, --Changed to fix bug #2345536
7396 p_message => substr(l_fnd_err_msg,1,2000),
7397 p_request_id => fnd_global.conc_request_id,
7398 p_program_id => fnd_global.conc_program_id,
7399 p_program_application_id => fnd_global.prog_appl_id,
7400 p_message_type => 1, --ERROR
7401 x_err_code => p_err_num,
7402 x_err_msg => p_err_msg);
7403
7404 IF(p_err_num <> 0) THEN
7405 raise proc_error;
7406 END IF;
7407
7408 EXCEPTION
7409
7410 WHEN OTHERS THEN
7411 NULL;
7412
7413 END;
7414
7415 end if; -- if (l_upd_rtg_asly_err = 1)
7416
7417 end if; -- if (l_txn_type in (update asly/rtg)
7418
7419 -- ***********************************************************************
7420 -- EA: NSO-WLT
7421
7422 /*-----------------------------------------------------------------+
7423 | Validate starting_operation_seq_num in wsm_resulting_jobs_ |
7424 | interface table. We need to validate operation seq only for |
7425 | *BONUS* txn. For other transaction types, if the resulting |
7426 | lot matches the start lot, we will later modify the operation seq|
7427 | to match starting lot. |
7428 ------------------------------------------------------------------*/
7429
7430 l_stmt_num := 194;
7431 --VJ: Start Changes for NSLBJ--
7432 --Changed the sql since org_id has been added to WRJI now--
7433 UPDATE wsm_resulting_jobs_interface wrji
7434 SET wrji.error_message = l_fnd_generic_err_msg
7435 WHERE wrji.header_id = l_header_id
7436 AND exists (SELECT null
7437 FROM wsm_split_merge_txn_interface txn
7438 WHERE txn.header_id = wrji.header_id
7439 AND txn.transaction_type_id = WSMPCNST.BONUS)
7440 AND wrji.starting_std_op_id is not null
7441 AND wrji.starting_operation_code is not null
7442 AND wrji.starting_std_op_id <>
7443 ( SELECT bso.standard_operation_id
7444 FROM bom_standard_operations bso
7445 WHERE bso.organization_id = wrji.organization_id
7446 AND bso.operation_code = wrji.starting_operation_code);
7447
7448 --VJ: End Changes for NSLBJ--
7449
7450 IF (SQL%ROWCOUNT > 0) THEN
7451 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
7452 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_std_op_id/starting_operation_code in Resulting Jobs');
7453 l_fnd_err_msg := FND_MESSAGE.GET;
7454 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7455
7456 set_wrji_error(); -- WLTEnh
7457
7458 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7459 p_message => substr(l_fnd_err_msg,1,2000),
7460 p_request_id => fnd_global.conc_request_id,
7461 p_program_id => fnd_global.conc_program_id,
7462 p_program_application_id => fnd_global.prog_appl_id,
7463 p_message_type => 1, --ERROR
7464 x_err_code => p_err_num,
7465 x_err_msg => p_err_msg);
7466 IF(p_err_num <> 0) THEN
7467 raise proc_error;
7468 END IF;
7469 END IF;
7470
7471
7472 --Changed following logic to fix bug #2358370--
7473 -- BA NSO-WLT: This validation has been modified to support non-std ops in the n/w rtg.
7474
7475 /*---------------------------------------------------------------------------------------+
7476 | This validation is for BONUS JOBS only.
7477 |
7478 | if neither starting_operation_code nor starting_operation_seq_num is specified then
7479 | error out;
7480 | else if starting_operation_code is given then
7481 | populate starting_std_op_id and starting_operation_seq_num
7482 | else
7483 | populate starting_operation_code;
7484 +---------------------------------------------------------------------------------------*/
7485 -- EA NSO-WLT
7486 --The following logic now holds as a fix for bug #2358370-
7487 -- If neither starting_operation_code, starting_operation_seq_num or starting_std_op_id are specified,
7488 -- then default them with the information of the 1st op in the routing
7489 --If starting_operation_code is specified, default starting_operation_seq_num and starting_std_op_id
7490 --If starting_operation_seq_num is defined, default starting_operation_code and starting_std_op_id
7491
7492 -----------------------------------------------------------------------------
7493 --- Start Validation for Starting Operation info for BONUS Txns alone -------
7494 --- Default other information if some information provided and then -------
7495 --- re-validate it again ----------------------------------------------------
7496 -----------------------------------------------------------------------------
7497
7498 l_stmt_num := 195;
7499 SELECT count(*)
7500 INTO l_count
7501 FROM wsm_resulting_jobs_interface wrji
7502 WHERE wrji.header_id = l_header_id
7503 AND exists (SELECT null
7504 FROM wsm_split_merge_txn_interface txn
7505 WHERE txn.header_id = wrji.header_id
7506 AND txn.transaction_type_id = WSMPCNST.BONUS);
7507
7508 IF (l_debug = 'Y') THEN
7509 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): l_count='||l_count);
7510 END IF;
7511
7512
7513 IF (l_count > 0) THEN -- EndIf just before stmt_num = 535 --
7514
7515 l_stmt_num := 196;
7516 SELECT wrji.starting_std_op_id,
7517 wrji.starting_operation_code,
7518 wrji.starting_operation_seq_num
7519 INTO l_start_std_op_id,
7520 l_start_op_code,
7521 l_start_op_seq_num
7522 FROM wsm_resulting_jobs_interface wrji
7523 WHERE wrji.header_id = l_header_id
7524 AND exists (SELECT null
7525 FROM wsm_split_merge_txn_interface txn
7526 WHERE txn.header_id = wrji.header_id
7527 AND txn.transaction_type_id = WSMPCNST.BONUS);
7528
7529 IF (l_debug = 'Y') THEN
7530 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
7531 ||l_stmt_num||'): l_start_std_op_id='
7532 ||l_start_std_op_id||', l_start_op_code='
7533 ||l_start_op_code||', l_start_op_seq_num='
7534 ||l_start_op_seq_num);
7535 END IF;
7536
7537
7538 --Changed following to fix bug #2358370--
7539 IF (
7540 (nvl(l_start_op_code, '*') = '*') and
7541 (nvl(l_start_op_seq_num, -9999) = -9999) and
7542 (nvl(l_start_std_op_id, -9999) = -9999)
7543 ) then
7544
7545 l_stmt_num := 197;
7546
7547 WSMPUTIL.find_routing_start (p_routing_sequence_id => l_wrji_rtg_seq_id,
7548 p_routing_rev_date => l_rtg_rev_date,
7549 -- CZH.I_OED-2: should be fixed in I_OED-1
7550 start_op_seq_id => l_start_op_seq_id,
7551 x_err_code => p_err_num,
7552 x_err_msg => p_err_msg);
7553
7554 IF (p_err_num <> 0) THEN
7555
7556 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPUTIL.find_routing_start returned error');
7557 l_stmt_num := 198;
7558 UPDATE wsm_resulting_jobs_interface
7559 SET error_message = p_err_msg
7560 where header_id = l_header_id;
7561
7562 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||p_err_msg);
7563
7564 set_wrji_error(); -- WLTEnh
7565
7566 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7567 p_message => substr(p_err_msg,1,2000),
7568 p_request_id => fnd_global.conc_request_id,
7569 p_program_id => fnd_global.conc_program_id,
7570 p_program_application_id => fnd_global.prog_appl_id,
7571 p_message_type => 1, --ERROR
7572 x_err_code => p_err_num,
7573 x_err_msg => p_err_msg);
7574 IF(p_err_num <> 0) THEN
7575 raise proc_error;
7576 END IF;
7577
7578 ELSE
7579 FND_FILE.PUT_LINE(FND_FILE.LOG,'WSMPUTIL.find_routing_start returned success');
7580 END IF;
7581
7582 l_stmt_num := 199;
7583 select bos.operation_seq_num,
7584 bos.standard_operation_id
7585 into l_bos_op_seq_num,
7586 l_bos_std_op_id
7587 from bom_operation_sequences bos
7588 where bos.operation_sequence_id = l_start_op_seq_id;
7589
7590 l_bso_op_code := NULL;
7591 IF (nvl(l_bos_std_op_id, -9999) <> -9999) THEN -- Get the op_code
7592 l_stmt_num := 200;
7593 SELECT operation_code
7594 INTO l_bso_op_code
7595 FROM bom_standard_operations
7596 WHERE standard_operation_id = l_bos_std_op_id
7597 AND organization_id = l_organization_id;
7598 END IF;
7599
7600 l_stmt_num := 201;
7601 IF (l_debug = 'Y') THEN
7602 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
7603 'l_bos_op_seq_num='||l_bos_op_seq_num||
7604 ', l_bos_std_op_id='||l_bos_std_op_id||
7605 ', l_bso_op_code='||l_bso_op_code);
7606 END IF;
7607
7608 UPDATE wsm_resulting_jobs_interface wrji
7609 SET wrji.starting_operation_seq_num = l_bos_op_seq_num,
7610 wrji.starting_operation_code = l_bso_op_code,
7611 wrji.starting_std_op_id = l_bos_std_op_id
7612 WHERE wrji.header_id = l_header_id;
7613
7614 IF (SQL%ROWCOUNT > 0) THEN
7615 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
7616 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_seq_num/starting_operation_code/starting_std_op_id in Resulting Jobs');
7617 l_fnd_err_msg := FND_MESSAGE.GET;
7618
7619 If l_debug = 'Y' Then
7620 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
7621 ||l_stmt_num||'): '||l_fnd_err_msg);
7622 End If;
7623
7624 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7625 p_message => substr(l_fnd_err_msg,1,2000),
7626 p_request_id => fnd_global.conc_request_id,
7627 p_program_id => fnd_global.conc_program_id,
7628 p_program_application_id => fnd_global.prog_appl_id,
7629 p_message_type => 2, --WARNING
7630 x_err_code => p_err_num,
7631 x_err_msg => p_err_msg);
7632 IF(p_err_num <> 0) THEN
7633 raise proc_error;
7634 END IF;
7635 END IF;
7636
7637
7638 ELSIF (l_start_op_code IS NOT NULL) OR (l_start_op_seq_num IS NOT NULL) THEN --if all 3 are not NULL
7639
7640 IF (l_start_op_code IS NOT NULL) THEN
7641
7642 IF (l_debug = 'Y') THEN
7643 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): starting op_code = '||l_start_op_code);
7644 END IF;
7645
7646 ---------------
7647 -- 1685779: added begin/end block so that if invalid opcode is passed, it is validated and a proper
7648 -- message is displayed.
7649 declare
7650 l_organization_id NUMBER := 0; -- BBK
7651 begin
7652
7653 -- BA NSO-WLT
7654 -- Find the routing seq id for this bonus job, using this rtg_seq_id and op_code,
7655 -- use wsmputil.operation_is_standard_repeats to find out if it repeats in
7656 -- the n/w rtg.
7657
7658 l_stmt_num := 202;
7659 --VJ: Start Changes for NSLBJ--
7660 --Changed the sql since org_id has been added to WRJI now--
7661 select wrji.common_routing_sequence_id, wrji.organization_id
7662 into l_rl_rtg_seq_id, l_organization_id
7663 from wsm_resulting_jobs_interface wrji
7664 where wrji.header_id = l_header_id;
7665 --VJ: End Changes for NSLBJ--
7666
7667
7668 l_stmt_num := 203;
7669 wsmputil.operation_is_standard_repeats(
7670 p_routing_sequence_id => l_rl_rtg_seq_id,
7671 p_routing_revision_date => l_rtg_rev_date, --sysdate
7672 p_standard_operation_id => NULL,
7673 p_operation_code => l_start_op_code,
7674 p_organization_id => l_organization_id, --BBK
7675 p_op_is_std_op => l_op_is_std_op,
7676 p_op_repeated_times => l_op_repeated_times,
7677 x_err_code => x_op_err_code,
7678 x_err_msg => x_op_err_msg);
7679
7680
7681 if ((l_op_repeated_times <> 1 and l_start_op_seq_num is null) or (l_op_is_std_op <> 1)) then
7682
7683 -- If the std oprn is repeated but operation seq num is not populated, error out..
7684 -- Also, if the std oprn code passed is incorrect, error out..
7685 l_fnd_err_msg := ' FAILURE: This operation code does not belong to a std op or this std op is repeated';
7686 fnd_file.put_line(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7687
7688 l_stmt_num := 204;
7689 UPDATE wsm_resulting_jobs_interface wsji
7690 SET wsji.error_message = l_fnd_generic_err_msg
7691 WHERE wsji.header_id = l_header_id
7692 and wip_entity_name = l_job_name;
7693
7694 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7695 p_message => substr(l_fnd_err_msg,1,2000),
7696 p_request_id => fnd_global.conc_request_id,
7697 p_program_id => fnd_global.conc_program_id,
7698 p_program_application_id => fnd_global.prog_appl_id,
7699 p_message_type => 1, --ERROR
7700 x_err_code => p_err_num,
7701 x_err_msg => p_err_msg);
7702
7703 if (p_err_num <> 0) then
7704 raise proc_error;
7705 end if;
7706
7707 -- if l_op_repeated_times <> 1 then process should not continue with the following.
7708 -- otherwise will get ORA-01422 error.
7709
7710 elsif (l_op_repeated_times <> 1 and l_start_op_seq_num is not null) then
7711
7712 -- If the std oprn is repeated and operation seq num is populated,
7713 -- check if it is a valid op seq num in BOM operation sequences.
7714 -- If not, no-data-found is raised where we handle the error.
7715
7716 l_stmt_num := 205;
7717 SELECT bos.operation_sequence_id,
7718 bos.standard_operation_id -- 1685779 :added this col as part of select
7719 INTO l_bos_op_seq_id,
7720 l_bos_std_op_id
7721 FROM bom_standard_operations bso,
7722 bom_operation_sequences bos,
7723 wsm_resulting_jobs_interface wrji
7724 WHERE wrji.header_id = l_header_id
7725 AND exists (SELECT null
7726 FROM wsm_split_merge_txn_interface txn
7727 WHERE txn.header_id = wrji.header_id
7728 AND txn.transaction_type_id = WSMPCNST.BONUS)
7729 AND bos.routing_sequence_id = wrji.common_routing_sequence_id
7730 AND nvl(bos.standard_operation_id, -9999) = nvl(bso.standard_operation_id, -9999)
7731 AND nvl(bso.operation_code, '*') = nvl(l_start_op_code, '*')
7732 AND bos.operation_seq_num = l_start_op_seq_num --2265237
7733 -- BC: CZH.I_OED-1, check against routing revsion date
7734 -- bugfix 1709639. Check for disabled operation
7735 --AND nvl(bos.disable_date, sysdate+1) > sysdate
7736 --AND bos.effectivity_date <= sysdate;
7737 -- HH24MISS ---AND nvl(bos.disable_date, l_rtg_rev_date+1) > l_rtg_rev_date
7738 -- HH24MISS ---AND bos.effectivity_date <= l_rtg_rev_date;
7739 AND l_rtg_rev_date between bos.effectivity_date and nvl(bos.disable_date, l_rtg_rev_date+1);
7740 -- EC: CZH.I_OED-1
7741
7742 elsif ( l_op_repeated_times = 1) then
7743
7744 -- If the std oprn is NOT repeated, lets get the operation seq num
7745 -- and opseq id and other necessary details..
7746 -- If this returns no-data-found (although it should not),
7747 -- we will handle the error in exception block.
7748
7749 l_stmt_num := 206;
7750 SELECT bos.operation_seq_num,
7751 bos.operation_sequence_id,
7752 bos.standard_operation_id -- 1685779 :added this col as part of select
7753 INTO l_bos_op_seq_num,
7754 l_bos_op_seq_id,
7755 l_bos_std_op_id
7756 FROM bom_standard_operations bso,
7757 bom_operation_sequences bos,
7758 wsm_resulting_jobs_interface wrji
7759 WHERE wrji.header_id = l_header_id
7760 AND exists (SELECT null
7761 FROM wsm_split_merge_txn_interface txn
7762 WHERE txn.header_id = wrji.header_id
7763 AND txn.transaction_type_id = WSMPCNST.BONUS)
7764 AND bos.routing_sequence_id = wrji.common_routing_sequence_id
7765 AND nvl(bos.standard_operation_id, -9999) = nvl(bso.standard_operation_id, -9999)
7766 AND nvl(bso.operation_code, '*') = nvl(l_start_op_code, '*')
7767 -- BC: CZH.I_OED-1, check against routing revsion date
7768 -- bugfix 1709639. Check for disabled operation
7769 --AND nvl(bos.disable_date, sysdate+1) > sysdate
7770 --AND bos.effectivity_date <= sysdate;
7771 --HH24MISS --AND nvl(bos.disable_date, l_rtg_rev_date+1) > l_rtg_rev_date
7772 --HH24MISS --AND bos.effectivity_date <= l_rtg_rev_date;
7773 AND l_rtg_rev_date between bos.effectivity_date and nvl(bos.disable_date, l_rtg_rev_date+1);
7774 -- EC: CZH.I_OED-1
7775
7776 -- BA: BUG 2686319 update WRJI with starting_operation_seq_num
7777 l_stmt_num := 207;
7778 UPDATE wsm_resulting_jobs_interface wrji
7779 SET starting_operation_seq_num = l_bos_op_seq_num
7780 WHERE wrji.header_id = l_header_id
7781 and wrji.process_status = WIP_CONSTANTS.RUNNING
7782 and wrji.internal_group_id = WSMPLOAD.G_GROUP_ID;
7783 -- EA: BUG 2686319
7784
7785 IF (l_debug = 'Y') THEN
7786 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num
7787 ||'): l_bos_op_seq_num='||l_bos_op_seq_num||', l_bos_op_seq_id='||l_bos_op_seq_id);
7788 END IF;
7789
7790 end if;
7791
7792 --End Changes to fix bug #2265237--
7793
7794 exception
7795 when NO_DATA_FOUND then
7796 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
7797 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_code');
7798 l_fnd_err_msg := FND_MESSAGE.GET;
7799 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7800
7801 --Start Additions to fix bug #2265237--
7802 --Whenever there's error, error_message column in interface table should be updated.
7803 l_stmt_num := 208;
7804 UPDATE wsm_resulting_jobs_interface wsji
7805 SET wsji.error_message = l_fnd_generic_err_msg
7806 WHERE wsji.header_id = l_header_id
7807 and wip_entity_name = l_job_name;
7808 --End Additions to fix bug #2265237--
7809
7810 set_wrji_error(); -- WLTEnh
7811
7812 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7813 p_message => substr(l_fnd_err_msg,1,2000),
7814 p_request_id => fnd_global.conc_request_id,
7815 p_program_id => fnd_global.conc_program_id,
7816 p_program_application_id => fnd_global.prog_appl_id,
7817 p_message_type => 1, --ERROR
7818 x_err_code => p_err_num,
7819 x_err_msg => p_err_msg);
7820 IF(p_err_num <> 0) THEN
7821 raise proc_error;
7822 END IF;
7823 end;
7824
7825 ---------------
7826 IF (l_start_op_seq_num IS NULL) OR (l_start_op_seq_num <> l_bos_op_seq_num) THEN
7827
7828 l_stmt_num := 209;
7829 IF (l_debug = 'Y') THEN
7830 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
7831 '): l_start_op_seq_num IS NULL or l_start_op_seq_num <> l_bos_op_seq_num');
7832 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
7833 '): l_start_op_seq_num = '||l_start_op_seq_num||
7834 ' l_bos_op_seq_num = '||l_bos_op_seq_num);
7835 END IF;
7836
7837 UPDATE wsm_resulting_jobs_interface wrji
7838 SET wrji.starting_operation_seq_num = l_bos_op_seq_num
7839 WHERE wrji.header_id = l_header_id
7840 AND exists (SELECT null
7841 FROM wsm_split_merge_txn_interface txn
7842 WHERE txn.header_id = wrji.header_id
7843 AND txn.transaction_type_id = WSMPCNST.BONUS);
7844
7845 IF (SQL%ROWCOUNT > 0) THEN
7846 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
7847 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_seq_num in Resulting Jobs');
7848 l_fnd_err_msg := FND_MESSAGE.GET;
7849 If l_debug = 'Y' Then
7850 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
7851 ||l_stmt_num||'): '||l_fnd_err_msg);
7852 End If;
7853
7854 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7855 p_message => substr(l_fnd_err_msg,1,2000),
7856 p_request_id => fnd_global.conc_request_id,
7857 p_program_id => fnd_global.conc_program_id,
7858 p_program_application_id => fnd_global.prog_appl_id,
7859 p_message_type => 2, --WARNING
7860 x_err_code => p_err_num,
7861 x_err_msg => p_err_msg);
7862 IF(p_err_num <> 0) THEN
7863 raise proc_error;
7864 END IF;
7865 END IF;
7866 END IF; -- 1685779 : end l_start_op_seq_num is NULL check
7867
7868 ELSIF (l_start_op_seq_num IS NOT NULL) THEN
7869
7870 IF (l_debug = 'Y') THEN
7871 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
7872 '): starting op_seq_num = '||l_start_op_seq_num);
7873 END IF;
7874
7875
7876 -- 1685779: added begin/end block so that if invalid opseq num is passed, it is validated and a proper
7877 -- message is displayed.
7878
7879 begin
7880
7881
7882 -- BA NSO-WLT BBK Commented out BSO related details.
7883
7884 l_stmt_num := 210;
7885 SELECT bos.operation_sequence_id,
7886 bos.standard_operation_id
7887 INTO l_bos_op_seq_id,
7888 l_bos_std_op_id
7889 FROM bom_operation_sequences bos,
7890 wsm_resulting_jobs_interface wrji
7891 where wrji.header_id = l_header_id
7892 AND exists (SELECT null
7893 FROM wsm_split_merge_txn_interface txn
7894 WHERE txn.header_id = wrji.header_id
7895 AND txn.transaction_type_id = WSMPCNST.BONUS)
7896 AND bos.routing_sequence_id = wrji.common_routing_sequence_id
7897 and bos.operation_seq_num = l_start_op_seq_num
7898 -- bugfix 1746686 Validate operation effectivity
7899 -- BC: CZH.I_OED-1, check against routing revsion date
7900 -- bugfix 1709639. Check for disabled operation
7901 --HH24MISS ---AND nvl(bos.disable_date, sysdate+1) > sysdate
7902 --HH24MISS ---AND bos.effectivity_date <= sysdate;
7903 AND l_rtg_rev_date between -- HH24MISS
7904 bos.effectivity_date and nvl(bos.disable_date, l_rtg_rev_date+1);
7905 -- EC: CZH.I_OED-1
7906
7907 If l_bos_std_op_id is not null Then
7908 l_stmt_num := 211;
7909 Select operation_code into l_bso_op_code
7910 From BOM_STANDARD_OPERATIONS
7911 Where standard_operation_id = l_bos_std_op_id;
7912
7913 End If;
7914
7915 -- EA NSO-WLT
7916 IF (l_debug = 'Y') THEN
7917 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): l_bso_op_code='||
7918 l_bso_op_code||', l_bos_op_seq_id='||l_bos_op_seq_id);
7919 END IF;
7920
7921 exception
7922
7923 when NO_DATA_FOUND then
7924 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
7925 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_seq_num');
7926 l_fnd_err_msg := FND_MESSAGE.GET;
7927 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
7928
7929 set_wrji_error(); -- WLTEnh
7930
7931 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7932 p_message => substr(l_fnd_err_msg,1,2000),
7933 p_request_id => fnd_global.conc_request_id,
7934 p_program_id => fnd_global.conc_program_id,
7935 p_program_application_id => fnd_global.prog_appl_id,
7936 p_message_type => 1, --ERROR
7937 x_err_code => p_err_num,
7938 x_err_msg => p_err_msg);
7939
7940 IF(p_err_num <> 0) THEN
7941 raise proc_error;
7942 END IF;
7943 end;
7944
7945
7946 IF (nvl(l_start_op_code, '*') <> nvl(l_bso_op_code, '*')) THEN
7947 IF (l_debug = 'Y') THEN
7948 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
7949 '): l_start_op_code <> l_bso_op_code');
7950 END IF;
7951
7952 l_stmt_num := 212;
7953 UPDATE wsm_resulting_jobs_interface wrji
7954 SET wrji.starting_operation_code = l_bso_op_code
7955 WHERE wrji.header_id = l_header_id
7956 AND exists (SELECT null
7957 FROM wsm_split_merge_txn_interface txn
7958 WHERE txn.header_id = wrji.header_id
7959 AND txn.transaction_type_id = WSMPCNST.BONUS);
7960
7961 IF (SQL%ROWCOUNT > 0) THEN
7962 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
7963 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_operation_code in Resulting Jobs');
7964 l_fnd_err_msg := FND_MESSAGE.GET;
7965 IF (l_debug = 'Y') THEN
7966 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
7967 ||l_stmt_num||'): '||l_fnd_err_msg);
7968 END IF;
7969
7970
7971 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
7972 p_message => substr(l_fnd_err_msg,1,2000),
7973 p_request_id => fnd_global.conc_request_id,
7974 p_program_id => fnd_global.conc_program_id,
7975 p_program_application_id => fnd_global.prog_appl_id,
7976 p_message_type => 2, --WARNING
7977 x_err_code => p_err_num,
7978 x_err_msg => p_err_msg);
7979 IF(p_err_num <> 0) THEN
7980 raise proc_error;
7981 END IF;
7982 END IF;
7983 END IF; -- Checks for start_op_code NOT NULL - else start_op_seq NOT NULL
7984
7985 -- BA NSO-WLT
7986 END IF; -- ELSIF (l_start_op_seq_num IS NOT NULL) THEN
7987 END IF; -- IF (l_start_op_code IS NOT NULL) OR (l_start_op_seq_num IS NOT NULL) THEN
7988 -- EA NSO-WLT
7989
7990
7991 l_stmt_num := 213;
7992 UPDATE wsm_resulting_jobs_interface wrji
7993 SET wrji.starting_std_op_id = l_bos_std_op_id
7994 WHERE wrji.header_id = l_header_id
7995 AND exists (SELECT null
7996 FROM wsm_split_merge_txn_interface txn
7997 WHERE txn.header_id = wrji.header_id
7998 AND txn.transaction_type_id = WSMPCNST.BONUS);
7999
8000 IF (SQL%ROWCOUNT > 0) THEN
8001 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
8002 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_std_op_id in Resulting Jobs');
8003 l_fnd_err_msg := FND_MESSAGE.GET;
8004 IF (l_debug = 'Y') THEN
8005 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8006 ||l_stmt_num||'): '||l_fnd_err_msg);
8007 END IF;
8008
8009 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8010 p_message => substr(l_fnd_err_msg,1,2000),
8011 p_request_id => fnd_global.conc_request_id,
8012 p_program_id => fnd_global.conc_program_id,
8013 p_program_application_id => fnd_global.prog_appl_id,
8014 p_message_type => 2, --WARNING
8015 x_err_code => p_err_num,
8016 x_err_msg => p_err_msg);
8017 IF(p_err_num <> 0) THEN
8018 raise proc_error;
8019 END IF;
8020 END IF;
8021
8022 END IF; -- EndIf of l_count > 0
8023
8024 -- End of Defaulting starting operation info for Bonus Txns.
8025
8026
8027 /*-----------------------------------------------------------------+
8028 | validate starting_operation_code
8029 +-----------------------------------------------------------------*/
8030
8031
8032 l_stmt_num := 214;
8033 UPDATE wsm_resulting_jobs_interface wrji
8034 SET wrji.error_message = l_fnd_generic_err_msg
8035 WHERE wrji.header_id = l_header_id
8036 AND EXISTS (SELECT null
8037 FROM wsm_split_merge_txn_interface txn
8038 WHERE txn.header_id = wrji.header_id
8039 AND txn.transaction_type_id = WSMPCNST.BONUS -- BA NSO-WLT
8040 AND wrji.starting_operation_seq_num is null); -- EA NSO-WLT
8041
8042 IF (SQL%ROWCOUNT > 0) THEN
8043 set_wrji_error(); -- WLTEnh
8044
8045 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8046 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_std_op_id/starting_operation_code in Resulting Jobs');
8047 l_fnd_err_msg := FND_MESSAGE.GET;
8048 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8049
8050 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8051 p_message => substr(l_fnd_err_msg,1,2000),
8052 p_request_id => fnd_global.conc_request_id,
8053 p_program_id => fnd_global.conc_program_id,
8054 p_program_application_id => fnd_global.prog_appl_id,
8055 p_message_type => 1, --ERROR
8056 x_err_code => p_err_num,
8057 x_err_msg => p_err_msg);
8058 IF(p_err_num <> 0) THEN
8059 raise proc_error;
8060 END IF;
8061 END IF;
8062
8063
8064 /*-----------------------------------------------------------------+
8065 | Bug 1685779 : |
8066 | validate if the starting_std_op_id is part of primary path of |
8067 | network routing for BONUS txn. By the time you reach here, |
8068 | starting_std_op_id is already populated for std ops. |
8069 +-----------------------------------------------------------------*/
8070
8071 -- BA NSO-WLT
8072 l_stmt_num := 215;
8073 UPDATE wsm_resulting_jobs_interface wrji
8074 SET wrji.error_message = l_fnd_generic_err_msg
8075 WHERE wrji.header_id = l_header_id
8076 AND exists (SELECT null
8077 FROM wsm_split_merge_txn_interface txn
8078 WHERE txn.header_id = wrji.header_id
8079 AND txn.transaction_type_id = WSMPCNST.BONUS)
8080 AND nvl(wrji.starting_std_op_id, -9999) = nvl(l_bos_std_op_id, -9999)
8081 AND not exists
8082 ( select 'Is Primary Path'
8083 from bom_operation_networks bon,
8084 bom_operation_sequences bos
8085 where bon.transition_type = 1 -- Primary
8086 and nvl(bon.disable_date, sysdate+1) > sysdate
8087 --BC: CZH.I_OED-2
8088 --and bon.from_op_seq_id = bos.operation_sequence_id
8089 and WSMPUTIL.replacement_op_seq_id(
8090 bon.from_op_seq_id,
8091 l_rtg_rev_date) = bos.operation_sequence_id
8092 --EC: CZH.I_OED-2
8093 and bos.routing_sequence_id = wrji.common_routing_sequence_id -- BD NSO-WLT
8094 -- BA NSO-WLT
8095 and bos.operation_seq_num = wrji.starting_operation_seq_num
8096 -- BA NSO-WLT
8097
8098 UNION
8099
8100 select 'Is Primary Path'
8101 from bom_operation_networks bon,
8102 bom_operation_sequences bos
8103 --BC: CZH.I_OED-2
8104 --where bon.to_op_seq_id = bos.operation_sequence_id
8105 where WSMPUTIL.replacement_op_seq_id(
8106 bon.to_op_seq_id,
8107 l_rtg_rev_date) = bos.operation_sequence_id
8108 --EC: CZH.I_OED-2
8109 and bos.routing_sequence_id = wrji.common_routing_sequence_id -- BD NSO-WLT
8110 -- BA NSO-WLT
8111 and bos.operation_seq_num = wrji.starting_operation_seq_num
8112 -- BA NSO-WLT
8113 and bon.to_op_seq_id not in ( select bon1.from_op_seq_id
8114 from bom_operation_networks bon1,
8115 bom_operation_sequences bos1
8116 --BC: CZH.I_OED-2
8117 --where bon1.from_op_seq_id = bos1.operation_sequence_id
8118 where WSMPUTIL.replacement_op_seq_id (
8119 bon1.from_op_seq_id,
8120 l_rtg_rev_date) = bos1.operation_sequence_id
8121 --EC: CZH.I_OED-2
8122 and bos1.routing_sequence_id = wrji.common_routing_sequence_id)
8123 );
8124
8125 -- BA NSO-WLT
8126
8127 IF (SQL%ROWCOUNT > 0) THEN
8128
8129 set_wrji_error(); -- WLTEnh
8130
8131 FND_MESSAGE.SET_NAME('WSM', 'WSM_OPRN_NOT_PRIMARY');
8132 l_fnd_err_msg := FND_MESSAGE.GET;
8133 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8134
8135 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8136 p_message => substr(l_fnd_err_msg,1,2000),
8137 p_request_id => fnd_global.conc_request_id,
8138 p_program_id => fnd_global.conc_program_id,
8139 p_program_application_id => fnd_global.prog_appl_id,
8140 p_message_type => 1, --ERROR
8141 x_err_code => p_err_num,
8142 x_err_msg => p_err_msg);
8143 IF(p_err_num <> 0) THEN
8144 raise proc_error;
8145 END IF;
8146 END IF;
8147
8148
8149 /*-----------------------------------------------------------------+
8150 | validate starting_intraoperation_step in |
8151 | wsm_resulting_jobs_interface table: For bonus lot, intraoperation|
8152 | step must be queue. For the other transaction type, intra- |
8153 | operation step must be queue or to move. |
8154 +-----------------------------------------------------------------*/
8155
8156 l_stmt_num := 216;
8157 UPDATE wsm_resulting_jobs_interface wrji
8158 SET wrji.error_message = l_fnd_generic_err_msg
8159 WHERE wrji.header_id = l_header_id
8160 and wrji.starting_intraoperation_step is not null
8161 and NOT EXISTS (select null
8162 from wsm_split_merge_txn_interface txn
8163 where txn.header_id = wrji.header_id
8164 and wrji.starting_intraoperation_step =
8165 decode(txn.transaction_type_id,WSMPCNST.BONUS,1,wrji.starting_intraoperation_step)
8166 and wrji.starting_intraoperation_step in
8167 (WIP_CONSTANTS.QUEUE,
8168 WIP_CONSTANTS.TOMOVE));
8169
8170
8171 IF (SQL%ROWCOUNT > 0) THEN
8172
8173 set_wrji_error(); -- WLTEnh
8174
8175 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8176 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'starting_intraoperation_step in Resulting Jobs');
8177 l_fnd_err_msg := FND_MESSAGE.GET;
8178 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8179
8180 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8181 p_message => substr(l_fnd_err_msg,1,2000),
8182 p_request_id => fnd_global.conc_request_id,
8183 p_program_id => fnd_global.conc_program_id,
8184 p_program_application_id => fnd_global.prog_appl_id,
8185 p_message_type => 1, --ERROR
8186 x_err_code => p_err_num,
8187 x_err_msg => p_err_msg);
8188 IF(p_err_num <> 0) THEN
8189 raise proc_error;
8190 END IF;
8191 END IF;
8192
8193 --- End of Starting Operation info for BONUS Txns ---------------
8194
8195 -- if it is update routing txn
8196 -- need to make sure that completion date
8197 -- has not been changed.
8198
8199
8200 ---- the following is added for bug 1411925
8201
8202 l_stmt_num := 217;
8203 SELECT transaction_type_id
8204 INTO l_txn_type
8205 FROM wsm_split_merge_txn_interface wsmti
8206 WHERE wsmti.header_id = l_header_id;
8207
8208 IF (l_txn_type = WSMPCNST.UPDATE_ROUTING) THEN
8209 -- need to make sure that completion date
8210 -- has not been changed.
8211
8212 l_stmt_num := 218;
8213 SELECT wdj.scheduled_completion_date
8214 into l_sch_comp_date
8215 from wip_discrete_jobs wdj,
8216 wsm_starting_jobs_interface wsji
8217 WHERE wdj.wip_entity_id = wsji.wip_entity_id
8218 AND wsji.header_id = l_header_id;
8219
8220 l_stmt_num := 219;
8221 UPDATE wsm_resulting_jobs_interface wrji
8222 SET scheduled_completion_date = l_sch_comp_date
8223 WHERE wrji.header_id = l_header_id
8224 AND scheduled_completion_date <> l_sch_comp_date;
8225
8226 IF (SQL%ROWCOUNT > 0) THEN
8227 FND_MESSAGE.SET_NAME('WSM', 'WSM_DISALLOW_SCH_DATE_CHANGE');
8228 l_fnd_err_msg := FND_MESSAGE.GET;
8229 If l_debug = 'Y' Then
8230 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8231 ||l_stmt_num||'): '||l_fnd_err_msg);
8232 End If;
8233
8234 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8235 p_message => substr(l_fnd_err_msg,1,2000),
8236 p_request_id => fnd_global.conc_request_id,
8237 p_program_id => fnd_global.conc_program_id,
8238 p_program_application_id => fnd_global.prog_appl_id,
8239 p_message_type => 2, --WARNING
8240 x_err_code => p_err_num,
8241 x_err_msg => p_err_msg);
8242 IF(p_err_num <> 0) THEN
8243 raise proc_error;
8244 END IF;
8245 END IF;
8246
8247 END IF;
8248
8249 ---- the above is added for bug 1411925
8250
8251
8252 /*-----------------------------------------------------------------+
8253 | validate completion_subinventory and completion_locator_id |
8254 | since populate_column is called completion_subinventory |
8255 | should never be null here |
8256 +-----------------------------------------------------------------*/
8257
8258 l_stmt_num := 220;
8259
8260 /* ST bugfix 3336844 (2793501) ,comment out nvl(, -1) on locator_id, it will be used for locator validation,
8261 so should be kept as it is. */
8262
8263 select completion_subinventory,
8264 completion_locator_id /*ST bug fix 3336844 nvl(completion_locator_id, -1)*/
8265 into l_comp_sub_inv_r,
8266 l_comp_loc_id_r
8267 from wsm_resulting_jobs_interface
8268 where header_id = l_header_id
8269 and wip_entity_name = l_job_name;
8270
8271 IF (l_debug = 'Y') THEN
8272 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||
8273 '): l_comp_sub_inv_r='||l_comp_sub_inv_r||', l_comp_loc_id_r='||l_comp_loc_id_r);
8274 END IF;
8275
8276 -- BA: Bugfix 2169141
8277 -- BC: czh.bug2398718, added code to error out if completion_sub_inv is null
8278 -- if (l_comp_sub_inv_r is not null) then
8279 if (l_comp_sub_inv_r is null and l_job_type = 1 ) then --For Std Job only. Bug#2679562
8280 -- error out saying Completion Subinventory is needed
8281 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
8282 FND_MESSAGE.SET_TOKEN('FLD_NAME',
8283 'Completion Subinventory in Resulting jobs');
8284 l_fnd_err_msg := FND_MESSAGE.GET;
8285 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8286 l_stmt_num := 221;
8287
8288 UPDATE wsm_resulting_jobs_interface
8289 SET error_message = l_fnd_generic_err_msg
8290 where header_id = l_header_id
8291 and wip_entity_name = l_job_name;
8292
8293 set_wrji_error(); -- WLTEnh
8294
8295 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8296 p_message => substr(l_fnd_err_msg,1,2000),
8297 p_request_id => fnd_global.conc_request_id,
8298 p_program_id => fnd_global.conc_program_id,
8299 p_program_application_id => fnd_global.prog_appl_id,
8300 p_message_type => 1, --ERROR
8301 x_err_code => p_err_num,
8302 x_err_msg => p_err_msg);
8303 IF(p_err_num <> 0) THEN
8304 raise proc_error;
8305 END IF;
8306
8307 elsif l_comp_sub_inv_r is NOT NULL Then -- Bug#2679562 changed else to elsif
8308
8309 -- EC: czh.bug2398718
8310
8311 l_stmt_num := 222;
8312 select count(secondary_inventory_name)
8313 into l_count
8314 from mtl_subinventories_val_v
8315 where organization_id = l_organization_id
8316 and secondary_inventory_name = l_comp_sub_inv_r;
8317 l_stmt_num := 223;
8318
8319 if l_count = 0 then
8320 l_stmt_num := 224;
8321 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8322 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Subinventory in Resulting jobs');
8323 l_fnd_err_msg := FND_MESSAGE.GET;
8324 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8325
8326 UPDATE wsm_resulting_jobs_interface
8327 SET error_message = l_fnd_generic_err_msg
8328 where header_id = l_header_id
8329 and wip_entity_name = l_job_name;
8330
8331 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8332 p_message => substr(l_fnd_err_msg,1,2000),
8333 p_request_id => fnd_global.conc_request_id,
8334 p_program_id => fnd_global.conc_program_id,
8335 p_program_application_id => fnd_global.prog_appl_id,
8336 p_message_type => 1, --ERROR
8337 x_err_code => p_err_num,
8338 x_err_msg => p_err_msg);
8339 IF(p_err_num <> 0) THEN
8340 raise proc_error;
8341 END IF;
8342 end if;
8343 /*** bugfix 3336844 (2793501) comment out previous validation of locator and subinventory which only considered
8344 --subinventory that were locator controlled. Replace with hierarchically check locator control.***/
8345
8346 l_stmt_num := 224.1;
8347
8348 SELECT nvl(msub.locator_type, 1) sub_loc_control,
8349 MP.stock_locator_control_code org_loc_control,
8350 MS.restrict_locators_code,
8351 MS.location_control_code item_loc_control
8352 INTO l_sub_loc_control, l_org_loc_control,
8353 l_restrict_locators_code, l_item_loc_control
8354 FROM mtl_system_items MS,
8355 mtl_secondary_inventories MSUB,
8356 mtl_parameters MP
8357 WHERE MP.organization_id = l_organization_id
8358 AND MS.organization_id = l_organization_id
8359 AND MS.inventory_item_id = l_primary_item_id
8360 AND MSUB.secondary_inventory_name = l_comp_sub_inv_r
8361 AND MSUB.organization_id = l_organization_id;
8362
8363
8364 l_locator_id := l_comp_loc_id_r;
8365 begin
8366
8367 WIP_LOCATOR.validate( l_organization_id,
8368 l_primary_item_id,
8369 l_comp_sub_inv_r,
8370 l_org_loc_control,
8371 l_sub_loc_control,
8372 l_item_loc_control,
8373 l_restrict_locators_code,
8374 NULL, NULL, NULL, NULL,
8375 l_locator_id,
8376 l_segs,
8377 l_loc_success);
8378 exception
8379 when NO_DATA_FOUND then
8380 l_stmt_num := 597;
8381 l_loc_success := FALSE;
8382 end;
8383
8384 if not l_loc_success then
8385
8386 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8387 FND_MESSAGE.SET_TOKEN('FLD_NAME',
8388 'Completion Subinventory and Locator combination in Resulting jobs');
8389 l_fnd_err_msg := FND_MESSAGE.GET;
8390 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8391
8392 UPDATE wsm_resulting_jobs_interface
8393 SET error_message = l_fnd_generic_err_msg
8394 where header_id = l_header_id
8395 and wip_entity_name = l_job_name;
8396
8397 WSMPUTIL.WRITE_TO_WIE (p_header_id => l_header_id,
8398 p_message => substr(l_fnd_err_msg,1,2000),
8399 p_request_id => fnd_global.conc_request_id,
8400 p_program_id => fnd_global.conc_program_id,
8401 p_program_application_id => fnd_global.prog_appl_id,
8402 p_message_type => 1, --ERROR
8403 x_err_code => p_err_num,
8404 x_err_msg => p_err_msg);
8405 IF(p_err_num <> 0) THEN
8406 raise proc_error;
8407 END IF;
8408 end if;
8409 end if;
8410
8411 /***** ST bug fix 3336844 : commenting out start ..
8412 -- BA: czh.bug2398718
8413 l_stmt_num := 225;
8414 select locator_type
8415 into l_locator_control_type
8416 from mtl_secondary_inventories
8417 where SECONDARY_INVENTORY_NAME = l_comp_sub_inv_r
8418 and organization_id = l_organization_id;
8419 -- EA: czh.bug2398718
8420
8421 end if;
8422 -- EA: Bugfix 2169141
8423
8424 -- BA: czh.bug2398718
8425 -- if(l_locator_control_type = 2 and l_comp_loc_id_r = -1) then -- BBK- Bug#2795951
8426 if(l_locator_control_type <> 1 and l_comp_loc_id_r = -1) then -- BBK- Bug#2795951
8427 l_stmt_num := 226;
8428 -- error out saying Completion Locator is needed
8429 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
8430 FND_MESSAGE.SET_TOKEN('FLD_NAME',
8431 'Completion Locator ID in Resulting jobs');
8432 l_fnd_err_msg := FND_MESSAGE.GET;
8433 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8434
8435 UPDATE wsm_resulting_jobs_interface
8436 SET error_message = l_fnd_generic_err_msg
8437 where header_id = l_header_id
8438 and wip_entity_name = l_job_name;
8439
8440 set_wrji_error(); -- WLTEnh
8441
8442 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8443 p_message => substr(l_fnd_err_msg,1,2000),
8444 p_request_id => fnd_global.conc_request_id,
8445 p_program_id => fnd_global.conc_program_id,
8446 p_program_application_id => fnd_global.prog_appl_id,
8447 p_message_type => 1, --ERROR
8448 x_err_code => p_err_num,
8449 x_err_msg => p_err_msg);
8450 IF(p_err_num <> 0) THEN
8451 raise proc_error;
8452 END IF;
8453
8454 elsif(l_locator_control_type <> 1 and l_comp_loc_id_r <> -1) then -- BBK- Bug#2795951
8455 -- elsif(l_locator_control_type = 2 and l_comp_loc_id_r <> -1) then -- BBK- Bug#2795951
8456 -- check if it is valid combination
8457 l_stmt_num := 227;
8458 select count(*)
8459 into l_count
8460 from mtl_item_locations_kfv
8461 where INVENTORY_LOCATION_ID = l_comp_loc_id_r
8462 and SUBINVENTORY_CODE = l_comp_sub_inv_r
8463 and organization_id = l_organization_id;
8464
8465 if l_count = 0 then
8466 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8467 FND_MESSAGE.SET_TOKEN('FLD_NAME',
8468 'Completion Subinventory and Locator combination in Resulting jobs');
8469 l_fnd_err_msg := FND_MESSAGE.GET;
8470 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8471
8472 UPDATE wsm_resulting_jobs_interface
8473 SET error_message = l_fnd_generic_err_msg
8474 where header_id = l_header_id
8475 and wip_entity_name = l_job_name;
8476
8477 set_wrji_error(); -- WLTEnh
8478
8479 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8480 p_message => substr(l_fnd_err_msg,1,2000),
8481 p_request_id => fnd_global.conc_request_id,
8482 p_program_id => fnd_global.conc_program_id,
8483 p_program_application_id => fnd_global.prog_appl_id,
8484 p_message_type => 1, --ERROR
8485 x_err_code => p_err_num,
8486 x_err_msg => p_err_msg);
8487 IF(p_err_num <> 0) THEN
8488 raise proc_error;
8489 END IF;
8490 end if;
8491
8492 elsif(l_comp_loc_id_r <> -1) then
8493 -- locator_type <>2, will ignore the completion_locator_id
8494 l_stmt_num := 228;
8495 UPDATE wsm_resulting_jobs_interface wrji
8496 SET wrji.completion_locator_id = NULL
8497 where header_id = l_header_id
8498 and wip_entity_name = l_job_name;
8499
8500 FND_MESSAGE.SET_NAME('WSM', 'WSM_MODIFIED_FIELD');
8501 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Completion Locator ID to NULL in Resulting jobs');
8502 l_fnd_err_msg := FND_MESSAGE.GET;
8503
8504 If l_debug = 'Y' Then
8505 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8506 ||l_stmt_num||'): '||l_fnd_err_msg);
8507 End If;
8508
8509 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8510 p_message => substr(l_fnd_err_msg,1,2000),
8511 p_request_id => fnd_global.conc_request_id,
8512 p_program_id => fnd_global.conc_program_id,
8513 p_program_application_id => fnd_global.prog_appl_id,
8514 p_message_type => 2, --Warning
8515 x_err_code => p_err_num,
8516 x_err_msg => p_err_msg);
8517
8518 else-- do nothing
8519 --Case where completion subinventory is non-NULL and locator is NULL
8520 --(for a non-Locator controlled subinventory).
8521 NULL;
8522 end if;
8523 -- EA: czh.bug2398718
8524
8525 bug fix 3336844 *****/
8526
8527 l_stmt_num := 229;
8528
8529 -- check if the starting operation for Bonus, Update Routing and Update
8530 -- assembly does not have a PO Move resource attached to it.
8531
8532 -- OSP-FP-I
8533
8534 -- the selection in l_txn_type may not be required as it is already fetched
8535 -- earlier
8536
8537 -- SELECT transaction_type_id
8538 -- INTO l_txn_type
8539 -- FROM wsm_split_merge_txn_interface wsmti
8540 -- WHERE wsmti.header_id = l_header_id;
8541
8542 IF (l_txn_type in ( WSMPCNST.BONUS, WSMPCNST.UPDATE_ROUTING, WSMPCNST.UPDATE_ASSEMBLY)
8543 --SpUA begin
8544 OR (l_txn_type in (WSMPCNST.SPLIT) AND l_split_has_update_assy = 1)) THEN
8545 --SpUA end
8546
8547 --SpUA bugfix 3161200
8548 --This is not really a SpUA bug!! But fixed anyway. For the valid case where
8549 --of non-std op TM, we need not have a starting op_seq_num. SQL below fails.
8550 --It is not necessary to execute this code at ToMove for APS Profile Option A
8551
8552 declare
8553
8554 l_sj_intraoperation_step number;
8555
8556 begin
8557
8558 IF (l_txn_type = WSMPCNST.BONUS) THEN
8559 l_sj_intraoperation_step := WIP_CONSTANTS.QUEUE;
8560 ELSE
8561 l_stmt_num := 230;
8562 select intraoperation_step
8563 into l_sj_intraoperation_step
8564 from wsm_starting_jobs_interface
8565 where header_id = l_header_id;
8566 END IF;
8567 --For Option C, Queue or ToMove, execute this. For Option A, only if it's Queue.
8568 if (l_sj_intraoperation_step <> WIP_CONSTANTS.TOMOVE OR l_profile_value = 1)
8569 then
8570
8571 --End SpUA bugfix
8572
8573 l_stmt_num := 231;
8574 select wrji.starting_operation_seq_num
8575 into l_osp_start_op_seq_id
8576 from wsm_resulting_jobs_interface wrji
8577 where wrji.header_id = l_header_id
8578 and wrji.rowid = l_wrji_rowid; --SpUA add
8579
8580 l_stmt_num := 232;
8581
8582 Begin
8583 l_stmt_num := 233;
8584
8585 select unique WSMPUTIL.replacement_op_seq_id ( operation_sequence_id,l_rtg_rev_date)
8586 into l_osp_start_op_seq_id
8587 from bom_operation_sequences bos,
8588 wsm_resulting_jobs_interface wrji
8589 where wrji.header_id = l_header_id
8590 and wrji.rowid = l_wrji_rowid --SpUA add
8591 and bos.routing_sequence_id = wrji.common_routing_sequence_id
8592 and bos.operation_seq_num = wrji.starting_operation_seq_num ;
8593
8594
8595 If WSMPUTIL.CHECK_PO_MOVE( l_osp_start_op_seq_id,
8596 'O',
8597 l_rtg_rev_date,
8598 p_err_msg,
8599 p_err_num) then
8600
8601
8602 set_wrji_error();
8603
8604 FND_MESSAGE.SET_NAME('WSM', 'WSM_OP_PO_MOVE');
8605 l_fnd_err_msg := FND_MESSAGE.GET;
8606 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||
8607 l_fnd_err_msg);
8608
8609 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8610 p_message => substr(l_fnd_err_msg,1,2000),
8611 p_request_id => fnd_global.conc_request_id,
8612 p_program_id => fnd_global.conc_program_id,
8613 p_program_application_id => fnd_global.prog_appl_id,
8614 p_message_type => 1, --ERROR
8615 x_err_code => p_err_num,
8616 x_err_msg => p_err_msg);
8617 IF(p_err_num <> 0) THEN
8618 raise proc_error;
8619 END IF;
8620
8621 end if;
8622
8623 Exception
8624
8625 When NO_DATA_FOUND Then
8626
8627 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
8628 FND_MESSAGE.SET_TOKEN('FLD_NAME', ' starting_operation_seq_num');
8629 l_fnd_err_msg := FND_MESSAGE.GET;
8630 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8631 ||l_stmt_num||'): '||l_fnd_err_msg);
8632
8633 set_wrji_error(); -- WLTEnh
8634
8635 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8636 p_message => substr(l_fnd_err_msg,1,2000),
8637 p_request_id => fnd_global.conc_request_id,
8638 p_program_id => fnd_global.conc_program_id,
8639 p_program_application_id => fnd_global.prog_appl_id,
8640 p_message_type => 1, --ERROR
8641 x_err_code => p_err_num,
8642 x_err_msg => p_err_msg);
8643
8644 IF(p_err_num <> 0) THEN
8645 raise proc_error;
8646 END IF;
8647
8648 End;
8649 end if;
8650 end;
8651 end if;
8652
8653
8654 -- OSP-FP-I
8655
8656
8657
8658 /*BA WLTEnh */
8659
8660 If l_wrji_error_flag = 1 Then -- UPDATE WSMTI
8661
8662 l_stmt_num := 234;
8663 UPDATE wsm_resulting_jobs_interface wrji
8664 SET wrji.error_message = l_fnd_generic_err_msg
8665 , wrji.process_status = WIP_CONSTANTS.ERROR
8666 where wrji.header_id = l_header_id
8667 and wrji.wip_entity_name = NVL(l_job_name, wrji.wip_entity_name);
8668
8669 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8670 ||l_stmt_num||'): '
8671 ||'Record for Header Id '
8672 ||l_header_id
8673 ||' set to ERROR in WRJI.');
8674 -- Bug 2682603
8675 If l_txn_type <> WSMPCNST.BONUS Then
8676
8677 l_stmt_num := 235;
8678
8679 Update wsm_starting_jobs_interface wsji
8680 SET wsji.error_message = l_fnd_generic_err_msg
8681 , wsji.process_status = WIP_CONSTANTS.ERROR
8682 Where wsji.header_id = l_header_id;
8683
8684 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8685 ||l_stmt_num||'): '
8686 ||'Record for Header Id '
8687 ||l_header_id
8688 ||' set to ERROR in WSJI for Non-BONUS Transaction.');
8689
8690 End If;
8691
8692
8693 l_stmt_num := 236;
8694 Update wsm_split_merge_txn_interface wsmti
8695 SET wsmti.error_message = l_fnd_generic_err_msg
8696 , wsmti.process_status = WIP_CONSTANTS.ERROR
8697 Where wsmti.header_id = l_header_id;
8698
8699 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8700 ||l_stmt_num||'): '
8701 ||'Record for Header Id '
8702 ||l_header_id
8703 ||' set to ERROR in WSMTI.');
8704 p_err_num := WIP_CONSTANTS.ERROR;
8705 p_err_msg := l_fnd_err_msg;
8706 raise proc_error;
8707
8708 End If;
8709
8710 /*EA WLTEnh */
8711
8712 END LOOP;
8713 CLOSE C_WRJI;
8714
8715 -------------------------------------------------------------------
8716 -------------------------------------------------------------------
8717 ------- End validations wRji -------------
8718 -------------------------------------------------------------------
8719 -------------------------------------------------------------------
8720
8721 -- Start : Comments to fix bug #3453139 --
8722 /********************************************
8723
8724 IF (l_debug = 'Y') THEN
8725 FND_FILE.PUT_LINE(FND_FILE.LOG,'Before check_wmti, check_wlmti of starting lots');
8726 END IF;
8727
8728 OPEN C_STARTING_JOB;
8729 LOOP fetch C_STARTING_JOB into l_wip_id, l_txn_date, l_txn_id, l_header_id, l_organization_id;
8730 exit when c_starting_job%notfound;
8731 l_stmt_num := 237;
8732 IF (wsmputil.check_wmti(l_wip_id, null, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
8733
8734 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wmti returned error:Pending move txn in this lot');
8735
8736 l_stmt_num := 238;
8737 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
8738 SET wsji.error_message = l_fnd_generic_err_msg
8739 , wsji.process_status = WIP_CONSTANTS.ERROR
8740 WHERE wsji.header_id = l_header_id
8741 AND wsji.WIP_ENTITY_ID = l_wip_id;
8742
8743 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8744 ||l_stmt_num||'): '
8745 ||'Record for Header Id '
8746 ||l_header_id
8747 ||' set to ERROR in WSJI for wip_entity_id='||l_wip_id);
8748
8749 l_stmt_num := 239;
8750 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
8751 SET wrji.error_message = l_fnd_generic_err_msg
8752 , wrji.process_status = WIP_CONSTANTS.ERROR
8753 WHERE wrji.header_id = l_header_id;
8754
8755 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8756 ||l_stmt_num||'): '
8757 ||'Record for Header Id '
8758 ||l_header_id
8759 ||' set to ERROR in WRJI ');
8760
8761 l_stmt_num := 240;
8762 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
8763 SET wsmti.error_message = l_fnd_generic_err_msg
8764 , wsmti.process_status = WIP_CONSTANTS.ERROR
8765 WHERE wsmti.header_id = l_header_id;
8766
8767 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8768 ||l_stmt_num||'): '
8769 ||'Record for Header Id '
8770 ||l_header_id
8771 ||' set to ERROR in WSMTI ');
8772
8773 IF (SQL%ROWCOUNT > 0) THEN
8774 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
8775 FND_MESSAGE.SET_TOKEN('TABLE', 'wip_move_transaction_interface');
8776 l_fnd_err_msg := FND_MESSAGE.GET;
8777 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8778
8779 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8780 p_message => substr(l_fnd_err_msg,1,2000),
8781 p_request_id => fnd_global.conc_request_id,
8782 p_program_id => fnd_global.conc_program_id,
8783 p_program_application_id => fnd_global.prog_appl_id,
8784 p_message_type => 1, --ERROR
8785 x_err_code => p_err_num,
8786 x_err_msg => p_err_msg);
8787 IF(p_err_num <> 0) THEN
8788 raise proc_error;
8789 END IF;
8790 END IF;
8791
8792 END IF;
8793
8794 l_stmt_num := 241;
8795 IF (wsmputil.check_wsmt(l_wip_id, null, l_txn_id, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
8796 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wsmt returned error:Pending wip lot txns in this lot');
8797
8798 l_stmt_num := 242;
8799 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
8800 SET wsji.error_message = l_fnd_generic_err_msg
8801 , wsji.process_status = WIP_CONSTANTS.ERROR
8802 WHERE wsji.header_id = l_header_id
8803 AND wsji.WIP_ENTITY_ID = l_wip_id;
8804
8805 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8806 ||l_stmt_num||'): '
8807 ||'Record for Header Id '
8808 ||l_header_id
8809 ||' set to ERROR in WSJI for wip_entity_id='||l_wip_id);
8810
8811 l_stmt_num := 243;
8812 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
8813 SET wrji.error_message = l_fnd_generic_err_msg
8814 , wrji.process_status = WIP_CONSTANTS.ERROR
8815 WHERE wrji.header_id = l_header_id;
8816
8817 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8818 ||l_stmt_num||'): '
8819 ||'Record for Header Id '
8820 ||l_header_id
8821 ||' set to ERROR in WRJI ');
8822
8823 l_stmt_num := 244;
8824 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
8825 SET wsmti.error_message = l_fnd_generic_err_msg
8826 , wsmti.process_status = WIP_CONSTANTS.ERROR
8827 WHERE wsmti.header_id = l_header_id;
8828
8829 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8830 ||l_stmt_num||'): '
8831 ||'Record for Header Id '
8832 ||l_header_id
8833 ||' set to ERROR in WSMTI ');
8834
8835 IF (SQL%ROWCOUNT > 0) THEN
8836 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
8837 FND_MESSAGE.SET_TOKEN('TABLE', 'wsm_split_merge_transactions');
8838 l_fnd_err_msg := FND_MESSAGE.GET;
8839 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8840
8841 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8842 p_message => substr(l_fnd_err_msg,1,2000),
8843 p_request_id => fnd_global.conc_request_id,
8844 p_program_id => fnd_global.conc_program_id,
8845 p_program_application_id => fnd_global.prog_appl_id,
8846 p_message_type => 1, --ERROR
8847 x_err_code => p_err_num,
8848 x_err_msg => p_err_msg);
8849 IF(p_err_num <> 0) THEN
8850 raise proc_error;
8851 END IF;
8852 END IF;
8853
8854 END IF;
8855
8856 l_stmt_num := 245;
8857 IF (wsmputil.check_wlmti(l_wip_id, null, l_header_id, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
8858 IF (l_debug = 'Y') THEN
8859 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wlmti returned error:Pending wip move interface txns in this lot');
8860 END IF;
8861
8862 l_stmt_num := 246;
8863 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
8864 SET wsji.error_message = l_fnd_generic_err_msg
8865 , wsji.process_status = WIP_CONSTANTS.ERROR
8866 WHERE wsji.header_id = l_header_id
8867 AND wsji.WIP_ENTITY_ID = l_wip_id;
8868
8869 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8870 ||l_stmt_num||'): '
8871 ||'Record for Header Id '
8872 ||l_header_id
8873 ||' set to ERROR in WSJI for wip_entity_id='||l_wip_id);
8874
8875 l_stmt_num := 247;
8876 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
8877 SET wrji.error_message = l_fnd_generic_err_msg
8878 , wrji.process_status = WIP_CONSTANTS.ERROR
8879 WHERE wrji.header_id = l_header_id;
8880
8881 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8882 ||l_stmt_num||'): '
8883 ||'Record for Header Id '
8884 ||l_header_id
8885 ||' set to ERROR in WRJI ');
8886
8887 l_stmt_num := 248;
8888 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
8889 SET wsmti.error_message = l_fnd_generic_err_msg
8890 , wsmti.process_status = WIP_CONSTANTS.ERROR
8891 WHERE wsmti.header_id = l_header_id;
8892
8893 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8894 ||l_stmt_num||'): '
8895 ||'Record for Header Id '
8896 ||l_header_id
8897 ||' set to ERROR in WSMTI ');
8898
8899 IF (SQL%ROWCOUNT > 0) THEN
8900 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
8901 FND_MESSAGE.SET_TOKEN('TABLE', 'wsm_lot_move_txn_interface');
8902 l_fnd_err_msg := FND_MESSAGE.GET;
8903 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8904
8905 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8906 p_message => substr(l_fnd_err_msg,1,2000),
8907 p_request_id => fnd_global.conc_request_id,
8908 p_program_id => fnd_global.conc_program_id,
8909 p_program_application_id => fnd_global.prog_appl_id,
8910 p_message_type => 1, --ERROR
8911 x_err_code => p_err_num,
8912 x_err_msg => p_err_msg);
8913 IF(p_err_num <> 0) THEN
8914 raise proc_error;
8915 END IF;
8916 END IF;
8917
8918 END IF;
8919
8920 END LOOP;
8921 CLOSE C_STARTING_JOB;
8922
8923 IF (l_debug = 'Y') THEN
8924 FND_FILE.PUT_LINE(FND_FILE.LOG,'Before check_wmti, check_wlmti of resulting lots');
8925 END IF;
8926
8927 OPEN C_RESULTING_JOB;
8928 LOOP
8929 FETCH C_RESULTING_JOB into l_job_name, l_txn_date, l_txn_id, l_header_id, l_organization_id;
8930 EXIT when c_resulting_job%notfound;
8931
8932 l_stmt_num := 249;
8933 IF (wsmputil.check_wmti(null,l_job_name, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
8934 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wmti returned error:Pending move txn in this lot');
8935
8936 l_stmt_num := 250;
8937 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
8938 SET wrji.error_message = l_fnd_generic_err_msg
8939 , wrji.process_status = WIP_CONSTANTS.ERROR
8940 WHERE wrji.header_id = l_header_id
8941 AND wrji.WIP_ENTITY_NAME = l_job_name;
8942
8943 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8944 ||l_stmt_num||'): '
8945 ||'Record for Header Id '
8946 ||l_header_id
8947 ||' set to ERROR in WRJI for wip_entity_name='||l_job_name);
8948 l_stmt_num := 251;
8949 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
8950 SET wsji.error_message = l_fnd_generic_err_msg
8951 , wsji.process_status = WIP_CONSTANTS.ERROR
8952 WHERE wsji.header_id = l_header_id;
8953
8954 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8955 ||l_stmt_num||'): '
8956 ||'Record for Header Id '
8957 ||l_header_id
8958 ||' set to ERROR in WSJI ');
8959
8960 l_stmt_num := 252;
8961 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
8962 SET wsmti.error_message = l_fnd_generic_err_msg
8963 , wsmti.process_status = WIP_CONSTANTS.ERROR
8964 WHERE wsmti.header_id = l_header_id;
8965
8966 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
8967 ||l_stmt_num||'): '
8968 ||'Record for Header Id '
8969 ||l_header_id
8970 ||' set to ERROR in WSMTI ');
8971
8972 IF (SQL%ROWCOUNT > 0) THEN
8973 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
8974 FND_MESSAGE.SET_TOKEN('TABLE', 'wip_move_transaction_interface');
8975 l_fnd_err_msg := FND_MESSAGE.GET;
8976 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
8977
8978 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
8979 p_message => substr(l_fnd_err_msg,1,2000),
8980 p_request_id => fnd_global.conc_request_id,
8981 p_program_id => fnd_global.conc_program_id,
8982 p_program_application_id => fnd_global.prog_appl_id,
8983 p_message_type => 1, --ERROR
8984 x_err_code => p_err_num,
8985 x_err_msg => p_err_msg);
8986 IF(p_err_num <> 0) THEN
8987 raise proc_error;
8988 END IF;
8989 END IF;
8990
8991 END IF;
8992
8993 l_stmt_num := 253;
8994 IF (wsmputil.check_wsmt(null,l_job_name, l_txn_id, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
8995 IF (l_debug = 'Y') THEN
8996 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wsmt returned error:Pending wip lot txns in this lot');
8997 END IF;
8998
8999 l_stmt_num := 254;
9000 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
9001 SET wrji.error_message = l_fnd_generic_err_msg
9002 , wrji.process_status = WIP_CONSTANTS.ERROR
9003 WHERE wrji.header_id = l_header_id
9004 AND wrji.WIP_ENTITY_NAME = l_job_name;
9005
9006 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9007 ||l_stmt_num||'): '
9008 ||'Record for Header Id '
9009 ||l_header_id
9010 ||' set to ERROR in WRJI for wip_entity_name='||l_job_name);
9011
9012 l_stmt_num := 255;
9013 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
9014 SET wsji.error_message = l_fnd_generic_err_msg
9015 , wsji.process_status = WIP_CONSTANTS.ERROR
9016 WHERE wsji.header_id = l_header_id;
9017
9018 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9019 ||l_stmt_num||'): '
9020 ||'Record for Header Id '
9021 ||l_header_id
9022 ||' set to ERROR in WSJI ');
9023
9024 l_stmt_num := 256;
9025 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
9026 SET wsmti.error_message = l_fnd_generic_err_msg
9027 , wsmti.process_status = WIP_CONSTANTS.ERROR
9028 WHERE wsmti.header_id = l_header_id;
9029
9030 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9031 ||l_stmt_num||'): '
9032 ||'Record for Header Id '
9033 ||l_header_id
9034 ||' set to ERROR in WSMTI ');
9035
9036 IF (SQL%ROWCOUNT > 0) THEN
9037 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
9038 FND_MESSAGE.SET_TOKEN('TABLE', 'wsm_split_merge_transactions');
9039 l_fnd_err_msg := FND_MESSAGE.GET;
9040 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
9041
9042 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
9043 p_message => substr(l_fnd_err_msg,1,2000),
9044 p_request_id => fnd_global.conc_request_id,
9045 p_program_id => fnd_global.conc_program_id,
9046 p_program_application_id => fnd_global.prog_appl_id,
9047 p_message_type => 1, --ERROR
9048 x_err_code => p_err_num,
9049 x_err_msg => p_err_msg);
9050 IF(p_err_num <> 0) THEN
9051 raise proc_error;
9052 END IF;
9053 END IF;
9054
9055 END IF;
9056
9057 l_stmt_num := 257;
9058 IF (wsmputil.check_wlmti(l_wip_id, null, l_header_id, l_txn_date, p_err_num, p_err_msg, l_organization_id) <> 0) THEN
9059 IF (l_debug = 'Y') THEN
9060 FND_FILE.PUT_LINE(FND_FILE.LOG,'check_wlmti returned error:Pending wip move interface txns in this lot');
9061 END IF;
9062
9063 l_stmt_num := 258;
9064 UPDATE WSM_RESULTING_JOBS_INTERFACE wrji
9065 SET wrji.error_message = l_fnd_generic_err_msg
9066 , wrji.process_status = WIP_CONSTANTS.ERROR
9067 WHERE wrji.header_id = l_header_id
9068 AND wrji.WIP_ENTITY_NAME = l_job_name;
9069
9070 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9071 ||l_stmt_num||'): '
9072 ||'Record for Header Id '
9073 ||l_header_id
9074 ||' set to ERROR in WRJI for wip_entity_name='||l_job_name);
9075
9076 l_stmt_num := 259;
9077 UPDATE WSM_STARTING_JOBS_INTERFACE wsji
9078 SET wsji.error_message = l_fnd_generic_err_msg
9079 , wsji.process_status = WIP_CONSTANTS.ERROR
9080 WHERE wsji.header_id = l_header_id;
9081
9082 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9083 ||l_stmt_num||'): '
9084 ||'Record for Header Id '
9085 ||l_header_id
9086 ||' set to ERROR in WSJI ');
9087
9088 l_stmt_num := 260;
9089 UPDATE WSM_SPLIT_MERGE_TXN_INTERFACE wsmti
9090 SET wsmti.error_message = l_fnd_generic_err_msg
9091 , wsmti.process_status = WIP_CONSTANTS.ERROR
9092 WHERE wsmti.header_id = l_header_id;
9093
9094 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('
9095 ||l_stmt_num||'): '
9096 ||'Record for Header Id '
9097 ||l_header_id
9098 ||' set to ERROR in WSMTI ');
9099
9100 IF (SQL%ROWCOUNT > 0) THEN
9101 FND_MESSAGE.SET_NAME('WSM', 'WSM_PENDING_TXN');
9102 FND_MESSAGE.SET_TOKEN('TABLE', 'wsm_lot_move_txn_interface');
9103 l_fnd_err_msg := FND_MESSAGE.GET;
9104 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
9105
9106 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
9107 p_message => substr(l_fnd_err_msg,1,2000),
9108 p_request_id => fnd_global.conc_request_id,
9109 p_program_id => fnd_global.conc_program_id,
9110 p_program_application_id => fnd_global.prog_appl_id,
9111 p_message_type => 1, --ERROR
9112 x_err_code => p_err_num,
9113 x_err_msg => p_err_msg);
9114 IF(p_err_num <> 0) THEN
9115 raise proc_error;
9116 END IF;
9117 END IF;
9118
9119 END IF;
9120
9121 END LOOP;
9122 CLOSE C_RESULTING_JOB;
9123 ********************************************/
9124 -- End : Comments to fix bug #3453139 --
9125
9126
9127 --VJ: Start fix for bug #2354270--
9128 /*-----------------------------------------------------------------+
9129 | Validate net_quantity is positive and |
9130 | net_quantity <= start_quantity |
9131 | |
9132 +-----------------------------------------------------------------*/
9133
9134 l_stmt_num := 261;
9135
9136 UPDATE wsm_resulting_jobs_interface wrji
9137 SET wrji.error_message = l_fnd_generic_err_msg
9138 WHERE wrji.header_id = l_header_id
9139 and (wrji.net_quantity < 0 --fixed as a part of bug #2352369
9140 -- and (wrji.net_quantity <= 0
9141 or
9142 wrji.net_quantity > wrji.start_quantity ); --bugfix 2168797: replaced AND with OR
9143
9144
9145 IF (SQL%ROWCOUNT > 0) THEN
9146 FND_MESSAGE.SET_NAME('WSM', 'WSM_INVALID_FIELD');
9147 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'net_quantity in Resulting Jobs');
9148 l_fnd_err_msg := FND_MESSAGE.GET;
9149 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
9150
9151 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE (p_header_id => l_header_id,
9152 p_message => substr(l_fnd_err_msg,1,2000),
9153 p_request_id => fnd_global.conc_request_id,
9154 p_program_id => fnd_global.conc_program_id,
9155 p_program_application_id => fnd_global.prog_appl_id,
9156 p_message_type => 1, --ERROR
9157 x_err_code => p_err_num,
9158 x_err_msg => p_err_msg);
9159 IF(p_err_num <> 0) THEN
9160 raise proc_error;
9161 END IF;
9162 END IF;
9163 --VJ: End fix for bug #2354270--
9164
9165
9166
9167 --Start: Additions for APS-WLT--
9168 l_profile_value := WSMPUTIL.CREATE_LBJ_COPY_RTG_PROFILE(l_organization_id); -- This returns the Profile value
9169
9170 IF (l_profile_value = 2) THEN -- Option A (Old Behavior)
9171 null;
9172 ELSE -- Option C (New Behavior)
9173 l_stmt_num := 262;
9174
9175 -- Start : Changes for bug #3421662--
9176 BEGIN
9177 -- SELECT nvl(starting_operation_seq_num, -1), starting_operation_code
9178 -- INTO l_wrji_starting_op_seq_num, l_wrji_starting_op_code
9179 -- FROM wsm_resulting_jobs_interface
9180 -- WHERE header_id = l_header_id
9181 -- AND rowid = l_wrji_rowid;
9182
9183 SELECT nvl(wrji.starting_operation_seq_num, -1), wrji.starting_operation_code
9184 INTO l_wrji_starting_op_seq_num, l_wrji_starting_op_code
9185 FROM wsm_resulting_jobs_interface wrji,
9186 wsm_split_merge_txn_interface wsmti
9187 WHERE wrji.header_id = l_header_id
9188 AND wsmti.header_id = wrji.header_id
9189 AND (wsmti.transaction_type_id in (3,5) -- Upd rtg/assy
9190 OR (wsmti.transaction_type_id = 1
9191 AND wrji.split_has_update_assy = 1)) -- SpUA
9192 AND wrji.rowid = l_wrji_rowid;
9193 -- End : Changes for bug #3421662--
9194
9195 IF (l_wrji_starting_op_seq_num = -1) AND (l_wrji_starting_op_code IS NULL) THEN
9196 FND_MESSAGE.SET_NAME('WSM', 'WSM_NULL_FIELD');
9197 FND_MESSAGE.SET_TOKEN('FLD_NAME', 'Starting Operation Seq Num / Code in Resulting jobs');
9198 l_fnd_err_msg := FND_MESSAGE.GET;
9199 FND_FILE.PUT_LINE(FND_FILE.LOG, 'WSMPVLDT.VALIDATE_RECORDS('||l_stmt_num||'): '||l_fnd_err_msg);
9200
9201 set_wrji_error(); -- WLTEnh
9202
9203 WSMPUTIL.AUTONOMOUS_WRITE_TO_WIE ( p_header_id => l_header_id,
9204 p_message => substr(l_fnd_err_msg,1,2000),
9205 p_request_id => fnd_global.conc_request_id,
9206 p_program_id => fnd_global.conc_program_id,
9207 p_program_application_id => fnd_global.prog_appl_id,
9208 p_message_type => 1, --ERROR
9209 x_err_code => p_err_num,
9210 x_err_msg => p_err_msg);
9211 IF(p_err_num <> 0) THEN
9212 raise proc_error;
9213 END IF;
9214 END IF;
9215 -- Start : Changes for bug #3421662--
9216 EXCEPTION
9217 WHEN NO_DATA_FOUND THEN
9218 NULL;
9219 END;
9220 -- End : Changes for bug #3421662--
9221 END IF;
9222
9223 --End: Additions for APS-WLT--
9224
9225
9226 FND_MESSAGE.SET_NAME('WSM', 'WSM_ERR_IN_START_LOT');
9227 l_fnd_err_msg := FND_MESSAGE.GET;
9228
9229 l_stmt_num := 263;
9230 UPDATE wsm_split_merge_txn_interface
9231 SET error_message = l_fnd_err_msg -- error_message = error_message || l_fnd_err_msg
9232 , process_status = WIP_CONSTANTS.ERROR -- WLTEnh
9233 WHERE header_id IN ( SELECT distinct header_id
9234 FROM wsm_starting_jobs_interface
9235 WHERE error_message IS NOT NULL)
9236 AND process_status = WIP_CONSTANTS.RUNNING;
9237
9238
9239 FND_MESSAGE.SET_NAME('WSM', 'WSM_ERR_IN_RESULT_LOT');
9240 l_fnd_err_msg := FND_MESSAGE.GET;
9241
9242 l_stmt_num := 264;
9243 UPDATE wsm_split_merge_txn_interface
9244 SET error_message = l_fnd_err_msg -- error_message = error_message || l_fnd_err_msg
9245 , process_status = WIP_CONSTANTS.ERROR -- WLTEnh
9246 WHERE header_id IN ( SELECT distinct header_id
9247 FROM wsm_resulting_jobs_interface
9248 WHERE error_message IS NOT NULL)
9249 AND process_status = WIP_CONSTANTS.RUNNING;
9250
9251
9252 l_stmt_num := 265;
9253
9254 /*BA WLTEnh */
9255
9256 -- Whenever an error happens in any of the table, we update all the
9257 -- other wlt ifc tables and hence it is sufficient to check the header
9258 -- alone to return the status of the validation.
9259
9260 Begin
9261 l_stmt_num := 266;
9262
9263 select 1 into l_errored_rows
9264 from wsm_split_merge_txn_interface
9265 Where internal_group_id = WSMPLOAD.G_GROUP_ID
9266 and header_id = WSMPLOAD.G_HEADER_ID
9267 and process_status = WIP_CONSTANTS.ERROR;
9268
9269 Exception
9270 When no_data_found Then
9271 l_errored_rows := 0;
9272
9273 When others Then
9274 l_errored_rows := 1; -- Error condition
9275
9276 End;
9277
9278 If (l_errored_rows = 0) Then
9279 p_err_msg := 'WSMPVLDT.VALIDATE_RECORDS: Passed validation for Header Id: '||WSMPLOAD.G_HEADER_ID;
9280 IF (l_debug = 'Y') THEN
9281 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9282 END IF;
9283 Else
9284 p_err_msg := ('Failed validation for Header Id '||WSMPLOAD.G_HEADER_ID);
9285 p_err_num := l_errored_rows;
9286 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9287
9288 End If;
9289
9290 IF (l_debug = 'Y') THEN
9291 fnd_file.put_line(fnd_file.log, 'WSMPVLDT.VALIDATE_RECORDS:End Time:'
9292 ||to_char(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
9293 END IF;
9294
9295 EXCEPTION
9296 WHEN proc_error THEN
9297 FND_FILE.PUT_LINE(fnd_file.log, substr('WSMPVLDT.VALIDATE_RECORDS('
9298 || to_char(l_stmt_num)
9299 || '): '
9300 || p_err_msg
9301 , 1, 2000) );
9302
9303 when others then
9304 p_err_num := SQLCODE;
9305 p_err_msg := 'WSMPVLDT.VALIDATE_RECORDS: ('||to_char(l_stmt_num)||'): '||SUBSTR(SQLERRM,1,1000);
9306 FND_FILE.PUT_LINE(fnd_file.log, p_err_msg);
9307
9308 END VALIDATE_RECORDS;
9309
9310
9311
9312 /*-------------------------------------------------------------+
9313 | CHECK_MERGE_OP
9314 ---------------------------------------------------------------*/
9315 /*-----------------------------------------------------------------+
9316 | Merge transaction only: check all starting lots are at the same |
9317 | department, using same resources, and at same intraoperation step|
9318 | and have the same job_type as the starting job |
9319 +-----------------------------------------------------------------*/
9320
9321 PROCEDURE CHECK_MERGE_OP(p_err_msg IN OUT NOCOPY VARCHAR2,
9322 --p_err_code IN OUT VARCHAR2,
9323 p_err_num IN OUT NOCOPY NUMBER) IS
9324 BEGIN
9325
9326 null;
9327
9328
9329 EXCEPTION
9330
9331 WHEN others THEN
9332 p_err_num := SQLCODE;
9333 p_err_msg := SUBSTR(SQLERRM,1,1000);
9334 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9335 END CHECK_MERGE_OP;
9336
9337
9338 /*-------------------------------------------------------------+
9339 | CHECK_NUMBER_OF_LOTS
9340 ---------------------------------------------------------------*/
9341 /*------------------------------------------------------------------------+
9342 | Only one starting lot must exist for split and update transactions. |
9343 | Only one resulting lot must exist for bonus, merge, update transactions.|
9344 | At least one starting lot must exist for merge transactions. |
9345 | At least one resulting lot must exist for split transaction. |
9346 +------------------------------------------------------------------------*/
9347
9348 PROCEDURE CHECK_NUMBER_OF_LOTS(p_err_msg IN OUT NOCOPY VARCHAR2,
9349 p_err_num IN OUT NOCOPY NUMBER) IS
9350 BEGIN
9351 null;
9352 EXCEPTION
9353 WHEN others THEN
9354 p_err_num := SQLCODE;
9355 p_err_msg := SUBSTR(SQLERRM,1,1000);
9356 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9357
9358 END CHECK_NUMBER_OF_LOTS;
9359
9360
9361 /*-------------------------------------------------------------+
9362 | CHECK_TOTAL_QTY
9363 ---------------------------------------------------------------*/
9364 /*-----------------------------------------------------------------+
9365 | Check sum of resulting lot quantity equal sum of total starting |
9366 | lot available quantities. |
9367 +-----------------------------------------------------------------*/
9368
9369 PROCEDURE CHECK_TOTAL_QTY (p_err_msg IN OUT NOCOPY VARCHAR2,
9370 p_err_num IN OUT NOCOPY NUMBER)IS
9371
9372 BEGIN
9373
9374 null;
9375 EXCEPTION
9376 WHEN others THEN
9377 p_err_num := SQLCODE;
9378 p_err_msg := SUBSTR(SQLERRM,1,1000);
9379 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9380
9381 END CHECK_TOTAL_QTY;
9382
9383
9384 /*-------------------------------------------------------------+
9385 | MATCH_START_RESULT_LOT
9386 ---------------------------------------------------------------*/
9387 /*-----------------------------------------------------------------+
9388 | If the resulting lot matches the starting lot, verify that the |
9389 | primary item id, operation sequence and intraoperation step of |
9390 | the resulting lot also match those of the starting lot. If not, |
9391 | update the values and populate a warning message in the record. |
9392 +-----------------------------------------------------------------*/
9393 --****************************************************************************
9394 ----------NOT USED ANY LONGER ---------------------------------------------------
9395 --****************************************************************************
9396
9397 PROCEDURE MATCH_START_RESULT_LOT (p_err_msg IN OUT NOCOPY VARCHAR2,
9398 p_err_num IN OUT NOCOPY NUMBER)IS
9399 BEGIN
9400 NULL;
9401 EXCEPTION
9402 WHEN others THEN
9403 p_err_num := SQLCODE;
9404 p_err_msg := SUBSTR(SQLERRM,1,1000);
9405 FND_FILE.PUT_LINE(FND_FILE.LOG, p_err_msg);
9406
9407 END MATCH_START_RESULT_LOT;
9408
9409
9410
9411
9412 END WSMPVLDT;