Files
open-insight/LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt

109 lines
4.8 KiB
Plaintext

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