updated obj_Post_Log(Post) to notify FI if an error is encountered and continue processing other records

This commit is contained in:
Infineon\StieberD
2025-09-03 15:56:08 -07:00
parent 3211eb5593
commit 464a1adebd
2 changed files with 48 additions and 11 deletions

View File

@ -20,9 +20,9 @@ COMPILE FUNCTION obj_Post_Log(Method,Parms)
DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, Get_Property, obj_RDS, Database_Services, Environment_Services
DECLARE FUNCTION Logging_Services, Datetime, SRP_DateTime, GetTickCount
DECLARE FUNCTION Logging_Services, Datetime, SRP_DateTime, GetTickCount, SRP_Datetime
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, Send_Dyn, RList, obj_WO_Log, Send_Event, obj_RDS
DECLARE SUBROUTINE obj_WO_Mat, Send_Info, obj_Notes, ErrMsg, Logging_Services, Mona_Services
DECLARE SUBROUTINE obj_WO_Mat, Send_Info, obj_Notes, ErrMsg, Logging_Services, Mona_Services, Database_Services
$INSERT POST_LOG_EQUATES
@ -222,12 +222,44 @@ Post:
IF Get_Status(errCode) THEN
Set_Status(0)
obj_Tables('UnlockRec',PlParms)
obj_Tables('UnlockRec',UFParms)
ClearSelect CursorVar
// 4/22/19 Added unlock statement to prevent POST_LOG service from locking up
Unlock hSysLists, ServiceKeyID else Null
RETURN
Tablename = Field(UFParms, @RM, 1, 1)
Key = Field(UFParms, @RM, 2, 1)
Database_Services('ReleaseKeyIDLock', Tablename, Key)
CurrDtm = Datetime()
FailureNotificationSent = PostLogRec<POST_LOG_FAILURE_NOTIFICATION_SENT$>
FailureNotificationDtm = PostLogRec<POST_LOG_FAILURE_NOTIFICATION_DTM$>
If FailureNotificationDtm NE '' then
SendReminder = ( SRP_Datetime('HourSpan', FailureNotificationDtm, CurrDtm) GE 1 )
end else
SendReminder = False$
end
If ( (FailureNotificationSent NE True$) or (SendReminder EQ True$) ) then
PostLogRec<POST_LOG_FAILED$> = True$
PostLogRec<POST_LOG_FAILURE_REASON$> = errCode
PostLogRec<POST_LOG_FAILURE_NOTIFICATION_SENT$> = True$
PostLogRec<POST_LOG_FAILURE_NOTIFICATION_DTM$> = CurrDtm
Database_Services('WriteDataRow', 'POST_LOG', PostLogKey, PostLogRec, True$, False$, False$)
// Notify OI_SYSADMIN group
Server = Environment_Services('GetServer')
Recipients = ''
SentFrom = 'SYSTEM'
Subject = 'Obj_Post_Log("Post") Error'
Message = OConv(CurrDtm, 'DT2/^H')
Message<2> = 'Error on server ':Server
Message<3> = 'Failed to write record ':Tablename:' ':Key:' . Error_Services error message: ':errCode
Swap @FM with \0D0A\ in Message
AttachWindow = ''
AttachKey = ''
SendToGroup = 'OI_SYSADMIN'
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
end else
Database_Services('ReleaseKeyIDLock', 'POST_LOG', PostLogKey)
end
END ELSE
obj_Tables('DeleteRec',PlParms)
END

View File

@ -11,6 +11,11 @@ Equ POST_LOG_REC_KEY1$ To 0
Equ POST_LOG_REC_KEY2$ To 0
Equ POST_LOG_REC_KEY3$ To 0
Equ POST_LOG_FIELD_NO$ To 1
Equ POST_LOG_FIELD_VALUE$ To 2
Equ POST_LOG_FIELD_ADD_MV_BY$ To 3
Equ POST_LOG_FIELD_NO$ To 1
Equ POST_LOG_FIELD_VALUE$ To 2
Equ POST_LOG_FIELD_ADD_MV_BY$ To 3
Equ POST_LOG_FAILED$ To 4
Equ POST_LOG_FAILURE_REASON$ To 5
Equ POST_LOG_FAILURE_NOTIFICATION_SENT$ To 6
Equ POST_LOG_FAILURE_NOTIFICATION_DTM$ To 7