1: PACKAGE BODY GMD_QC_TESTS_GRP as
2: /* $Header: GMDGTSTB.pls 120.1 2006/03/22 23:07:10 rlnagara noship $*/
3:
4: /*===========================================================================
5: FUNCTION NAME: check_test_exist
40:
41: BEGIN
42: IF p_test_id IS NOT NULL THEN
43: SELECT 'X' INTO l_exists
44: FROM GMD_QC_TESTS_B
45: WHERE test_id = p_test_id ;
46: ELSE
47: SELECT 'X' INTO l_exists
48: FROM GMD_QC_TESTS_B
44: FROM GMD_QC_TESTS_B
45: WHERE test_id = p_test_id ;
46: ELSE
47: SELECT 'X' INTO l_exists
48: FROM GMD_QC_TESTS_B
49: WHERE test_code = p_test_code ;
50: END IF;
51:
52: RETURN TRUE;
58:
59: EXCEPTION WHEN OTHERS
60: THEN
61: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
62: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.CHECK_TEST_EXIST' );
63: FND_MESSAGE.Set_Token('ERROR', SUBSTR(SQLERRM,1,100));
64: FND_MESSAGE.Set_Token('POSITION',l_progress );
65: FND_MSG_PUB.ADD;
66: RETURN FALSE;
114:
115: EXCEPTION WHEN OTHERS
116: THEN
117: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
118: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.TEST_EXIST_IN_SPEC' );
119: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
120: FND_MESSAGE.Set_Token('POSITION',l_progress );
121: FND_MSG_PUB.ADD;
122: RETURN FALSE;
151: x_message_data OUT NOCOPY VARCHAR2) IS
152:
153: l_progress VARCHAR2(3);
154: l_exptab GMD_UTILITY_PKG.exptab ;
155: l_test_in_rec GMD_QC_TESTS%ROWTYPE ;
156: l_test_rec GMD_QC_TESTS%ROWTYPE ;
157: BEGIN
158: l_progress := '010';
159:
152:
153: l_progress VARCHAR2(3);
154: l_exptab GMD_UTILITY_PKG.exptab ;
155: l_test_in_rec GMD_QC_TESTS%ROWTYPE ;
156: l_test_rec GMD_QC_TESTS%ROWTYPE ;
157: BEGIN
158: l_progress := '010';
159:
160: x_return_status := FND_API.G_RET_STS_SUCCESS ;
186: IF l_exptab(i).pvalue_type = 'O' THEN
187: l_test_in_rec.test_code := l_exptab(i).poperand ;
188: l_test_in_rec.test_id := NULL;
189:
190: IF NOT ( GMD_QC_TESTS_PVT.Fetch_Row(
191: p_gmd_qc_tests => l_test_in_rec,
192: x_gmd_qc_tests => l_test_rec)) THEN
193: FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_TEST_EXP');
194: FND_MESSAGE.SET_TOKEN('TEST',l_exptab(i).poperand);
187: l_test_in_rec.test_code := l_exptab(i).poperand ;
188: l_test_in_rec.test_id := NULL;
189:
190: IF NOT ( GMD_QC_TESTS_PVT.Fetch_Row(
191: p_gmd_qc_tests => l_test_in_rec,
192: x_gmd_qc_tests => l_test_rec)) THEN
193: FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_TEST_EXP');
194: FND_MESSAGE.SET_TOKEN('TEST',l_exptab(i).poperand);
195: FND_MSG_PUB.ADD;
188: l_test_in_rec.test_id := NULL;
189:
190: IF NOT ( GMD_QC_TESTS_PVT.Fetch_Row(
191: p_gmd_qc_tests => l_test_in_rec,
192: x_gmd_qc_tests => l_test_rec)) THEN
193: FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_TEST_EXP');
194: FND_MESSAGE.SET_TOKEN('TEST',l_exptab(i).poperand);
195: FND_MSG_PUB.ADD;
196: RAISE FND_API.G_EXC_ERROR ;
217: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
218:
219: WHEN OTHERS THEN
220: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
221: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.VALIDATE_EXPRESSION' );
222: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
223: FND_MESSAGE.Set_Token('POSITION',l_progress );
224: FND_MSG_PUB.ADD;
225: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
293: x_return_status := FND_API.G_RET_STS_ERROR ;
294: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
295: WHEN OTHERS THEN
296: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
297: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.INSERT_EXP_TEST_VALUES' );
298: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
299: FND_MESSAGE.Set_Token('POSITION',l_progress );
300: FND_MSG_PUB.ADD;
301: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
326: x_message_data OUT NOCOPY VARCHAR2) IS
327:
328: l_progress VARCHAR2(3);
329: l_test_method_precision NUMBER(2);
330: l_test_in_rec GMD_QC_TESTS%ROWTYPE ;
331: l_test_rec GMD_QC_TESTS%ROWTYPE ;
332: l_old_display_precision NUMBER(2);
333: l_old_report_precision NUMBER(2);
334:
327:
328: l_progress VARCHAR2(3);
329: l_test_method_precision NUMBER(2);
330: l_test_in_rec GMD_QC_TESTS%ROWTYPE ;
331: l_test_rec GMD_QC_TESTS%ROWTYPE ;
332: l_old_display_precision NUMBER(2);
333: l_old_report_precision NUMBER(2);
334:
335: BEGIN
386:
387: IF p_test_id IS NOT NULL THEN
388: l_test_in_rec.test_id := p_test_id ;
389:
390: IF (GMD_QC_TESTS_PVT.Fetch_Row(p_gmd_qc_tests => l_test_in_rec,
391: x_gmd_qc_tests => l_test_rec)) THEN
392: l_old_display_precision := l_test_rec.display_precision;
393: l_old_report_precision := l_test_rec.report_precision;
394:
387: IF p_test_id IS NOT NULL THEN
388: l_test_in_rec.test_id := p_test_id ;
389:
390: IF (GMD_QC_TESTS_PVT.Fetch_Row(p_gmd_qc_tests => l_test_in_rec,
391: x_gmd_qc_tests => l_test_rec)) THEN
392: l_old_display_precision := l_test_rec.display_precision;
393: l_old_report_precision := l_test_rec.report_precision;
394:
395: IF l_old_display_precision IS NULL OR l_old_report_precision IS NULL THEN
433:
434: l_progress := '060';
435:
436: IF p_test_id IS NOT NULL THEN
437: IF gmd_qc_tests_grp.test_exist_in_spec(p_test_id => p_test_id) THEN
438: IF p_validation_level IN ('FULL','REPORT_PRECISION') THEN
439: IF p_new_report_precision < l_old_report_precision THEN
440: FND_MESSAGE.Set_Name('GMD','GMD_NEW_PRCSN_LESS_OLD');
441: FND_MESSAGE.Set_Token('OLD_PRECISION',to_char(l_old_report_precision));
460: x_return_status := FND_API.G_RET_STS_ERROR ;
461: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
462: WHEN OTHERS THEN
463: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
464: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.DISPLAY_REPORT_PRECISION' );
465: FND_MESSAGE.Set_Token('ERROR', SUBSTR(SQLERRM,1,100));
466: FND_MESSAGE.Set_Token('POSITION',l_progress );
467: FND_MSG_PUB.ADD;
468: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
507: x_return_status := FND_API.G_RET_STS_ERROR ;
508: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
509: WHEN OTHERS THEN
510: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
511: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.MIN_MAX_VALUE_NUM');
512: FND_MESSAGE.Set_Token('ERROR', SUBSTR(SQLERRM,1,100));
513: FND_MESSAGE.Set_Token('POSITION',l_progress );
514: FND_MSG_PUB.ADD;
515: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
585: x_return_status := FND_API.G_RET_STS_ERROR ;
586: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
587: WHEN OTHERS THEN
588: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
589: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.validate_experimental_error');
590: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
591: FND_MESSAGE.Set_Token('POSITION',l_progress );
592: FND_MSG_PUB.ADD;
593: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
705: x_return_status := FND_API.G_RET_STS_ERROR ;
706: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
707: WHEN OTHERS THEN
708: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
709: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.validate_all_exp_error');
710: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
711: FND_MESSAGE.Set_Token('POSITION',l_progress );
712: FND_MSG_PUB.ADD;
713: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
761: --+========================================================================+
762:
763:
764: PROCEDURE CHECK_FOR_NULL_AND_FKS(
765: p_gmd_qc_tests_rec IN GMD_QC_TESTS%ROWTYPE,
766: x_gmd_qc_tests_rec OUT NOCOPY GMD_QC_TESTS%ROWTYPE,
767: x_return_status OUT NOCOPY VARCHAR2,
768: x_message_data OUT NOCOPY VARCHAR2) IS
769:
762:
763:
764: PROCEDURE CHECK_FOR_NULL_AND_FKS(
765: p_gmd_qc_tests_rec IN GMD_QC_TESTS%ROWTYPE,
766: x_gmd_qc_tests_rec OUT NOCOPY GMD_QC_TESTS%ROWTYPE,
767: x_return_status OUT NOCOPY VARCHAR2,
768: x_message_data OUT NOCOPY VARCHAR2) IS
769:
770: CURSOR cr_check_valid_test_method(p_test_method_id NUMBER) IS
796: l_progress := '010';
797:
798: x_return_status := FND_API.G_RET_STS_SUCCESS ;
799:
800: x_gmd_qc_tests_rec := p_gmd_qc_tests_rec ;
801:
802: -- Test Code
803:
804: IF (LTRIM(RTRIM(x_gmd_qc_tests_rec.test_code)) IS NULL) THEN
800: x_gmd_qc_tests_rec := p_gmd_qc_tests_rec ;
801:
802: -- Test Code
803:
804: IF (LTRIM(RTRIM(x_gmd_qc_tests_rec.test_code)) IS NULL) THEN
805: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_ID_CODE_NULL');
806: FND_MSG_PUB.ADD;
807: RAISE FND_API.G_EXC_ERROR;
808: END IF;
808: END IF;
809:
810: -- Test Description
811:
812: IF (LTRIM(RTRIM(x_gmd_qc_tests_rec.test_desc)) IS NULL) THEN
813: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_DESC_REQD');
814: FND_MSG_PUB.ADD;
815: RAISE FND_API.G_EXC_ERROR;
816: END IF;
816: END IF;
817:
818: -- Test Method
819:
820: IF x_gmd_qc_tests_rec.test_method_id IS NULL THEN
821: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_METHOD_REQD');
822: FND_MSG_PUB.ADD;
823: RAISE FND_API.G_EXC_ERROR;
824: ELSE
821: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_METHOD_REQD');
822: FND_MSG_PUB.ADD;
823: RAISE FND_API.G_EXC_ERROR;
824: ELSE
825: OPEN cr_check_valid_test_method(x_gmd_qc_tests_rec.test_method_id);
826: FETCH cr_check_valid_test_method INTO l_temp;
827: IF cr_check_valid_test_method%NOTFOUND THEN
828: CLOSE cr_check_valid_test_method;
829: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_METHOD');
826: FETCH cr_check_valid_test_method INTO l_temp;
827: IF cr_check_valid_test_method%NOTFOUND THEN
828: CLOSE cr_check_valid_test_method;
829: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_METHOD');
830: FND_MESSAGE.SET_TOKEN('TEST_METHOD', TO_CHAR(x_gmd_qc_tests_rec.test_method_id));
831: FND_MSG_PUB.ADD;
832: RAISE FND_API.G_EXC_ERROR;
833: END IF;
834: CLOSE cr_check_valid_test_method ;
837:
838: l_progress := '020';
839: -- Test Data Type
840:
841: IF x_gmd_qc_tests_rec.test_type IS NULL THEN
842: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_TYPE_REQD');
843: FND_MSG_PUB.ADD;
844: RAISE FND_API.G_EXC_ERROR;
845: ELSIF x_gmd_qc_tests_rec.test_type NOT IN ('U','N','E','L','V','T') THEN
841: IF x_gmd_qc_tests_rec.test_type IS NULL THEN
842: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_TYPE_REQD');
843: FND_MSG_PUB.ADD;
844: RAISE FND_API.G_EXC_ERROR;
845: ELSIF x_gmd_qc_tests_rec.test_type NOT IN ('U','N','E','L','V','T') THEN
846: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_TYPE');
847: FND_MSG_PUB.ADD;
848: RAISE FND_API.G_EXC_ERROR;
849: END IF;
848: RAISE FND_API.G_EXC_ERROR;
849: END IF;
850:
851: -- Test Priority
852: IF x_gmd_qc_tests_rec.priority IS NULL THEN
853: x_gmd_qc_tests_rec.priority := '5N';
854:
855: ELSIF (NOT validate_test_priority(p_test_priority => x_gmd_qc_tests_rec.priority)) THEN
856: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_PRIORITY');
849: END IF;
850:
851: -- Test Priority
852: IF x_gmd_qc_tests_rec.priority IS NULL THEN
853: x_gmd_qc_tests_rec.priority := '5N';
854:
855: ELSIF (NOT validate_test_priority(p_test_priority => x_gmd_qc_tests_rec.priority)) THEN
856: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_PRIORITY');
857: FND_MSG_PUB.ADD;
851: -- Test Priority
852: IF x_gmd_qc_tests_rec.priority IS NULL THEN
853: x_gmd_qc_tests_rec.priority := '5N';
854:
855: ELSIF (NOT validate_test_priority(p_test_priority => x_gmd_qc_tests_rec.priority)) THEN
856: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_PRIORITY');
857: FND_MSG_PUB.ADD;
858: RAISE FND_API.G_EXC_ERROR;
859: END IF;
857: FND_MSG_PUB.ADD;
858: RAISE FND_API.G_EXC_ERROR;
859: END IF;
860:
861: x_gmd_qc_tests_rec.delete_mark := 0;
862:
863: IF x_gmd_qc_tests_rec.test_type NOT IN ('N','E') THEN
864: IF (x_gmd_qc_tests_rec.min_value_num IS NOT NULL OR x_gmd_qc_tests_rec.max_value_num IS NOT NULL) THEN
865: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_RANGE_NOT_REQD');
859: END IF;
860:
861: x_gmd_qc_tests_rec.delete_mark := 0;
862:
863: IF x_gmd_qc_tests_rec.test_type NOT IN ('N','E') THEN
864: IF (x_gmd_qc_tests_rec.min_value_num IS NOT NULL OR x_gmd_qc_tests_rec.max_value_num IS NOT NULL) THEN
865: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_RANGE_NOT_REQD');
866: FND_MSG_PUB.ADD;
867: RAISE FND_API.G_EXC_ERROR;
860:
861: x_gmd_qc_tests_rec.delete_mark := 0;
862:
863: IF x_gmd_qc_tests_rec.test_type NOT IN ('N','E') THEN
864: IF (x_gmd_qc_tests_rec.min_value_num IS NOT NULL OR x_gmd_qc_tests_rec.max_value_num IS NOT NULL) THEN
865: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_RANGE_NOT_REQD');
866: FND_MSG_PUB.ADD;
867: RAISE FND_API.G_EXC_ERROR;
868: END IF;
867: RAISE FND_API.G_EXC_ERROR;
868: END IF;
869:
870: ELSE
871: IF (x_gmd_qc_tests_rec.min_value_num IS NULL OR x_gmd_qc_tests_rec.max_value_num IS NULL) THEN
872: FND_MESSAGE.SET_NAME('GMD', 'GMD_TEST_RANGE_REQ');
873: FND_MSG_PUB.ADD;
874: RAISE FND_API.G_EXC_ERROR;
875: END IF;
874: RAISE FND_API.G_EXC_ERROR;
875: END IF;
876: END IF;
877:
878: IF x_gmd_qc_tests_rec.test_type = 'E' THEN
879: IF x_gmd_qc_tests_rec.expression IS NULL THEN
880: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXPRESSION_REQD');
881: FND_MSG_PUB.ADD;
882: RAISE FND_API.G_EXC_ERROR;
875: END IF;
876: END IF;
877:
878: IF x_gmd_qc_tests_rec.test_type = 'E' THEN
879: IF x_gmd_qc_tests_rec.expression IS NULL THEN
880: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXPRESSION_REQD');
881: FND_MSG_PUB.ADD;
882: RAISE FND_API.G_EXC_ERROR;
883: END IF;
880: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXPRESSION_REQD');
881: FND_MSG_PUB.ADD;
882: RAISE FND_API.G_EXC_ERROR;
883: END IF;
884: ELSIF x_gmd_qc_tests_rec.expression IS NOT NULL THEN
885: FND_MESSAGE.SET_NAME('GMD','GMD_EXPRESSION_NOT_REQD');
886: FND_MSG_PUB.ADD;
887: RAISE FND_API.G_EXC_ERROR;
888: END IF;
886: FND_MSG_PUB.ADD;
887: RAISE FND_API.G_EXC_ERROR;
888: END IF;
889:
890: IF x_gmd_qc_tests_rec.test_type IN ('U','T','V') THEN
891: --BEGIN BUG#3545701
892: --Commented the code for Non-validated tests.
893: /* IF x_gmd_qc_tests_rec.test_type = 'U' and x_gmd_qc_tests_rec.test_unit IS NOT NULL THEN
894: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_UNIT_NOT_REQD');
889:
890: IF x_gmd_qc_tests_rec.test_type IN ('U','T','V') THEN
891: --BEGIN BUG#3545701
892: --Commented the code for Non-validated tests.
893: /* IF x_gmd_qc_tests_rec.test_type = 'U' and x_gmd_qc_tests_rec.test_unit IS NOT NULL THEN
894: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_UNIT_NOT_REQD');
895: FND_MSG_PUB.ADD;
896: RAISE FND_API.G_EXC_ERROR;
897: END IF; */
895: FND_MSG_PUB.ADD;
896: RAISE FND_API.G_EXC_ERROR;
897: END IF; */
898: --END BUG#3545701
899: IF (x_gmd_qc_tests_rec.display_precision IS NOT NULL OR x_gmd_qc_tests_rec.report_precision IS NOT NULL) THEN
900: FND_MESSAGE.SET_NAME('GMD','GMD_PRECISION_NOT_REQD');
901: FND_MSG_PUB.ADD;
902: RAISE FND_API.G_EXC_ERROR;
903: END IF;
901: FND_MSG_PUB.ADD;
902: RAISE FND_API.G_EXC_ERROR;
903: END IF;
904:
905: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
906: FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_EXP_ERROR_TYPE');
907: FND_MSG_PUB.ADD;
908: RAISE FND_API.G_EXC_ERROR;
909: END IF;
907: FND_MSG_PUB.ADD;
908: RAISE FND_API.G_EXC_ERROR;
909: END IF;
910:
911: IF (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.below_min_action_code IS NOT NULL )
912: OR (x_gmd_qc_tests_rec.above_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_min_action_code IS NOT NULL )
913: OR (x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.below_max_action_code IS NOT NULL )
914: OR (x_gmd_qc_tests_rec.above_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_max_action_code IS NOT NULL ) THEN
915: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_NOT_REQD');
908: RAISE FND_API.G_EXC_ERROR;
909: END IF;
910:
911: IF (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.below_min_action_code IS NOT NULL )
912: OR (x_gmd_qc_tests_rec.above_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_min_action_code IS NOT NULL )
913: OR (x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.below_max_action_code IS NOT NULL )
914: OR (x_gmd_qc_tests_rec.above_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_max_action_code IS NOT NULL ) THEN
915: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_NOT_REQD');
916: FND_MSG_PUB.ADD;
909: END IF;
910:
911: IF (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.below_min_action_code IS NOT NULL )
912: OR (x_gmd_qc_tests_rec.above_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_min_action_code IS NOT NULL )
913: OR (x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.below_max_action_code IS NOT NULL )
914: OR (x_gmd_qc_tests_rec.above_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_max_action_code IS NOT NULL ) THEN
915: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_NOT_REQD');
916: FND_MSG_PUB.ADD;
917: RAISE FND_API.G_EXC_ERROR;
910:
911: IF (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.below_min_action_code IS NOT NULL )
912: OR (x_gmd_qc_tests_rec.above_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_min_action_code IS NOT NULL )
913: OR (x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.below_max_action_code IS NOT NULL )
914: OR (x_gmd_qc_tests_rec.above_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_max_action_code IS NOT NULL ) THEN
915: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_NOT_REQD');
916: FND_MSG_PUB.ADD;
917: RAISE FND_API.G_EXC_ERROR;
918: END IF;
916: FND_MSG_PUB.ADD;
917: RAISE FND_API.G_EXC_ERROR;
918: END IF;
919: ELSE
920: IF x_gmd_qc_tests_rec.test_unit IS NULL THEN
921: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_UNIT_REQD');
922: FND_MESSAGE.SET_TOKEN('TEST',x_gmd_qc_tests_rec.test_code);
923: FND_MSG_PUB.ADD;
924: RAISE FND_API.G_EXC_ERROR;
918: END IF;
919: ELSE
920: IF x_gmd_qc_tests_rec.test_unit IS NULL THEN
921: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_UNIT_REQD');
922: FND_MESSAGE.SET_TOKEN('TEST',x_gmd_qc_tests_rec.test_code);
923: FND_MSG_PUB.ADD;
924: RAISE FND_API.G_EXC_ERROR;
925: END IF;
926:
923: FND_MSG_PUB.ADD;
924: RAISE FND_API.G_EXC_ERROR;
925: END IF;
926:
927: IF (x_gmd_qc_tests_rec.display_precision IS NULL OR x_gmd_qc_tests_rec.report_precision IS NULL ) THEN
928: FND_MESSAGE.SET_NAME('GMD', 'GMD_PRECISION_REQD');
929: FND_MESSAGE.SET_TOKEN('TEST',x_gmd_qc_tests_rec.test_code);
930: FND_MSG_PUB.ADD;
931: RAISE FND_API.G_EXC_ERROR;
925: END IF;
926:
927: IF (x_gmd_qc_tests_rec.display_precision IS NULL OR x_gmd_qc_tests_rec.report_precision IS NULL ) THEN
928: FND_MESSAGE.SET_NAME('GMD', 'GMD_PRECISION_REQD');
929: FND_MESSAGE.SET_TOKEN('TEST',x_gmd_qc_tests_rec.test_code);
930: FND_MSG_PUB.ADD;
931: RAISE FND_API.G_EXC_ERROR;
932: END IF;
933:
930: FND_MSG_PUB.ADD;
931: RAISE FND_API.G_EXC_ERROR;
932: END IF;
933:
934: IF ((x_gmd_qc_tests_rec.exp_error_type IN ('N','P')) OR (x_gmd_qc_tests_rec.exp_error_type IS NULL)) THEN
935: NULL ;
936: ELSE
937: FND_MESSAGE.SET_NAME('GMD','GMD_INVALID_EXP_ERROR_TYPE');
938: FND_MSG_PUB.ADD;
942: END IF;
943:
944: l_progress := '030';
945:
946: IF x_gmd_qc_tests_rec.exp_error_type IS NULL AND
947: (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_min IS NOT NULL
948: OR x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_max IS NOT NULL)
949: THEN
950: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_TYPE_REQ');
943:
944: l_progress := '030';
945:
946: IF x_gmd_qc_tests_rec.exp_error_type IS NULL AND
947: (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_min IS NOT NULL
948: OR x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_max IS NOT NULL)
949: THEN
950: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_TYPE_REQ');
951: FND_MSG_PUB.ADD;
944: l_progress := '030';
945:
946: IF x_gmd_qc_tests_rec.exp_error_type IS NULL AND
947: (x_gmd_qc_tests_rec.below_spec_min IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_min IS NOT NULL
948: OR x_gmd_qc_tests_rec.below_spec_max IS NOT NULL OR x_gmd_qc_tests_rec.above_spec_max IS NOT NULL)
949: THEN
950: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERROR_TYPE_REQ');
951: FND_MSG_PUB.ADD;
952: RAISE FND_API.G_EXC_ERROR;
951: FND_MSG_PUB.ADD;
952: RAISE FND_API.G_EXC_ERROR;
953: END IF;
954:
955: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL AND
956: (x_gmd_qc_tests_rec.below_spec_min IS NULL AND x_gmd_qc_tests_rec.above_spec_min IS NULL
957: AND x_gmd_qc_tests_rec.below_spec_max IS NULL AND x_gmd_qc_tests_rec.above_spec_max IS NULL)
958: THEN
959: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERR_TYPE_NULL');
952: RAISE FND_API.G_EXC_ERROR;
953: END IF;
954:
955: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL AND
956: (x_gmd_qc_tests_rec.below_spec_min IS NULL AND x_gmd_qc_tests_rec.above_spec_min IS NULL
957: AND x_gmd_qc_tests_rec.below_spec_max IS NULL AND x_gmd_qc_tests_rec.above_spec_max IS NULL)
958: THEN
959: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERR_TYPE_NULL');
960: FND_MSG_PUB.ADD;
953: END IF;
954:
955: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL AND
956: (x_gmd_qc_tests_rec.below_spec_min IS NULL AND x_gmd_qc_tests_rec.above_spec_min IS NULL
957: AND x_gmd_qc_tests_rec.below_spec_max IS NULL AND x_gmd_qc_tests_rec.above_spec_max IS NULL)
958: THEN
959: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXP_ERR_TYPE_NULL');
960: FND_MSG_PUB.ADD;
961: RAISE FND_API.G_EXC_ERROR;
960: FND_MSG_PUB.ADD;
961: RAISE FND_API.G_EXC_ERROR;
962: END IF;
963:
964: IF x_gmd_qc_tests_rec.TEST_UNIT IS NOT NULL THEN
965: OPEN cr_check_valid_test_unit(x_gmd_qc_tests_rec.test_unit);
966: FETCH cr_check_valid_test_unit INTO l_temp;
967: IF cr_check_valid_test_unit%NOTFOUND THEN
968: CLOSE cr_check_valid_test_unit;
961: RAISE FND_API.G_EXC_ERROR;
962: END IF;
963:
964: IF x_gmd_qc_tests_rec.TEST_UNIT IS NOT NULL THEN
965: OPEN cr_check_valid_test_unit(x_gmd_qc_tests_rec.test_unit);
966: FETCH cr_check_valid_test_unit INTO l_temp;
967: IF cr_check_valid_test_unit%NOTFOUND THEN
968: CLOSE cr_check_valid_test_unit;
969: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_UNIT');
966: FETCH cr_check_valid_test_unit INTO l_temp;
967: IF cr_check_valid_test_unit%NOTFOUND THEN
968: CLOSE cr_check_valid_test_unit;
969: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_UNIT');
970: FND_MESSAGE.SET_TOKEN('TEST_UNIT',x_gmd_qc_tests_rec.test_unit);
971: FND_MSG_PUB.ADD;
972: RAISE FND_API.G_EXC_ERROR;
973: END IF;
974: CLOSE cr_check_valid_test_unit ;
973: END IF;
974: CLOSE cr_check_valid_test_unit ;
975: END IF;
976:
977: IF x_gmd_qc_tests_rec.TEST_CLASS IS NOT NULL THEN
978: OPEN cr_check_valid_test_class(x_gmd_qc_tests_rec.test_class);
979: FETCH cr_check_valid_test_class INTO l_temp;
980: IF cr_check_valid_test_class%NOTFOUND THEN
981: CLOSE cr_check_valid_test_class;
974: CLOSE cr_check_valid_test_unit ;
975: END IF;
976:
977: IF x_gmd_qc_tests_rec.TEST_CLASS IS NOT NULL THEN
978: OPEN cr_check_valid_test_class(x_gmd_qc_tests_rec.test_class);
979: FETCH cr_check_valid_test_class INTO l_temp;
980: IF cr_check_valid_test_class%NOTFOUND THEN
981: CLOSE cr_check_valid_test_class;
982: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_CLASS');
979: FETCH cr_check_valid_test_class INTO l_temp;
980: IF cr_check_valid_test_class%NOTFOUND THEN
981: CLOSE cr_check_valid_test_class;
982: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_TEST_CLASS');
983: FND_MESSAGE.SET_TOKEN('TEST_CLASS', x_gmd_qc_tests_rec.test_class);
984: FND_MSG_PUB.ADD;
985: RAISE FND_API.G_EXC_ERROR;
986: END IF;
987: CLOSE cr_check_valid_test_class ;
988: END IF;
989:
990: l_progress := '040';
991:
992: IF x_gmd_qc_tests_rec.BELOW_MIN_ACTION_CODE IS NOT NULL THEN
993: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.below_min_action_code);
994: FETCH cr_check_valid_action_code INTO l_temp;
995: IF cr_check_valid_action_code%NOTFOUND THEN
996: CLOSE cr_check_valid_action_code;
989:
990: l_progress := '040';
991:
992: IF x_gmd_qc_tests_rec.BELOW_MIN_ACTION_CODE IS NOT NULL THEN
993: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.below_min_action_code);
994: FETCH cr_check_valid_action_code INTO l_temp;
995: IF cr_check_valid_action_code%NOTFOUND THEN
996: CLOSE cr_check_valid_action_code;
997: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
994: FETCH cr_check_valid_action_code INTO l_temp;
995: IF cr_check_valid_action_code%NOTFOUND THEN
996: CLOSE cr_check_valid_action_code;
997: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
998: FND_MESSAGE.SET_TOKEN('ACTION', x_gmd_qc_tests_rec.below_min_action_code);
999: FND_MSG_PUB.ADD;
1000: RAISE FND_API.G_EXC_ERROR;
1001: END IF;
1002: CLOSE cr_check_valid_action_code ;
1001: END IF;
1002: CLOSE cr_check_valid_action_code ;
1003: END IF;
1004:
1005: IF x_gmd_qc_tests_rec.ABOVE_MIN_ACTION_CODE IS NOT NULL THEN
1006: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.above_min_action_code);
1007: FETCH cr_check_valid_action_code INTO l_temp;
1008: IF cr_check_valid_action_code%NOTFOUND THEN
1009: CLOSE cr_check_valid_action_code;
1002: CLOSE cr_check_valid_action_code ;
1003: END IF;
1004:
1005: IF x_gmd_qc_tests_rec.ABOVE_MIN_ACTION_CODE IS NOT NULL THEN
1006: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.above_min_action_code);
1007: FETCH cr_check_valid_action_code INTO l_temp;
1008: IF cr_check_valid_action_code%NOTFOUND THEN
1009: CLOSE cr_check_valid_action_code;
1010: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1007: FETCH cr_check_valid_action_code INTO l_temp;
1008: IF cr_check_valid_action_code%NOTFOUND THEN
1009: CLOSE cr_check_valid_action_code;
1010: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1011: FND_MESSAGE.SET_TOKEN('ACTION', x_gmd_qc_tests_rec.above_min_action_code);
1012: FND_MSG_PUB.ADD;
1013: RAISE FND_API.G_EXC_ERROR;
1014: END IF;
1015: CLOSE cr_check_valid_action_code ;
1014: END IF;
1015: CLOSE cr_check_valid_action_code ;
1016: END IF;
1017:
1018: IF x_gmd_qc_tests_rec.BELOW_MAX_ACTION_CODE IS NOT NULL THEN
1019: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.below_max_action_code);
1020: FETCH cr_check_valid_action_code INTO l_temp;
1021: IF cr_check_valid_action_code%NOTFOUND THEN
1022: CLOSE cr_check_valid_action_code;
1015: CLOSE cr_check_valid_action_code ;
1016: END IF;
1017:
1018: IF x_gmd_qc_tests_rec.BELOW_MAX_ACTION_CODE IS NOT NULL THEN
1019: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.below_max_action_code);
1020: FETCH cr_check_valid_action_code INTO l_temp;
1021: IF cr_check_valid_action_code%NOTFOUND THEN
1022: CLOSE cr_check_valid_action_code;
1023: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1020: FETCH cr_check_valid_action_code INTO l_temp;
1021: IF cr_check_valid_action_code%NOTFOUND THEN
1022: CLOSE cr_check_valid_action_code;
1023: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1024: FND_MESSAGE.SET_TOKEN('ACTION', x_gmd_qc_tests_rec.below_max_action_code);
1025: FND_MSG_PUB.ADD;
1026: RAISE FND_API.G_EXC_ERROR;
1027: END IF;
1028: CLOSE cr_check_valid_action_code ;
1027: END IF;
1028: CLOSE cr_check_valid_action_code ;
1029: END IF;
1030:
1031: IF x_gmd_qc_tests_rec.ABOVE_MAX_ACTION_CODE IS NOT NULL THEN
1032: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.above_max_action_code);
1033: FETCH cr_check_valid_action_code INTO l_temp;
1034: IF cr_check_valid_action_code%NOTFOUND THEN
1035: CLOSE cr_check_valid_action_code;
1028: CLOSE cr_check_valid_action_code ;
1029: END IF;
1030:
1031: IF x_gmd_qc_tests_rec.ABOVE_MAX_ACTION_CODE IS NOT NULL THEN
1032: OPEN cr_check_valid_action_code(x_gmd_qc_tests_rec.above_max_action_code);
1033: FETCH cr_check_valid_action_code INTO l_temp;
1034: IF cr_check_valid_action_code%NOTFOUND THEN
1035: CLOSE cr_check_valid_action_code;
1036: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1033: FETCH cr_check_valid_action_code INTO l_temp;
1034: IF cr_check_valid_action_code%NOTFOUND THEN
1035: CLOSE cr_check_valid_action_code;
1036: FND_MESSAGE.SET_NAME('GMD', 'GMD_INVALID_ACTION_CODE');
1037: FND_MESSAGE.SET_TOKEN('ACTION', x_gmd_qc_tests_rec.above_max_action_code);
1038: FND_MSG_PUB.ADD;
1039: RAISE FND_API.G_EXC_ERROR;
1040: END IF;
1041: CLOSE cr_check_valid_action_code ;
1041: CLOSE cr_check_valid_action_code ;
1042: END IF;
1043:
1044: -- make test_id null. generate test id with sequence.
1045: x_gmd_qc_tests_rec.test_id := NULL;
1046:
1047: EXCEPTION
1048: WHEN FND_API.G_EXC_ERROR THEN
1049: x_return_status := FND_API.G_RET_STS_ERROR ;
1050: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1051:
1052: WHEN OTHERS THEN
1053: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
1054: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.check_for_null_and_fks');
1055: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
1056: FND_MESSAGE.Set_Token('POSITION',l_progress );
1057: FND_MSG_PUB.ADD;
1058: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1061: END check_for_null_and_fks;
1062:
1063:
1064: PROCEDURE VALIDATE_BEFORE_INSERT(
1065: p_gmd_qc_tests_rec IN GMD_QC_TESTS%ROWTYPE,
1066: x_gmd_qc_tests_rec OUT NOCOPY GMD_QC_TESTS%ROWTYPE,
1067: x_return_status OUT NOCOPY VARCHAR2,
1068: x_message_data OUT NOCOPY VARCHAR2) IS
1069:
1062:
1063:
1064: PROCEDURE VALIDATE_BEFORE_INSERT(
1065: p_gmd_qc_tests_rec IN GMD_QC_TESTS%ROWTYPE,
1066: x_gmd_qc_tests_rec OUT NOCOPY GMD_QC_TESTS%ROWTYPE,
1067: x_return_status OUT NOCOPY VARCHAR2,
1068: x_message_data OUT NOCOPY VARCHAR2) IS
1069:
1070: l_progress VARCHAR2(3);
1075:
1076: x_return_status := FND_API.G_RET_STS_SUCCESS ;
1077:
1078: CHECK_FOR_NULL_AND_FKS(
1079: p_gmd_qc_tests_rec => p_gmd_qc_tests_rec,
1080: x_gmd_qc_tests_rec => x_gmd_qc_tests_rec,
1081: x_return_status => x_return_status,
1082: x_message_data => x_message_data );
1083:
1076: x_return_status := FND_API.G_RET_STS_SUCCESS ;
1077:
1078: CHECK_FOR_NULL_AND_FKS(
1079: p_gmd_qc_tests_rec => p_gmd_qc_tests_rec,
1080: x_gmd_qc_tests_rec => x_gmd_qc_tests_rec,
1081: x_return_status => x_return_status,
1082: x_message_data => x_message_data );
1083:
1084: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1085: RETURN;
1086: END IF;
1087:
1088: -- check for duplicate test_code.
1089: IF CHECK_TEST_EXIST(p_test_code => x_gmd_qc_tests_rec.test_code) THEN
1090: FND_MESSAGE.SET_NAME('GMD','SY_WFDUPLICATE');
1091: FND_MSG_PUB.ADD;
1092: RAISE FND_API.G_EXC_ERROR;
1093: END IF;
1091: FND_MSG_PUB.ADD;
1092: RAISE FND_API.G_EXC_ERROR;
1093: END IF;
1094:
1095: IF x_gmd_qc_tests_rec.test_type = 'E' THEN
1096: validate_expression(
1097: p_expression => x_gmd_qc_tests_rec.expression,
1098: x_test_tab => l_exp_test_id_tab,
1099: x_return_status => x_return_status,
1093: END IF;
1094:
1095: IF x_gmd_qc_tests_rec.test_type = 'E' THEN
1096: validate_expression(
1097: p_expression => x_gmd_qc_tests_rec.expression,
1098: x_test_tab => l_exp_test_id_tab,
1099: x_return_status => x_return_status,
1100: x_message_data => x_message_data );
1101:
1103: RETURN;
1104: END IF;
1105: END IF;
1106:
1107: IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1108: DISPLAY_REPORT_PRECISION
1109: (p_validation_level => 'FULL',
1110: p_test_method_id => x_gmd_qc_tests_rec.test_method_id,
1111: p_test_id => null,
1106:
1107: IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1108: DISPLAY_REPORT_PRECISION
1109: (p_validation_level => 'FULL',
1110: p_test_method_id => x_gmd_qc_tests_rec.test_method_id,
1111: p_test_id => null,
1112: p_new_display_precision => x_gmd_qc_tests_rec.display_precision,
1113: p_new_report_precision => x_gmd_qc_tests_rec.report_precision,
1114: x_return_status => x_return_status,
1108: DISPLAY_REPORT_PRECISION
1109: (p_validation_level => 'FULL',
1110: p_test_method_id => x_gmd_qc_tests_rec.test_method_id,
1111: p_test_id => null,
1112: p_new_display_precision => x_gmd_qc_tests_rec.display_precision,
1113: p_new_report_precision => x_gmd_qc_tests_rec.report_precision,
1114: x_return_status => x_return_status,
1115: x_message_data => x_message_data );
1116:
1109: (p_validation_level => 'FULL',
1110: p_test_method_id => x_gmd_qc_tests_rec.test_method_id,
1111: p_test_id => null,
1112: p_new_display_precision => x_gmd_qc_tests_rec.display_precision,
1113: p_new_report_precision => x_gmd_qc_tests_rec.report_precision,
1114: x_return_status => x_return_status,
1115: x_message_data => x_message_data );
1116:
1117: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1121:
1122: -- In case of numeric range with label,min_value_num and max_value_num is derived
1123: -- after test values are insert. so do this validation after insertion of test values.
1124:
1125: IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1126:
1127: x_gmd_qc_tests_rec.min_value_num := ROUND(x_gmd_qc_tests_rec.min_value_num,x_gmd_qc_tests_rec.display_precision);
1128: x_gmd_qc_tests_rec.max_value_num := ROUND(x_gmd_qc_tests_rec.max_value_num,x_gmd_qc_tests_rec.display_precision);
1129:
1123: -- after test values are insert. so do this validation after insertion of test values.
1124:
1125: IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1126:
1127: x_gmd_qc_tests_rec.min_value_num := ROUND(x_gmd_qc_tests_rec.min_value_num,x_gmd_qc_tests_rec.display_precision);
1128: x_gmd_qc_tests_rec.max_value_num := ROUND(x_gmd_qc_tests_rec.max_value_num,x_gmd_qc_tests_rec.display_precision);
1129:
1130:
1131: MIN_MAX_VALUE_NUM(
1124:
1125: IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1126:
1127: x_gmd_qc_tests_rec.min_value_num := ROUND(x_gmd_qc_tests_rec.min_value_num,x_gmd_qc_tests_rec.display_precision);
1128: x_gmd_qc_tests_rec.max_value_num := ROUND(x_gmd_qc_tests_rec.max_value_num,x_gmd_qc_tests_rec.display_precision);
1129:
1130:
1131: MIN_MAX_VALUE_NUM(
1132: p_test_type => x_gmd_qc_tests_rec.test_type,
1128: x_gmd_qc_tests_rec.max_value_num := ROUND(x_gmd_qc_tests_rec.max_value_num,x_gmd_qc_tests_rec.display_precision);
1129:
1130:
1131: MIN_MAX_VALUE_NUM(
1132: p_test_type => x_gmd_qc_tests_rec.test_type,
1133: p_min_value_num => x_gmd_qc_tests_rec.min_value_num,
1134: p_max_value_num => x_gmd_qc_tests_rec.max_value_num,
1135: x_return_status => x_return_status,
1136: x_message_data => x_message_data );
1129:
1130:
1131: MIN_MAX_VALUE_NUM(
1132: p_test_type => x_gmd_qc_tests_rec.test_type,
1133: p_min_value_num => x_gmd_qc_tests_rec.min_value_num,
1134: p_max_value_num => x_gmd_qc_tests_rec.max_value_num,
1135: x_return_status => x_return_status,
1136: x_message_data => x_message_data );
1137:
1130:
1131: MIN_MAX_VALUE_NUM(
1132: p_test_type => x_gmd_qc_tests_rec.test_type,
1133: p_min_value_num => x_gmd_qc_tests_rec.min_value_num,
1134: p_max_value_num => x_gmd_qc_tests_rec.max_value_num,
1135: x_return_status => x_return_status,
1136: x_message_data => x_message_data );
1137:
1138: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1138: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1139: RETURN;
1140: END IF;
1141:
1142: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1139: RETURN;
1140: END IF;
1141:
1142: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1140: END IF;
1141:
1142: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1148: END IF;
1141:
1142: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1148: END IF;
1149:
1142: IF x_gmd_qc_tests_rec.exp_error_type IS NOT NULL THEN
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1148: END IF;
1149:
1150: validate_all_exp_error(
1143: IF x_gmd_qc_tests_rec.exp_error_type = 'N' THEN
1144: x_gmd_qc_tests_rec.below_spec_min := ROUND(x_gmd_qc_tests_rec.below_spec_min,x_gmd_qc_tests_rec.display_precision);
1145: x_gmd_qc_tests_rec.above_spec_min := ROUND(x_gmd_qc_tests_rec.above_spec_min,x_gmd_qc_tests_rec.display_precision);
1146: x_gmd_qc_tests_rec.below_spec_max := ROUND(x_gmd_qc_tests_rec.below_spec_max,x_gmd_qc_tests_rec.display_precision);
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1148: END IF;
1149:
1150: validate_all_exp_error(
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1147: x_gmd_qc_tests_rec.above_spec_max := ROUND(x_gmd_qc_tests_rec.above_spec_max,x_gmd_qc_tests_rec.display_precision);
1148: END IF;
1149:
1150: validate_all_exp_error(
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1148: END IF;
1149:
1150: validate_all_exp_error(
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1149:
1150: validate_all_exp_error(
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1150: validate_all_exp_error(
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1151: p_exp_error_type => x_gmd_qc_tests_rec.exp_error_type,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1152: p_below_spec_min => x_gmd_qc_tests_rec.below_spec_min,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1153: p_below_min_action_code => x_gmd_qc_tests_rec.below_min_action_code,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1161: p_test_max => x_gmd_qc_tests_rec.max_value_num,
1154: p_above_spec_min => x_gmd_qc_tests_rec.above_spec_min,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1161: p_test_max => x_gmd_qc_tests_rec.max_value_num,
1162: x_return_status => x_return_status,
1155: p_above_min_action_code => x_gmd_qc_tests_rec.above_min_action_code,
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1161: p_test_max => x_gmd_qc_tests_rec.max_value_num,
1162: x_return_status => x_return_status,
1163: x_message_data => x_message_data );
1156: p_below_spec_max => x_gmd_qc_tests_rec.below_spec_max,
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1161: p_test_max => x_gmd_qc_tests_rec.max_value_num,
1162: x_return_status => x_return_status,
1163: x_message_data => x_message_data );
1164:
1157: p_below_max_action_code => x_gmd_qc_tests_rec.below_max_action_code,
1158: p_above_spec_max => x_gmd_qc_tests_rec.above_spec_max,
1159: p_above_max_action_code => x_gmd_qc_tests_rec.above_max_action_code,
1160: p_test_min => x_gmd_qc_tests_rec.min_value_num,
1161: p_test_max => x_gmd_qc_tests_rec.max_value_num,
1162: x_return_status => x_return_status,
1163: x_message_data => x_message_data );
1164:
1165: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1167: END IF;
1168:
1169: END IF;
1170:
1171: END IF; -- IF x_gmd_qc_tests_rec.test_type in ('N','L','E') THEN
1172:
1173: EXCEPTION
1174: WHEN FND_API.G_EXC_ERROR THEN
1175: x_return_status := FND_API.G_RET_STS_ERROR ;
1176: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1177:
1178: WHEN OTHERS THEN
1179: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
1180: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.validate_before_insert');
1181: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
1182: FND_MESSAGE.Set_Token('POSITION',l_progress );
1183: FND_MSG_PUB.ADD;
1184: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1193: ===========================================================================*/
1194:
1195: PROCEDURE PROCESS_AFTER_INSERT (
1196: p_init_msg_list IN VARCHAR2 ,
1197: p_gmd_qc_tests_rec IN GMD_QC_TESTS%ROWTYPE,
1198: x_return_status OUT NOCOPY VARCHAR2,
1199: x_message_data OUT NOCOPY VARCHAR2) IS
1200:
1201: l_progress VARCHAR2(3);
1209: IF FND_API.to_Boolean( p_init_msg_list ) THEN
1210: FND_MSG_PUB.initialize; -- clear the message stack.
1211: END IF;
1212:
1213: IF p_gmd_qc_tests_rec.test_id IS NULL THEN
1214: FND_MESSAGE.SET_NAME('GMD','GMD_TEST_ID_CODE_NULL');
1215: FND_MSG_PUB.ADD;
1216: RAISE FND_API.G_EXC_ERROR;
1217: END IF;
1215: FND_MSG_PUB.ADD;
1216: RAISE FND_API.G_EXC_ERROR;
1217: END IF;
1218:
1219: IF p_gmd_qc_tests_rec.test_type = 'E' THEN
1220: validate_expression(
1221: p_expression => p_gmd_qc_tests_rec.expression,
1222: x_test_tab => l_exp_test_id_tab,
1223: x_return_status => x_return_status,
1217: END IF;
1218:
1219: IF p_gmd_qc_tests_rec.test_type = 'E' THEN
1220: validate_expression(
1221: p_expression => p_gmd_qc_tests_rec.expression,
1222: x_test_tab => l_exp_test_id_tab,
1223: x_return_status => x_return_status,
1224: x_message_data => x_message_data );
1225:
1227: RETURN;
1228: END IF;
1229:
1230: IF l_exp_test_id_tab.COUNT > 0 THEN
1231: GMD_QC_TESTS_GRP.INSERT_EXP_TEST_VALUES(
1232: p_test_id => p_gmd_qc_tests_rec.test_id,
1233: p_test_id_tab => l_exp_test_id_tab,
1234: x_return_status => x_return_status,
1235: x_message_data => x_message_data);
1228: END IF;
1229:
1230: IF l_exp_test_id_tab.COUNT > 0 THEN
1231: GMD_QC_TESTS_GRP.INSERT_EXP_TEST_VALUES(
1232: p_test_id => p_gmd_qc_tests_rec.test_id,
1233: p_test_id_tab => l_exp_test_id_tab,
1234: x_return_status => x_return_status,
1235: x_message_data => x_message_data);
1236: IF x_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1237: RETURN;
1238: END IF;
1239: END IF;
1240:
1241: END IF; -- IF p_gmd_qc_tests_rec.test_type = 'E' THEN
1242:
1243: EXCEPTION
1244: WHEN FND_API.G_EXC_ERROR THEN
1245: x_return_status := FND_API.G_RET_STS_ERROR ;
1246: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1247:
1248: WHEN OTHERS THEN
1249: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
1250: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.process_after_insert');
1251: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
1252: FND_MESSAGE.Set_Token('POSITION',l_progress );
1253: FND_MSG_PUB.ADD;
1254: x_message_data := FND_MSG_PUB.GET(FND_MSG_PUB.G_LAST,FND_API.G_FALSE);
1281: BEGIN
1282: IF p_test_class IS NOT NULL AND
1283: p_test_group_order IS NOT NULL THEN
1284: SELECT 'X' INTO l_exists
1285: FROM GMD_QC_TESTS_B
1286: WHERE test_class = p_test_class
1287: AND test_group_order = p_test_group_order
1288: AND rownum =1 ;
1289: RETURN TRUE;
1295: END;
1296: EXCEPTION WHEN OTHERS
1297: THEN
1298: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
1299: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.test_group_order_exist' );
1300: FND_MESSAGE.Set_Token('ERROR', SUBSTR(SQLERRM,1,100));
1301: FND_MESSAGE.Set_Token('POSITION',l_progress );
1302: FND_MSG_PUB.ADD;
1303: RETURN FALSE;
1358: c.test_qty,
1359: c.test_qty_uom, --rconv
1360: 'N',
1361: 'Y'
1362: FROM GMD_QC_TESTS a, gem_lookups b , gmd_test_methods c
1363: where a.test_class = p_test_class
1364: AND b.lookup_type = 'GMD_QC_TEST_TYPE'
1365: AND a.test_type = b.lookup_code
1366: AND a.test_method_id = c.test_method_id
1382: SELECT nvl(a.test_qty_uom, c.test_qty_uom) test_qty_uom,
1383: nvl(a.test_qty, c.test_qty) test_qty
1384: INTO l_test_qty_uom, l_test_qty
1385: FROM gmd_spec_tests a,
1386: gmd_qc_tests b,
1387: gmd_test_methods_b c
1388: WHERE a.spec_id = l_spec_id
1389: AND a.test_id = b.test_id
1390: AND b.test_id = l_test_id.test_id
1392: EXCEPTION
1393: WHEN NO_DATA_FOUND THEN
1394: SELECT a.test_qty_uom, a.test_qty
1395: INTO l_test_qty_uom, l_test_qty
1396: FROM gmd_test_methods_b a, gmd_qc_tests b
1397: WHERE b.test_id = l_test_id.test_id
1398: AND a.test_method_id = b.test_method_id;
1399: END;
1400:
1411: COMMIT;
1412: EXCEPTION
1413: WHEN OTHERS THEN
1414: FND_MESSAGE.Set_Name('GMD','GMD_API_ERROR');
1415: FND_MESSAGE.Set_Token('PACKAGE','GMD_QC_TESTS_GRP.POPULATE_TEST_GRP_GT' );
1416: FND_MESSAGE.Set_Token('ERROR', substr(sqlerrm,1,100));
1417: FND_MSG_PUB.ADD;
1418: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1419: END POPULATE_TEST_GRP_GT;
1439: WHERE test_id = p_test_id;
1440: COMMIT;
1441: END update_test_grp;
1442:
1443: END gmd_qc_tests_grp ;