COMPILE FUNCTION obj_Prod_Ver(Method,Parms) /* Methods for PROD_VER table 3/16/2011 JCH - Initial Coding Properties: Methods: * Convert(OrderDetKey) ;* Create PROD_VER Record from Data in ORDER_DET records on ORDER_DET window write event */ DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, ErrMsg DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey $INSERT PROD_SPEC_EQUATES $INSERT ORDER_DET_EQU $INSERT QUOTE_SPEC_EQU $INSERT PROD_VER_EQUATES $INSERT CUST_PART_EQUATES ErrTitle = 'Error in Stored Procedure "obj_PROD_VER"' ErrorMsg = '' IF NOT(ASSIGNED(Method)) THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine' IF NOT(ASSIGNED(Parms)) THEN Parms = '' IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) RETURN '' END Result = '' BEGIN CASE CASE Method = 'Convert' ; GOSUB Convert CASE Method = 'SAPSubPartNos' ; GOSUB SAPSubPartNos CASE Method = 'CustPartSpec' ; GOSUB CustPartSpec CASE 1 ErrorMsg = 'Unknown Method ':Method:' passed to object routine.' END CASE IF ErrorMsg NE '' THEN Set_Status(-1,ErrTitle:@SVM:ErrorMsg) END RETURN Result * * * * * * * CustPartSpec: * * * * * * * debug ProdVerNo = Parms[1,@RM] ProdVerRec = Parms[COL2()+1,@RM] IF ProdVerNo = '' THEN RETURN IF ProdVerRec = '' THEN ProdVerRec = XLATE('PROD_VER',ProdVerNo,'','X') IF ProdVerRec = '' THEN RETURN END CustNo = ProdVerRec CustPartNo = ProdVerRec CustPartRec = XLATE('CUST_PART',CustNo:'*':CustPartNo,'','X') IF CustPartRec = '' THEN RETURN SpecDescs = CustPartRec CONVERT @LOWER_CASE TO @UPPER_CASE IN SpecDescs LOCATE 'TARGET' IN SpecDescs USING @VM SETTING Pos THEN SpecNo = CustPartRec RevNo = CustPartRec Result = SpecNo:'*':RevNo END ELSE SpecNo = SpecNo[-1,'B':@VM] DEBUG END RETURN * * * * * * * Convert: * * * * * * * RETURN * * * * * * * SAPSubPartNos: * * * * * * * ProdVerNo = Parms[1,@RM] ProdVerRec = Parms[COL2()+1,@RM] IF ProdVerNo = '' THEN RETURN IF ProdVerRec = '' THEN ProdVerRec = XLATE('PROD_VER',ProdVerNo,'','X') END CurrSubPartNo = ProdVerRec Ans = CurrSubPartNo SPCnt = COUNT(SubPartNos,@VM) + (SubPartNos NE '') FOR I = 1 TO SPCnt SubPartNo = SubPartNos<1,I> IF SubPartNo MATCHES "6N'-'1A'-'2A" THEN LOCATE SubPartNo IN Ans BY 'AL' USING @VM SETTING Pos ELSE Ans = INSERT(Ans,1,Pos,0,SubPartNo) END END NEXT I Result = Ans RETURN