65: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
66: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' Complete step batchstep_id='||p_batch_step_rec.batchstep_id);
67: END IF;
68:
69: x_return_status := FND_API.G_RET_STS_SUCCESS;
70:
71: l_batch_step_rec := p_batch_step_rec;
72: l_batch_header_rec := p_batch_header_rec;
73:
82: ,x_batch_step_rec => l_batch_step_rec
83: ,x_exception_material_tbl => x_exception_material_tbl
84: ,x_return_status => l_return_status);
85:
86: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
87: x_return_status := l_return_status;
88: RAISE error_release_batch;
89: END IF;
90:
109: ,x_exception_material_tbl => x_exception_material_tbl
110: ,x_return_status => l_return_status
111: ,p_quality_override => TRUE);
112:
113: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
114: x_return_status := l_return_status;
115: RAISE error_complete_step_rec;
116: END IF;
117:
150: (p_batch_header_rec => l_in_batch_header_rec
151: ,x_batch_header_rec => l_batch_header_rec
152: ,x_return_status => x_return_status);
153:
154: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
155: RAISE error_validation;
156: END IF;
157:
158: l_in_batch_header_rec := l_batch_header_rec;
161: ,x_exception_material_tbl => x_exception_material_tbl
162: ,x_batch_header_rec => l_batch_header_rec
163: ,x_return_status => l_return_status);
164:
165: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
166: x_return_status := l_return_status;
167: RAISE error_complete_batch;
168: END IF;
169:
176: ,p_delete_reservations => 'T'
177: ,p_recursive => 'R'
178: ,x_return_status => l_return_status);
179:
180: IF l_return_status <> fnd_api.g_ret_sts_success THEN
181: IF (g_debug <= gme_debug.g_log_procedure) THEN
182: gme_debug.put_line ( g_pkg_name
183: || '.'
184: || l_api_name
201: NULL;
202: WHEN error_fetch THEN
203: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
204: ,SQLERRM);
205: x_return_status := fnd_api.g_ret_sts_unexp_error;
206: WHEN OTHERS THEN
207: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
208: IF g_debug <= gme_debug.g_log_procedure THEN
209: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
207: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
208: IF g_debug <= gme_debug.g_log_procedure THEN
209: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
210: END IF;
211: x_return_status := FND_API.g_ret_sts_unexp_error;
212: END complete_step;
213:
214: PROCEDURE complete_step_recursive
215: (p_batch_step_rec IN gme_batch_steps%ROWTYPE
243: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' complete step recursive batch_step_id='||p_batch_step_rec.batchstep_id);
244: END IF;
245:
246: /* Set the return status to success initially */
247: x_return_status := FND_API.G_RET_STS_SUCCESS;
248:
249: x_batch_step_rec := p_batch_step_rec;
250:
251: /* Exit the recursive loop if the step is already released, completed or closed */
262: -- Pawan Kumar added for bug 5034336
263: -- check for batch step lock status from gmo
264: gmo_vbatch_grp.GET_ENTITY_LOCK_STATUS (
265: P_API_VERSION => 1.0,
266: P_INIT_MSG_LIST => FND_API.G_FALSE,
267: P_COMMIT => FND_API.G_FALSE,
268: P_VALIDATION_LEVEL => FND_API.G_VALID_LEVEL_FULL,
269: X_RETURN_STATUS => x_return_status ,
270: X_MSG_COUNT => l_msg_count,
263: -- check for batch step lock status from gmo
264: gmo_vbatch_grp.GET_ENTITY_LOCK_STATUS (
265: P_API_VERSION => 1.0,
266: P_INIT_MSG_LIST => FND_API.G_FALSE,
267: P_COMMIT => FND_API.G_FALSE,
268: P_VALIDATION_LEVEL => FND_API.G_VALID_LEVEL_FULL,
269: X_RETURN_STATUS => x_return_status ,
270: X_MSG_COUNT => l_msg_count,
271: X_MSG_DATA => l_msg_stack,
264: gmo_vbatch_grp.GET_ENTITY_LOCK_STATUS (
265: P_API_VERSION => 1.0,
266: P_INIT_MSG_LIST => FND_API.G_FALSE,
267: P_COMMIT => FND_API.G_FALSE,
268: P_VALIDATION_LEVEL => FND_API.G_VALID_LEVEL_FULL,
269: X_RETURN_STATUS => x_return_status ,
270: X_MSG_COUNT => l_msg_count,
271: X_MSG_DATA => l_msg_stack,
272: P_ENTITY_NAME => 'OPERATION',
275: X_LOCK_STATUS => l_lock_status,
276: X_LOCKED_BY_STATUS => l_locked_by_status,
277: X_LOCK_ALLOWED => l_lock_allowed);
278:
279: IF x_return_status <> fnd_api.g_ret_sts_success THEN
280: RAISE gmo_lock_error;
281: END IF;
282:
283: IF (g_debug <= gme_debug.g_log_procedure) THEN
305: ,p_batch_header_rec => p_batch_header_rec
306: ,x_exception_material_tbl => x_exception_material_tbl
307: ,x_return_status => l_return_status);
308:
309: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
310: x_return_status := l_return_status;
311: RAISE error_process_dep_steps;
312: END IF;
313:
352: ,x_batch_step_rec => x_batch_step_rec
353: ,x_exception_material_tbl => x_exception_material_tbl
354: ,x_return_status => l_return_status);
355:
356: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
357: x_return_status := l_return_status;
358: RAISE cmpl_step_line_error;
359: END IF;
360:
363: ,p_update_inv_ind => p_batch_header_rec.update_inventory_ind
364: ,x_exception_material_tbl => x_exception_material_tbl
365: ,x_return_status => l_return_status);
366:
367: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
368: x_return_status := l_return_status;
369: RAISE cmpl_step_prod_error;
370: END IF;
371:
382: ,x_message_list => l_msg_stack
383: ,x_return_status => l_return_status
384: ,x_batch_step_rec => x_batch_step_rec);
385:
386: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
387: RAISE update_step_qty_error;
388: END IF;
389:
390: IF nvl(g_debug, gme_debug.g_log_procedure + 1) <= gme_debug.g_log_procedure THEN
404: || ':'
405: || 'GMO_LOCK_ERROR.');
406:
407: END IF;
408: x_return_status := fnd_api.g_ret_sts_error;
409: WHEN error_quality_status THEN --Bug#6348353
410: gme_common_pvt.log_message('GME_QUALITY_NOT_COMPLETE'
411: ,'STEP_NO', x_batch_step_rec.batchstep_no
412: ,'BATCH_NO', p_batch_header_rec.batch_no);
409: WHEN error_quality_status THEN --Bug#6348353
410: gme_common_pvt.log_message('GME_QUALITY_NOT_COMPLETE'
411: ,'STEP_NO', x_batch_step_rec.batchstep_no
412: ,'BATCH_NO', p_batch_header_rec.batch_no);
413: x_return_status := fnd_api.g_ret_sts_error;
414: WHEN OTHERS THEN
415: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
416: IF g_debug <= gme_debug.g_log_procedure THEN
417: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
415: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
416: IF g_debug <= gme_debug.g_log_procedure THEN
417: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
418: END IF;
419: x_return_status := FND_API.g_ret_sts_unexp_error;
420: END complete_step_recursive;
421:
422: /*===========================================================================================
423: Procedure
450: gme_debug.put_line('Entering api '||g_pkg_name||'.'||l_api_name);
451: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' Complete step line batchstep_id='||p_batch_step_rec.batchstep_id);
452: END IF;
453:
454: x_return_status := FND_API.G_RET_STS_SUCCESS;
455:
456: -- Each time this is called, p_batch_step_rec has already been retrieved from DB... has all
457: -- latest data and in addition has the actual completion date calculated and set
458: x_batch_step_rec := p_batch_step_rec;
507:
508: EXCEPTION
509: WHEN batch_step_upd_err THEN
510: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR', SQLERRM);
511: x_return_status := FND_API.g_ret_sts_unexp_error;
512: WHEN OTHERS THEN
513: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
514: IF g_debug <= gme_debug.g_log_procedure THEN
515: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
513: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
514: IF g_debug <= gme_debug.g_log_procedure THEN
515: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
516: END IF;
517: x_return_status := FND_API.g_ret_sts_unexp_error;
518: END complete_step_line;
519:
520: PROCEDURE complete_step_material
521: (p_batch_step_rec IN gme_batch_steps%ROWTYPE
549: gme_debug.put_line(g_pkg_name||'.'||l_api_name||' Completing products/byproducts for step_id='||p_batch_step_rec.batchstep_id);
550: END IF;
551:
552: /* Set the return status to success initially */
553: x_return_status := FND_API.G_RET_STS_SUCCESS;
554:
555: -- retrieve all autobystep products and phantom ingredients associated to the step...
556: OPEN Cur_step_prod_byprod(p_batch_step_rec.batchstep_id);
557: FETCH Cur_step_prod_byprod BULK COLLECT INTO l_matl_dtl_tab;
568: ,p_update_inv_ind => p_update_inv_ind
569: ,x_exception_material_tbl => x_exception_material_tbl
570: ,x_return_status => l_return_status);
571:
572: IF l_return_status NOT IN (FND_API.G_RET_STS_SUCCESS, gme_common_pvt.g_exceptions_err) THEN
573: x_return_status := l_return_status;
574: RAISE error_process_prod;
575: END IF;
576:
590: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
591: IF g_debug <= gme_debug.g_log_procedure THEN
592: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
593: END IF;
594: x_return_status := FND_API.g_ret_sts_unexp_error;
595: END complete_step_material;
596:
597: PROCEDURE validate_dependent_steps (p_batch_id IN NUMBER
598: ,p_step_id IN NUMBER
622: || l_api_name);
623: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' batchstep_id = '||p_step_id);
624: END IF;
625:
626: x_return_status := FND_API.g_ret_sts_success;
627:
628: FOR l_dep_step_rec IN Cur_get_dep_steps(p_batch_id, p_step_id) LOOP
629: /*
630: If the dependency is Finish To Start then the prior step should be
659:
660: EXCEPTION
661: WHEN INVALID_START_DATE THEN
662: gme_common_pvt.log_message('GME_INVALID_START_DATE');
663: x_return_status := FND_API.G_RET_STS_ERROR;
664: WHEN GME_STEP_DEP_WIP THEN
665: gme_common_pvt.log_message('GME_STEP_DEP_WIP');
666: x_return_status := FND_API.G_RET_STS_ERROR;
667: WHEN GME_STEP_DEP_COMPLETE THEN
662: gme_common_pvt.log_message('GME_INVALID_START_DATE');
663: x_return_status := FND_API.G_RET_STS_ERROR;
664: WHEN GME_STEP_DEP_WIP THEN
665: gme_common_pvt.log_message('GME_STEP_DEP_WIP');
666: x_return_status := FND_API.G_RET_STS_ERROR;
667: WHEN GME_STEP_DEP_COMPLETE THEN
668: gme_common_pvt.log_message('GME_STEP_DEP_COMPLETE');
669: x_return_status := FND_API.G_RET_STS_ERROR ;
670: WHEN OTHERS THEN
665: gme_common_pvt.log_message('GME_STEP_DEP_WIP');
666: x_return_status := FND_API.G_RET_STS_ERROR;
667: WHEN GME_STEP_DEP_COMPLETE THEN
668: gme_common_pvt.log_message('GME_STEP_DEP_COMPLETE');
669: x_return_status := FND_API.G_RET_STS_ERROR ;
670: WHEN OTHERS THEN
671: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
672: IF g_debug <= gme_debug.g_log_procedure THEN
673: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
671: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
672: IF g_debug <= gme_debug.g_log_procedure THEN
673: gme_debug.put_line ('Unexpected error: '||g_pkg_name||'.'||l_api_name||': '||SQLERRM);
674: END IF;
675: x_return_status := FND_API.g_ret_sts_unexp_error;
676: END validate_dependent_steps;
677:
678: PROCEDURE validate_step_for_complete (p_batch_header_rec IN gme_batch_header%ROWTYPE
679: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
716: || l_api_name);
717: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' batchstep_id = '||p_batch_step_rec.batchstep_id);
718: END IF;
719:
720: x_return_status := fnd_api.g_ret_sts_success;
721:
722: -- set output structure
723: x_batch_step_rec := p_batch_step_rec;
724:
756: ,p_start_date => p_batch_header_rec.actual_start_date
757: ,p_cmplt_date => p_batch_header_rec.actual_cmplt_date
758: ,p_batch_header_rec => p_batch_header_rec
759: ,p_validate_plan_dates_ind => 1) THEN
760: x_return_status := fnd_api.g_ret_sts_error;
761: RAISE error_vr_dates;
762: END IF;
763: -- End Bug 5336007
764: END IF; -- p_batch_header_rec.batch_status = 1
814: ,p_step_id => x_batch_step_rec.batchstep_id
815: ,p_step_actual_start_date => x_batch_step_rec.actual_start_date
816: ,x_return_status => x_return_status);
817:
818: IF x_return_status <> fnd_api.g_ret_sts_success THEN
819: RAISE error_validation;
820: END IF;
821: END IF;
822:
821: END IF;
822:
823: -- if quality is not complete cannot complete step
824: IF (x_batch_step_rec.quality_status NOT IN (1,4,6) AND
825: p_override_quality = fnd_api.g_false) THEN
826: RAISE error_quality_status;
827: END IF;
828:
829: IF NVL (g_debug, gme_debug.g_log_procedure + 1) <=
833:
834: EXCEPTION
835: --Bug#5109119 Begin
836: WHEN error_close_period THEN
837: x_return_status := FND_API.G_RET_STS_ERROR;
838: WHEN error_validation THEN
839: NULL;
840: -- 9277115 - add following condition.
841: WHEN error_actual_start_date THEN
839: NULL;
840: -- 9277115 - add following condition.
841: WHEN error_actual_start_date THEN
842: gme_common_pvt.log_message ('GME_STEP_START_BATCH_START_ERR');
843: x_return_status := FND_API.G_RET_STS_ERROR;
844: WHEN error_no_direct_compl THEN
845: gme_common_pvt.log_message('NO_DIRECT_CERT_ALLOWED');
846: x_return_status := FND_API.G_RET_STS_ERROR ;
847: WHEN error_future_date THEN
842: gme_common_pvt.log_message ('GME_STEP_START_BATCH_START_ERR');
843: x_return_status := FND_API.G_RET_STS_ERROR;
844: WHEN error_no_direct_compl THEN
845: gme_common_pvt.log_message('NO_DIRECT_CERT_ALLOWED');
846: x_return_status := FND_API.G_RET_STS_ERROR ;
847: WHEN error_future_date THEN
848: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
849: fnd_msg_pub.ADD;
850: x_return_status := FND_API.G_RET_STS_ERROR;
846: x_return_status := FND_API.G_RET_STS_ERROR ;
847: WHEN error_future_date THEN
848: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
849: fnd_msg_pub.ADD;
850: x_return_status := FND_API.G_RET_STS_ERROR;
851: WHEN error_cmplt_date THEN
852: gme_common_pvt.log_message('GME_INVALID_DATE_RANGE'
853: ,'DATE1','Completion date'
854: ,'DATE2','Start date');
851: WHEN error_cmplt_date THEN
852: gme_common_pvt.log_message('GME_INVALID_DATE_RANGE'
853: ,'DATE1','Completion date'
854: ,'DATE2','Start date');
855: x_return_status := fnd_api.g_ret_sts_error;
856: WHEN error_quality_status THEN
857: gme_common_pvt.log_message('GME_QUALITY_NOT_COMPLETE'
858: ,'STEP_NO', x_batch_step_rec.batchstep_no
859: ,'BATCH_NO', p_batch_header_rec.batch_no);
856: WHEN error_quality_status THEN
857: gme_common_pvt.log_message('GME_QUALITY_NOT_COMPLETE'
858: ,'STEP_NO', x_batch_step_rec.batchstep_no
859: ,'BATCH_NO', p_batch_header_rec.batch_no);
860: x_return_status := fnd_api.g_ret_sts_error;
861: WHEN error_vr_dates THEN
862: x_return_status := FND_API.G_RET_STS_ERROR;
863: WHEN OTHERS THEN
864: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
858: ,'STEP_NO', x_batch_step_rec.batchstep_no
859: ,'BATCH_NO', p_batch_header_rec.batch_no);
860: x_return_status := fnd_api.g_ret_sts_error;
861: WHEN error_vr_dates THEN
862: x_return_status := FND_API.G_RET_STS_ERROR;
863: WHEN OTHERS THEN
864: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
865:
866: IF g_debug <= gme_debug.g_log_procedure THEN
870: || l_api_name
871: || ': '
872: || SQLERRM);
873: END IF;
874: x_return_status := fnd_api.g_ret_sts_unexp_error;
875: END validate_step_for_complete;
876:
877: /*===========================================================================================
878: Procedure
936: || l_api_name);
937: END IF;
938:
939: -- Set the return status to success initially *
940: x_return_status := FND_API.G_RET_STS_SUCCESS;
941:
942: -- Check the date of the step being certified with the batch actual start date
943: IF (p_batch_header_rec.actual_start_date IS NOT NULL) THEN
944: IF (p_batch_step_rec.actual_start_date < p_batch_header_rec.actual_start_date) THEN
1026: EXCEPTION
1027: WHEN BATCH_STEP_FETCH_ERROR THEN
1028: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
1029: ,SQLERRM);
1030: x_return_status := fnd_api.g_ret_sts_unexp_error;
1031: WHEN INVALID_DATE_ERR THEN
1032: x_return_status := FND_API.G_RET_STS_ERROR;
1033: WHEN OTHERS THEN
1034: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1028: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
1029: ,SQLERRM);
1030: x_return_status := fnd_api.g_ret_sts_unexp_error;
1031: WHEN INVALID_DATE_ERR THEN
1032: x_return_status := FND_API.G_RET_STS_ERROR;
1033: WHEN OTHERS THEN
1034: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
1035:
1036: IF g_debug <= gme_debug.g_log_procedure THEN
1040: || l_api_name
1041: || ': '
1042: || SQLERRM);
1043: END IF;
1044: x_return_status := fnd_api.g_ret_sts_unexp_error;
1045: END validate_step_cmplt_date;
1046:
1047: END gme_complete_batch_step_pvt;