From ea20e6c8a00e143b37d7b5460b873b5ca8041fa7 Mon Sep 17 00:00:00 2001 From: "Infineon\\Ouellette" Date: Fri, 22 Aug 2025 12:00:02 -0700 Subject: [PATCH] Created a basic table and method to write to that table for the purpose of collecting basic data on user dialog responses. --- LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt | 108 ++++++++++++++++++ .../STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt | 17 +++ 2 files changed, 125 insertions(+) create mode 100644 LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt create mode 100644 LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt diff --git a/LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt b/LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt new file mode 100644 index 0000000..49d22aa --- /dev/null +++ b/LSL2/STPROC/DIALOG_RESPONSE_LOG_SERVICES.txt @@ -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 = ResponseDtm + NewDialogResponseLogRec = EntityId + NewDialogResponseLogRec = EntityType + NewDialogResponseLogRec = UserId + NewDialogResponseLogRec = ResponseType + NewDialogResponseLogRec = 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 diff --git a/LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt b/LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt new file mode 100644 index 0000000..1b3b86f --- /dev/null +++ b/LSL2/STPROCINS/DIALOG_RESPONSE_LOG_EQUATES.txt @@ -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