Changed from using obj_tables to Database_Services
This commit is contained in:
parent
cb5df15264
commit
56d992b961
@ -15,12 +15,12 @@ COMPILE FUNCTION obj_WO_Mat_QA(Method,Parms)
|
|||||||
#pragma precomp SRP_PreCompiler
|
#pragma precomp SRP_PreCompiler
|
||||||
|
|
||||||
|
|
||||||
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, Btree.Extract
|
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, Btree.Extract, Database_Services, Logging_Services
|
||||||
|
|
||||||
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box, obj_WO_Log, NextKey, obj_WO_Mat_QA
|
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Dialog_Box, obj_WO_Log, NextKey, obj_WO_Mat_QA, Environment_Services
|
||||||
DECLARE FUNCTION obj_Prod_Spec, obj_RDS_Test, SRP_Math
|
DECLARE FUNCTION obj_Prod_Spec, obj_RDS_Test, SRP_Math, Database_Services, Error_Services, Logging_Services
|
||||||
|
|
||||||
$INSERT LOGICAL
|
$Insert APP_INSERTS
|
||||||
$INSERT MSG_EQUATES
|
$INSERT MSG_EQUATES
|
||||||
$INSERT WO_LOG_EQUATES
|
$INSERT WO_LOG_EQUATES
|
||||||
$INSERT WO_MAT_EQUATES
|
$INSERT WO_MAT_EQUATES
|
||||||
@ -31,8 +31,14 @@ $INSERT PRS_STAGE_EQUATES
|
|||||||
$INSERT PROD_VER_EQUATES
|
$INSERT PROD_VER_EQUATES
|
||||||
$INSERT QA_MET_EQUATES ;* Used in GetQAMet data structure return variable
|
$INSERT QA_MET_EQUATES ;* Used in GetQAMet data structure return variable
|
||||||
|
|
||||||
|
LogPath = Environment_Services('GetApplicationRootPath') : '\WO_MAT_QA'; //Define the directory where the log will be saved to. This happens the first time of the day that the log is written to.
|
||||||
|
LogDate = Oconv(Date(), 'D4/')
|
||||||
|
LogTime = Oconv(Time(), 'MTS')
|
||||||
|
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||||
|
|
||||||
EQU CRLF$ TO \0D0A\
|
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' WO_MAT_QA_Writes.csv'; //Define the file name that will get created.
|
||||||
|
Headers = 'Logging DTM' : @FM : 'WOMatKey' : @FM : 'Message'; //Define the column names in the log file, delimited by a Field Mark.
|
||||||
|
objLogWOMatQAWrite = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$); //Actually creates the log.
|
||||||
|
|
||||||
ErrTitle = 'Error in Stored Procedure "obj_WO_Mat_QA"'
|
ErrTitle = 'Error in Stored Procedure "obj_WO_Mat_QA"'
|
||||||
ErrorMsg = ''
|
ErrorMsg = ''
|
||||||
@ -233,8 +239,9 @@ EpiProPSRec = ''
|
|||||||
|
|
||||||
MetLine = 1
|
MetLine = 1
|
||||||
|
|
||||||
|
WOMatKey = WONo:'*':CassNo
|
||||||
WOMatQARec = ''
|
WOMatQARec = ''
|
||||||
WOMatRec = XLATE('WO_MAT',WONo:'*':CassNo,'','X') ;* WOMat record used to check for pre-existing signatures jch 6/7/2015
|
WOMatRec = XLATE('WO_MAT',WOMatKey,'','X') ;* WOMat record used to check for pre-existing signatures jch 6/7/2015
|
||||||
|
|
||||||
|
|
||||||
FOR WOStepNo = 1 TO StepCnt
|
FOR WOStepNo = 1 TO StepCnt
|
||||||
@ -322,12 +329,15 @@ FOR WOStepNo = 1 TO StepCnt
|
|||||||
NEXT StageNo
|
NEXT StageNo
|
||||||
|
|
||||||
NEXT WOStepNo
|
NEXT WOStepNo
|
||||||
|
Database_Services('WriteDataRow', 'WO_MAT_QA', WOMatKey, WOMatQARec, True$, False$, False$)
|
||||||
|
If Error_Services('HasError') then
|
||||||
wommParms = 'WO_MAT_QA':@RM:WONo:'*':CassNo:@RM:@RM:WOMatQARec ;* Both table use the WO_Mat_Key
|
ErrorMessage = Error_Services('GetMessage')
|
||||||
|
LogData = ''
|
||||||
obj_Tables('WriteRec',wommParms)
|
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||||
|
LogData<2> = WOMatKey
|
||||||
|
LogData<3> = ErrorMessage
|
||||||
|
Logging_Services('AppendLog', objLogWOMatQAWrite, LogData, @RM, @FM, False$)
|
||||||
|
end
|
||||||
|
|
||||||
* * * * * * * * * * * *
|
* * * * * * * * * * * *
|
||||||
|
|
||||||
@ -411,36 +421,32 @@ IF ErrorMsg NE '' THEN RETURN
|
|||||||
NewMetKey = WOStep:'*':Stage:'*':MetProp
|
NewMetKey = WOStep:'*':Stage:'*':MetProp
|
||||||
|
|
||||||
WOMatKey = WONo:'*':CassNo
|
WOMatKey = WONo:'*':CassNo
|
||||||
otParms = 'WO_MAT_QA':@RM:WOMatKey
|
HaveLock = Database_Services('GetKeyIDLock', 'WO_MAT_QA', WOMatKey, True$)
|
||||||
WOMatQARec = obj_Tables('ReadRec',otParms)
|
If HaveLock then
|
||||||
WOMatRec = XLATE('WO_MAT',WOMatKey,'','X')
|
WOMatQARec = Database_Services('ReadDataRow', 'WO_MAT_QA', WOMatKey, True$, 0, False$)
|
||||||
|
WOMatRec = XLATE('WO_MAT',WOMatKey,'','X')
|
||||||
|
|
||||||
|
AllQAMetKeysStruct = obj_WO_Mat_QA('GetQAMetKeys',WOMatKey:@RM:WOMatQARec) ;* All QAMetSort Keys Specified for this Work Order Returns Keys in <1> and Sequence numbers = <2>
|
||||||
|
|
||||||
AllQAMetKeysStruct = obj_WO_Mat_QA('GetQAMetKeys',WOMatKey:@RM:WOMatQARec) ;* All QAMetSort Keys Specified for this Work Order Returns Keys in <1> and Sequence numbers = <2>
|
AllMetKeys = AllQAMetKeysStruct<1> ;* Correctly sorted list of all possible QA Met keys built from the PRS_SPEC records for all WO Steps
|
||||||
|
AllLines = AllQAMetKeysStruct<2> ;* List of position numbers for each of the met keys
|
||||||
|
|
||||||
AllMetKeys = AllQAMetKeysStruct<1> ;* Correctly sorted list of all possible QA Met keys built from the PRS_SPEC records for all WO Steps
|
CurrMetKeys = ''
|
||||||
AllLines = AllQAMetKeysStruct<2> ;* List of position numbers for each of the met keys
|
CurrLines = ''
|
||||||
|
cmqCnt = COUNT(WOMatQARec<WO_MAT_QA_PROFILE$>,@VM) + (WOMatQARec<WO_MAT_QA_PROFILE$> NE '')
|
||||||
|
|
||||||
CurrMetKeys = ''
|
FOR M = 1 to cmqCnt
|
||||||
CurrLines = ''
|
|
||||||
cmqCnt = COUNT(WOMatQARec<WO_MAT_QA_PROFILE$>,@VM) + (WOMatQARec<WO_MAT_QA_PROFILE$> NE '')
|
|
||||||
|
|
||||||
FOR M = 1 to cmqCnt
|
|
||||||
CurrMetKey = WOMatQARec<WO_MAT_QA_PROFILE$,M>[1,1]:'*':WOMatQARec<WO_MAT_QA_STAGE$,M>:'*':WOMatQARec<WO_MAT_QA_PROP$,M>
|
CurrMetKey = WOMatQARec<WO_MAT_QA_PROFILE$,M>[1,1]:'*':WOMatQARec<WO_MAT_QA_STAGE$,M>:'*':WOMatQARec<WO_MAT_QA_PROP$,M>
|
||||||
CurrMetKeys<1,M> = CurrMetKey
|
CurrMetKeys<1,M> = CurrMetKey
|
||||||
|
|
||||||
LOCATE CurrMetKey IN AllMetKeys USING @VM SETTING AllPos THEN
|
LOCATE CurrMetKey IN AllMetKeys USING @VM SETTING AllPos THEN
|
||||||
CurrLines<1,M> = AllPos ;* Builds a list of CurrLines for the Met Keys on the existing WO_MAT records
|
CurrLines<1,M> = AllPos ;* Builds a list of CurrLines for the Met Keys on the existing WO_MAT records
|
||||||
END
|
END
|
||||||
NEXT M
|
NEXT M
|
||||||
|
|
||||||
LOCATE NewMetKey IN AllMetKeys USING @VM SETTING SpecLine THEN
|
LOCATE NewMetKey IN AllMetKeys USING @VM SETTING SpecLine THEN
|
||||||
|
|
||||||
LOCATE SpecLine IN CurrLines BY 'AR' USING @VM SETTING InsertPos THEN
|
LOCATE SpecLine IN CurrLines BY 'AR' USING @VM SETTING InsertPos ELSE
|
||||||
|
|
||||||
obj_Tables('UnlockRec',otParms)
|
|
||||||
|
|
||||||
END ELSE
|
|
||||||
|
|
||||||
CurrLines = INSERT(CurrLines,1,InsertPos,0,SpecLine)
|
CurrLines = INSERT(CurrLines,1,InsertPos,0,SpecLine)
|
||||||
|
|
||||||
@ -478,20 +484,25 @@ LOCATE NewMetKey IN AllMetKeys USING @VM SETTING SpecLine THEN
|
|||||||
WOMatQARec = INSERT(WOMatQARec, WO_MAT_QA_STD_MAX$, InsertPos, 0, '' )
|
WOMatQARec = INSERT(WOMatQARec, WO_MAT_QA_STD_MAX$, InsertPos, 0, '' )
|
||||||
WOMatQARec = INSERT(WOMatQARec, WO_MAT_QA_STD_RESULT$, InsertPos, 0, '' )
|
WOMatQARec = INSERT(WOMatQARec, WO_MAT_QA_STD_RESULT$, InsertPos, 0, '' )
|
||||||
END
|
END
|
||||||
|
Database_Services('WriteDataRow', 'WO_MAT_QA', WOMatKey, WOMatQARec, True$, False$, False$)
|
||||||
|
If Error_Services('HasError') then
|
||||||
otParms = FIELDSTORE(otParms,@RM,4,0,WOMatQARec)
|
ErrorMessage = Error_Services('GetMessage')
|
||||||
obj_Tables('WriteRec',otParms)
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||||
|
LogData<2> = WOMatKey
|
||||||
|
LogData<3> = ErrorMessage
|
||||||
|
Logging_Services('AppendLog', objLogWOMatQAWrite, LogData, @RM, @FM, False$)
|
||||||
|
end
|
||||||
END ;* End of SpecLine LOCATE
|
END ;* End of SpecLine LOCATE
|
||||||
|
|
||||||
END ELSE
|
END
|
||||||
|
end else
|
||||||
obj_Tables('UnlockRec',otParms)
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDTM;//Defined at entry of subroutine
|
||||||
END ;* End of NewMetKey LOCATE
|
LogData<2> = WOMatKey
|
||||||
|
LogData<3> = 'Error getting lock on WO_MAT_QA record.'
|
||||||
|
Logging_Services('AppendLog', objLogWOMatQAWrite, LogData, @RM, @FM, False$)
|
||||||
|
end
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
@ -737,3 +748,4 @@ Next I
|
|||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user