23: FETCH get_user_id_csr INTO l_user_id;
24: IF get_user_id_csr%NOTFOUND THEN
25: FND_MESSAGE.set_name('AHL','AHL_PRD_INV_BPEL_USR');
26: FND_MESSAGE.SET_TOKEN('USER_NAME',p_user_id);
27: FND_MSG_PUB.ADD;
28: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
29: END IF;
30: CLOSE get_user_id_csr;
31:
144: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
145: END IF;
146:
147: IF FND_API.To_Boolean(p_init_msg_list) THEN
148: FND_MSG_PUB.Initialize;
149: END IF;
150:
151: -- Initialize API return status to success
152: --x_return_status := FND_API.G_RET_STS_SUCCESS;
153: x_return_status := init_user_and_role(p_userid);
154:
155: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
156: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
157: FND_MSG_PUB.ADD;
158: RAISE FND_API.G_EXC_ERROR;
159: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
160: l_workorder_id := get_workorder_id(p_WorkorderNumber);
161: ELSE
166: OPEN get_wo_details_csr(l_workorder_id);
167: FETCH get_wo_details_csr INTO l_wo_details;
168: IF(get_wo_details_csr%NOTFOUND)THEN
169: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
170: FND_MSG_PUB.ADD;
171: CLOSE get_wo_details_csr;
172: RAISE FND_API.G_EXC_ERROR;
173: ELSE
174: x_WO_DETAILS_REC.WorkorderId := l_wo_details.WORKORDER_ID;
227: x_WO_DETAILS_REC.NonRoutineId := l_wo_details.service_request_id;
228: x_WO_DETAILS_REC.NonRoutineNumber := to_char(l_wo_details.service_request_number);
229: x_WO_DETAILS_REC.IsUnitQuarantined := l_wo_details.UNIT_QUARANTINE_FLAG;
230: x_WO_DETAILS_REC.IsCompleteEnabled := AHL_COMPLETIONS_PVT.Is_Complete_Enabled(l_wo_details.WORKORDER_ID, NULL, NULL, 'T');
231: FND_MSG_PUB.Initialize;
232: x_WO_DETAILS_REC.IsPartsChangeEnabled := AHL_PRD_UTIL_PKG.Is_PartChange_Enabled(l_wo_details.WORKORDER_ID,'T');
233: FND_MSG_PUB.Initialize;
234:
235: IF(x_WO_DETAILS_REC.StatusCode NOT IN ('22','7','12','1','7','4','5') AND x_WO_DETAILS_REC.IsUnitQuarantined = 'F')THEN
229: x_WO_DETAILS_REC.IsUnitQuarantined := l_wo_details.UNIT_QUARANTINE_FLAG;
230: x_WO_DETAILS_REC.IsCompleteEnabled := AHL_COMPLETIONS_PVT.Is_Complete_Enabled(l_wo_details.WORKORDER_ID, NULL, NULL, 'T');
231: FND_MSG_PUB.Initialize;
232: x_WO_DETAILS_REC.IsPartsChangeEnabled := AHL_PRD_UTIL_PKG.Is_PartChange_Enabled(l_wo_details.WORKORDER_ID,'T');
233: FND_MSG_PUB.Initialize;
234:
235: IF(x_WO_DETAILS_REC.StatusCode NOT IN ('22','7','12','1','7','4','5') AND x_WO_DETAILS_REC.IsUnitQuarantined = 'F')THEN
236: x_WO_DETAILS_REC.IsNonRoutineCreationEnabled := 'T';
237: ELSE
242: ELSE
243: x_WO_DETAILS_REC.IsUpdateEnabled := 'T';
244: END IF;
245: x_WO_DETAILS_REC.IsResTxnEnabled := AHL_PRD_UTIL_PKG.Is_ResTxn_Allowed(l_wo_details.WORKORDER_ID,'T');
246: FND_MSG_PUB.Initialize;
247: IF(l_wo_details.PLAN_ID IS NULL)THEN
248: x_WO_DETAILS_REC.IsQualityEnabled := 'N';
249: /*ELSIF(x_WO_DETAILS_REC.StatusCode IN ('22','7','12','1','7','4','5') OR x_WO_DETAILS_REC.IsUnitQuarantined = 'T')THEN
250: x_WO_DETAILS_REC.IsQualityEnabled := 'F';*/
256:
257: EXCEPTION
258: WHEN FND_API.G_EXC_ERROR THEN
259: x_return_status := FND_API.G_RET_STS_ERROR;
260: x_msg_count := FND_MSG_PUB.count_msg;
261:
262:
263: x_msg_data := GET_MSG_DATA(x_msg_count);
264: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
262:
263: x_msg_data := GET_MSG_DATA(x_msg_count);
264: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
265: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
266: x_msg_count := FND_MSG_PUB.count_msg;
267: x_msg_data := GET_MSG_DATA(x_msg_count);
268: WHEN OTHERS THEN
269: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
270:
267: x_msg_data := GET_MSG_DATA(x_msg_count);
268: WHEN OTHERS THEN
269: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
270:
271: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
272: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
273: p_procedure_name => l_api_name,
274: p_error_text => SUBSTR(SQLERRM,1,500));
275: END IF;
268: WHEN OTHERS THEN
269: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
270:
271: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
272: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
273: p_procedure_name => l_api_name,
274: p_error_text => SUBSTR(SQLERRM,1,500));
275: END IF;
276: x_msg_count := FND_MSG_PUB.count_msg;
272: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
273: p_procedure_name => l_api_name,
274: p_error_text => SUBSTR(SQLERRM,1,500));
275: END IF;
276: x_msg_count := FND_MSG_PUB.count_msg;
277: x_msg_data := GET_MSG_DATA(x_msg_count);
278: END get_workorder_details;
279:
280: PROCEDURE get_wo_operations_details
327: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
328: END IF;
329:
330: IF FND_API.To_Boolean(p_init_msg_list) THEN
331: FND_MSG_PUB.Initialize;
332: END IF;
333: -- Check Error Message stack.
334: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
335: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
332: END IF;
333: -- Check Error Message stack.
334: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
335: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
336: FND_MSG_PUB.ADD;
337: RAISE FND_API.G_EXC_ERROR;
338: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
339: l_workorder_id := get_workorder_id(p_WorkorderNumber);
340: ELSE
340: ELSE
341: l_workorder_id := p_WorkorderId;
342: END IF;
343:
344: x_msg_count := FND_MSG_PUB.count_msg;
345: IF x_msg_count > 0 THEN
346: RAISE FND_API.G_EXC_ERROR;
347: END IF;
348:
353: ELSE
354: l_workorder_operation_id := p_WoOperationId;
355: END IF;
356:
357: x_msg_count := FND_MSG_PUB.count_msg;
358: IF x_msg_count > 0 THEN
359: RAISE FND_API.G_EXC_ERROR;
360: END IF;
361:
389: END IF;
390: l_op_index := l_op_index + 1;
391: END LOOP;
392:
393: x_msg_count := FND_MSG_PUB.count_msg;
394: IF x_msg_count > 0 THEN
395: RAISE FND_API.G_EXC_ERROR;
396: END IF;
397:
397:
398: EXCEPTION
399: WHEN FND_API.G_EXC_ERROR THEN
400: x_return_status := FND_API.G_RET_STS_ERROR;
401: x_msg_count := FND_MSG_PUB.count_msg;
402:
403:
404: x_msg_data := GET_MSG_DATA(x_msg_count);
405: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
403:
404: x_msg_data := GET_MSG_DATA(x_msg_count);
405: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
406: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
407: x_msg_count := FND_MSG_PUB.count_msg;
408: x_msg_data := GET_MSG_DATA(x_msg_count);
409: WHEN OTHERS THEN
410: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
411:
408: x_msg_data := GET_MSG_DATA(x_msg_count);
409: WHEN OTHERS THEN
410: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
411:
412: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
413: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
414: p_procedure_name => l_api_name,
415: p_error_text => SUBSTR(SQLERRM,1,500));
416: END IF;
409: WHEN OTHERS THEN
410: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
411:
412: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
413: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
414: p_procedure_name => l_api_name,
415: p_error_text => SUBSTR(SQLERRM,1,500));
416: END IF;
417: x_msg_count := FND_MSG_PUB.count_msg;
413: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
414: p_procedure_name => l_api_name,
415: p_error_text => SUBSTR(SQLERRM,1,500));
416: END IF;
417: x_msg_count := FND_MSG_PUB.count_msg;
418: x_msg_data := GET_MSG_DATA(x_msg_count);
419: END get_wo_operations_details;
420:
421: PROCEDURE get_wo_mtl_reqmts
476: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
477: END IF;
478:
479: IF FND_API.To_Boolean(p_init_msg_list) THEN
480: FND_MSG_PUB.Initialize;
481: END IF;
482:
483: -- Check Error Message stack.
484: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
482:
483: -- Check Error Message stack.
484: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
485: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
486: FND_MSG_PUB.ADD;
487: RAISE FND_API.G_EXC_ERROR;
488: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
489: l_workorder_id := get_workorder_id(p_WorkorderNumber);
490: ELSE
498: ELSE
499: l_workorder_operation_id := p_WoOperationId;
500: END IF;
501:
502: x_msg_count := FND_MSG_PUB.count_msg;
503: IF x_msg_count > 0 THEN
504: RAISE FND_API.G_EXC_ERROR;
505: END IF;
506:
521: l_mtl_index := l_mtl_index + 1;
522: END LOOP;
523:
524: -- Check Error Message stack.
525: x_msg_count := FND_MSG_PUB.count_msg;
526: IF x_msg_count > 0 THEN
527: RAISE FND_API.G_EXC_ERROR;
528: END IF;
529:
529:
530: EXCEPTION
531: WHEN FND_API.G_EXC_ERROR THEN
532: x_return_status := FND_API.G_RET_STS_ERROR;
533: x_msg_count := FND_MSG_PUB.count_msg;
534:
535:
536: x_msg_data := GET_MSG_DATA(x_msg_count);
537: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
535:
536: x_msg_data := GET_MSG_DATA(x_msg_count);
537: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
538: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
539: x_msg_count := FND_MSG_PUB.count_msg;
540: x_msg_data := GET_MSG_DATA(x_msg_count);
541: WHEN OTHERS THEN
542: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
543:
540: x_msg_data := GET_MSG_DATA(x_msg_count);
541: WHEN OTHERS THEN
542: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
543:
544: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
545: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
546: p_procedure_name => l_api_name,
547: p_error_text => SUBSTR(SQLERRM,1,500));
548: END IF;
541: WHEN OTHERS THEN
542: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
543:
544: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
545: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
546: p_procedure_name => l_api_name,
547: p_error_text => SUBSTR(SQLERRM,1,500));
548: END IF;
549: x_msg_count := FND_MSG_PUB.count_msg;
545: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
546: p_procedure_name => l_api_name,
547: p_error_text => SUBSTR(SQLERRM,1,500));
548: END IF;
549: x_msg_count := FND_MSG_PUB.count_msg;
550: x_msg_data := GET_MSG_DATA(x_msg_count);
551: END get_wo_mtl_reqmts;
552:
553: PROCEDURE get_wo_assoc_documents
658: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
659: END IF;
660:
661: IF FND_API.To_Boolean(p_init_msg_list) THEN
662: FND_MSG_PUB.Initialize;
663: END IF;
664:
665: -- Check Error Message stack.
666: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
664:
665: -- Check Error Message stack.
666: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
667: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
668: FND_MSG_PUB.ADD;
669: RAISE FND_API.G_EXC_ERROR;
670: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
671: l_workorder_id := get_workorder_id(p_WorkorderNumber);
672: ELSE
672: ELSE
673: l_workorder_id := p_WorkorderId;
674: END IF;
675:
676: x_msg_count := FND_MSG_PUB.count_msg;
677: IF x_msg_count > 0 THEN
678: RAISE FND_API.G_EXC_ERROR;
679: END IF;
680:
693: l_doc_index := l_doc_index +1;
694: END LOOP;
695:
696: -- Check Error Message stack.
697: x_msg_count := FND_MSG_PUB.count_msg;
698: IF x_msg_count > 0 THEN
699: RAISE FND_API.G_EXC_ERROR;
700: END IF;
701:
701:
702: EXCEPTION
703: WHEN FND_API.G_EXC_ERROR THEN
704: x_return_status := FND_API.G_RET_STS_ERROR;
705: x_msg_count := FND_MSG_PUB.count_msg;
706:
707:
708: x_msg_data := GET_MSG_DATA(x_msg_count);
709: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
707:
708: x_msg_data := GET_MSG_DATA(x_msg_count);
709: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
710: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
711: x_msg_count := FND_MSG_PUB.count_msg;
712: x_msg_data := GET_MSG_DATA(x_msg_count);
713: WHEN OTHERS THEN
714: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
715:
712: x_msg_data := GET_MSG_DATA(x_msg_count);
713: WHEN OTHERS THEN
714: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
715:
716: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
717: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
718: p_procedure_name => l_api_name,
719: p_error_text => SUBSTR(SQLERRM,1,500));
720: END IF;
713: WHEN OTHERS THEN
714: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
715:
716: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
717: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
718: p_procedure_name => l_api_name,
719: p_error_text => SUBSTR(SQLERRM,1,500));
720: END IF;
721: x_msg_count := FND_MSG_PUB.count_msg;
717: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
718: p_procedure_name => l_api_name,
719: p_error_text => SUBSTR(SQLERRM,1,500));
720: END IF;
721: x_msg_count := FND_MSG_PUB.count_msg;
722: x_msg_data := GET_MSG_DATA(x_msg_count);
723: END get_wo_assoc_documents;
724:
725: PROCEDURE get_wo_turnover_notes
769: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
770: END IF;
771:
772: IF FND_API.To_Boolean(p_init_msg_list) THEN
773: FND_MSG_PUB.Initialize;
774: END IF;
775:
776: -- Check Error Message stack.
777: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
775:
776: -- Check Error Message stack.
777: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
778: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
779: FND_MSG_PUB.ADD;
780: RAISE FND_API.G_EXC_ERROR;
781: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
782: l_workorder_id := get_workorder_id(p_WorkorderNumber);
783: ELSE
783: ELSE
784: l_workorder_id := p_WorkorderId;
785: END IF;
786:
787: x_msg_count := FND_MSG_PUB.count_msg;
788: IF x_msg_count > 0 THEN
789: RAISE FND_API.G_EXC_ERROR;
790: END IF;
791:
801: l_notes_index := l_notes_index +1;
802: END LOOP;
803:
804: -- Check Error Message stack.
805: x_msg_count := FND_MSG_PUB.count_msg;
806: IF x_msg_count > 0 THEN
807: RAISE FND_API.G_EXC_ERROR;
808: END IF;
809: EXCEPTION
808: END IF;
809: EXCEPTION
810: WHEN FND_API.G_EXC_ERROR THEN
811: x_return_status := FND_API.G_RET_STS_ERROR;
812: x_msg_count := FND_MSG_PUB.count_msg;
813:
814:
815: x_msg_data := GET_MSG_DATA(x_msg_count);
816: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
814:
815: x_msg_data := GET_MSG_DATA(x_msg_count);
816: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
817: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
818: x_msg_count := FND_MSG_PUB.count_msg;
819: x_msg_data := GET_MSG_DATA(x_msg_count);
820: WHEN OTHERS THEN
821: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
822:
819: x_msg_data := GET_MSG_DATA(x_msg_count);
820: WHEN OTHERS THEN
821: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
822:
823: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
824: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
825: p_procedure_name => l_api_name,
826: p_error_text => SUBSTR(SQLERRM,1,500));
827: END IF;
820: WHEN OTHERS THEN
821: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
822:
823: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
824: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
825: p_procedure_name => l_api_name,
826: p_error_text => SUBSTR(SQLERRM,1,500));
827: END IF;
828: x_msg_count := FND_MSG_PUB.count_msg;
824: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
825: p_procedure_name => l_api_name,
826: p_error_text => SUBSTR(SQLERRM,1,500));
827: END IF;
828: x_msg_count := FND_MSG_PUB.count_msg;
829: x_msg_data := GET_MSG_DATA(x_msg_count);
830: END get_wo_turnover_notes;
831:
832: PROCEDURE get_wo_res_txns
893: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
894: END IF;
895:
896: IF FND_API.To_Boolean(p_init_msg_list) THEN
897: FND_MSG_PUB.Initialize;
898: END IF;
899:
900: -- Check Error Message stack.
901: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
899:
900: -- Check Error Message stack.
901: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
902: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
903: FND_MSG_PUB.ADD;
904: RAISE FND_API.G_EXC_ERROR;
905: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
906: l_workorder_id := get_workorder_id(p_WorkorderNumber);
907: ELSE
907: ELSE
908: l_workorder_id := p_WorkorderId;
909: END IF;
910:
911: x_msg_count := FND_MSG_PUB.count_msg;
912: IF x_msg_count > 0 THEN
913: RAISE FND_API.G_EXC_ERROR;
914: END IF;
915:
917: OPEN get_operation_sequence_csr(p_WoOperationId);
918: FETCH get_operation_sequence_csr INTO l_operation_sequence;
919: IF(get_operation_sequence_csr%NOTFOUND)THEN
920: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
921: FND_MSG_PUB.ADD;
922: RAISE FND_API.G_EXC_ERROR;
923: END IF;
924: CLOSE get_operation_sequence_csr;
925: ELSIF (p_WoOperationId IS NULL AND p_OperationSequence IS NOT NULL)THEN
925: ELSIF (p_WoOperationId IS NULL AND p_OperationSequence IS NOT NULL)THEN
926: l_operation_sequence := p_OperationSequence;
927: END IF;
928: -- Check Error Message stack.
929: x_msg_count := FND_MSG_PUB.count_msg;
930: IF x_msg_count > 0 THEN
931: RAISE FND_API.G_EXC_ERROR;
932: END IF;
933:
1006: END IF;
1007: END LOOP;
1008:
1009: -- Check Error Message stack.
1010: x_msg_count := FND_MSG_PUB.count_msg;
1011: IF x_msg_count > 0 THEN
1012: RAISE FND_API.G_EXC_ERROR;
1013: END IF;
1014: x_return_status := FND_API.G_RET_STS_SUCCESS;
1015:
1016: EXCEPTION
1017: WHEN FND_API.G_EXC_ERROR THEN
1018: x_return_status := FND_API.G_RET_STS_ERROR;
1019: x_msg_count := FND_MSG_PUB.count_msg;
1020:
1021:
1022: x_msg_data := GET_MSG_DATA(x_msg_count);
1023: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1021:
1022: x_msg_data := GET_MSG_DATA(x_msg_count);
1023: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1024: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1025: x_msg_count := FND_MSG_PUB.count_msg;
1026: x_msg_data := GET_MSG_DATA(x_msg_count);
1027: WHEN OTHERS THEN
1028: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1029:
1026: x_msg_data := GET_MSG_DATA(x_msg_count);
1027: WHEN OTHERS THEN
1028: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1029:
1030: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1031: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1032: p_procedure_name => l_api_name,
1033: p_error_text => SUBSTR(SQLERRM,1,500));
1034: END IF;
1027: WHEN OTHERS THEN
1028: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1029:
1030: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1031: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1032: p_procedure_name => l_api_name,
1033: p_error_text => SUBSTR(SQLERRM,1,500));
1034: END IF;
1035: x_msg_count := FND_MSG_PUB.count_msg;
1031: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1032: p_procedure_name => l_api_name,
1033: p_error_text => SUBSTR(SQLERRM,1,500));
1034: END IF;
1035: x_msg_count := FND_MSG_PUB.count_msg;
1036: x_msg_data := GET_MSG_DATA(x_msg_count);
1037: END get_wo_res_txns;
1038:
1039: PROCEDURE get_qa_plan_results
1153: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1154: END IF;
1155:
1156: IF FND_API.To_Boolean(p_init_msg_list) THEN
1157: FND_MSG_PUB.Initialize;
1158: END IF;
1159:
1160: -- Check Error Message stack.
1161: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
1159:
1160: -- Check Error Message stack.
1161: IF(p_WorkorderId IS NULL AND p_WorkorderNumber IS NULL)THEN
1162: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
1163: FND_MSG_PUB.ADD;
1164: RAISE FND_API.G_EXC_ERROR;
1165: ELSIF (p_WorkorderId IS NULL AND p_WorkorderNumber IS NOT NULL)THEN
1166: l_workorder_id := get_workorder_id(p_WorkorderNumber);
1167: ELSE
1167: ELSE
1168: l_workorder_id := p_WorkorderId;
1169: END IF;
1170:
1171: x_msg_count := FND_MSG_PUB.count_msg;
1172: IF x_msg_count > 0 THEN
1173: RAISE FND_API.G_EXC_ERROR;
1174: END IF;
1175:
1180: ELSE
1181: l_workorder_operation_id := p_WoOperationId;
1182: END IF;
1183: --l_workorder_operation_id := NULL;
1184: x_msg_count := FND_MSG_PUB.count_msg;
1185: IF x_msg_count > 0 THEN
1186: RAISE FND_API.G_EXC_ERROR;
1187: END IF;
1188:
1321: l_result_row_index := l_result_row_index + 1;
1322: END LOOP;
1323: END IF;
1324: -- Check Error Message stack.
1325: x_msg_count := FND_MSG_PUB.count_msg;
1326:
1327: EXCEPTION
1328: WHEN FND_API.G_EXC_ERROR THEN
1329: x_return_status := FND_API.G_RET_STS_ERROR;
1326:
1327: EXCEPTION
1328: WHEN FND_API.G_EXC_ERROR THEN
1329: x_return_status := FND_API.G_RET_STS_ERROR;
1330: x_msg_count := FND_MSG_PUB.count_msg;
1331:
1332:
1333: x_msg_data := GET_MSG_DATA(x_msg_count);
1334: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1332:
1333: x_msg_data := GET_MSG_DATA(x_msg_count);
1334: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1335: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1336: x_msg_count := FND_MSG_PUB.count_msg;
1337: x_msg_data := GET_MSG_DATA(x_msg_count);
1338: WHEN OTHERS THEN
1339: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1340:
1337: x_msg_data := GET_MSG_DATA(x_msg_count);
1338: WHEN OTHERS THEN
1339: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1340:
1341: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1342: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1343: p_procedure_name => l_api_name,
1344: p_error_text => SUBSTR(SQLERRM,1,500));
1345: END IF;
1338: WHEN OTHERS THEN
1339: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1340:
1341: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
1342: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1343: p_procedure_name => l_api_name,
1344: p_error_text => SUBSTR(SQLERRM,1,500));
1345: END IF;
1346: x_msg_count := FND_MSG_PUB.count_msg;
1342: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
1343: p_procedure_name => l_api_name,
1344: p_error_text => SUBSTR(SQLERRM,1,500));
1345: END IF;
1346: x_msg_count := FND_MSG_PUB.count_msg;
1347: x_msg_data := GET_MSG_DATA(x_msg_count);
1348: END get_qa_plan_results;
1349:
1350: FUNCTION get_workorder_id(p_WorkorderNumber IN VARCHAR2) RETURN NUMBER
1360: OPEN get_workorder_id_csr(p_WorkorderNumber);
1361: FETCH get_workorder_id_csr INTO l_workorder_id;
1362: IF(get_workorder_id_csr%NOTFOUND)THEN
1363: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
1364: FND_MSG_PUB.ADD;
1365: CLOSE get_workorder_id_csr;
1366: RAISE FND_API.G_EXC_ERROR;
1367: END IF;
1368: CLOSE get_workorder_id_csr;
1383: OPEN get_workorder_operation_id_csr(p_WorkorderId, p_operation_sequence);
1384: FETCH get_workorder_operation_id_csr INTO l_workorder_operation_id;
1385: IF(get_workorder_operation_id_csr%NOTFOUND)THEN
1386: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_NOT_FOUND');
1387: FND_MSG_PUB.ADD;
1388: CLOSE get_workorder_operation_id_csr;
1389: RAISE FND_API.G_EXC_ERROR;
1390: END IF;
1391: CLOSE get_workorder_operation_id_csr;
1484:
1485: IF(l_trunover_notes_tbl IS NOT NULL AND l_trunover_notes_tbl.COUNT > 0)THEN
1486: IF(p_WO_DETAILS_REC.IsUpdateEnabled <> 'T')THEN
1487: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_TRNNTREC_NALWD');
1488: FND_MSG_PUB.ADD;
1489: RAISE FND_API.G_EXC_ERROR;
1490: END IF;
1491:
1492: AHL_PRD_WORKORDER_PVT.INSERT_TURNOVER_NOTES
1525: RETURN;--Nothing to do
1526: END IF;
1527: IF(p_CURR_WO_DETAILS_REC.IsUpdateEnabled <> 'T')THEN
1528: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_UPD_NALWD');
1529: FND_MSG_PUB.ADD;
1530: RAISE FND_API.G_EXC_ERROR;
1531: END IF;
1532: IF(p_WO_DETAILS_REC.StatusCode = '3' AND p_CURR_WO_DETAILS_REC.StatusCode = '1')THEN
1533: --release Job
1565: );
1566: ELSIF(p_WO_DETAILS_REC.StatusCode = '4')THEN
1567: IF(p_CURR_WO_DETAILS_REC.IsCompleteEnabled <> 'T')THEN
1568: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WO_COMP_NALWD');
1569: FND_MSG_PUB.ADD;
1570: RAISE FND_API.G_EXC_ERROR;
1571: END IF;
1572: -- complete job
1573: AHL_COMPLETIONS_PVT.complete_workorder
1640: END IF;
1641:
1642: IF(p_OP_DETAILS_REC.IsQualityEnabled <> 'T')THEN
1643: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_OPQASUB_NALWD');
1644: FND_MSG_PUB.ADD;
1645: RAISE FND_API.G_EXC_ERROR;
1646: END IF;
1647:
1648: get_qa_plan_results
1763: --DBMS_OUTPUT.put_line('x_return_status :i: ' || x_return_status);
1764: IF(p_Operations(i).ObjectVersionNumber IS NULL OR
1765: p_Operations(i).ObjectVersionNumber <> l_Operations(0).ObjectVersionNumber)THEN
1766: FND_MESSAGE.SET_NAME('AHL','AHL_COM_RECORD_CHANGED');
1767: FND_MSG_PUB.ADD;
1768: RAISE FND_API.G_EXC_ERROR;
1769: END IF;
1770: IF(l_Operations(0).IsUpdateEnabled <> 'T')THEN
1771: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_OPUPD_NALWD');
1768: RAISE FND_API.G_EXC_ERROR;
1769: END IF;
1770: IF(l_Operations(0).IsUpdateEnabled <> 'T')THEN
1771: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_OPUPD_NALWD');
1772: FND_MSG_PUB.ADD;
1773: RAISE FND_API.G_EXC_ERROR;
1774: END IF;
1775: process_op_quality
1776: (
1793: OR p_Operations(i).ActualStartDate IS NOT NULL
1794: OR p_Operations(i).ActualEndDate IS NOT NULL)THEN
1795: IF(p_Operations(i).StatusCode NOT IN ('1','2'))THEN
1796: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_OPUPD_NALWD');
1797: FND_MSG_PUB.ADD;
1798: RAISE FND_API.G_EXC_ERROR;
1799: END IF;
1800: ----DBMS_OUTPUT.put_line('op :i:statusCode: ' || p_Operations(i).StatusCode);
1801: l_prd_operation_tbl(j).operation_sequence_num := l_Operations(0).OperationSequenceNumber;
1898: RETURN;
1899: END IF;
1900: IF(p_WO_DETAILS_REC.IsQualityEnabled <> 'T')THEN
1901: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_WOQASUB_NALWD');
1902: FND_MSG_PUB.ADD;
1903: RAISE FND_API.G_EXC_ERROR;
1904: END IF;
1905:
1906: get_qa_plan_results
2019:
2020: IF(l_res_txns_tbl IS NOT NULL AND l_res_txns_tbl.COUNT > 0)THEN
2021: IF(p_WO_DETAILS_REC.IsUpdateEnabled <> 'T')THEN
2022: FND_MESSAGE.SET_NAME('AHL','AHL_PRD_RES_TXN_NALWD');
2023: FND_MSG_PUB.ADD;
2024: RAISE FND_API.G_EXC_ERROR;
2025: END IF;
2026: AHL_PRD_RESOURCE_TRANX_PVT.process_resource_txns
2027: (
2074:
2075: SAVEPOINT PROCESS_WORKORDER;
2076:
2077: IF FND_API.To_Boolean(p_init_msg_list) THEN
2078: FND_MSG_PUB.Initialize;
2079: END IF;
2080: -- Initialize API return status to success
2081: x_return_status := init_user_and_role(p_userid);
2082: --AHL_DEBUG_PUB.debug( 'p_WO_DETAILS_REC.WorkorderId : '||p_WO_DETAILS_REC.WorkorderId);
2099: IF(p_WO_DETAILS_REC.ObjectVersionNumber IS NULL OR
2100: p_WO_DETAILS_REC.ObjectVersionNumber <> l_WO_DETAILS_REC.ObjectVersionNumber)THEN
2101: --AHL_DEBUG_PUB.debug( 'Object Version Numbers are not same');
2102: FND_MESSAGE.SET_NAME('AHL','AHL_COM_RECORD_CHANGED');
2103: FND_MSG_PUB.ADD;
2104: RAISE FND_API.G_EXC_ERROR;
2105: END IF;
2106: process_turnover_notes(
2107: p_WO_DETAILS_REC => l_WO_DETAILS_REC,
2172: EXCEPTION
2173: WHEN FND_API.G_EXC_ERROR THEN
2174: ROLLBACK TO PROCESS_WORKORDER;
2175: x_return_status := FND_API.G_RET_STS_ERROR;
2176: x_msg_count := FND_MSG_PUB.count_msg;
2177:
2178:
2179: x_msg_data := GET_MSG_DATA(x_msg_count);
2180: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2179: x_msg_data := GET_MSG_DATA(x_msg_count);
2180: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2181: ROLLBACK TO PROCESS_WORKORDER;
2182: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2183: x_msg_count := FND_MSG_PUB.count_msg;
2184: x_msg_data := GET_MSG_DATA(x_msg_count);
2185: WHEN OTHERS THEN
2186: ROLLBACK TO PROCESS_WORKORDER;
2187: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2185: WHEN OTHERS THEN
2186: ROLLBACK TO PROCESS_WORKORDER;
2187: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2188:
2189: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2190: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2191: p_procedure_name => l_api_name,
2192: p_error_text => SUBSTR(SQLERRM,1,500));
2193: END IF;
2186: ROLLBACK TO PROCESS_WORKORDER;
2187: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2188:
2189: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
2190: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2191: p_procedure_name => l_api_name,
2192: p_error_text => SUBSTR(SQLERRM,1,500));
2193: END IF;
2194: x_msg_count := FND_MSG_PUB.count_msg;
2190: fnd_msg_pub.add_exc_msg(p_pkg_name => G_PKG_NAME,
2191: p_procedure_name => l_api_name,
2192: p_error_text => SUBSTR(SQLERRM,1,500));
2193: END IF;
2194: x_msg_count := FND_MSG_PUB.count_msg;
2195: x_msg_data := GET_MSG_DATA(x_msg_count);
2196: END process_workorder;
2197:
2198: FUNCTION GET_MSG_DATA(p_msg_count IN NUMBER) RETURN VARCHAR2 IS
2206: IF (p_msg_count IS NULL)THEN
2207: RETURN NULL;
2208: END IF;
2209: IF (p_msg_count = 1) then
2210: FND_MSG_PUB.count_and_get( p_count => l_msg_count,
2211: p_data => l_temp_msg_data,
2212: p_encoded => fnd_api.g_false);
2213: l_msg_data := '(' || 1 || ')' || l_temp_msg_data;
2214: ELSE
2214: ELSE
2215: IF (l_msg_count > 0) THEN
2216: FOR i IN 1..l_msg_count LOOP
2217:
2218: FND_MSG_PUB.get(
2219: p_encoded => 'F',
2220: p_data => l_temp_msg_data,
2221: p_msg_index_out => l_msg_index_out);
2222: IF(i = 1)THEN