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

@ -83,12 +83,12 @@ end service
Service IsProd()
Machine = Environment_Services('GetServer')
IsProd = False$
If Machine _NEC "messa012" and Machine _NEC "mestsa01ec" and Machine _NEC "mestsa09ec" and Machine _NEC "mestsa010ec" and Machine _NEC "mestsa011ec" and Machine _NEC "mestsa012ec" and Machine _NEC "mestsa024ec" and Machine _NEC "MESTST1010" and Machine _NEC "MESTST1009" then
IsProd = True$
end
Response = IsProd
Machine = Environment_Services('GetServer')
IsProd = False$
If Machine _NEC "messa012" and Machine _NEC "mestsa01ec" and Machine _NEC "mestsa09ec" and Machine _NEC "mestsa010ec" and Machine _NEC "mestsa011ec" and Machine _NEC "mestsa012ec" and Machine _NEC "mestsa024ec" and Machine _NEC "MESTST1010" and Machine _NEC "MESTST1009" then
IsProd = True$
end
Response = IsProd
end service
@ -118,13 +118,13 @@ Service GetApplicationRootIP()
Machine = Environment_Services('GetServer')
Begin Case
Case Machine EQ 'MESSA005' ; ApplicationRootIP = '\\messa005.infineon.com'
Case Machine EQ 'MESSA005' ; ApplicationRootIP = '\\messa005.infineon.com'
Case Machine EQ 'MESTSA01EC' ; ApplicationRootIP = '\\10.95.140.13'
Case Machine EQ 'MESTSA09EC' ; ApplicationRootIP = '\\10.95.140.62'
Case Machine EQ 'MESTSA010EC' ; ApplicationRootIP = '\\10.95.140.63'
Case Machine EQ 'MESTSA011EC' ; ApplicationRootIP = '\\10.95.140.64'
Case Machine EQ 'MESTSA012EC' ; ApplicationRootIP = '\\10.95.140.65'
Case Machine EQ 'MESTSA024EC' ; ApplicationRootIP = '\\10.95.140.66'
Case Machine EQ 'MESTSA09EC' ; ApplicationRootIP = '\\10.95.140.62'
Case Machine EQ 'MESTSA010EC' ; ApplicationRootIP = '\\10.95.140.63'
Case Machine EQ 'MESTSA011EC' ; ApplicationRootIP = '\\10.95.140.64'
Case Machine EQ 'MESTSA012EC' ; ApplicationRootIP = '\\10.95.140.65'
Case Machine EQ 'MESTSA024EC' ; ApplicationRootIP = '\\10.95.140.66'
Case Machine EQ 'MESSA012' ; ApplicationRootIP = '\\10.95.176.50'
Case Machine EQ 'MESST5201' ; ApplicationRootIP = '\\10.95.140.14'
Case Machine EQ 'MESST5202' ; ApplicationRootIP = '\\10.95.140.14'
@ -208,15 +208,15 @@ end service
//----------------------------------------------------------------------------------------------------------------------
Service GetSpcFilesharePath()
IsProd = Environment_Services("IsProd")
IsProd = Environment_Services("IsProd")
If IsProd EQ True$ then
Response = '\\mesfs.infineon.com\EC_SPC_Si_Import\TXT'
end else
Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data'
MakeDirSuccess = Utility("MAKEDIR", Path)
Response = Path
end
If IsProd EQ True$ then
Response = '\\mesfs.infineon.com\EC_SPC_Si_Import\TXT'
end else
Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data'
MakeDirSuccess = Utility("MAKEDIR", Path)
Response = Path
end
end service
@ -228,15 +228,15 @@ end service
//----------------------------------------------------------------------------------------------------------------------
Service GetSPCDataPath()
IsProd = Environment_Services("IsProd")
IsProd = Environment_Services("IsProd")
If IsProd EQ True$ then
Response = '\\messa04ec.infineon.com\OI_SPC_Data_Transfer'
end else
Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data'
MakeDirSuccess = Utility("MAKEDIR", Path)
Response = Path
end
If IsProd EQ True$ then
Response = '\\messa04ec.infineon.com\OI_SPC_Data_Transfer'
end else
Path = Environment_Services('GetApplicationRootPath'):'\SPC_Data'
MakeDirSuccess = Utility("MAKEDIR", Path)
Response = Path
end
end service
@ -344,11 +344,11 @@ Service GetLocalRootPath()
Case Machine EQ 'MESSA012' ; LocalRootPath = 'D:'
Case Machine EQ 'MESSA01EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA01EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA09EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA010EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA011EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA012EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA024EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA09EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA010EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA011EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA012EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESTSA024EC' ; LocalRootPath = 'D:'
Case Machine EQ 'MESST6501' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive.
Case Machine EQ 'MESST6502' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive.
Case Machine EQ 'MESTST1006' ; LocalRootPath = 'C:' ; // This is a map to the user's actual C drive.
@ -478,19 +478,19 @@ end service
Service GetSQLScrapeConnectionString()
Machine = Environment_Services('GetServer')
Begin Case
Case Machine = 'MESSA01EC'
// PROD SQL Servers
ConnectionString = 'Provider=MSOLEDBSQL.1;Password=0okm9ijn;Persist Security Info=True;User ID=srpadmin;Initial Catalog=LSL2SQL;Data Source=MESSQLEC1.infineon.com\PROD1,53959;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""'
Case ( (Machine = 'MESTSA01EC') or (Machine = 'MESTSA09EC') or (Machine = 'MESTSA010EC') or (Machine = 'MESTSA011EC') or (Machine = 'MESTSA012EC') )
// DEV SQL Servers
Machine = Environment_Services('GetServer')
Begin Case
Case Machine = 'MESSA01EC'
// PROD SQL Servers
ConnectionString = 'Provider=MSOLEDBSQL.1;Password=0okm9ijn;Persist Security Info=True;User ID=srpadmin;Initial Catalog=LSL2SQL;Data Source=MESSQLEC1.infineon.com\PROD1,53959;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""'
Case ( (Machine = 'MESTSA01EC') or (Machine = 'MESTSA09EC') or (Machine = 'MESTSA010EC') or (Machine = 'MESTSA011EC') or (Machine = 'MESTSA012EC') )
// DEV SQL Servers
ConnectionString = 'Provider=MSOLEDBSQL.1;Password=Fisql2023!;Persist Security Info=True;User ID=fisql;Initial Catalog=LSL2SQL;Data Source=10.95.140.27\TEST1,50572;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""'
Case Otherwise$
// Default to DEV SQL Servers just in case
ConnectionString = 'Provider=MSOLEDBSQL.1;Password=Fisql2023!;Persist Security Info=True;User ID=fisql;Initial Catalog=LSL2SQL;Data Source=10.95.140.27\TEST1,50572;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""'
End Case
Response = ConnectionString
Case Otherwise$
// Default to DEV SQL Servers just in case
ConnectionString = 'Provider=MSOLEDBSQL.1;Password=Fisql2023!;Persist Security Info=True;User ID=fisql;Initial Catalog=LSL2SQL;Data Source=10.95.140.27\TEST1,50572;Initial File Name="";Trust Server Certificate=True;Server SPN="";Authentication="";Access Token=""'
End Case
Response = ConnectionString
end service
@ -515,65 +515,65 @@ end service
Service GetTempPath()
TempDirectory = Str(\00\, 1024)
GetTempPath(Len(TempDirectory), TempDirectory)
Convert \00\ to '' in TempDirectory
Response = TempDirectory
TempDirectory = Str(\00\, 1024)
GetTempPath(Len(TempDirectory), TempDirectory)
Convert \00\ to '' in TempDirectory
Response = TempDirectory
end service
Service GetMonaResource()
If Environment_Services("IsProd") then
Response = "OPENINSIGHT_MES_OP_FE"
end else
Response = "OPENINSIGHT_MES_OP_FE_DEV"
end
If Environment_Services("IsProd") then
Response = "OPENINSIGHT_MES_OP_FE"
end else
Response = "OPENINSIGHT_MES_OP_FE_DEV"
end
end service
Service GetMonInBufferedWorkerApiUrl()
If Environment_Services("IsProd") then
Response = "https://messa014.infineon.com:7851"
end else
Response = "https://mestsa008.infineon.com:7851"
end
If Environment_Services("IsProd") then
Response = "https://messa014.infineon.com:7851"
end else
Response = "https://mestsa008.infineon.com:7851"
end
end service
Service GetProveInApiUrl()
If Environment_Services("IsProd") then
Response = "https://messa014.infineon.com:8851"
end else
Response = "https://mestsa008.infineon.com:8851"
end
If Environment_Services("IsProd") then
Response = "https://messa014.infineon.com:8851"
end else
Response = "https://mestsa008.infineon.com:8851"
end
end service
Service GetIfxEmailServer()
Response = 'smtp.intra.infineon.com'
Response = 'smtp.intra.infineon.com'
end service
Service GetEnvironmentVariable(VariableName)
If VariableName NE '' then
VarLength = GetEnvironmentVariable(VariableName, "", 0) + 1
VarValue = space(VarLength+1)
VarLength = GetEnvironmentVariable(VariableName, VarValue, VarLength)
VarValue = VarValue[1, VarLength]
Response = VarValue
end else
Error_Services('Add', 'Error in service ':Service:'. Null VariableName passed in')
end
If VariableName NE '' then
VarLength = GetEnvironmentVariable(VariableName, "", 0) + 1
VarValue = space(VarLength+1)
VarLength = GetEnvironmentVariable(VariableName, VarValue, VarLength)
VarValue = VarValue[1, VarLength]
Response = VarValue
end else
Error_Services('Add', 'Error in service ':Service:'. Null VariableName passed in')
end
end service
@ -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

@ -73,7 +73,7 @@ Declare subroutine Database_Services, SRP_JSON, Error_Services, Extract_Si_Keys,
Declare subroutine Logging_Services, Btree.Extract, Update_Index, Delay
GoToService else
Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
end
Return Response else ''
@ -96,7 +96,7 @@ Service GetComments(WMOutNo)
CommentArray = ''
WMOutRow = Database_Services('ReadDataRow', 'WM_OUT', WMOutNo)
CommentDates = Oconv(WMOutRow<WM_OUT_EPP_COMMENT_DATE$>, 'DT')
CommentDates = Oconv(WMOutRow<WM_OUT_EPP_COMMENT_DATE$>, 'DT')
CommentUsers = WMOutRow<WM_OUT_EPP_COMMENT_USER$>
Comments = WMOutRow<WM_OUT_EPP_COMMENT_NOTE$>
@ -121,25 +121,25 @@ Service AddComment(WMOutNo, Comment, UsernameOpt)
WMOutRow = Database_Services('ReadDataRow', 'WM_OUT', WMOutNo)
UserName = @USER4
If Assigned(UsernameOpt) then
If UsernameOpt NE '' then
Username = UsernameOpt
end
end
If UsernameOpt NE '' then
Username = UsernameOpt
end
end
CommentTime = Datetime()
OldDates = WMOutRow<WM_OUT_EPP_COMMENT_DATE$>
OldUsers = WMOutRow<WM_OUT_EPP_COMMENT_USER$>
OldDates = WMOutRow<WM_OUT_EPP_COMMENT_DATE$>
OldUsers = WMOutRow<WM_OUT_EPP_COMMENT_USER$>
OldComments = WMOutRow<WM_OUT_EPP_COMMENT_NOTE$>
If (OldDates EQ '' AND OldUsers EQ '' AND OldComments EQ '') then
WMOutRow<WM_OUT_EPP_COMMENT_DATE$> = CommentTime
WMOutRow<WM_OUT_EPP_COMMENT_USER$> = UserName
WMOutRow<WM_OUT_EPP_COMMENT_NOTE$> = Comment
end else
WMOutRow<WM_OUT_EPP_COMMENT_DATE$> = CommentTime :@VM: OldDates
WMOutRow<WM_OUT_EPP_COMMENT_USER$> = UserName :@VM: OldUsers
WMOutRow<WM_OUT_EPP_COMMENT_NOTE$> = Comment :@VM: OldComments
end
Database_Services('WriteDataRow', 'WM_OUT', WMOutNo, WMOutRow, 1, 0, 0)
If (OldDates EQ '' AND OldUsers EQ '' AND OldComments EQ '') then
WMOutRow<WM_OUT_EPP_COMMENT_DATE$> = CommentTime
WMOutRow<WM_OUT_EPP_COMMENT_USER$> = UserName
WMOutRow<WM_OUT_EPP_COMMENT_NOTE$> = Comment
end else
WMOutRow<WM_OUT_EPP_COMMENT_DATE$> = CommentTime :@VM: OldDates
WMOutRow<WM_OUT_EPP_COMMENT_USER$> = UserName :@VM: OldUsers
WMOutRow<WM_OUT_EPP_COMMENT_NOTE$> = Comment :@VM: OldComments
end
Database_Services('WriteDataRow', 'WM_OUT', WMOutNo, WMOutRow, 1, 0, 0)
End Service
@ -169,9 +169,9 @@ Service ConvertRecordToJSON(KeyID, Record, ItemURL)
SRP_JSON(objWMOut, 'SetValue', 'CURR_WFR_CNT', CurrWfrQty)
CustNo = Database_Services('ReadDataColumn', 'WO_LOG', {WO_NO}, WO_LOG_CUST_NO$, True$, 0, False$)
CustReshipNo = Database_Services('ReadDataColumn', 'WO_MAT', WoMatKey, WO_MAT_RESHIP_CUST_NO$, True$, 0, False$)
If CustReshipNo NE '' then
CustNo = CustReshipNo
end
If CustReshipNo NE '' then
CustNo = CustReshipNo
end
CustName = Database_Services('ReadDataColumn', 'COMPANY', CustNo, COMPANY_CO_NAME$, True$, 0, False$)
CustAbbrev = Database_Services('ReadDataColumn', 'COMPANY', CustNo, COMPANY_ABBREV$, True$, 0, False$)
SRP_JSON(objWMOut, 'SetValue', 'CustNo', CustNo)
@ -231,13 +231,13 @@ Service ConvertRecordToJSON(KeyID, Record, ItemURL)
For each RTFRecordId in AllRTFRecords using @VM setting vPos
objRTF = ''
If SRP_JSON(objRTF, 'New', 'Object') then
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFRecordId, True$, 0, False$)
SRP_JSON(objRTF, 'SetValue', 'ReturnToFabLotsId', RTFRecordId)
SRP_JSON(objRTF, 'SetValue', 'StartDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$>, 'DT'))
SRP_JSON(objRTF, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
SRP_JSON(objRTFRecords, 'Set', 'ReturnToFabRecord', objRTF)
SRP_JSON(objRTFRecords, 'Add', objRTF)
SRP_JSON(objRTF, 'Release')
RTFRecord = Database_Services('ReadDataRow', 'RETURN_TO_FAB_LOTS', RTFRecordId, True$, 0, False$)
SRP_JSON(objRTF, 'SetValue', 'ReturnToFabLotsId', RTFRecordId)
SRP_JSON(objRTF, 'SetValue', 'StartDtm', OConv(RTFRecord<RETURN_TO_FAB_LOTS_MH_INIT_DTM$>, 'DT'))
SRP_JSON(objRTF, 'SetValue', 'Completed', RTFRecord<RETURN_TO_FAB_LOTS_COMPLETED$>, 'Boolean')
SRP_JSON(objRTFRecords, 'Set', 'ReturnToFabRecord', objRTF)
SRP_JSON(objRTFRecords, 'Add', objRTF)
SRP_JSON(objRTF, 'Release')
end
Next RTFRecordId
@ -333,28 +333,28 @@ Service GetWMOData(WorkOrderNo, Columns, ShowGasGauge, WMOOverrideList)
If Error_Services('NoError') then
For each Column in Columns using @VM setting vPos
Begin Case
Case Column EQ 'HOLD'
HoldStatus = Calculate(Column)
If HoldStatus EQ True$ then
HoldStatus = 'On Hold'
end else
HoldStatus = 'Off Hold'
end
WMOList<fPos, vPos> = HoldStatus
Case Otherwise$
Val = Calculate(Column)
Conv = Xlate('DICT.WM_OUT', Column, DICT_CONV$, 'X')
If Conv NE '' then
Val = OConv(Val, Conv)
end
WMOList<fPos, vPos> = Val
Case Column EQ 'HOLD'
HoldStatus = Calculate(Column)
If HoldStatus EQ True$ then
HoldStatus = 'On Hold'
end else
HoldStatus = 'Off Hold'
end
WMOList<fPos, vPos> = HoldStatus
Case Otherwise$
Val = Calculate(Column)
Conv = Xlate('DICT.WM_OUT', Column, DICT_CONV$, 'X')
If Conv NE '' then
Val = OConv(Val, Conv)
end
WMOList<fPos, vPos> = Val
End Case
Next Column
end else
Error_Services('Add', 'Error reading WM_OUT Record ' : @ID : ' in the ' : Service : ' service.')
end
* update the gauge
If ShowGasGauge then Msg(@Window, MsgUp, fPos, MSGINSTUPDATE$)
If ShowGasGauge then Msg(@Window, MsgUp, fPos, MSGINSTUPDATE$)
Next @ID
end else
Error_Services('Add', 'Error opening WM_OUT dictionary in the ' : Service : ' service.')
@ -410,44 +410,44 @@ Service GetWaferMap(WMOKey)
end service
Service SetVoidFlag(WMOutKey, Username)
ErrorMessage = ''
If RowExists('WM_OUT', WMOutKey) then
WMOutRec = Database_Services('ReadDataRow', 'WM_OUT', WMOutKey, True$, 0, False$)
If Error_Services('NoError') then
WMOutRec<WM_OUT_VOID$> = True$
Database_Services('WriteDataRow', 'WM_OUT', WMOutKey, WMOutRec, True$, False, False$)
If Error_Services('NoError') then
Set_Status(0)
WONo = Field(WMOutKey, '*', 1)
CassNo = Field(WMOutKey, '*', 3)
WOMLParms = ''
LogFile = 'WO_MAT' ; WOMLParms = LogFile:@RM
LogDTM = OConv(Datetime(), 'DT') ; WOMLParms := LogDTM:@RM
Action = 'WM_OUT_VOID' ; WOMLParms := Action:@RM
WhCd = 'CR' ; WOMLParms := WhCd:@RM
LocCd = 'VOID' ; WOMLParms := LocCd:@RM
WONos = WONo ; WOMLParms := WONos:@RM
CassNos = CassNo ; WOMLParms := CassNos:@RM
UserID = Username ; WOMLParms := UserID:@RM
Tags = '' ; WOMLParms := Tags:@RM
ToolID = '' ; WOMLParms := ToolID:@RM
WOMLParms := ''
obj_WO_Mat_Log('Create',WOMLParms)
IF Get_Status(errCode) THEN
ErrorMessage = 'Error writing inventory transactions'
end
end else
ErrorMessage = 'Failed to write to the WM_OUT record ' : WMOutKey : ' while attempting to set void status.'
end
end else
ErrorMessage = 'Failed to read WM_OUT record ' : WMOutKey : ' while attempting to set void status.'
end
end else
ErrorMessage = 'Invalid WM_OUT Key ' : WMOutKey : ' passed to SetVoidFlag routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
ErrorMessage = ''
If RowExists('WM_OUT', WMOutKey) then
WMOutRec = Database_Services('ReadDataRow', 'WM_OUT', WMOutKey, True$, 0, False$)
If Error_Services('NoError') then
WMOutRec<WM_OUT_VOID$> = True$
Database_Services('WriteDataRow', 'WM_OUT', WMOutKey, WMOutRec, True$, False, False$)
If Error_Services('NoError') then
Set_Status(0)
WONo = Field(WMOutKey, '*', 1)
CassNo = Field(WMOutKey, '*', 3)
WOMLParms = ''
LogFile = 'WO_MAT' ; WOMLParms = LogFile:@RM
LogDTM = OConv(Datetime(), 'DT') ; WOMLParms := LogDTM:@RM
Action = 'WM_OUT_VOID' ; WOMLParms := Action:@RM
WhCd = 'CR' ; WOMLParms := WhCd:@RM
LocCd = 'VOID' ; WOMLParms := LocCd:@RM
WONos = WONo ; WOMLParms := WONos:@RM
CassNos = CassNo ; WOMLParms := CassNos:@RM
UserID = Username ; WOMLParms := UserID:@RM
Tags = '' ; WOMLParms := Tags:@RM
ToolID = '' ; WOMLParms := ToolID:@RM
WOMLParms := ''
obj_WO_Mat_Log('Create',WOMLParms)
IF Get_Status(errCode) THEN
ErrorMessage = 'Error writing inventory transactions'
end
end else
ErrorMessage = 'Failed to write to the WM_OUT record ' : WMOutKey : ' while attempting to set void status.'
end
end else
ErrorMessage = 'Failed to read WM_OUT record ' : WMOutKey : ' while attempting to set void status.'
end
end else
ErrorMessage = 'Invalid WM_OUT Key ' : WMOutKey : ' passed to SetVoidFlag routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
@ -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/')
@ -209,7 +212,7 @@ end service
// determines if extended data related to wafers, product versions, and recipe should be included. The default is false.
//----------------------------------------------------------------------------------------------------------------------
Service GetWorkOrder(WorkOrderNo, ExtendedData)
SRP_Stopwatch('Start', Service)
SRP_Stopwatch('Start', Service)
If ExtendedData NE True$ then ExtendedData = False$
ServiceKeyID := '*' : WorkOrderNo
@ -271,7 +274,7 @@ SRP_Stopwatch('Start', Service)
end
Response = WorkOrder
SRP_Stopwatch('Stop', Service)
SRP_Stopwatch('Stop', Service)
end service
@ -985,14 +988,14 @@ Service UpdateWOStepStatus(WONo)
WOStepKey = WONo:'*':1
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
WOStepCurrStatus = obj_WO_Step('CurrStatus', WOStepKey:@RM:WOStepRec)
// Get a fresh copy of the record
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
WOStepCurrStatusStatic = WOStepRec<WO_STEP_CURR_STATUS_STATIC$>
If WOStepCurrStatus NE WOStepCurrStatusStatic then
WOStepRec<WO_STEP_CURR_STATUS_STATIC$> = WOStepCurrStatus
Database_Services('WriteDataRow', 'WO_STEP', WOStepKey, WOStepRec, True$, False$, True$)
end
Database_Services('ReleaseKeyIDLock', 'WO_STEP', WOStepKey)
// Get a fresh copy of the record
WOStepRec = Database_Services('ReadDataRow', 'WO_STEP', WOStepKey)
WOStepCurrStatusStatic = WOStepRec<WO_STEP_CURR_STATUS_STATIC$>
If WOStepCurrStatus NE WOStepCurrStatusStatic then
WOStepRec<WO_STEP_CURR_STATUS_STATIC$> = WOStepCurrStatus
Database_Services('WriteDataRow', 'WO_STEP', WOStepKey, WOStepRec, True$, False$, True$)
end
Database_Services('ReleaseKeyIDLock', 'WO_STEP', WOStepKey)
end
end service
@ -1849,34 +1852,34 @@ end service
Service RemoveWoMatCassetteFromWO(WoMatKey, Username)
ErrorMessage = ''
If RowExists('WO_MAT', WoMatKey) then
WoNo = Field(WoMatKey, '*', 1)
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WoNo, True$, 0, False$)
If Error_Services('NoError') then
WoMatKeys = WOLogRecord<WO_LOG_WO_MAT_KEY$>
Locate WoMatKey in WoMatKeys using @VM setting CassPos then
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
Database_Services('WriteDataRow', 'WO_LOG', WoNo, WoLogRecord)
If Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
Work_Order_Services('UpdateReleasedQty', WONo)
Work_Order_Services('UpdateUnscheduledQuantities')
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = "Unable to locate cass no " : WoMatKey : ' in the WO_LOG ' : WoNo : ' Record.'
end
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Invalid WoMat Key ' : WoMatKey : ' passed to RemoveWoMatCassetteFromWO routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
ErrorMessage = ''
If RowExists('WO_MAT', WoMatKey) then
WoNo = Field(WoMatKey, '*', 1)
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WoNo, True$, 0, False$)
If Error_Services('NoError') then
WoMatKeys = WOLogRecord<WO_LOG_WO_MAT_KEY$>
Locate WoMatKey in WoMatKeys using @VM setting CassPos then
WoLogRecord<WO_LOG_WO_MAT_KEY$> = Delete(WOLogRecord<WO_LOG_WO_MAT_KEY$>, 1, CassPos, 0)
Database_Services('WriteDataRow', 'WO_LOG', WoNo, WoLogRecord)
If Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
Work_Order_Services('UpdateReleasedQty', WONo)
Work_Order_Services('UpdateUnscheduledQuantities')
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = "Unable to locate cass no " : WoMatKey : ' in the WO_LOG ' : WoNo : ' Record.'
end
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Invalid WoMat Key ' : WoMatKey : ' passed to RemoveWoMatCassetteFromWO routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
end service
@ -1894,7 +1897,7 @@ Service CreateVoidedLotRecord(LotId, LegacyLotId, LegacyLotType, WoMatKey, UserI
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Invalid Legacy Lot Type passed to routine.'
ErrorMessage = 'Invalid Legacy Lot Type passed to routine.'
end
end else
ErrorMessage = 'A Legacy lot ID was passed to the routine, but the legacy lot type was null.'
@ -1951,10 +1954,10 @@ end service
Service SignVoidNonEpp(WOMatKeys, WONo, Username)
ErrorMessage = ''
ErrorMessage = ''
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
if Error_Services('NoError') then
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
if Error_Services('NoError') then
for each WoMatKey in WOMatKeys using @VM
if WoMatKey NE '' then
CassNo = Field(WoMatKey, '*', 2)
@ -2001,16 +2004,16 @@ Service SignVoidNonEpp(WOMatKeys, WONo, Username)
ErrorMessage = Error_Services('GetMessage')
end
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
Work_Order_Services('UpdateReleasedQty', WONo)
Work_Order_Services('UpdateUnscheduledQuantities')
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
@ -2020,10 +2023,10 @@ end service
Service SignVoidWMI(WMInKeys, WONo, Username)
ErrorMessage = ''
ErrorMessage = ''
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
if Error_Services('NoError') then
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
if Error_Services('NoError') then
for each WmInKey in WMInKeys using @VM
if WmInKey NE '' then
WONo = Field(WMInKey, '*', 1)
@ -2079,36 +2082,36 @@ Service SignVoidWMI(WMInKeys, WONo, Username)
ErrorMessage = Error_Services('GetMessage')
end
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
Work_Order_Services('UpdateReleasedQty', WONo)
Work_Order_Services('UpdateUnscheduledQuantities')
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WoNo
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WoNo
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WoNo
LogData<4> = 'Void queued successfully.'
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WoNo
LogData<4> = 'Void queued successfully.'
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
end service
@ -2116,10 +2119,10 @@ end service
Service SignVoidWMO(WMOutKeys, WONo, Username)
ErrorMessage = ''
ErrorMessage = ''
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
If Error_Services('NoError') then
WOLogRecord = Database_Services('ReadDataRow', 'WO_LOG', WONo, True$, 0, False$)
If Error_Services('NoError') then
for each WmOutKey in WMOutKeys using @VM
if WmOutKey NE '' then
WONo = Field(WmOutKey, '*', 1)
@ -2175,36 +2178,36 @@ Service SignVoidWMO(WMOutKeys, WONo, Username)
ErrorMessage = Error_Services('GetMessage')
end
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
If ErrorMessage EQ '' then
//Commit work order changes all at once here.
Database_Services('WriteDataRow', 'WO_LOG', WONo, WoLogRecord)
if Error_Services('NoError') then
Work_Order_Services('UpdateReceivedQty', WONo)
Work_Order_Services('UpdateReleasedQty', WONo)
Work_Order_Services('UpdateUnscheduledQuantities')
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
end else
Error_Services('Add', ErrorMessage)
end
If ErrorMessage NE '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WONo
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = WONo
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = ''
LogData<4> = 'Void processed successfully.'
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Username
LogData<3> = ''
LogData<4> = 'Void processed successfully.'
Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
end service
@ -2219,17 +2222,17 @@ Service GetEligiblePeelOffLotsByWOAndEntityType(WONo, EntityType)
Case EntityType EQ 'RDS'
CassIds = Database_Services('ReadDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, True$, 0, False$)
for each CassId in CassIds using @VM
RDSNo = XLATE('WO_MAT', CassId, WO_MAT_RDS_NO$, 'X')
Signatures = Signature_Services('GetSigProfile', CassId, 0, RDSNo)
Eligible = True$
for each Signature in Signatures<1> using @VM setting SigPos
SignatureDtm = Signatures<3, SigPos>
If SignatureDtm NE '' then
Eligible = False$
end
Until Eligible EQ False$
Next Signature
If Eligible then EligibleCassIds<1, -1> = CassId
RDSNo = XLATE('WO_MAT', CassId, WO_MAT_RDS_NO$, 'X')
Signatures = Signature_Services('GetSigProfile', CassId, 0, RDSNo)
Eligible = True$
for each Signature in Signatures<1> using @VM setting SigPos
SignatureDtm = Signatures<3, SigPos>
If SignatureDtm NE '' then
Eligible = False$
end
Until Eligible EQ False$
Next Signature
If Eligible then EligibleCassIds<1, -1> = CassId
Next CassId
Case EntityType EQ 'WM_OUT'
//WM_OUTS can be voided when
@ -2268,7 +2271,7 @@ Service GetEligiblePeelOffLotsByWOAndEntityType(WONo, EntityType)
Until Eligible EQ False$
Next UMWCass
end
If Eligible then EligibleCassIds<1, -1> = CassId
If Eligible then EligibleCassIds<1, -1> = CassId
Next CassId
Case EntityType EQ 'WM_IN'
WOStepKey = XLATE('WO_LOG', WONo, WO_LOG_WO_STEP_KEY$, 'X')
@ -2295,7 +2298,7 @@ Service GetEligiblePeelOffLotsByWOAndEntityType(WONo, EntityType)
Until Eligible EQ False$
Next NCR
end
If Eligible then EligibleCassIds<1, -1> = CassId
If Eligible then EligibleCassIds<1, -1> = CassId
Next CassId
Case EntityType EQ ''
ErrorMessage = 'Entity type parameter was invalid.'
@ -2316,17 +2319,17 @@ end service
Service UpdateOpenWorkOrderStatuses()
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID then
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID then
StatusName = Service
StatusName = Service
IsProd = Environment_Services('IsProd')
If IsProd then
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_SERVICE_MANAGER'
end else
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_DEV_SERVICE_MANAGER'
end
MonaStatus = 'ok'
MonaStatus = 'ok'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG'
LogDate = Oconv(Date(), 'D4/')
@ -2349,25 +2352,25 @@ Service UpdateOpenWorkOrderStatuses()
Extract_Si_Keys('WO_LOG', 'CLOSE_DATE', '', OpenWoLogKeys)
If Not(Get_Status(ErrCode)) then
If OpenWoLogKeys NE '' then
OpenWoLogKeys = SRP_Array('SortSimpleList', OpenWoLogKeys, 'AscendingNumbers', @VM)
LastOpenWoUpdated = ''
ServiceKey = UCase(Service)
If RowExists('APP_INFO', ServiceKey) then
LastOpenWoUpdated = Database_Services('ReadDataRow', 'APP_INFO', ServiceKey)
end
If (LastOpenWoUpdated NE '') then
Locate LastOpenWoUpdated in OpenWoLogKeys using @VM setting vPos then
vPos += 1
end else
vPos = 1
end
end else
vPos = 1
end
NextOpenWoLogKey = OpenWoLogKeys<0, vPos>
Database_Services('WriteDataRow', 'APP_INFO', ServiceKey, NextOpenWoLogKey, True$, False$, False$)
If NextOpenWoLogKey NE '' then
Work_Order_Services('UpdateWorkOrderStatus', NextOpenWoLogKey)
OpenWoLogKeys = SRP_Array('SortSimpleList', OpenWoLogKeys, 'AscendingNumbers', @VM)
LastOpenWoUpdated = ''
ServiceKey = UCase(Service)
If RowExists('APP_INFO', ServiceKey) then
LastOpenWoUpdated = Database_Services('ReadDataRow', 'APP_INFO', ServiceKey)
end
If (LastOpenWoUpdated NE '') then
Locate LastOpenWoUpdated in OpenWoLogKeys using @VM setting vPos then
vPos += 1
end else
vPos = 1
end
end else
vPos = 1
end
NextOpenWoLogKey = OpenWoLogKeys<0, vPos>
Database_Services('WriteDataRow', 'APP_INFO', ServiceKey, NextOpenWoLogKey, True$, False$, False$)
If NextOpenWoLogKey NE '' then
Work_Order_Services('UpdateWorkOrderStatus', NextOpenWoLogKey)
If Error_Services('HasError') then
LogData<1> = OConv(Datetime(), 'DT/^S')
ErrorMsg = 'Error calling UpdateWorkOrderStatus for WO_LOG ':NextOpenWoLogKey:'. ':Error_Services('GetMessage')
@ -2375,7 +2378,7 @@ Service UpdateOpenWorkOrderStatuses()
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
MonaStatus = 'critical'
end
end
end
end else
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'No open work orders to update.'
@ -2623,17 +2626,17 @@ end service
Service UpdateWorkOrderData(WONo)
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID:'*':WONo then
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
Lock hSysLists, ServiceKeyID:'*':WONo then
StatusName = Service
StatusName = Service
IsProd = Environment_Services('IsProd')
If IsProd then
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_SERVICE_MANAGER'
end else
MonaResource = 'GRP_OPENINSIGHT_MES_OP_FE_DEV_SERVICE_MANAGER'
end
MonaStatus = 'ok'
MonaStatus = 'ok'
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_MAT'
LogDate = Oconv(Date(), 'D4/')
@ -2686,59 +2689,59 @@ Service UpdateWorkOrderData(WONo)
WM_Out_Services('VerifyWOLogWMOKeyIndex', WMOKey)
end
end
RDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
If (RDSNo NE '') then
If (DCount(RDSNo, @VM) GT 1) then
NewRDSNo = ''
NumRDS = 0
For each RDSKey in RDSNo using @VM setting vPos
If RowExists('RDS', RDSKey) then
NumRDS += 1
NewRDSNo = RDSKey
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end
Next RDSKey
If (NumRDS EQ 1) then
Transaction_Services('PostWriteFieldTransaction', 'WO_MAT', WOMatKey, WO_MAT_RDS_NO$, NewRDSNo)
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'Multiple RDS records associated with WO_MAT ':WOMatKey:'.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end else
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end
end else
If Not(EpiPro) then
Query = 'SELECT RDS WITH WO EQ ':WONo:' AND WITH CASS_NO EQ ':CassNo
RList(Query, TARGET_ACTIVELIST$, '', '', '')
ErrCode = ''
If Not(Get_Status(ErrCode)) then
ReadNext RDSNo then
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'No RDS found for WO_MAT ':WOMatKey:'.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'Error calling RList to find RDSNo associated with WO_MAT ':WOMatKey:'. Error code: ':ErrCode
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end
end
Voided = Xlate('WO_MAT', WOMatKey, 'VOID', 'X')
If Not(Voided) then NewWOLogWOMatKeys<0, -1> = WOMatKey
RDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X')
If (RDSNo NE '') then
If (DCount(RDSNo, @VM) GT 1) then
NewRDSNo = ''
NumRDS = 0
For each RDSKey in RDSNo using @VM setting vPos
If RowExists('RDS', RDSKey) then
NumRDS += 1
NewRDSNo = RDSKey
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end
Next RDSKey
If (NumRDS EQ 1) then
Transaction_Services('PostWriteFieldTransaction', 'WO_MAT', WOMatKey, WO_MAT_RDS_NO$, NewRDSNo)
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'Multiple RDS records associated with WO_MAT ':WOMatKey:'.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end else
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end
end else
If Not(EpiPro) then
Query = 'SELECT RDS WITH WO EQ ':WONo:' AND WITH CASS_NO EQ ':CassNo
RList(Query, TARGET_ACTIVELIST$, '', '', '')
ErrCode = ''
If Not(Get_Status(ErrCode)) then
ReadNext RDSNo then
RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo)
RDS_Services('VerifyWOMatRDSNoIndex', RDSNo)
RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo)
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'No RDS found for WO_MAT ':WOMatKey:'.'
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end else
MonaStatus = 'critical'
LogData<1> = OConv(Datetime(), 'DT/^S')
LogData<4> = 'Error calling RList to find RDSNo associated with WO_MAT ':WOMatKey:'. Error code: ':ErrCode
Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM)
end
end
end
Voided = Xlate('WO_MAT', WOMatKey, 'VOID', 'X')
If Not(Voided) then NewWOLogWOMatKeys<0, -1> = WOMatKey
end else
Done = True$
end
@ -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'