Merged PR 18416: Added in additional fields to response. Expected wafer map and a check for to...

Added in additional fields to response. Expected wafer map and a check for tool being down, as well as logging to API Endpoints

Related work items: #137427
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-06-10 18:55:24 +02:00
parent ebd8b36d13
commit de6296b1d3
2 changed files with 472 additions and 2 deletions

View File

@ -32,6 +32,8 @@ $Insert WO_LOG_EQUATES
$Insert WM_OUT_EQUATES
$Insert RLIST_EQUATES
$Insert WAFER_COUNTER_EQUATES
$Insert TOOL_EQUATES
$Insert TOOL_LOG_EQUATES
Equ Tab$ to \09\
Equ CRLF$ to \0D0A\
@ -43,8 +45,9 @@ Equ next_cur$ To 1
Equ add_exist$ to 2
Declare subroutine Error_Services, Database_Services, Logging_Services, Httpclient_Services, Reduce, SRP_JSON
Declare function Database_Services, Environment_Services, Logging_Services, Httpclient_Services
Declare function RTI_CreateGuid, SRP_JSON
Declare subroutine Wafer_Counter_Services, Lot_Event_Services
Declare function Database_Services, Environment_Services, Logging_Services, Httpclient_Services, OConv
Declare function RTI_CreateGuid, SRP_JSON, WO_Mat_Services, WM_Out_Services, Wafer_Counter_Services, Datetime
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WaferCounter'
LogDate = Oconv(Date(), 'D4/')
@ -263,6 +266,8 @@ Service AddScan(LotID, ScanQty, ScanDtm, ScanTool, ScanUser, ScanLocation, Wafer
Record<WAFER_COUNTER.SCAN_WAFER_MAP$> = WaferMap
Database_Services('WriteDataRow', 'WAFER_COUNTER', KeyID, Record)
Response = KeyId
end service
@ -393,6 +398,161 @@ Service GetWaferCounterToolID(WaferSize=WAFER_SIZES, Location=LOCATIONS)
end service
//----------------------------------------------------------------------------------------------------------------------
// ProcessCass2DBarcode
//
// Takes in the raw barcode data for a 2D Cassette label. Returns a single field array with 3 field delimited by @VM
// CassId, Expected Qty, and Cass Type
//----------------------------------------------------------------------------------------------------------------------
Service ProcessCass2DBarcode(BarcodeText)
ErrorMessage = ''
ExpectedSlotWaferMap = ''
ExpectedQty = ''
CassId = ''
CassType = ''
If BarcodeText NE '' then
DelimCnt = DCount(BarcodeText, '|')
If DelimCnt EQ 8 then
CassId = Field(BarcodeText, '|', 3)
If CassId NE '' then
If CassId[1, 2] EQ '1T' then
CassId[1, 2] = ''
Begin Case
Case CassId[1, 1] EQ 'O'
CassId[1, 1] = ''
CassType = 'WM_OUT'
Case (CassId[1, 1] EQ 'I')
CassId[1, 1] = ''
CassType = 'WM_IN'
Case Otherwise$
CassType = 'RDS'
End Case
Convert '.' to '*' in CassId
Begin Case
Case RowExists('RDS', CassId)
ExpectedQty = Xlate('RDS', CassId, 'WFRS_OUT', 'X')
Case RowExists('WM_OUT', CassId)
ExpectedQty = Xlate('WM_OUT', CassId, 'WAFER_CNT', 'X')
End Case
end
end else
ErrorMessage = 'Invalid Lot Label Scan. Unable to determine Cass Id'
end
end else
ErrorMessage = 'Invalid Lot Label Scan.'
end
end else
ErrorMessage = 'Scan data was null.'
end
If ErrorMessage EQ '' then
Response = CassId : @VM: ExpectedQty : @VM : CassType
end else
Error_Services('Add', ErrorMessage)
end
end service
//----------------------------------------------------------------------------------------------------------------------
// ProcessTool2DBarcode
//
// Takes in the raw barcode data for a wafer counter label, Cassette Id, Cassette Type, and UserId(Optional)
// Returns a key ID for a completed WAFER_COUNTER record.
//----------------------------------------------------------------------------------------------------------------------
Service ProcessTool2DBarcode(BarcodeText, CassId, CassType, UserId)
ErrorMessage = ''
If BarcodeText NE '' then
DelimCnt = DCount(BarcodeText, '|')
If DelimCnt EQ 2 then
WaferSize = Field(BarcodeText, '|', 1)
Area = Field(BarcodeText, '|', 2)
If Environment_Services('IsProd') then
WcJson = Wafer_Counter_Services('GetWaferCounterJSON', WaferSize, Area, CassID)
end else
WcJson = Wafer_Counter_Services('GetWaferCounterJSONTestData', WaferSize, Area, CassID)
end
If Error_Services('NoError') then
objJSON = ''
If SRP_JSON(objJSON, 'Parse', WcJson) EQ '' then
ScanDtm = SRP_JSON(objJSON, 'GetValue', 'dateTimeFormatted')
ToolID = SRP_JSON(objJSON, 'GetValue', 'equipmentId')
WaferCount = SRP_JSON(objJSON, 'GetValue', 'total')
SlotMap = SRP_JSON(objJSON, 'GetValue', 'slotMap')
SRP_JSON(objJSON, 'Release')
ToolCurrModeKey = Database_Services('ReadDataColumn', 'TOOL', ToolId, TOOL_CURR_MODE_KEY$, True$, 0, False$)
ToolCurrMode = Database_Services('ReadDataColumn', 'TOOL_LOG', ToolCurrModeKey, TOOL_LOG_TOOL_MODE$, True$, 0, False$)
If ToolCurrMode EQ 'PROD' OR ToolCurrMode EQ 'LIM' then
WaferCounterId = Wafer_Counter_Services('AddScan', CassID, WaferCount, ScanDtm, ToolID, UserId, Area, SlotMap)
If Error_Services('NoError') then
Lot_Event_Services('CreateLotEvent', CassId, ScanDtm, 'WAFER_COUNTER', 'Wafer counter data received for lot. ' : WaferCount : ' wafers found.', ToolId, UserId, True$, CassType)
end
end else
ErrorMessage = 'Wafer counter is currently down and cannot be used to log wafer counts.'
end
end else
ErrorMessage = 'Error parsing response from wafer counter.'
end
end else
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Invalid tool scan.'
end
end else
ErrorMessage = 'Scan data was null.'
end
If ErrorMessage EQ '' then
Response = WaferCounterId
end else
Error_Services('Add', ErrorMessage)
end
end service
//----------------------------------------------------------------------------------------------------------------------
// GetWaferCounterJSONTestData
//
// Emulates GetWaferCounterJson service.
//----------------------------------------------------------------------------------------------------------------------
Service GetWaferCounterJSONTestData(WaferSize, ToolLocation, CassID)
If ( (WaferSize NE '') and (ToolLocation NE '') and (CassID NE '') ) then
Response = ''
objJson = ''
If SRP_JSON(objJson, 'New', 'Object') then
SRP_JSON(objJson, 'SetValue', 'dateTimeFormatted', Datetime(), 'String')
SRP_JSON(objJson, 'SetValue', 'equipmentId', 'WC8INCH1', 'String')
SRP_JSON(objJson, 'SetValue', 'total', 24, 'Number')
SRP_JSON(objJson, 'SetValue', 'slotMap', '1111111110111111111111111', 'String')
Response = SRP_Json(objJson, 'Stringify', 'Styled')
SRP_JSON(objJSON, 'Release')
end
If Error_Services('NoError') then
StatusCode = 200
If StatusCode NE 200 then
Begin Case
Case Response EQ ''
ErrorMsg = 'Unexpected server error.'
Case Response EQ 'No files!'
ErrorMsg = 'No data. Please re-seat cassette and try again.'
Case Otherwise$
// Use message in response body to populate error services
ErrorMsg = Response
End Case
Error_Services('Add', ErrorMsg)
end
end
end
end service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -405,3 +565,4 @@ ClearCursors:
return