Merged PR 28607: Archive Services Initial Pull

This is the initial pull for Archiving data.
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-10-16 23:55:23 +00:00
parent cbb52c469b
commit 05e0fb3eda
15 changed files with 3246 additions and 696 deletions

View File

@ -0,0 +1,240 @@
Function ARCHIVE_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 : RDS_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 RLIST_EQUATES
$Insert APP_INSERTS
$Insert IFX_EQUATES
$Insert ARCHIVE_EQUATES
Equ COMMA$ to ','
Declare function Error_Services, Database_Services, obj_RDS_Test, Logging_Services, Environment_Services
Declare function Tool_Parms_Services, Signature_Services, obj_WO_Mat_QA, Datetime, Override_Services
Declare function Rds_Services, SRP_DateTime, SRP_Math, obj_WO_Mat, Lot_Services, SRP_Array
Declare function Lot_Event_Services, GetTickCount, Work_Order_Services, Archive_Services
Declare subroutine Error_Services, Database_Services, Logging_Services, Service_Services, obj_WO_React
Declare Subroutine Mona_Services
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$
* This code prevents an anomaly where an @SVM appears when the value is read
* and causes an error when copying the record to SQL.
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:
ActionFlow = ACTION_STOP$
return
DELETE_RECORD:
ActionFlow = ACTION_STOP$
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

238
LSL2/STPROC/ARCHIVE_API.txt Normal file
View File

@ -0,0 +1,238 @@
Function Archive_API(@API)
/***********************************************************************************************************************
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 SRP Computer Solutions, Inc.
Name : Archive_API
Description : API logic for the Archive resource.
Notes : All web APIs should include the API_SETUP insert. This will provide several useful variables:
HTTPMethod - The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)
APIURL - The URL for the API entry point (e.g., api.mysite.com/v1).
FullEndpointURL - The URL submitted by the client, including query params.
FullEndpointURLNoQuery - The URL submitted by the client, excluding query params.
EndpointSegment - The URL endpoint segment.
ParentURL - The URL path preceeding the current endpoint.
CurrentAPI - The name of this stored procedure.
Parameters :
API [in] -- Web API to process. Format is [APIPattern].[HTTPMethod]:
- APIPattern must follow this structure Archive[.ID.[<Property>]]
- HTTPMethod can be any valid HTTP method, e.g., GET, POST, PUT, DELETE, etc.
Examples:
- Archive.POST
- Archive.ID.PUT
- Archive.ID.firstName.GET
Response [out] -- Response to be sent back to the Controller (HTTP_MCP) or requesting procedure. Web API
services do not rely upon anything being returned in the response. This is what the
various services like SetResponseBody and SetResponseStatus services are for. A response
value is only helpful if the developers want to use it for debug purposes.
History : (Date, Initials, Notes)
10/10/25 xxx Original programmer.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert APP_INSERTS
$insert API_SETUP
$insert HTTP_INSERTS
$insert SRPJSONX
Declare Function OI_WIZARD_SERVICES, ARCHIVE_SERVICES, Date_Services
GoToAPI else
// The specific resource endpoint doesn't have a API handler yet.
HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.')
end
Return Response OR ''
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Endpoint Handlers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
API archive.HEAD
API archive.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
ArchiveIds = Archive_Services('GetAllArchiveIDs')
ArchiveListJson = ''
GoSub GenerateArchiveListJson
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', ArchiveListJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api
API archive.getarchive.HEAD
API archive.getarchive.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
ArchiveId = Http_Services('GetQueryField', 'ArchiveId')
ArchiveJson = Archive_Services('ConvertArchiveRecordToJson', ArchiveId)
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', ArchiveJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api
API archive.findarchivebyrecord.HEAD
API archive.findarchivebyrecord.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
Table = Http_Services('GetQueryField', 'Table')
RecordId = Http_Services('GetQueryField', 'RecordId')
ArchiveIds = Archive_Services('GetArchiveIDsByRecord', RecordId, Table)
SRP_JsonX_Begin('JSON', '{')
SRP_JsonX('ArchiveRecords','[')
for each ArchiveId in ArchiveIds using @FM
ThisArchiveJson = Archive_Services('ConvertArchiveRecordToJson', ArchiveId)
SRP_JsonX(ThisArchiveJson)
Next ArchiveId
SRP_JsonX(']')
ArchiveJson = SRP_JsonX_End('Pretty')
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', ArchiveJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api
API archive.findarchivebymetadata.HEAD
API archive.findarchivebymetadata.GET
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
MetaDataType = Http_Services('GetQueryField', 'MetaDataType')
SearchValues = Http_Services('GetQueryField', 'SearchValue')
ArchiveIds = Archive_Services('GetArchiveIDsByMetaData', MetaDataType, SearchValues)
SRP_JsonX_Begin('JSON', '{')
SRP_JsonX('ArchiveRecords','[')
for each ArchiveId in ArchiveIds using @FM
ThisArchiveJson = Archive_Services('ConvertArchiveRecordToJson', ArchiveId)
SRP_JsonX(ThisArchiveJson)
Next ArchiveId
SRP_JsonX(']')
ArchiveJson = SRP_JsonX_End('Pretty')
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
HTTP_Services('SetResponseBody', ArchiveJson, False$, 'application/hal+json')
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end else
HTTP_Services('SetResponseStatus', 401, 'Invalid session. Reauthentication required.')
end
end api
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GenerateArchiveListJson:
If Assigned(ArchiveListJson) AND Assigned(ArchiveIds) then
SRP_JsonX_Begin('JSON', '{')
SRP_JsonX('Archives', '[')
for each ArchiveId in ArchiveIds using @FM
ArchiveType = Field(ArchiveId, '*', 1)
ArchiveParent = Field(ArchiveId, '*', 2)
CreationDtm = Date_Services('ConvertDateTimeToISO8601', XLATE('ARCHIVE', ArchiveId, ARCHIVE_ARCHIVE_CREATION_DTM$, 'X'))
RecordCount = DCOUNT(XLATE('ARCHIVE', ArchiveId, ARCHIVE_CHILD_RECORD$, 'X'), @VM)
SRP_JsonX('{')
SRP_JsonX('ArchiveId', ArchiveId, 'String')
SRP_JsonX('ArchiveType', ArchiveType, 'String')
SRP_JsonX('ArchiveParent', ArchiveParent, 'String')
SRP_JsonX('CreationDtm', CreationDtm, 'String')
SRP_JsonX('RecordCount', RecordCount)
SRP_JsonX('}')
Next ArchiveId
SRP_JsonX(']')
ArchiveListJson = SRP_JsonX_End('Pretty')
end
return

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,105 @@
Function Dearchive_API(@API)
/***********************************************************************************************************************
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 SRP Computer Solutions, Inc.
Name : Dearchive_API
Description : API logic for the Dearchive resource.
Notes : All web APIs should include the API_SETUP insert. This will provide several useful variables:
HTTPMethod - The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)
APIURL - The URL for the API entry point (e.g., api.mysite.com/v1).
FullEndpointURL - The URL submitted by the client, including query params.
FullEndpointURLNoQuery - The URL submitted by the client, excluding query params.
EndpointSegment - The URL endpoint segment.
ParentURL - The URL path preceeding the current endpoint.
CurrentAPI - The name of this stored procedure.
Parameters :
API [in] -- Web API to process. Format is [APIPattern].[HTTPMethod]:
- APIPattern must follow this structure Dearchive[.ID.[<Property>]]
- HTTPMethod can be any valid HTTP method, e.g., GET, POST, PUT, DELETE, etc.
Examples:
- Dearchive.POST
- Dearchive.ID.PUT
- Dearchive.ID.firstName.GET
Response [out] -- Response to be sent back to the Controller (HTTP_MCP) or requesting procedure. Web API
services do not rely upon anything being returned in the response. This is what the
various services like SetResponseBody and SetResponseStatus services are for. A response
value is only helpful if the developers want to use it for debug purposes.
History : (Date, Initials, Notes)
10/14/25 xxx Original programmer.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert APP_INSERTS
$insert API_SETUP
$insert HTTP_INSERTS
$Insert IFX_EQUATES
Declare subroutine Service_Services
Declare function OI_Wizard_Services
GoToAPI else
// The specific resource endpoint doesn't have a API handler yet.
HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.')
end
Return Response OR ''
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Endpoint Handlers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
API dearchive.ID.POST
ErrorMsg = ''
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
ArchiveId = EndpointSegment
swap '__' with '*' in ArchiveId
If RowExists('ARCHIVE', ArchiveId) then
Service_Services('PostProcedure', 'ARCHIVE_SERVICES', 'DeArchiveDataFromTxt':SD$:ArchiveId)
If Error_Services('NoError') then
Message = 'Successfully queued data for de-archive.'
end else
ErrorMsg = 'Error queueing de-archiving.'
end
end else
ErrorMsg = 'Archive record not found in database.'
end
If ErrorMsg NE '' then
HTTP_Services('SetResponseStatus', 500, ErrorMsg)
end else
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end
end else
HTTP_Services('SetResponseStatus', 500, 'Invalid session. Reauthentication required.')
end
end api

View File

@ -601,7 +601,28 @@ Service GetScrapeServerPort()
end service
Service GetTextDataBackupRootDir()
Machine = Environment_Services('GetServer')
DataBackupDir = ''
Begin Case
Case Machine = 'MESSA01EC'
// PROD SQL Servers
DataBackupDir = '\\MESFS.INFINEON.COM\MES_OpenInsight_Backups\DataBackups\'
Case ( (Machine = 'MESTSA01EC') or (Machine = 'MESTSA09EC') or (Machine = 'MESTSA010EC') or (Machine = 'MESTSA011EC') or (Machine = 'MESTSA012EC') )
// DEV SQL Servers
DataBackupDir = 'd:\MES_OpenInsight_Backups\DataBackups\'
Case Otherwise$
// Default to DEV SQL Servers just in case
DataBackupDir = 'd:\MES_OpenInsight_Backups\DataBackups\'
End Case
Response = DataBackupDir
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,105 @@
Function Rearchive_API(@API)
/***********************************************************************************************************************
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 SRP Computer Solutions, Inc.
Name : Rearchive_API
Description : API logic for the Rearchive resource.
Notes : All web APIs should include the API_SETUP insert. This will provide several useful variables:
HTTPMethod - The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)
APIURL - The URL for the API entry point (e.g., api.mysite.com/v1).
FullEndpointURL - The URL submitted by the client, including query params.
FullEndpointURLNoQuery - The URL submitted by the client, excluding query params.
EndpointSegment - The URL endpoint segment.
ParentURL - The URL path preceeding the current endpoint.
CurrentAPI - The name of this stored procedure.
Parameters :
API [in] -- Web API to process. Format is [APIPattern].[HTTPMethod]:
- APIPattern must follow this structure Rearchive[.ID.[<Property>]]
- HTTPMethod can be any valid HTTP method, e.g., GET, POST, PUT, DELETE, etc.
Examples:
- Rearchive.POST
- Rearchive.ID.PUT
- Rearchive.ID.firstName.GET
Response [out] -- Response to be sent back to the Controller (HTTP_MCP) or requesting procedure. Web API
services do not rely upon anything being returned in the response. This is what the
various services like SetResponseBody and SetResponseStatus services are for. A response
value is only helpful if the developers want to use it for debug purposes.
History : (Date, Initials, Notes)
10/16/25 xxx Original programmer.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert APP_INSERTS
$insert API_SETUP
$insert HTTP_INSERTS
$Insert IFX_EQUATES
Declare subroutine Service_Services
Declare function OI_Wizard_Services
GoToAPI else
// The specific resource endpoint doesn't have a API handler yet.
HTTP_Services('SetResponseStatus', 204, 'This is a valid endpoint but a web API handler has not yet been created.')
end
Return Response OR ''
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Endpoint Handlers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
API rearchive.ID.POST
ErrorMsg = ''
OIWizardID = ''
Cookies = HTTP_Services('GetHTTPCookie')
For each Cookie in Cookies using ';'
Key = Field(Cookie, '=', 1)
If Key EQ 'sessionID' then
OIWizardID = Field(Cookie, '=', 2)
end
Next Cookie
ValidSession = OI_Wizard_Services('ValidateSession', OIWizardID)
If ValidSession then
ArchiveId = EndpointSegment
swap '__' with '*' in ArchiveId
If RowExists('ARCHIVE', ArchiveId) then
Service_Services('PostProcedure', 'ARCHIVE_SERVICES', 'ReArchive':SD$:ArchiveId)
If Error_Services('NoError') then
Message = 'Successfully queued data for re-archive.'
end else
ErrorMsg = 'Error queueing re-archiving.'
end
end else
ErrorMsg = 'Archive record not found in database.'
end
If ErrorMsg NE '' then
HTTP_Services('SetResponseStatus', 500, ErrorMsg)
end else
HTTP_Services('SetResponseHeaderField', 'Content-Location', FullEndpointURL)
If Assigned(Message) then
HTTP_Services('SetResponseStatus', 201, Message)
end else
HTTP_Services('SetResponseStatus', 201)
end
end
end else
HTTP_Services('SetResponseStatus', 500, 'Invalid session. Reauthentication required.')
end
end api

View File

@ -0,0 +1,70 @@
Compile function TW_Use_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler
$Insert SERVICE_SETUP
$Insert LOGICAL
$Insert TW_USE_EQUATES
Declare subroutine Error_Services, Delay, Update_Index
Equ NUM_ATTEMPTS$ to 10
GoToService
Return Response or ""
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
Service VerifyRelationalIndexes(TWUseKey)
ErrorMsg = ''
If TWUseKey NE '' then
RDSTestKey = Field(TWUseKey, '*', 1, 1)
If RDSTestKey NE '' then
// Add index transaction to update TW_USE relational index (target RDS_TEST table)
If RowExists('TW_USE', TWUseKey) then
IndexTransactionRow = 'RDS_TEST*TW_USE_ID*AR':@FM:TWUseKey:@FM:"":@FM:RDSTestKey:@FM
end else
IndexTransactionRow = 'RDS_TEST*TW_USE_ID*AR':@FM:TWUseKey:@FM:RDSTestKey:@FM:"":@FM
end
Done = False$
For AttemptNo = 1 to NUM_ATTEMPTS$
If AttemptNo GT 1 then Delay(1)
Open "!TW_USE" to BangTable then
Lock BangTable, 0 then
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
PendingTrans := IndexTransactionRow
Write PendingTrans on BangTable, 0 then
Done = True$
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !TW_USE. ':TWUseKey
end
end
Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !TW_USE to add index transaction. ':TWUseKey
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Error in ':Service:' service. Unable to Lock !TW_USE to add index transaction. ':TWUseKey
end
end
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Error in ':Service:' service. Unable to Open !TW_USE to add index transaction. ':TWUseKey
end
end
Until Done or ErrorMsg
Next AttemptNo
If Done then
ErrCode = ''
Update_Index('TW_USE', 'MET_NO', False$, True$)
If Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Update_Index call failed. Error code: ':ErrCode
end
end
end
end
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
End Service

View File

@ -531,6 +531,94 @@ Service VerifyWoStepWMOKeyIndex(WMOKey)
end service
Service VerifyRelationalIndexes(WMOKey)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WM_OUT'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_STEP{WM_OUT_KEYS} Log.csv'
Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result'
objVerifyWMOKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
LogData = ''
LogData<1> = LoggingDtm
LogData<2> = WMOKey
LogData<4> = 'Begin ':Service
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
ErrorMsg = ''
If WMOKey NE '' then
WOStepKey = Field(WMOKey, '*', 1, 2)
If WOStepKey NE '' then
WOStepWMOKeys = Xlate('WO_STEP', WOStepKey, 'WM_OUT_KEYS', 'X')
LogData<3> = WOStepKey
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
LogData<4> = 'WMOKey missing from WO_STEP record. Generating index transaction.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
// Add index transaction to update WM_OUT_KEYS relational index (target WO_STEP table)
If RowExists('WM_OUT', WMOKey) then
IndexTransactionRow = 'WO_STEP*WM_OUT_KEYS*AR':@FM:WMOKey:@FM:"":@FM:WOStepKey:@FM
end else
IndexTransactionRow = 'WO_STEP*WM_OUT_KEYS*AR':@FM:WMOKey:@FM:WOStepKey:@FM:"":@FM
end
Done = False$
For AttemptNo = 1 to NUM_ATTEMPTS$
If AttemptNo GT 1 then Delay(1)
Open "!WM_OUT" to BangTable then
Lock BangTable, 0 then
Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM
PendingTrans := IndexTransactionRow
Write PendingTrans on BangTable, 0 then
Done = True$
LogData<4> = 'Index transaction successfully added.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey
end
end
Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey
end
end
end else
If AttemptNo GE NUM_ATTEMPTS$ then
ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey
end
end
Until Done or ErrorMsg
Next AttemptNo
If Done then
ErrCode = ''
Update_Index('WM_OUT', 'WO_STEP_KEY', False$, True$)
If Get_Status(ErrCode) then
ErrorMsg = 'Error in ':Service:' service. Update_Index call failed. Error code: ':ErrCode
end
end
end else
LogData<4> = 'WO_STEP key for WM_OUT ':WMOKey:' is null. Nothing to update.'
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end
end
If ErrorMsg NE '' then
LogData<4> = ErrorMsg
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
end
LogData<4> = 'End ':Service
Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
Service VerifyWOLogWMOKeyIndex(WMOKey)
@ -990,3 +1078,5 @@ Service GetWmOutZpl(WmOutKey)
end service

View File

@ -49,6 +49,9 @@ $Insert WM_OUT_EQUATES
$Insert VOIDED_LOT_EQUATES
$Insert IFX_EQUATES
$Insert CUST_EPI_PART_EQUATES
$Insert REACT_RUN_EQUATES
$Insert RDS_LAYER_EQUATES
$Insert RDS_TEST_EQUATES
Equ MAX_NUM_CASS$ to 150
Equ NUM_ATTEMPTS$ to 10
@ -58,11 +61,11 @@ Declare subroutine Btree.Extract, Set_Status, obj_WO_Log, obj_Notes, Print_Wo_M
Declare subroutine Print_Wmi_Labels, Print_Wmo_Labels, ErrMsg, Print_Cass_Labels, Logging_Services, Service_Services
Declare subroutine obj_WO_Mat_Log, WO_Mat_Services, Work_Order_Services, Transaction_Services, Extract_Si_Keys
Declare subroutine Mona_Services, Lot_Event_Services, RDS_Services, Lot_Services, WM_In_Services, WM_Out_Services
Declare subroutine obj_WO_Mat, obj_Post_Log, Delay
Declare subroutine obj_WO_Mat, obj_Post_Log, Delay, Archive_Services
Declare function SRP_Array, Work_Order_Services, Memory_Services, Database_Services, SRP_Sort_Array, SRP_JSON
Declare function Company_Services, obj_Prod_Spec, Schedule_Services, obj_WO_Log, obj_WO_Step, Memberof, Datetime
Declare function Environment_Services, Logging_Services, Hold_Services, Signature_Services, Lot_Services
Declare function SRP_Datetime, RTI_CreateGUID, RDS_Services, UCase, Date_Services
Declare function SRP_Datetime, RTI_CreateGUID, RDS_Services, UCase, Date_Services, WO_Mat_Services
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
LogDate = Oconv(Date(), 'D4/')
@ -2880,6 +2883,278 @@ Service GetVoidedWaferCount(WorkOrderNo)
end service
Service GetClosedWOsToArchive(ArchiveYears)
ErrorMsg = ''
WONos = ''
ArchiveThresholdDate = SRP_Datetime('AddYears', Date(), - ArchiveYears)
Open 'DICT.WO_LOG' to hWOLogDict then
SearchString = 'CLOSE_DATE':@VM:'#':@FM
SearchString := 'CLOSE_DATE':@VM:'<':ArchiveThresholdDate:@FM
SearchString := 'WO_START_DTM':@VM:'#':@FM
Btree.Extract(SearchString, 'WO_LOG', hWOLogDict, WONos)
If Get_Status(errCode) then
ErrorMsg = 'Error querying the WO_LOG table.'
end
end else
ErrorMsg = 'Error opening WO_LOG dictionary.'
end
If ErrorMsg NE '' then
Error_Services('Add', ErrorMsg)
end
Response = WONos
end service
Service GetWOLogHierachy(WOLogId)
ErrorMsg = ''
HierarchyKeys = ''
If WOLogId NE '' then
If RowExists('WO_LOG', WOLogId) then
WOLogRec = Database_Services('ReadDataRow', 'WO_LOG', WOLogId, True$, 0, False$)
If Error_Services('NoError') then
WOMatKeys = Wo_Mat_Services('GetWOMatKeys', WOLogId)
If Error_Services('NoError') then
NCRKeys = ''
for each WOMatKey in WOMatKeys using @VM
NCRKeys<1, -1> = Database_Services('ReadDataColumn', 'WO_MAT', WOMatKey, WO_MAT_NCR_KEYS$, True$, 0, False$)
Next WOMatKey
WOMatQAKeys = WOMatKeys
WOStepKey = WOLogRec<WO_LOG_WO_STEP_KEY$>
WMInKeys = Database_Services('ReadDataColumn', 'WO_STEP', WOStepKey, WO_STEP_WM_IN_KEYS$, True$, 0, False$)
if Error_Services('NoError') then
WMOutKeys = Database_Services('ReadDataColumn', 'WO_STEP', WOStepKey, WO_STEP_WM_OUT_KEYS$, True$, 0, False$)
if Error_Services('NoError') then
RDSKeys = RDS_Services('GetRDSKeys', WOLogId)
if Error_Services('NoError') then
ReactRunKeys = RDSKeys
RDSLayerKeys = ''
CleanInspKeys = ''
for each ReactRunKey in ReactRunKeys using @VM setting iPos
ReactRunRec = Database_Services('ReadDataRow', 'REACT_RUN', ReactRunKey, True$, 0, False$)
If Error_Services('NoError') then
CleanInspKeys<1, -1> = ReactRunRec<REACT_RUN_CI_NO$>
RDSLayerKeys<1, -1> = ReactRunRec<REACT_RUN_RDS_LAYER_KEYS$>
end else
ErrorMsg = Error_Services('GetMessage')
end
Next ReactRunKey
RDSTestKeys = ''
If ErrorMsg EQ '' then
For each RDSLayerKey in RDSLayerKeys using @VM
RDSLayerRec = Database_Services('ReadDataRow', 'RDS_LAYER', RDSLayerKey, True$, 0, False$)
//If Error_Services('NoError') then
ThisLayerRDSTestKeys = RDSLayerRec<RDS_LAYER_RDS_TEST_KEYS$>
for each LayerRDSTestKey in ThisLayerRDSTestKeys using @VM
If LayerRDSTestKey NE '' then
RDSTestKeys<1, -1> = LayerRDSTestKey
end
Next LayerRDSTestKey
* end else
* ErrorMsg = Error_Services('GetMessage')
* end
Next RDSLayerKey
TWUseKeys = ''
end
NCRKeys = ''
TWUseKeys = ''
If ErrorMsg EQ '' then
for each RDSTestKey in RDSTestKeys using @VM
if RDSTestKey NE '' then
RDSTestRec = Database_Services('ReadDataRow', 'RDS_TEST', RDSTestKey, True$, 0, False$)
If Error_Services('NoError') then
TWUseKeys<1,-1> = RDSTestRec<RDS_TEST_TW_USE_ID$>
end else
ErrorMsg = Error_Services('GetMessage')
end
end
Next RDSTestKey
end
If ErrorMsg EQ '' then
//ArchiveRecord
//WOLogId
If RowExists('WO_LOG', WOLogId) then
HierarchyKeys<1, -1> = WOLogId
HierarchyKeys<2, -1> = 'WO_LOG'
end
//WOStepKey
If RowExists('WO_STEP', WOStepKey) then
HierarchyKeys<1, -1> = WOStepKey
HierarchyKeys<2, -1> = 'WO_STEP'
end
//WOMatKeys
for each WOMatKey in WOMatKeys using @VM
If RowExists('WO_MAT', WOMatKey) then
HierarchyKeys<1, -1> = WOMatKey
HierarchyKeys<2, -1> = 'WO_MAT'
end
Next WOMatKey
//WOMatQAKeys
for each WOMatQAKey in WOMatQAKeys using @VM
If RowExists('WO_MAT_QA', WOMatQAKey) then
HierarchyKeys<1, -1> = WOMatQAKey
HierarchyKeys<2, -1> = 'WO_MAT_QA'
end
Next WOMatQAKey
//WMInKeys (EpiPro Specific)
for each WMInKey in WMInKeys using @VM
If RowExists('WM_IN', WMInKey) then
HierarchyKeys<1, -1> = WMInKey
HierarchyKeys<2, -1> = 'WM_IN'
end
Next WMInKey
//WMOutKeys (EpiPro Specific)
for each WMOutKey in WMOutKeys using @VM
Archive_Services('VerifyRelationalIndexes', 'WM_OUT', WMOutKey)
if Error_Services('NoError') then
If RowExists('WM_OUT', WMOutKey) then
HierarchyKeys<1, -1> = WMOutKey
HierarchyKeys<2, -1> = 'WM_OUT'
end
end else
ErrorMsg = Error_Services('GetMessage')
end
Next WMOutKey
//RDSKeys
for each RDSKey in RDSKeys using @VM
If RowExists('RDS', RDSKey) then
HierarchyKeys<1, -1> = RDSKey
HierarchyKeys<2, -1> = 'RDS'
end
Next RDSKey
//ReactRunKeys
for each ReactRunKey in ReactRunKeys using @VM
If RowExists('REACT_RUN', ReactRunKey) then
HierarchyKeys<1, -1> = ReactRunKey
HierarchyKeys<2, -1> = 'REACT_RUN'
end
Next ReactRunKey
//RDSLayerKeys
for each RDSLayerKey in RDSLayerKeys using @VM
If RowExists('RDS_LAYER', RDSLayerKey) then
HierarchyKeys<1, -1> = RDSLayerKey
HierarchyKeys<2, -1> = 'RDS_LAYER'
end
Next RDSLayerKey
//CleanInspKeys
for each CleanInspKey in CleanInspKeys using @VM
If RowExists('CLEAN_INSP', CleanInspKey) then
HierarchyKeys<1, -1> = CleanInspKey
HierarchyKeys<2, -1> = 'CLEAN_INSP'
end
Next CleanInspKey
//RDSTestKeys
for each RDSTestKey in RDSTestKeys using @VM
If RowExists('RDS_TEST', RDSTestKey) then
HierarchyKeys<1, -1> = RDSTestKey
HierarchyKeys<2, -1> = 'RDS_TEST'
end
Next RDSTestKey
//NCRKeys
for each NCRKey in NCRKeys using @VM
if NCRKey NE '' then
If RowExists('NCR', NCRKey) then
HierarchyKeys<1, -1> = NCRKey
HierarchyKeys<2, -1> = 'NCR'
end
end
Next NCRKey
//TWUseKeys
for each TWUseKey in TWUseKeys using @VM
if TWUseKey NE '' then
Archive_Services('VerifyRelationalIndexes', 'TW_USE', TWUseKey)
if Error_Services('NoError') then
If RowExists('TW_USE', TWUseKey) then
HierarchyKeys<1, -1> = TWUseKey
HierarchyKeys<2, -1> = 'TW_USE'
end
end else
ErrorMsg = Error_Services('GetMessage')
end
//end
end
Next TWUseKey
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = Error_Services('GetMessage')
end
end else
ErrorMsg = 'WO_LOG record not found in WO_LOG table.'
end
end else
ErrorMsg = 'WO_LOG ID was null.'
end
If ErrorMsg EQ '' then
Response = HierarchyKeys
end else
Error_Services('Add', ErrorMsg)
end
end service
Service GetWOMetaData(WOLogId)
ErrorMsg = ''
WOMetaData = ''
WOLogRec = Database_Services('ReadDataRow', 'WO_LOG', WOLogId, True$, 0, False$)
If Error_Services('NoError') then
// Meta Data field Variables
CustNo = WOLogRec<WO_LOG_CUST_NO$>
CustPartNo = WOLogRec<WO_LOG_CUST_PART_NO$>
EpiPartNo = WOLogRec<WO_LOG_EPI_PART_NO$>
ProdVerNo = WOLogRec<WO_LOG_PROD_VER_NO$>
ProdSpecNo = XLATE('PROD_VER', ProdVerNo, PROD_VER_PROC_STEP_PSN$, 'X')
SubstratePartNo = WOLogRec<WO_LOG_ORD_SUB_PART_NO$>
WOStartDate = WOLogRec<WO_LOG_ENTRY_DATE$>
WOCloseDate = WOLogRec<WO_LOG_CLOSE_DATE$>
ProdOrdNo = WOLogRec<WO_LOG_PROD_ORD_NO$>
MetaDataFields = 'CUST_NO' : @VM : 'CUST_PART_NO' : @VM : 'EPI_PART_NO' : @VM : 'PROD_VER_NO' : @VM : 'PSN' : @VM : 'SUB_PART_NO' : @VM : 'ENTRY_DATE' : @VM : 'CLOSE_DATE' : @VM : 'PROD_ORD_NO'
MetaDataTypes = 'string' : @VM : 'string' : @VM : 'string' : @VM : 'string' : @VM : 'string' : @VM : 'string' : @VM : 'DateTime' : @VM : 'DateTime' : @VM : 'string'
MetaDataValues = CustNo : @VM : CustPartNo : @VM : EpiPartNo : @VM : ProdVerNo : @VM : ProdSpecNo : @VM : SubstratePartNo : @VM : WOStartDate : @VM : WOCloseDate : @VM : ProdOrdNo
// Loop through the data and add only those fields that have a value.
for i = 1 to DCount(MetaDataFields, @VM)
if MetaDataValues<1, i> NE '' then
WOMetaData<1, i> = MetaDataFields<1, i>
WOMetaData<2, i> = MetaDataTypes<1, i>
WOMetaData<3, i> = MetaDataValues<1, i>
end
Next i
end else
ErrorMsg = Error_Services('GetMessage')
end
If ErrorMsg EQ '' then
Response = WOMetaData
end else
Error_Services('Add', ErrorMsg)
end
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -2892,3 +3167,6 @@ ClearCursors:
return

View File

@ -1,19 +1,24 @@
compile insert ARCHIVE_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 28/08/2025
Written : 15/10/2025
Description : Insert for Table ARCHIVE
----------------------------------------*/
#ifndef __ARCHIVE_EQUATES__
#define __ARCHIVE_EQUATES__
equ ARCHIVE_ARCHIVE_DTM$ to 1
equ ARCHIVE_COMPLETE$ to 2
equ ARCHIVE_CHILD_RECORD$ to 3
equ ARCHIVE_CHILD_TABLE$ to 4
equ ARCHIVE_CHILD_RECORD_ARCHIVED$ to 5
equ ARCHIVE_CHILD_RECORD_DELETED$ to 6
equ ARCHIVE_CHILD_RECORD_ARCHIVE_DTM$ to 7
equ ARCHIVE_CHILD_RECORD_DELETE_DTM$ to 8
equ ARCHIVE_ARCHIVE_CREATION_DTM$ to 1
equ ARCHIVE_ARCHIVE_PATH$ to 2
equ ARCHIVE_COMPLETE$ to 3
equ ARCHIVE_ARCHIVE_COMPLETION_DTM$ to 4
equ ARCHIVE_CHILD_RECORD$ to 5
equ ARCHIVE_CHILD_TABLE$ to 6
equ ARCHIVE_CHILD_RECORD_ARCHIVED$ to 7
equ ARCHIVE_CHILD_RECORD_DELETED$ to 8
equ ARCHIVE_DEARCHIVE_DATETIME$ to 9
equ ARCHIVE_METADATA_FIELD$ to 10
equ ARCHIVE_METADATA_TYPE$ to 11
equ ARCHIVE_METADATA_VALUE$ to 12
equ ARCHIVE_CHILD_RECORD_DE_ARCHIVED$ to 13
#endif

View File

@ -0,0 +1,13 @@
compile insert ARCHIVE_QUEUE_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 05/09/2025
Description : Insert for Table ARCHIVE_QUEUE
----------------------------------------*/
#ifndef __ARCHIVE_QUEUE_EQUATES__
#define __ARCHIVE_QUEUE_EQUATES__
equ ARCHIVE_QUEUE_ARCHIVE_ID$ to 1
equ ARCHIVE_QUEUE_COMPLETED$ to 2
#endif

View File

@ -0,0 +1,13 @@
compile insert ARCHIVE_QUEUE_ERROR_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 02/10/2025
Description : Insert for Table ARCHIVE_QUEUE_ERROR
----------------------------------------*/
#ifndef __ARCHIVE_QUEUE_ERROR_EQUATES__
#define __ARCHIVE_QUEUE_ERROR_EQUATES__
equ ARCHIVE_QUEUE_ERROR_ARCHIVE_ID$ to 1
equ ARCHIVE_QUEUE_ERROR_ERROR_MSG$ to 2
#endif

View File

@ -0,0 +1,13 @@
compile insert DELETE_QUEUE_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 05/09/2025
Description : Insert for Table DELETE_QUEUE
----------------------------------------*/
#ifndef __DELETE_QUEUE_EQUATES__
#define __DELETE_QUEUE_EQUATES__
equ DELETE_QUEUE_ARCHIVE_ID$ to 1
equ DELETE_QUEUE_COMPLETED$ to 2
#endif

View File

@ -0,0 +1,13 @@
compile insert DELETE_QUEUE_ERROR_EQUATES
/*----------------------------------------
Author : Table Create Insert Routine
Written : 29/09/2025
Description : Insert for Table DELETE_QUEUE_ERROR
----------------------------------------*/
#ifndef __DELETE_QUEUE_ERROR_EQUATES__
#define __DELETE_QUEUE_ERROR_EQUATES__
equ DELETE_QUEUE_ERROR_ARCHIVE_ID$ to 1
equ DELETE_QUEUE_ERROR_ERROR_MSG$ to 2
#endif

View File

@ -25,3 +25,4 @@ Equ Server.Port$ to 25000
Equ Server.KeepAlive$ to 60000
Equ MessageProcessor$ to 'NDW_MESSAGING_PROCESSOR'