From 3604a4d8eadb5cf4dc914609aea91ddd71427dec Mon Sep 17 00:00:00 2001 From: "Infineon\\StieberD" Date: Thu, 24 Oct 2024 18:08:15 -0700 Subject: [PATCH] fixed a bug when deleting all messages --- LSL2/STPROC/COMM_NOTE_PTRS.txt | 17 +-- LSL2/STPROC/NOTES_SERVICES.txt | 9 +- LSL2/STPROC/NOTE_PTRS_ACTIONS.txt | 230 ++++++++++++++++++++++++++++++ LSL2/STPROC/TEST_DANIEL3.txt | 82 +++++++++-- 4 files changed, 316 insertions(+), 22 deletions(-) create mode 100644 LSL2/STPROC/NOTE_PTRS_ACTIONS.txt diff --git a/LSL2/STPROC/COMM_NOTE_PTRS.txt b/LSL2/STPROC/COMM_NOTE_PTRS.txt index 9d6d6d9..80cf3a1 100644 --- a/LSL2/STPROC/COMM_NOTE_PTRS.txt +++ b/LSL2/STPROC/COMM_NOTE_PTRS.txt @@ -148,12 +148,12 @@ ReadNote: END npParms = 'NOTE_PTRS':@RM:@USER4 - UserRec = Database_Services('ReadDataRow', 'NOTE_PTRS', @USER4) - - IF Error_Services('HasError') THEN - ErrMsg(Error_Services('GetMessage')) - RETURN - END + If RowExists('NOTE_PTRS', @User4) then + UserRec = Database_Services('ReadDataRow', 'NOTE_PTRS', @USER4) + end else + UserRec = '' + Database_Services('WriteDataRow', 'NOTE_PTRS', @User4, UserRec) + end LOCATE NoteID IN UserRec USING @VM SETTING Fpos THEN UserRec = 'No' @@ -222,7 +222,7 @@ Delete: IF NoteIDS = '' THEN RETURN npParms = 'NOTE_PTRS':@RM:@USER4 - UserRec = obj_Tables('ReadRec',npParms) + UserRec = Database_Services('ReadDataRow', 'NOTE_PTRS', @User4) IF Get_Status(errCode) THEN ErrMsg(errCode) @@ -246,9 +246,10 @@ Delete: NEXT I npParms = FIELDSTORE(npParms,@RM,4,0,UserRec) - obj_Tables('WriteRec',npParms) + Database_Services('WriteDataRow', 'NOTE_PTRS', @User4, UserRec, True$, False$, True$) GOSUB Refresh RETURN + diff --git a/LSL2/STPROC/NOTES_SERVICES.txt b/LSL2/STPROC/NOTES_SERVICES.txt index 08ca66c..25baedc 100644 --- a/LSL2/STPROC/NOTES_SERVICES.txt +++ b/LSL2/STPROC/NOTES_SERVICES.txt @@ -179,8 +179,13 @@ end service Service UpdateNotes(UserID) ErrorMsg = '' - IF UserID NE '' then - NPRec = Database_Services('ReadDataRow', 'NOTE_PTRS', UserID) + IF UserID NE '' then + If RowExists('NOTE_PTRS', UserID) then + NPRec = Database_Services('ReadDataRow', 'NOTE_PTRS', UserID) + end else + NPRec = '' + Database_Services('WriteDataRow', 'NOTE_PTRS', UserID, NPRec, True$, False$, True$) + end If Error_Services('NoError') then IF LEN(NPRec) > 60000 THEN * Dump the oldest note pointers diff --git a/LSL2/STPROC/NOTE_PTRS_ACTIONS.txt b/LSL2/STPROC/NOTE_PTRS_ACTIONS.txt new file mode 100644 index 0000000..c7fe82e --- /dev/null +++ b/LSL2/STPROC/NOTE_PTRS_ACTIONS.txt @@ -0,0 +1,230 @@ +Function NOTE_PTRS_Actions(Action, CalcColName, FSList, Handle, Name, FMC, Record, Status, OrigRecord, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10) +/*********************************************************************************************************************** + + This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written + permission from Infineon. + + Name : NOTES_PTRS_Actions + + Description : Handles calculated columns and MFS calls for the current table. + + Notes : This function uses @ID, @RECORD, and @DICT to make sure {ColumnName} references work correctly. + If called from outside of a calculated column these will need to be set and restored. + + Parameters : + Action [in] -- Name of the action to be taken + CalcColName [in] -- Name of the calculated column that needs to be processed. Normally this should only be + populated when the CalcField action is being used. + FSList [in] -- The list of MFSs and the BFS name for the current file or volume. This is an @SVM + delimited array, with the current MFS name as the first value in the array, and the BFS + name as the last value. Normally set by a calling MFS. + Handle [in] -- The file handle of the file or media map being accessed. Note, this does contain the + entire handle structure that the Basic+ Open statement would provide. Normally set by a + calling MFS. + Name [in] -- The name (key) of the record or file being accessed. Normally set by a calling MFS. + FMC [in] -- Various functions. Normally set by a calling MFS. + Record [in] -- The entire record (for record-oriented functions) or a newly-created handle (for + "get handle" functions). Normally set by a calling MFS. + Status [in/out] -- Indicator of the success or failure of an action. Normally set by the calling MFS but + for some actions can be set by the action handler to indicate failure. + OrigRecord [in] -- Original content of the record being processed by the current action. This is + automatically being assigned by the WRITE_RECORD and DELETE_RECORD actions within + BASE_MFS. + Param1-10 [in/out] -- Additional request parameter holders + ActionFlow [out] -- Used to control the action chain (see the ACTION_SETUP insert for more information.) + Can also be used to return a special value, such as the results of the CalcField + method. + + History : (Date, Initials, Notes) + 04/10/18 dmb Original programmer. + 10/04/18 djs Added a trigger within the WRITE_RECORD event, which fires when the reactor number has + changed. When this occurs the related RDS_LAYER records for this RDS record are populated + with the most recent associated TOOL_PARMS record. (related by PSN and Reactor) + +***********************************************************************************************************************/ + +#pragma precomp SRP_PreCompiler + +$Insert FILE.SYSTEM.EQUATES +$Insert ACTION_SETUP +$Insert LOGICAL +$Insert NOTE_PTRS_EQUATES + +Equ COMMA$ to ',' + +Declare function Error_Services, Database_Services, Logging_Services, Environment_Services, Datetime +Declare subroutine Error_Services, Database_Services, Logging_Services, Set_Status + +LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Notes' +LogDate = Oconv(Date(), 'D4/') +LogTime = Oconv(Time(), 'MTS') +LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Notes Ptrs Log.csv' +Headers = 'Logging DTM' : @FM : 'User' : @FM : 'Notes' +objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$) +LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM + +If KeyID then GoSub Initialize_System_Variables + +Begin Case + + Case Action _EQC 'CalculateColumn' ; GoSub CalculateColumn + Case Action _EQC 'READ_RECORD_PRE' ; GoSub READ_RECORD_PRE + Case Action _EQC 'READ_RECORD' ; GoSub READ_RECORD + Case Action _EQC 'READONLY_RECORD_PRE' ; GoSub READONLY_RECORD_PRE + Case Action _EQC 'READONLY_RECORD' ; GoSub READONLY_RECORD + Case Action _EQC 'WRITE_RECORD_PRE' ; GoSub WRITE_RECORD_PRE + Case Action _EQC 'WRITE_RECORD' ; GoSub WRITE_RECORD + Case Action _EQC 'DELETE_RECORD_PRE' ; GoSub DELETE_RECORD_PRE + Case Action _EQC 'DELETE_RECORD' ; GoSub DELETE_RECORD + Case Otherwise$ ; Status = 'Invalid Action' + +End Case + +If KeyID then GoSub Restore_System_Variables + +If Assigned(ActionFlow) else ActionFlow = ACTION_CONTINUE$ + +Return ActionFlow + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Calculated Columns +// +// The typical structure of a calculated column will look like this: +// +// Declare function Database_Services +// +// @ANS = Database_Services('CalculateColumn') +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +CalculateColumn: + + // Make sure the ActionFlow return variable is cleared in case nothing is calculated. + ActionFlow = '' + +return + + + +// ----- MFS calls ----------------------------------------------------------------------------------------------------- + +READ_RECORD_PRE: + // In order to stop a record from being read in this action these lines of code must be used: + // + // OrigFileError = 100 : @FM : KeyID + // Status = 0 + // Record = '' + // ActionFlow = ACTION_STOP$ +return + +READ_RECORD: + + // In order to stop a record from being read in this action these lines of code must be used: + // + // OrigFileError = 100 : @FM : KeyID + // Status = 0 + // Record = '' +return + +READONLY_RECORD_PRE: + // In order to stop a record from being read in this action these lines of code must be used: + // + // OrigFileError = 100 : @FM : KeyID + // Status = 0 + // Record = '' + // ActionFlow = ACTION_STOP$ +return + +READONLY_RECORD: + // In order to stop a record from being read in this action these lines of code must be used: + // + // OrigFileError = 100 : @FM : KeyID + // Status = 0 + // Record = '' +return + +WRITE_RECORD_PRE: +return + +WRITE_RECORD: +return + +DELETE_RECORD_PRE: + + Notes = RetStack() + Swap @FM with ' | ' in Notes + LogData = '' + LogData<1> = LoggingDTM + LogData<2> = @User4 + LogData<3> = Name + LogData<4> = Notes + Logging_Services('AppendLog', objLog, LogData, @RM, @FM) + + ActionFlow = ACTION_STOP$ + +return + +DELETE_RECORD: +return + + + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Internal GoSubs +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +ClearCursors: + For counter = 0 to 8 + ClearSelect counter + Next counter +return + + +Initialize_System_Variables: + + // Save these for restoration later + SaveDict = @DICT + SaveID = @ID + SaveRecord = @RECORD + OrigFileError = @FILE.ERROR + + // Now make sure @DICT, ID, and @RECORD are populated + CurrentDictName = '' + If @DICT then + DictHandle = @DICT<1, 2> + Locate DictHandle in @TABLES(5) Using @FM Setting fPos then + CurrentDictName = Field(@TABLES(0), @FM, fPos, 1) + end + end + + If CurrentDictName NE DictName then + Open DictName to @DICT else Status = 'Unable to initialize @DICT' + end + + @ID = KeyID + If Record else + // Record might not have been passed in. Read the record from the database table just to make sure. + @FILE.ERROR = '' + Open TableName to hTable then + FullFSList = hTable[1, 'F' : @VM] + BFS = FullFSList[-1, 'B' : @SVM] + LastHandle = hTable[-1, 'B' : \0D\] + FileHandle = \0D\ : LastHandle[1, @VM] + + Call @BFS(READO.RECORD, BFS, FileHandle, KeyID, FMC, Record, ReadOStatus) + end + end + @RECORD = Record + +return + + +Restore_System_Variables: + + Transfer SaveDict to @DICT + Transfer SaveID to @ID + Transfer SaveRecord to @RECORD + @FILE.ERROR = OrigFileError + +return + diff --git a/LSL2/STPROC/TEST_DANIEL3.txt b/LSL2/STPROC/TEST_DANIEL3.txt index 9611140..9a2b281 100644 --- a/LSL2/STPROC/TEST_DANIEL3.txt +++ b/LSL2/STPROC/TEST_DANIEL3.txt @@ -95,21 +95,78 @@ $Insert PS_EQUATES * equ REV_CREATE_ENGINE_NO_UI$ to 0x040 Main: - debug - Recipients = '' - SentFrom = @USER4 +* debug +* LSLUsers = '' +* Open 'LSL_USERS' to hUsers then +* EOF = False$ +* Select hUsers +* Loop +* Readnext UserId else EOF = True$ +* Until EOF +* LSLUsers<-1> = UserId +* If Not(RowExists('NOTE_PTRS', UserId)) then +* +* Database_Services('WriteDataRow', 'NOTE_PTRS', UserId, '', True$, False$, True$) +* end +* Repeat +* end +* Ptrs = '' +* Open 'NOTE_PTRS' to hPtrs then +* EOF = False$ +* Select hPtrs +* Loop +* Readnext Ptr else EOF = True$ +* Until EOF +* Ptrs<-1> = Ptr +* +* Repeat +* end +* +* Diff = SRP_Array('Join', LSLUsers, Ptrs, 'AND', @FM) +* +* return - SendToGroup = 'RDS_HOLD' : @VM : 'FI_SUPPORT' - - Subject = 'Testing 2' - Message = 'Testing 1234' - AttachWindow = '' - AttachKey = '' - - Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup - obj_Notes('Create',Parms) +* return +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,ACTIVE_DIRECTORY_SERVICES', '', '', '') + Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,COMM_NOTE_PTRS', '', '', '') + Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NOTE_PTRS_ACTIONS', '', '', '') + Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NOTES_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,DATABASE_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,LSL_USERS_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NDW_AUDIT_REPORT_EVENTS', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NDW_MAIN_EVENTS', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NDW_SCHEDULE_SEARCH_EVENTS', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NOTE_MESSAGE', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,NOTES_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,OBJ_NOTE_PTRS', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,OBJ_NOTES_SENT', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,OBJ_NOTES', '', '', '') +* +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,OBJ_PROD_SPEC', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,OBJ_REACTOR_LOG', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,PRINT_WO_MASTER_SCHEDULER', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,SQL_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,SVC_SCHEDULER', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,TOOL_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,WAFER_COUNTER_SERVICES', '', '', '') +* Messaging_Services('SendMessage', 'RunProcedure', 'Request', '', 'All', 'RTP27,WO_SET_SCHEDULE', '', '', '') +* debug +* Recipients = '' +* SentFrom = @USER4 +* +* SendToGroup = 'RDS_HOLD' : @VM : 'FI_SUPPORT' +* +* Subject = 'Testing 2' +* Message = 'Testing 1234' +* AttachWindow = '' +* AttachKey = '' +* +* Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup +* obj_Notes('Create',Parms) +* +* return * Main: @@ -222,3 +279,4 @@ Main2: return +