Created a basic table and method to write to that table for the purpose of collecting basic data on user dialog responses.
This commit is contained in:
108
LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt
Normal file
108
LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
Compile function Dialog_Response_Log_Services(@Service, @Params)
|
||||||
|
#pragma precomp SRP_PreCompiler
|
||||||
|
|
||||||
|
Declare function RTI_CreateGUID, Error_Services, Datetime, Environment_Services, Logging_Services
|
||||||
|
|
||||||
|
Declare subroutine Database_Services, Error_Services, Logging_Services
|
||||||
|
|
||||||
|
$insert LOGICAL
|
||||||
|
$Insert DIALOG_RESPONSE_LOG_EQUATES
|
||||||
|
|
||||||
|
Options ENTITY_TYPES = 'RDS', 'REACTOR', 'WM_OUT', 'WM_IN'
|
||||||
|
Options RESPONSE_TYPES = 'OVERRIDE', 'METROLOGY', 'TEST_WAFER', 'HTR_LAST_BOX_TW'
|
||||||
|
|
||||||
|
GoToService
|
||||||
|
|
||||||
|
Return Response or ""
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// SERVICES
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Service AddDialogResponseLog(EntityId, EntityType=ENTITY_TYPES, UserId, ResponseType=RESPONSE_TYPES, Data)
|
||||||
|
|
||||||
|
ErrorMsg = ''
|
||||||
|
NewDialogResponseLogId = ''
|
||||||
|
ResponseDtm = Datetime()
|
||||||
|
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\DialogResponseLog'
|
||||||
|
LogDate = Oconv(Date(), 'D4/')
|
||||||
|
LogTime = Oconv(Time(), 'MTS')
|
||||||
|
LoggingDTM = LogDate : ' ' : LogTime
|
||||||
|
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' DialogResponseLogCreation.csv'
|
||||||
|
Headers = 'Logging DTM' : @FM : 'Key Id' : @FM : 'Response Dtm' : @FM : 'Entity Id' : @FM : 'Entity Type' : @FM : 'User Id' : @FM : 'Response Type' : @FM : 'Data' : @FM : 'Creation Message'
|
||||||
|
objAddLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
|
||||||
|
|
||||||
|
If EntityId NE '' then
|
||||||
|
If EntityType NE '' then
|
||||||
|
If RowExists(EntityType, EntityId) then
|
||||||
|
If UserId NE '' then
|
||||||
|
If RowExists('LSL_USERS', UserId) then
|
||||||
|
If ResponseType NE '' then
|
||||||
|
If Data NE '' then
|
||||||
|
NewDialogResponseLogId = RTI_CreateGUID()
|
||||||
|
If NewDialogResponseLogId NE '' then
|
||||||
|
NewDialogResponseLogRec = ''
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_RESPONSE_DTM$> = ResponseDtm
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_ENTITY_ID$> = EntityId
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_ENTITY_TYPE$> = EntityType
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_USER_ID$> = UserId
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_DIALOG_TYPE$> = ResponseType
|
||||||
|
NewDialogResponseLogRec<DIALOG_RESPONSE_LOG_DATA$> = Data
|
||||||
|
Database_Services('WriteDataRow', 'DIALOG_RESPONSE_LOG', NewDialogResponseLogId, NewDialogResponseLogRec)
|
||||||
|
If Error_Services('HasError') then
|
||||||
|
ErrorMsg = Error_Services('GetMessage')
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Error generating a new key ID.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Data was null.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Response Type was null.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Invalid user id.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'User Id was null.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Entity Id and Entity Type was not a valid data type.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Entity Type was null.'
|
||||||
|
end
|
||||||
|
end else
|
||||||
|
ErrorMsg = 'Entity Id was null.'
|
||||||
|
end
|
||||||
|
|
||||||
|
If ErrorMsg EQ '' then
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDTM
|
||||||
|
LogData<2> = NewDialogResponseLogId
|
||||||
|
LogData<3> = OConv(ResponseDtm, 'DT')
|
||||||
|
LogData<4> = EntityId
|
||||||
|
LogData<5> = EntityType
|
||||||
|
LogData<6> = UserId
|
||||||
|
LogData<7> = ResponseType
|
||||||
|
LogData<8> = Data
|
||||||
|
LogData<9> = 'Success'
|
||||||
|
Logging_Services('AppendLog', objAddLog, LogData, @RM, @FM, False$)
|
||||||
|
end else
|
||||||
|
LogData = ''
|
||||||
|
LogData<1> = LoggingDTM
|
||||||
|
LogData<2> = NewDialogResponseLogId
|
||||||
|
LogData<3> = OConv(ResponseDtm, 'DT')
|
||||||
|
LogData<4> = EntityId
|
||||||
|
LogData<5> = EntityType
|
||||||
|
LogData<6> = UserId
|
||||||
|
LogData<7> = ResponseType
|
||||||
|
LogData<8> = Data
|
||||||
|
LogData<9> = ErrorMsg
|
||||||
|
Logging_Services('AppendLog', objAddLog, LogData, @RM, @FM, False$)
|
||||||
|
Error_Services('Set', ErrorMsg)
|
||||||
|
end
|
||||||
|
|
||||||
|
End Service
|
17
LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt
Normal file
17
LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
compile insert DIALOG_RESPONSE_LOG_EQUATES
|
||||||
|
/*----------------------------------------
|
||||||
|
Author : Table Create Insert Routine
|
||||||
|
Written : 22/08/2025
|
||||||
|
Description : Insert for Table DIALOG_RESPONSE_LOG
|
||||||
|
----------------------------------------*/
|
||||||
|
#ifndef __DIALOG_RESPONSE_LOG_EQUATES__
|
||||||
|
#define __DIALOG_RESPONSE_LOG_EQUATES__
|
||||||
|
|
||||||
|
equ DIALOG_RESPONSE_LOG_RESPONSE_DTM$ to 1
|
||||||
|
equ DIALOG_RESPONSE_LOG_ENTITY_ID$ to 2
|
||||||
|
equ DIALOG_RESPONSE_LOG_ENTITY_TYPE$ to 3
|
||||||
|
equ DIALOG_RESPONSE_LOG_USER_ID$ to 4
|
||||||
|
equ DIALOG_RESPONSE_LOG_DIALOG_TYPE$ to 5
|
||||||
|
equ DIALOG_RESPONSE_LOG_DATA$ to 6
|
||||||
|
|
||||||
|
#endif
|
Reference in New Issue
Block a user