added services and triggers to manually add index transactions to keep indexes up-to-date
This commit is contained in:
committed by
Stieber Daniel (CSC FI SPS MESLEO)
parent
71daf317f0
commit
c89bb6b3d4
@ -2064,6 +2064,219 @@ Service GetRDSKeys(WONo)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOMatRDSNoIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_MAT{RDS_NO} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOMatKey':@FM:'Result'
|
||||
objVerifyRDSNoLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WOMatKey = Xlate('RDS', RDSNo, 'WO_MAT_KEY', 'X')
|
||||
If WOMatKey NE '' then
|
||||
WOMatRDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
|
||||
LogData<3> = WOMatKey
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
If WOMatRDSNo EQ '' then
|
||||
LogData<4> = 'RDSNo missing from WO_MAT record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_NO relational index (target WO_MAT table)
|
||||
IndexTransactionRow = 'WO_MAT*RDS_NO*AR':@FM:RDSNo:@FM:"":@FM:WOMatKey:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'Index ok. RDSNo not missing from WO_MAT record.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WO_MAT key for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOStepRDSKeyIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_STEP{RDS_KEY} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyRDSKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WOStepKey = Xlate('RDS', RDSNo, 'WO_STEP_KEY', 'X')
|
||||
If WOStepKey NE '' then
|
||||
WOStepRDSKeys = Xlate('WO_STEP', WOStepKey, 'RDS_KEY', 'X')
|
||||
LogData<3> = WOStepKey
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
Locate RDSNo in WOStepRDSKeys using @VM setting vPos then
|
||||
LogData<4> = 'Index ok. RDSNo not missing from WO_STEP record.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData<4> = 'RDSNo missing from WO_STEP record. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_KEY relational index (target WO_STEP table)
|
||||
IndexTransactionRow = 'WO_STEP*RDS_KEY*AR':@FM:RDSNo:@FM:"":@FM:WOStepKey:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WO_STEP key for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
|
||||
Service VerifyWOLogRDSKeyIndex(RDSNo)
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS RDS{WO} Log.csv'
|
||||
Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result'
|
||||
objVerifyRDSWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = RDSNo
|
||||
LogData<4> = 'Begin ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
|
||||
ErrorMsg = ''
|
||||
If RDSNo NE '' then
|
||||
If RowExists('RDS', RDSNo) then
|
||||
WONo = Xlate('RDS', RDSNo, 'WO', 'X')
|
||||
If WONo NE '' then
|
||||
WOLogRDSKeys = ''
|
||||
Extract_Si_Keys('RDS', 'WO', WONo, WOLogRDSKeys)
|
||||
LogData<3> = WONo
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
Locate RDSNo in WOLogRDSKeys using @VM setting vPos then
|
||||
LogData<4> = 'Index ok. RDSNo not missing from Btree index.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData<4> = 'RDSNo missing from Btree index. Generating index transaction.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
// Add index transaction to update RDS_KEY relational index (target WO_STEP table)
|
||||
IndexTransactionRow = 'WO':@FM:RDSNo:@FM:"":@FM:WONo:@FM
|
||||
Open "!RDS" to BangTable then
|
||||
Lock BangTable, 0 then
|
||||
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
|
||||
PendingTrans := IndexTransactionRow
|
||||
Write PendingTrans on BangTable, 0 then
|
||||
LogData<4> = 'Index transaction successfully added.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !RDS. ':RDSNo
|
||||
end
|
||||
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData<4> = 'WONo for RDS ':RDSNo:' is null. Nothing to update.'
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null RDSNo passed in.'
|
||||
end
|
||||
|
||||
If ErrorMsg NE '' then
|
||||
LogData<4> = ErrorMsg
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
end
|
||||
|
||||
LogData<4> = 'End ':Service
|
||||
Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM)
|
||||
|
||||
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
|
||||
|
||||
end service
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal GoSubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user