[Home] [Help]
PACKAGE BODY: APPS.WIP_ONLINE_MTL_TXN_PROCESSOR
Source
1 PACKAGE BODY wip_online_mtl_txn_processor AS
2 /* $Header: wipopsrb.pls 120.3 2007/10/12 18:33:30 vjambhek ship $ */
3
4 --unmarks serial numbers and sets their status to 'in transit'
5 --precondition: p_source_id is SOURCE_ID of one or many items
6 -- serial numbers exist in msn
7 PROCEDURE updateSerials(p_header_id IN NUMBER,
8 x_err_msg OUT NOCOPY VARCHAR2,
9 x_return_status OUT NOCOPY VARCHAR2) IS
10 CURSOR c_serials IS
11 SELECT wlc.inventory_item_id,
12 wlc.organization_id,
13 wlcs.fm_serial_number,
14 wlcs.to_serial_number
15 FROM wip_lpn_completions wlc, wip_lpn_completions_serials wlcs
16 WHERE wlc.header_id = p_header_id
17 and wlc.header_id = wlcs.header_id;
18
19 l_msg_count NUMBER;
20 BEGIN
21 x_return_status := FND_API.G_RET_STS_SUCCESS;
22 SAVEPOINT PRE_UPDATE;
23 FOR v_serial IN c_serials LOOP
24 wms_wip_integration.post_completion(p_item_id => v_serial.inventory_item_id,
25 p_org_id => v_serial.organization_id,
26 p_quantity => NULL,
27 p_fm_serial_number => v_serial.fm_serial_number,
28 p_to_serial_number => v_serial.to_serial_number,
29 x_msg_count => l_msg_count,
30 x_msg_data => x_err_msg,
31 x_return_status => x_return_status);
32 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
33 ROLLBACK TO PRE_UPDATE;
34 raise FND_API.G_EXC_UNEXPECTED_ERROR;
35 end if;
36 END LOOP;
37
38 EXCEPTION
39 when FND_API.G_EXC_UNEXPECTED_ERROR then
40 if(l_msg_count > 1) then
41 fnd_msg_pub.get(p_data => x_err_msg,
42 p_msg_index_out => l_msg_count);
43 end if;
44 when others then
45 null;
46 end updateSerials;
47
48 --precondition: p_header_id is HEADER_ID and SOURCE_ID of assy
49 -- p_header_id is SOURCE_ID of components
50 PROCEDURE backflushComponents(p_header_id IN NUMBER,
51 x_err_msg OUT NOCOPY VARCHAR2,
52 x_return_status OUT NOCOPY VARCHAR2) IS
53 msgCount NUMBER;
54 BEGIN
55 commit;
56 wms_wip_integration.backflush(p_header_id => p_header_id,
57 x_msg_data => x_err_msg,
58 x_msg_count => msgCount,
59 x_return_status => x_return_status);
60 END backflushComponents;
61
62
63 --precondition: p_header_id is HEADER_ID and SOURCE_ID of assy
64 -- p_header_id is SOURCE_ID of components
65 PROCEDURE completeWol(p_header_id IN NUMBER,
66 x_err_msg OUT NOCOPY VARCHAR2,
67 x_return_status OUT NOCOPY VARCHAR2) IS BEGIN
68
69 SAVEPOINT COMPLETEWOL;
70 wip_wol_processor.completeAssyItem(p_header_id => p_header_id,
71 x_err_msg => x_err_msg,
72 x_return_status => x_return_status);
73
74 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
75 raise FND_API.G_EXC_UNEXPECTED_ERROR;
76 end if;
77
78 updateSerials(p_header_id => p_header_id,
79 x_err_msg => x_err_msg,
80 x_return_status => x_return_status);
81
82 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
83 raise FND_API.G_EXC_UNEXPECTED_ERROR;
84 end if;
85
86 exception when others then
87 ROLLBACK TO COMPLETEWOL;
88 END completeWol;
89
90 --precondition: p_header_id is HEADER_ID and SOURCE_ID of assy
91 -- p_header_id is SOURCE_ID of components
92 PROCEDURE completeAssyAndComponents(p_header_id IN NUMBER,
93 x_err_msg OUT NOCOPY VARCHAR2,
94 x_return_status OUT NOCOPY VARCHAR2) IS BEGIN
95 SAVEPOINT CACSTART;
96 wip_online_mtl_txn_processor.completeAssyItem(p_header_id => p_header_id,
97 x_err_msg => x_err_msg,
98 x_return_status => x_return_status);
99
100 if(x_return_status = FND_API.G_RET_STS_SUCCESS) then --now perform material txns for the components
101 transactMaterials(p_source_id => p_header_id,
102 x_err_msg => x_err_msg,
103 x_return_status => x_return_status);
104 end if;
105
106
107 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
108 ROLLBACK to SAVEPOINT CACSTART;
109 end if;
110 END completeAssyAndComponents;
111
112
113 --precondition: p_header_id is HEADER_ID and SOURCE_ID of assy
114 PROCEDURE completeAssyItem(p_header_id IN NUMBER,
115 x_err_msg OUT NOCOPY VARCHAR2,
116 x_return_status OUT NOCOPY VARCHAR2) IS BEGIN
117 SAVEPOINT COMPASSYITEM;
118 wip_discrete_job_processor.completeAssyItem(p_header_id => p_header_id,
119 x_err_msg => x_err_msg,
120 x_return_status => x_return_status);
121 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
122 raise FND_API.G_EXC_UNEXPECTED_ERROR;
123 end if;
124 updateSerials(p_header_id => p_header_id,
125 x_err_msg => x_err_msg,
126 x_return_status => x_return_status);
127
128 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
129 raise FND_API.G_EXC_UNEXPECTED_ERROR;
130 end if;
131
132 EXCEPTION
133 when others then
134 ROLLBACK TO COMPASSYITEM;
135 END completeAssyItem;
136
137 --precondition: p_source_id is SOURCE_ID of materials
138 -- for any material record, HEADER_ID != SOURCE_ID
139 -- The not-equal is a requirement for assembly completion and makes
140 -- sense for material txns as well(generate a header id for each item
141 -- and then another for the source id column to group them for processing).
142 PROCEDURE transactMaterials(p_source_id IN NUMBER,
143 x_err_msg OUT NOCOPY VARCHAR2,
144 x_return_status OUT NOCOPY VARCHAR2) IS
145
146 CURSOR c_components(v_source_id NUMBER) IS
147 SELECT HEADER_ID
148 FROM WIP_LPN_COMPLETIONS
149 WHERE v_source_id = SOURCE_ID
150 AND v_source_id <> HEADER_ID;
151 BEGIN
152 x_return_status := FND_API.G_RET_STS_SUCCESS;
153 SAVEPOINT TXMAT;
154 FOR v_comp_header_id IN c_components(p_source_id) LOOP
155 transactMaterial(p_header_id => v_comp_header_id.header_id,
156 x_err_msg => x_err_msg,
157 x_return_status => x_return_status);
158 if(x_return_status <> FND_API.G_RET_STS_SUCCESS) then
159 raise FND_API.G_EXC_UNEXPECTED_ERROR;
160 end if;--break out nocopy of the loop, preserving the error message and status for the bad component
161 END LOOP;
162
163 EXCEPTION
164 when others then
165 ROLLBACK TO SAVEPOINT TXMAT;
166 END transactMaterials;
167
168
169 PROCEDURE transactMaterial(p_header_id IN NUMBER,
170 x_err_msg OUT NOCOPY VARCHAR2,
171 x_return_status OUT NOCOPY VARCHAR2) IS BEGIN
172 wip_material_processor.processItem(p_header_id => p_header_id,
173 x_err_msg => x_err_msg,
174 x_return_status => x_return_status);
175 END transactMaterial;
176
177
178 PROCEDURE lpnCompleteFlow (p_orgID NUMBER,
179 p_userID NUMBER,
180 p_scheduledFlag NUMBER,
181 p_scheduleNumber VARCHAR2,
182 p_transactionTypeID NUMBER,
183 p_transactionHeaderID NUMBER,
184 p_completionTxnID NUMBER,
185 p_processHeaderID NUMBER,
186 p_processTempID NUMBER,
187 p_processCmpTxnID NUMBER,
188 p_transactionQty NUMBER,
189 p_transactionUOM VARCHAR2,
190 p_lineID NUMBER,
191 p_lineOp NUMBER,
192 p_assyItemID NUMBER,
193 p_reasonID NUMBER,
194 p_qualityID NUMBER,
195 p_wipEntityID IN OUT NOCOPY NUMBER,
196 p_kanbanID NUMBER,
197 p_projectID NUMBER,
198 p_taskID NUMBER,
199 p_lpnID NUMBER,
200 p_demandSourceHeaderID NUMBER,
201 p_demandSourceLine VARCHAR2,
202 p_demandSourceDelivery VARCHAR2,
203 x_return_status OUT NOCOPY VARCHAR2,
204 x_err_msg OUT NOCOPY VARCHAR2) IS
205 environment wma_common.Environment;
206 mmttParameter wma_flow.FlowParam;
207 lpnParameter wma_cfm.LpnCfmParam;
208 dummyErrCode VARCHAR2(1);
209 error VARCHAR2(241); -- error message
210 l_msg_stack VARCHAR2(2000);
211 l_msg_count NUMBER;
212 l_ret_value NUMBER;
213 returnStatus VARCHAR2(1);
214 labelStatus VARCHAR2(1);
215 l_paramTbl wip_logger.param_tbl_t;
216 l_logLevel NUMBER := to_number(fnd_log.g_current_runtime_level);
217 BEGIN
218 if (l_logLevel <= wip_constants.trace_logging) then
219 l_paramTbl(1).paramName := 'not printing params';
220 l_paramTbl(1).paramValue := ' ';
221 wip_logger.entryPoint(p_procName => 'wipopsrb.lpnCompleteFlow',
222 p_params => l_paramTbl,
223 x_returnStatus => dummyErrCode);
224 end if;
225
226 environment.orgID := p_orgID;
227 environment.userID := p_userID;
228 wma_derive.deriveEnvironment(environment);
229
230 -- Insert records into mmtt
231 -- lpnID inserted here for label printing
232 mmttParameter.environment := environment ;
233 mmttParameter.transactionDate := sysdate ;
234 mmttParameter.scheduledFlag := p_scheduledFlag ;
235 if (l_logLevel <= wip_constants.full_logging) then
236 wip_logger.log('scheduled flag: ' || mmttParameter.scheduledFlag, dummyErrCode);
237 end if;
238 mmttParameter.scheduleNumber := p_scheduleNumber ;
239 mmttParameter.transactionType := p_transactionTypeID ;
240 mmttParameter.transactionHeaderID := p_processHeaderID ;
241 if(p_processTempID is null) then
242 select mtl_material_transactions_s.nextval
243 into mmttParameter.transactionIntID
244 from dual;
245 else
246 mmttParameter.transactionIntID := p_processTempID;
247 end if;
248
249 /*Fix for bug #6216695, which is an FP of 6082623:
250 Assign header id to flow parameter so that it can used to populate MTLT and MSNT*/
251 mmttParameter.headerId := p_transactionHeaderID ;
252
253 mmttParameter.transactionQty := p_transactionQty ;
254 mmttParameter.transactionUOM := p_transactionUOM ;
255 mmttParameter.lineID := p_lineID ;
256 mmttParameter.lineOp := p_lineOp ;
257 mmttParameter.assemblyID := p_assyItemID ;
258 mmttParameter.reasonID := p_reasonID ;
259 mmttParameter.qualityID := p_qualityID ;
260 mmttParameter.completionTxnID := p_completionTxnID ; /*2880347 */
261 mmttParameter.wipEntityID := p_wipEntityID ;
262 mmttParameter.kanbanID := p_kanbanID;
263 mmttParameter.projectID := p_projectID ;
264 mmttParameter.taskID := p_taskID ;
265 mmttParameter.lpnID := p_lpnID ;
266 mmttParameter.demandSourceHeaderID := p_demandSourceHeaderID ;
267 mmttParameter.demandSourceLine := p_demandSourceLine ;
268 mmttParameter.demandSourceDelivery := p_demandSourceDelivery ;
269
270 /* select DEFAULT_PULL_SUPPLY_SUBINV,
271 DEFAULT_PULL_SUPPLY_LOCATOR_ID
272 into mmttParameter.subinventoryCode,
273 mmttParameter.locatorID
274 from wip_parameters
275 where organization_id = p_orgID;
276 */
277 -- mmttParameter.subinventoryCode := null;
278 -- mmttParameter.locatorID := null;
279
280 wma_flow.insertParentRecordIntoMMTT(mmttParameter, l_ret_value , x_err_msg);
281 if ( l_ret_value = -1 ) then
282 x_return_status := fnd_api.g_ret_sts_unexp_error;
283 if (l_logLevel <= wip_constants.full_logging) then
284 wip_logger.log('assy insert failed', dummyErrCode);
285 end if;
286 raise fnd_api.g_exc_unexpected_error;
287 end if;
288
289
290 /*Bug 6417742 (FP of 6342851) - Commented label printing call, this API will be called from WIP_MTLTEMPPROC_PRIV.PROCESSWIP.
291 -- print label
292 wip_utilities.print_label(p_txn_id => p_processHeaderID,
293 p_table_type => 2, --MMTT
294 p_ret_status => returnStatus,
295 p_msg_count => l_msg_count,
296 p_msg_data => error,
297 p_label_status => labelStatus,
298 p_business_flow_code => 33); -- discrete business flow code
299 -- do not error out if label printing, only put warning message in log
300 if(returnStatus <> fnd_api.g_ret_sts_success) then
301 WIP_UTILITIES.get_message_stack(p_msg => l_msg_stack);
302 if (l_logLevel <= wip_constants.full_logging) then
303 wip_logger.log(p_msg => 'An error has occurred with label printing.\n' ||
304 'The following error has occurred during ' ||
305 'printing: ' || l_msg_stack || '\n' ||
306 'Please check the Inventory log file for more ' ||
307 'information.',
308 x_returnStatus =>dummyErrCode);
309 end if;
310 end if;
311 if (l_logLevel <= wip_constants.full_logging) then
312 wip_logger.log(p_msg => 'Label printing returned with status ' ||
313 returnStatus,
314 x_returnStatus => dummyErrCode);
315 end if; */
316
317 -- process the transaction
318 wip_cfmProc_priv.processMobile(p_processHeaderID,
319 p_processTempID,
320 fnd_api.g_false, -- do not call inv trx processor
321 x_return_status,
322 x_err_msg);
323
324 if ( x_return_status <> fnd_api.g_ret_sts_success ) then
325 if (l_logLevel <= wip_constants.full_logging) then
326 wip_logger.log('assy processing failed', dummyErrCode);
327 end if;
328 raise fnd_api.g_exc_unexpected_error;
329 end if;
330
331 --get the flow schedule wip entity id if it is a wol trx
332 if (p_scheduledFlag = 2) then
333 select transaction_source_id
334 into p_wipEntityID
335 from mtl_material_transactions_temp
336 where transaction_temp_id = p_processTempID;
337 end if;
338
339
340 --delete the assy mmtt record
341 delete from mtl_material_transactions_temp
342 where transaction_temp_id = p_processTempID;
343
344 /*Start - Fix for bug #6216695, which is an FP of 6082623:
345 Delete MTLT and MSNT records also*/
346 delete mtl_serial_numbers_temp
347 where transaction_temp_id = p_processTempID
348 or transaction_temp_id in (
349 select serial_transaction_temp_id
350 from mtl_transaction_lots_temp
351 where transaction_temp_id = p_processTempID);
352
353 delete mtl_transaction_lots_temp
354 where transaction_temp_id = p_processTempID;
355 /*End - Fix for bug #6216695, which is an FP of 6082623:
356 Delete MTLT and MSNT records also*/
357
358 --process the components
359 wip_mtlTempProc_priv.processTemp(p_initMsgList => fnd_api.g_true,
360 p_txnHdrID => p_processHeaderID,
361 p_txnMode => wip_constants.online,
362 p_destroyQtyTrees => fnd_api.g_true,
363 p_endDebug => fnd_api.g_false,
364 x_returnStatus => x_return_status,
365 x_errorMsg => x_err_msg);
366 if(x_return_status <> fnd_api.g_ret_sts_success) then
367 if (l_logLevel <= wip_constants.full_logging) then
368 wip_logger.log('component processing failed', dummyErrCode);
369 end if;
370 raise fnd_api.g_exc_unexpected_error;
371 end if;
372
373 -- insert into wip_lpn_completions
374 lpnParameter.environment := environment ;
375 lpnParameter.transactionDate := sysdate ;
376 -- for wip_lpn_completions, unscheduled is 3
377 if (p_scheduledFlag = 1) then
378 lpnParameter.scheduledFlag := 1 ;
379 else
380 lpnParameter.scheduledFlag := 3 ;
381 end if;
382 lpnParameter.transactionType := p_transactionTypeID ;
383 lpnParameter.headerID := p_transactionHeaderID ;
384 lpnParameter.transactionQty := p_transactionQty ;
385 lpnParameter.transactionUOM := p_transactionUOM ;
386 lpnParameter.subinventoryCode := null ;
387 lpnParameter.locatorID := null ;
388 lpnParameter.kanbanID := p_kanbanID ;
389 lpnParameter.lineID := null ;
390 lpnParameter.lineOp := null ;
391 lpnParameter.assemblyID := p_assyItemID ;
392 lpnParameter.reasonID := p_reasonID ;
393 lpnParameter.qualityID := p_qualityID ;
394 lpnParameter.lpnID := p_lpnID ;
395 lpnParameter.completionTxnID := p_completionTxnID;
396 lpnParameter.wipEntityID := p_wipEntityID;
397 lpnParameter.demandSourceHeaderID := p_demandSourceHeaderID;
398 lpnParameter.demandSourceLine := p_demandSourceLine;
399 lpnParameter.demandSourceDelivery := p_demandSourceDelivery;
400 wma_cfm.process(lpnParameter, l_ret_value , x_err_msg);
401 if ( l_ret_value = -1 ) then
402 x_return_status := fnd_api.g_ret_sts_unexp_error;
403 if (l_logLevel <= wip_constants.full_logging) then
404 wip_logger.log('assy lpn insert failed', dummyErrCode);
405 end if;
406 raise fnd_api.g_exc_unexpected_error;
407 end if;
408
409 updateSerials(p_header_id => lpnParameter.headerID,
410 x_err_msg => x_err_msg,
411 x_return_status => x_return_status);
412
413 if ( x_return_status <> fnd_api.g_ret_sts_success ) then
414 if (l_logLevel <= wip_constants.full_logging) then
415 wip_logger.log('updateSerials failed', dummyErrCode);
416 end if;
417 raise fnd_api.g_exc_unexpected_error;
418 end if;
419
420 x_return_status := fnd_api.G_RET_STS_SUCCESS;
421
422 if (l_logLevel <= wip_constants.trace_logging) then
423 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteFlow',
424 p_procReturnStatus => x_return_status,
425 p_msg => x_err_msg,
426 x_returnStatus => dummyErrCode);
427 wip_logger.cleanUp(dummyErrCode);
428 end if;
429
430 EXCEPTION
431 when fnd_api.g_exc_unexpected_error then
432 if (l_logLevel <= wip_constants.trace_logging) then
433 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteFlow',
434 p_procReturnStatus => x_return_status,
435 p_msg => 'error:' || x_err_msg,
436 x_returnStatus => dummyErrCode);
437 wip_logger.cleanUp(dummyErrCode);
438 end if;
439 when others then
440 x_return_status := fnd_api.g_ret_sts_unexp_error;
441 x_err_msg := SQLERRM;
442 -- WIP_UTILITIES.get_message_stack(p_msg => x_err_msg);
443 if (l_logLevel <= wip_constants.trace_logging) then
444 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteFlow',
445 p_procReturnStatus => x_return_status,
446 p_msg => 'unexp error: ' || x_err_msg,
447 x_returnStatus => dummyErrCode);
448 wip_logger.cleanUp(dummyErrCode);
449 end if;
450 END lpnCompleteFlow;
451
452 /* Process an Lpn (discrete job) completion, called by LpnCmpProcessor.java Calls
453 * wma online processor in mmtt first, then deletes those records and
454 * populates wip_lpn_completions for wms processing.
455 *
456 * parameters: p_orgID -- current org
457 * p_userID -- current user
458 * p_transactionHeaderID -- header ID in wip_lpn_completions
459 * p_processHeaderID -- transaction header ID in mmtt
460 * p_processIntID -- transaction temp ID in mmtt
461 * x_err_msg -- err_msg if call fails, null if success
462 * x_return_status -- fnd_api.G_RET_STS_SUCCESS ('S') if successful
463 */
464 PROCEDURE lpnCompleteJob (p_orgID NUMBER,
465 p_userID NUMBER,
466 p_transactionTypeID NUMBER,
467 p_transactionHeaderID NUMBER,
468 p_completionTxnID NUMBER,
469 p_processHeaderID NUMBER,
470 p_processIntID NUMBER,
471 p_processCmpTxnID NUMBER,
472 p_wipEntityID NUMBER,
473 p_wipEntityName VARCHAR2,
474 p_assyItemID NUMBER,
475 p_assyItemName VARCHAR2,
476 p_overcomplete NUMBER,
477 p_transactionQty NUMBER,
478 p_transactionUOM VARCHAR2,
479 p_qualityID NUMBER,
480 p_kanbanID NUMBER,
481 p_projectID NUMBER,
482 p_taskID NUMBER,
483 p_lpnID NUMBER,
484 x_return_status OUT NOCOPY VARCHAR2,
485 x_err_msg OUT NOCOPY VARCHAR2) IS
486 environment wma_common.Environment;
487 mtiParameters wma_completion.CmpParams;
488 lpnParameters wma_completion.LpnCmpParams;
489 dummyErrCode VARCHAR2(1);
490 l_ret_value NUMBER;
491 l_paramTbl wip_logger.param_tbl_t;
492 l_logLevel NUMBER := to_number(fnd_log.g_current_runtime_level);
493 /* New variables for Bug 6013398*/
494 msgCount NUMBER;
495 labelStatus VARCHAR2(1);
496 l_msg_stack VARCHAR2(2000);
497 dummy VARCHAR2(1);
498 l_cmpl_txnTmpID NUMBER;
499 l_retStatus VARCHAR2(1);
500 error VARCHAR2(2000); -- error message
501
502 BEGIN
503 if (l_logLevel <= wip_constants.trace_logging) then
504 l_paramTbl(1).paramName := 'not printing params';
505 l_paramTbl(1).paramValue := ' ';
506 wip_logger.entryPoint(p_procName => 'wipopsrb.lpnCompleteJob',
507 p_params => l_paramTbl,
508 x_returnStatus => dummyErrCode);
509 end if;
510
511 environment.orgID := p_orgID;
512 environment.userID := p_userID;
513 wma_derive.deriveEnvironment(environment) ;
514
515
516 lpnParameters.environment := environment ;
517 lpnParameters.transactionTypeID := p_transactionTypeID ;
518 lpnParameters.headerID := p_transactionHeaderID ;
519 lpnParameters.wipEntityID := p_wipEntityID ;
520 lpnParameters.wipEntityName := p_wipEntityName ;
521 lpnParameters.itemID := p_assyItemID ;
522 lpnParameters.itemName := p_assyItemName ;
523 lpnParameters.overcomplete := ( p_overcomplete = 1) ;
524 lpnParameters.transactionQty := p_transactionQty ;
525 lpnParameters.transactionUOM := p_transactionUOM ;
526 lpnParameters.subinv := null ;
527 lpnParameters.locatorID := null ;
528 lpnParameters.locatorName := null ;
529 lpnParameters.kanbanCardID := p_kanbanID ;
530 lpnParameters.qualityID := p_qualityID ;
531 lpnParameters.lpnID := p_lpnID ;
532 lpnParameters.completionTxnID := p_completionTxnID;
533 wma_completion.process(parameters => lpnParameters,
534 status => l_ret_value,
535 errMessage => x_err_msg,
536 cmpl_txnTmpID => l_cmpl_txnTmpID); --Bug 6013398
537 if ( l_ret_value = -1 ) then
538 x_return_status := fnd_api.g_ret_sts_unexp_error;
539 if (l_logLevel <= wip_constants.full_logging) then
540 wip_logger.log('lpn processing failed', dummyErrCode);
541 end if;
542 raise fnd_api.g_exc_unexpected_error;
543 end if;
544
545 --move the components to MMTT
546 wip_mtlTempProc_priv.validateInterfaceTxns(p_txnHdrID => p_processHeaderID,
547 p_initMsgList => fnd_api.g_true,
548 x_returnStatus => x_return_status);
549 if(x_return_status <> fnd_api.g_ret_sts_success) then
550 if (l_logLevel <= wip_constants.full_logging) then
551 wip_logger.log('component validation failed', dummyErrCode);
552 end if;
553 wip_utilities.get_message_stack(p_msg => x_err_msg);
554 raise fnd_api.g_exc_unexpected_error;
555 end if;
556
557 --process the components
558 wip_mtlTempProc_priv.processTemp(p_initMsgList => fnd_api.g_true,
559 p_txnHdrID => p_processHeaderID,
560 p_txnMode => wip_constants.online,
561 p_destroyQtyTrees => fnd_api.g_true,
562 p_endDebug => fnd_api.g_false,
563 x_returnStatus => x_return_status,
564 x_errorMsg => x_err_msg);
565
566 if(x_return_status <> fnd_api.g_ret_sts_success) then
567 if (l_logLevel <= wip_constants.full_logging) then
568 wip_logger.log('component processing failed', dummyErrCode);
569 end if;
570 raise fnd_api.g_exc_unexpected_error;
571 end if;
572
573 /* Start - Bug 6013398: Moved below code from procedure wma_completion.process to here*/
574 /* Start of fix for bug 4253002 */
575 wip_utilities.print_label(p_txn_id => l_cmpl_txnTmpID,
576 p_table_type => 2, --MMTT
577 p_ret_status => l_retStatus,
578 p_msg_count => msgCount,
579 p_msg_data => error,
580 p_label_status => labelStatus,
581 p_business_flow_code => 26); -- discrete business flow code
582 -- do not error out if label printing, only put warning message in log
583 if(l_retStatus <> fnd_api.g_ret_sts_success) then
584 wip_utilities.get_message_stack(p_msg => l_msg_stack);
585 if (l_logLevel <= wip_constants.full_logging) then
586 wip_logger.log(p_msg => 'An error has occurred with label printing.\n' ||
587 'The following error has occurred during ' ||
588 'printing: ' || l_msg_stack || '\n' ||
589 'Please check the Inventory log file for more ' ||
590 'information.',
591 x_returnStatus =>dummy);
592 end if;
593 end if;
594 if (l_logLevel <= wip_constants.full_logging) then
595 wip_logger.log(p_msg => 'Label printing returned with status ' || l_retStatus,
596 x_returnStatus => dummy);
597 end if;
598 /* End of fix for bug 4253002 */
599
600 --and delete it
601 delete mtl_material_transactions_temp
602 where transaction_temp_id = l_cmpl_txnTmpID;
603
604 /* Fix for bug 4253002: Dummy mtlt and msnt records created in putintoMMTT()
605 will also be deleted along with the parent MMTT record. */
606 delete mtl_serial_numbers_temp
607 where transaction_temp_id = l_cmpl_txnTmpID
608 or transaction_temp_id in (
609 select serial_transaction_temp_id
610 from mtl_transaction_lots_temp
611 where transaction_temp_id = l_cmpl_txnTmpID);
612
613 delete mtl_transaction_lots_temp
614 where transaction_temp_id = l_cmpl_txnTmpID;
615
616 /* End - Bug 6013398: Moved below code from procedure wma_completion.process to here*/
617
618 updateSerials(p_header_id => lpnParameters.headerID,
619 x_err_msg => x_err_msg,
620 x_return_status => x_return_status);
621
622 if ( x_return_status <> fnd_api.g_ret_sts_success ) then
623 if (l_logLevel <= wip_constants.full_logging) then
624 wip_logger.log('updateSerials failed', dummyErrCode);
625 end if;
626 raise fnd_api.g_exc_unexpected_error;
627 end if;
628
629
630
631 x_return_status := fnd_api.G_RET_STS_SUCCESS;
632
633 if (l_logLevel <= wip_constants.trace_logging) then
634 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteJob',
635 p_procReturnStatus => x_return_status,
636 p_msg => x_err_msg,
637 x_returnStatus => dummyErrCode);
638 wip_logger.cleanUp(dummyErrCode);
639 end if;
640
641 EXCEPTION
642 when fnd_api.g_exc_unexpected_error then
643 if (l_logLevel <= wip_constants.trace_logging) then
644 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteJob',
645 p_procReturnStatus => x_return_status,
646 p_msg => x_err_msg,
647 x_returnStatus => dummyErrCode);
648 wip_logger.cleanUp(dummyErrCode);
649 end if;
650 when others then
651 x_return_status := fnd_api.g_ret_sts_unexp_error;
652 WIP_UTILITIES.get_message_stack(p_msg => x_err_msg);
653 if (l_logLevel <= wip_constants.trace_logging) then
654 wip_logger.exitPoint(p_procName => 'wipopsrb.lpnCompleteJob',
655 p_procReturnStatus => x_return_status,
656 p_msg => SQLERRM,
657 x_returnStatus => dummyErrCode);
658 wip_logger.cleanUp(dummyErrCode);
659 end if;
660
661 END lpnCompleteJob;
662
663 END wip_online_mtl_txn_processor;