Fixed some error throwing in LOT_SERVICES

This commit is contained in:
Infineon\StieberD
2025-07-01 09:30:22 -07:00
parent fd55fe06a9
commit ff0036d4c2

View File

@ -1,10 +1,56 @@
Compile function Lot_Services(@Service, @Params)
#pragma precomp SRP_PreCompiler
/***********************************************************************************************************************
$insert APP_INSERTS
Name : Lot_Services
Description : Handler program for all LOT services.
Notes : Application errors should be logged using the Error Services module. There are a few methodological
assumptions built into way errors are managed which are important to understand in order to properly
work with Error Services:
- The term 'top' refers to the originating procedure of a call stack and the term 'bottom' refers to
the last routine (or the current routine) within a call stack. Within the OpenInsight Debugger
this will appear backwards since the originating procedure always appears at the bottom of the
list and the current routine appears at the top of the list. We are using this orientation because
it is common to refer to the process of calling other procedures as 'drilling down'.
- The reason for defining the orientation of the call stack is because Error_Services allows for
multiple error conditions to be appended to an original error. In most cases this will happen when
a procedure at the bottom of the stack generates an error condition and then returns to its
calling procedure. This higher level procedure can optionally add more information relevant to
itself. This continues as the call stack 'bubbles' its way back to the top to where the
originating procedure is waiting.
- Native OpenInsight commands that handle errors (e.g., Set_Status, Set_FSError, Set_EventStatus)
preserve their error state until explicitly cleared. This can hinder the normal execution of code
since subsequent procedures (usually SSPs) will fail if a pre-existing error condition exists.
Our philosophy is that error conditions should automatically be cleared before a new procedure
is executed to avoid this problem. However, the nature of Basic+ does not make this easy to
automate for any given stored procedure. Therefore, if a stored procedure wants to conform to our
philosophy then it should include a call into the 'Clear' service request at the top of the
program. Alternatively this can be done through a common insert (see SERVICE_SETUP for example.)
- Service modules will use the SERVICE_SETUP insert and therefore automatically clear out any
error conditions that were set before.
Parameters :
Service [in] -- Name of the service being requested
Param1-10 [in/out] -- Additional request parameter holders
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
Metadata :
History : (Date, Initials, Notes)
07/01/25 djs Corrected error throwing.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$Insert SERVICE_SETUP
$Insert APP_INSERTS
$Insert LOT_EQUATES
$Insert TEST_WAFER_PROD_EQUATES
$Insert Lot_Operation_Equates
$Insert LOT_OPERATION_EQUATES
$Insert PRODUCT_OPERATION_EQUATES
$Insert LOT_EVENT_EQUATES
$Insert NOTIFICATION_EQUATES
@ -58,9 +104,9 @@ GoToService
Return Response or ""
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// Services
//----------------------------------------------------------------------------------------------------------------------
Service GenerateNewLotId(LotType)
@ -115,11 +161,11 @@ Service GenerateNewLotId(LotType)
end
end
Repeat
Case OTHERWISE$
//null
Case Otherwise$
Null
End Case
If GeneratedLotID NE '' AND ValidLotNum then
//Write the new lot id now so it's reserved
// Write the new lot id now so it's reserved
Database_Services('WriteDataRow', 'LOT', GeneratedLotID, '')
If RowExists('LOT', GeneratedLotID) then
NewLotID = GeneratedLotID
@ -135,9 +181,8 @@ Service GetLotIdByLegacyLotIdAndType(LegacyLotId, LegacyLotType)
StartTick = GetTickCount()
MetricName = 'GetLotIdByLegacyLotIdAndType'
ErrorMsg = ''
Open 'DICT.LOT' to DictLot then
SearchString = ''
SearchString := 'LEGACY_LOT_ID':@VM:LegacyLotId:@FM
SearchString := 'TYPE':@VM:LegacyLotType:@FM
@ -149,7 +194,6 @@ Service GetLotIdByLegacyLotIdAndType(LegacyLotId, LegacyLotType)
end else
Response = LotIdKeys<1,1>
end
end else
ErrorMsg = 'Error in ':Service:' service. Error opening LOT dictionary.'
end
@ -157,6 +201,8 @@ Service GetLotIdByLegacyLotIdAndType(LegacyLotId, LegacyLotType)
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
@ -169,7 +215,7 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
ErrorMessage = ''
Begin Case
Case LotType EQ 'RDS' OR LotType EQ 'WM_IN' OR LotType EQ 'WM_OUT' OR LotType EQ 'WO_MAT'
//Case statement for legacy lot entity types
// Case statement for legacy lot entity types
NewLotId = Lot_Services('GenerateNewLotId', LotType)
If NewLotId NE '' then
If RowExists('LOT', NewLotId) NE False$ then
@ -203,7 +249,7 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
If NewLotId NE '' then
If RowExists('LOT', NewLotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', NewLotId)
//Ensure the lot record is empty
// Ensure the lot record is empty
If LotRec<LOT_TYPE$> EQ '' AND LotRec<LOT_PROD_ID$> EQ '' AND LotRec<LOT_ORIG_WAFER_QTY$> EQ '' AND LotRec<LOT_WAFER_QTY$> EQ '' then
LotRec<LOT_TYPE$> = LotType
LotRec<LOT_PROD_ID$> = TWProdID
@ -213,26 +259,26 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
LotRec<LOT_VENDOR_LOT_NO$> = VendorLotNo
LotRec<LOT_VENDOR_CODE$> = VendorCode
Database_Services('WriteDataRow', 'LOT', NewLotId, LotRec)
//Now Ensure that the written lot matches what was just written
// Now Ensure that the written lot matches what was just written
LotRecCheck = Database_Services('ReadDataRow', 'LOT', NewLotId)
If LotRecCheck EQ LotRec then
//Lot Created successfully
// Lot Created successfully
CreatedLotNumber = NewLotId
If RowExists('LOT', CreatedLotNumber) then
Lot_Services('CreateInitialLotOperationRecords', CreatedLotNumber)
If Error_Services('NoError') then
//Check in at first operation
//Get Curr Operation(Should be first one in sequence)
// Check in at first operation
// Get Curr Operation(Should be first one in sequence)
ThisLotCurrOpId = Lot_Services('GetLotCurrOperationId', CreatedLotNumber)
If ThisLotCurrOpId NE '' then
//Set lot to open
// Set lot to open
Lot_Services('OpenLot', CreatedLotNumber)
if Error_Services('NoError') then
//Move lot in
// Move lot in
Lot_Services('MoveInLot', CreatedLotNumber, Username)
if Error_Services('NoError') then
If PrinterID NE 'WEB' then
//If PrinterID is set to WEB this means the request comes from OI_Wizard and the client is going to handle printing.
// If PrinterID is set to WEB this means the request comes from OI_Wizard and the client is going to handle printing.
Labeling_Services('PrintTestWaferLotLabel', CreatedLotNumber, Username, PrinterID)
If Error_Services('HasError') then
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : CreatedLotNumber : ' , ' : Error_Services('GetMessage')
@ -251,18 +297,18 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
end else
//Close LOT record as there was an error
// Close LOT record as there was an error
Lot_Services('CloseLot', NewLotId)
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
end else
//Close LOT record as there was an error
// Close LOT record as there was an error
Lot_Services('CloseLot', NewLotId)
ErrorMessage = 'Error in Create New Test Wafer Lot Process, error getting current operation for lot: ' : NewLotId
end
end else
//Close LOT record as there was an error
//Database_Services('DeleteDataRow', 'LOT', NewLotId, True$, False$)
// Close LOT record as there was an error
// Database_Services('DeleteDataRow', 'LOT', NewLotId, True$, False$)
Lot_Services('CloseLot', NewLotId)
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : NewLotId : ' , ' : Error_Services('GetMessage')
end
@ -292,6 +338,9 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
ErrorMessage = 'Error in ':Service:' service. Lot Type "':LotType:'" is not currently supported.'
End Case
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
@ -310,9 +359,6 @@ Service CreateNewLot(LotType, ProdName, LotQty, VendorPartNo, VendorLotNo, Vendo
end
Response = CreatedLotNumber
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
End Service
@ -329,7 +375,7 @@ Service CreateNewTestWaferLot(LotType, ProdName, LotQty, VendorPartNo, VendorLot
If NewLotId NE '' then
If RowExists('LOT', NewLotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', NewLotId)
//Ensure the lot record is empty
// Ensure the lot record is empty
If LotRec<LOT_TYPE$> EQ '' AND LotRec<LOT_PROD_ID$> EQ '' AND LotRec<LOT_ORIG_WAFER_QTY$> EQ '' AND LotRec<LOT_WAFER_QTY$> EQ '' then
LotRec<LOT_TYPE$> = LotType
LotRec<LOT_PROD_ID$> = TWProdID
@ -339,25 +385,25 @@ Service CreateNewTestWaferLot(LotType, ProdName, LotQty, VendorPartNo, VendorLot
LotRec<LOT_VENDOR_LOT_NO$> = VendorLotNo
LotRec<LOT_VENDOR_CODE$> = VendorCode
Database_Services('WriteDataRow', 'LOT', NewLotId, LotRec)
//Now Ensure that the written lot matches what was just written
// Now Ensure that the written lot matches what was just written
LotRecCheck = Database_Services('ReadDataRow', 'LOT', NewLotId)
If LotRecCheck EQ LotRec then
//Lot Created successfully
// Lot Created successfully
CreatedLotNumber = NewLotId
If RowExists('LOT', CreatedLotNumber) then
Lot_Services('CreateInitialLotOperationRecords', CreatedLotNumber)
If Error_Services('NoError') then
//Check in at first operation
//Get Curr Operation(Should be first one in sequence)
// Check in at first operation
// Get Curr Operation(Should be first one in sequence)
ThisLotCurrOpId = Lot_Services('GetLotCurrOperationId', CreatedLotNumber)
If ThisLotCurrOpId NE '' then
Lot_Services('MoveInLot', NewLotId, Username)
if Error_Services('NoError') then
//Set lot to open
// Set lot to open
Lot_Services('OpenLot', CreatedLotNumber)
if Error_Services('NoError') then
If PrinterID NE 'WEB' then
//If PrinterID is set to WEB this means the request comes from OI_Wizard and the client is going to handle printing.
// If PrinterID is set to WEB this means the request comes from OI_Wizard and the client is going to handle printing.
Labeling_Services('PrintTestWaferLotLabel', CreatedLotNumber, Username, PrinterID)
If Error_Services('HasError') then
ErrorMessage = 'Error in Create New Test Wafer Lot Process, lot id: ' : CreatedLotNumber : ' , ' : Error_Services('GetMessage')
@ -417,13 +463,13 @@ Service CreateNewTestWaferLot(LotType, ProdName, LotQty, VendorPartNo, VendorLot
LogData<4> = 'Successfully created lot id ' : CreatedLotNumber : ' of product type ' : ProdName '.'
Logging_Services('AppendLog', objTWCreationLog, LogData, @RM, @FM, False$)
end else
Error_Services('Add', ErrorMessage)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ProdName
LogData<3> = Username
LogData<4> = ErrorMessage
Logging_Services('AppendLog', objTWCreationLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
Response = CreatedLotNumber
@ -438,7 +484,7 @@ Service GenerateInitialLotOperationRecords(LotId)
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
ProdID = LotRec<LOT_PROD_ID$>
If ProdID NE '' then
//Get product operations
// Get product operations
ThisLotOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId)
If ThisLotOperations NE '' then
for each ProdOperationKey in ThisLotOperations using @FM
@ -450,24 +496,22 @@ Service GenerateInitialLotOperationRecords(LotId)
end else
ErrorMessage = 'Prod ID not specified'
end
//ID will be LotNum + OperationID
//Get product operations
// ID will be LotNum + OperationID
// Get product operations
end else
ErrorMessage = 'Lot ID does not exist.'
end
end else
ErrorMessage = 'Lot ID was null'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
Service GetPrescribedOperationsByProdId(ProdId, ProdType)
ErrorMsg = ''
ProdOperationKeys = ''
If ProdId NE '' then
Begin Case
@ -475,12 +519,17 @@ Service GetPrescribedOperationsByProdId(ProdId, ProdType)
ProdRec = Database_Services('ReadDataRow', 'TEST_WAFER_PROD', ProdId)
ProdOperationKeys = ProdRec<TEST_WAFER_PROD_PRODUCT_OPERATIONS$>
Case Otherwise$
//error, no matching prod type.
ErrorMsg = 'Error in ':Service:' service. No matching prod type.'
End Case
end else
//Error: ProdID was null
ErrorMsg = 'Error in ':Service:' service. Null ProdId passed into service.'
end
If ErrorMsg EQ '' then
Response = ProdOperationKeys
end else
Error_Services('Add', ErrorMsg)
end
end service
@ -495,11 +544,9 @@ Service CreateInitialLotOperationRecords(LotId)
ThisInitialProdOperations = Lot_Services('GetPrescribedOperationsByProdId', ProdId, LotType)
If Error_Services('NoError') AND ThisInitialProdOperations NE '' then
For each ProdOperation in ThisInitialProdOperations using @VM
ProdOperationRec = Database_Services('ReadDataRow', 'PRODUCT_OPERATION', ProdOperation)
OperationID = ProdOperationRec<PRODUCT_OPERATION_OPERATION_ID$>
OperationSequence = ProdOperationRec<PRODUCT_OPERATION_OPERATION_SEQUENCE$>
LotOperationRecID = Rti_Createguid()
If Not(RowExists('LOT_OPERATION', LotOperationRecID)) then
LotOperationRec = ''
@ -510,46 +557,47 @@ Service CreateInitialLotOperationRecords(LotId)
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
TestRec = Database_Services('ReadDataRow', 'LOT', LotId)
end else
ErrorMessage = 'Lot Operation already existed, cannot overwrite'
ErrorMessage = 'Error in ':Service:' service. Lot Operation already existed, cannot overwrite.'
end
Next Operation
end else
ErrorMessage = 'Error getting prescribed operations for lot# ' : LotId
ErrorMessage = 'Error in ':Service:' service. Error getting prescribed operations for lot# ' : LotId
end
end else
ErrorMessage = 'Lot ID was null'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
ErrorMessage = 'Error in ':Service:' service. Null LotID passed into service.'
end
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
//Returns a @FM delimited list of operations in sequence
// Returns a @FM delimited list of operations in sequence
Service GetLotOperationSequence(LotId)
StartTick = GetTickCount()
MetricName = 'GetLotOperationSequence'
ErrorMsg = ''
LotOperationsInSequence = ''
If LotID NE '' then
//Get Operations
// Get Operations
LotOperations = Xlate('LOT', LotId, LOT_LOT_OPERATIONS$, 'X')
for each LotOperation in LotOperations using @VM
ThisLotOperationSequence = Xlate('LOT_OPERATION', LotOperation, LOT_OPERATION_OPERATION_SEQUENCE$, 'X')
LotOperationsInSequence<ThisLotOperationSequence> = LotOperation
Next LotOperation
end else
//error: lot id was null
ErrorMsg = 'Error in ':Service:' service. Null LotID passed into service.'
end
Response = LotOperationsInSequence
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg EQ '' then
Response = LotOperationsInSequence
end else
Error_Services('Add', ErrorMsg)
end
end service
@ -560,7 +608,7 @@ Service GetLotCurrOperationId(LotId)
CurrOperation = ''
If LotID NE '' then
//Get them in sequence first
// Get them in sequence first
LotOperationsInSequence = Lot_Services('GetLotOperationSequence', LotId)
for each LotOperation in LotOperationsInSequence using @FM
ThisLotOperationStartDTM = Xlate('LOT_OPERATION', LotOperation, LOT_OPERATION_DATETIME_IN$, 'X')
@ -571,13 +619,15 @@ Service GetLotCurrOperationId(LotId)
until CurrOperation
Next LotOperation
end else
//error: lot id was null
ErrorMsg = 'Error in ':Service:' service. Null LotID passed into service'
end
Response = CurrOperation
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg NE '' then Error_Services('Add', ErrorMsg)
end service
@ -585,11 +635,11 @@ Service GetLotCurrOperationName(LotId)
StartTick = GetTickCount()
MetricName = 'GetLotCurrOperationName'
ErrorMsg = ''
CurrOperationId = ''
CurrOperationName = ''
If LotID NE '' then
//Get them in sequence first
// Get them in sequence first
LotOperationsInSequence = Lot_Services('GetLotOperationSequence', LotId)
for each LotOperation in LotOperationsInSequence using @FM
ThisLotOperationStartDTM = Xlate('LOT_OPERATION', LotOperation, LOT_OPERATION_DATETIME_IN$, 'X')
@ -601,13 +651,18 @@ Service GetLotCurrOperationName(LotId)
until CurrOperationName
Next LotOperation
end else
//error: lot id was null
ErrorMsg = 'Error in ':Service:' service. Null LotID passed into service.'
end
Response = CurrOperationName
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMsg EQ '' then
Response = CurrOperationName
end else
Error_Services('Add', ErrorMsg)
end
end service
@ -616,11 +671,11 @@ Service AddLotOperationIntoSequence(LotId, NewOperationId, NewSequence, Rework)
ErrorMessage = ''
If LotId NE '' then
If NewSequence NE '' AND Num(NewSequence) then
//Get Current Operations in sequence
// Get Current Operations in sequence
LotCurrOperation = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperationSequence = Xlate('LOT_OPERATION', LotCurrOperation, LOT_OPERATION_OPERATION_SEQUENCE$, 'X')
If CurrOperationSequence LE NewSequence then
//Get Curr Operation Sequence
// Get Curr Operation Sequence
Done = False$
LotCurrOperationSequence = Lot_Services('GetLotOperationSequence', LotId)
for each Operation in LotCurrOperationSequence using @Fm setting OpPos
@ -647,21 +702,19 @@ Service AddLotOperationIntoSequence(LotId, NewOperationId, NewSequence, Rework)
LotOperationRec<LOT_OPERATION_REWORK$> = Rework
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
end else
//Error: Lot Operation already existed, cannot overwrite
ErrorMessage = 'Error in ':Service:' service. Lot Operation already existed, cannot overwrite'
end
end
end else
//Error: Not allowed to add new operations prior to current operation
ErrorMessage = 'Error in ':Service:' service. Not allowed to add new operations prior to current operation'
end
end else
//Error: null or invalid sequence passed to routine
ErrorMessage = 'Error in ':Service:' service. Null or invalid sequence passed to routine'
end
end else
//Error: Lot id was null
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
ErrorMessage = 'Error in ':Service:' service. Null LotID passed into service.'
end
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
@ -675,11 +728,7 @@ Service IsLotMovedIn(LotId)
If RowExists('LOT', LotId) then
CurrOperId = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperDtmIn = Database_Services('ReadDataColumn', 'LOT_OPERATION', CurrOperId, LOT_OPERATION_DATETIME_IN$, True$, 0, False$)
If CurrOperDtmIn LE Datetime() AND CurrOperDtmIn NE '' then
Response = True$
end else
Response = False$
end
Response = ( (CurrOperDtmIn LE Datetime()) AND (CurrOperDtmIn NE '') )
end
EndTick = GetTickCount()
@ -699,9 +748,9 @@ Service IsOperationCompleted(LotOperationId)
ErrorMessage = 'Invalid lot operation id passed to routine.'
end
If ErrorMessage NE '' then
Error_Services('Add', 'Error in ' : service : ' with Lot OperationId ' : LotOperationId : ' : ' : ErrorMessage)
Error_Services('Add', 'Error in ' : Service : ' with Lot OperationId ' : LotOperationId : ' : ' : ErrorMessage)
end
response = OperationCompleted
Response = OperationCompleted
end service
@ -725,17 +774,26 @@ Service StartLot(LotId, Operator)
end else
ErrorMessage = 'Error in ':Service:' process. Lot id was not passed to routine.'
end
If ErrorMessage NE '' then
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Successfully started lot.'
Logging_Services('AppendLog', objLotStartLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Error starting lot.'
Logging_Services('AppendLog', objLotStartLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
end service
@ -754,7 +812,11 @@ Service BeginRun(LotId, Operator, ToolId)
end else
ErrorMessage = 'Error in ':Service:' process. Lot id, Operator, or ToolId was not passed to routine.'
end
If ErrorMessage NE '' then
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
@ -762,10 +824,16 @@ Service BeginRun(LotId, Operator, ToolId)
LogData<4> = ToolId
LogData<4> = 'Successfully began run.'
Logging_Services('AppendLog', objLotRunLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = ToolId
LogData<4> = 'Error beginning run.'
Logging_Services('AppendLog', objLotRunLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
end service
@ -784,18 +852,28 @@ Service EndRun(LotId, Operator, ToolId)
end else
ErrorMessage = 'Error in ':Service:' process. Lot id, Operator, or ToolId was not passed to routine.'
end
If ErrorMessage NE '' then
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = ToolId
LogData<4> = 'Successfully edned run.'
LogData<4> = 'Successfully ended run.'
Logging_Services('AppendLog', objLotRunLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = ToolId
LogData<4> = 'Error ending run.'
Logging_Services('AppendLog', objLotRunLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, Service, StartTick, EndTick)
end service
@ -804,7 +882,6 @@ Service MoveInLot(LotID, Operator)
StartTick = GetTickCount()
MetricName = 'MoveInLot'
ErrorMessage = ''
ThisLotCurrOperationID = ''
If LotId NE '' then
@ -849,19 +926,27 @@ Service MoveInLot(LotID, Operator)
end else
ErrorMessage = 'Error in Move In process. Lot id was not passed to routine.'
end
If ErrorMessage NE '' then
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Successfully Moved Lot into operation ' : ThisLotCurrOperationID : '.'
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Error moving Lot into operation ' : ThisLotCurrOperationID : '.'
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
end service
@ -869,7 +954,6 @@ Service MoveOutLot(LotID, Operator)
StartTick = GetTickCount()
MetricName = 'MoveOutLot'
ErrorMessage = ''
ThisLotCurrOperationID = ''
If LotId NE '' then
@ -912,14 +996,17 @@ Service MoveOutLot(LotID, Operator)
end else
ErrorMessage = 'Error in Move Out process. Lot id was not passed to routine.'
end
If ErrorMessage NE '' then
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage EQ '' then
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = LotID
LogData<3> = Operator
LogData<4> = 'Successfully Moved Lot out of operation ' : ThisLotCurrOperationID : '.'
Logging_Services('AppendLog', objLotMoveLog, LogData, @RM, @FM, False$)
Error_Services('Add', ErrorMessage)
end else
LogData = ''
LogData<1> = LoggingDTM
@ -930,9 +1017,6 @@ Service MoveOutLot(LotID, Operator)
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
end service
@ -940,16 +1024,13 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
ErrorMessage = ''
JsonString = ''
If FullObject EQ '' then
FullObject = True$
end
If FullObject EQ '' then FullObject = True$
If RowExists('LOT', LotId) then
objJSON = ''
If SRP_JSON(objJSON, 'New', 'Object') then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId)
If Error_Services('NoError') then
If SRP_JSON(objLot, 'New', 'Object') then
SRP_JSON(objLot, 'SetValue', 'LotId', LotId)
SRP_JSON(objLot, 'SetValue', 'Type', LotRec<LOT_TYPE$>)
SRP_JSON(objLot, 'SetValue', 'ProdId', LotRec<LOT_PROD_ID$>)
@ -973,7 +1054,7 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
MostRecentEventDtmOConv = OConv(MostRecentEventDtmIConv, 'DT')
SRP_JSON(objLot, 'SetValue', 'MostRecentEventDateTime', MostRecentEventDtmOConv)
If FullObject then
//Events Array
// Events Array
EventsArrayJson = ''
If SRP_Json(EventsArrayJson, 'New', 'Array') then
LotEventKeys = Lot_Event_Services('GetLotEventsInSequence', LotId)
@ -1003,7 +1084,7 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
end else
ErrorMessage = 'Error Creating Events JSON Array'
end
//Operations Array
// Operations Array
OperationsArrayJson = ''
If SRP_Json(OperationsArrayJson, 'New', 'Array') then
LotOperationKeys = Lot_Services('GetLotOperationSequence', LotId)
@ -1053,10 +1134,12 @@ Service ConvertLotRecordToJson(LotId, ItemURL, CurrUser, FullObject=BOOLEAN)
end else
ErrorMessage = 'Invalid or null lot number passed to routine.'
end
If ErrorMessage NE '' then
If ErrorMessage EQ '' then
Response = JsonString
end else
Error_Services('Add', ErrorMessage)
end
Response = JsonString
end service
@ -1079,13 +1162,12 @@ Service OpenLot(LotId)
end else
ErrorMessage = 'Unable to Open Lot ' : LotId : '. Lot ID was not found in LOT table.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
@ -1093,7 +1175,6 @@ Service CloseLot(LotId)
StartTick = GetTickCount()
MetricName = 'CloseLot'
ErrorMessage = ''
If RowExists('LOT', LotId) then
LotRec = Database_Services('ReadDataRow', 'LOT', LotId, True$, 0, False$)
@ -1107,13 +1188,12 @@ Service CloseLot(LotId)
end else
ErrorMessage = 'Unable to Close Lot ' : LotId : '. Lot ID was not found in LOT table.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
@ -1171,7 +1251,7 @@ Service AutoCloseTestWaferLot(LotId, CloseUserId)
ErrorMessage = CloseUserId : ' does not have permission to close this lot.'
end
If ErrorMessage EQ '' then
//Close Lot as there were no validation failures.
// Close Lot as there were no validation failures.
Lot_Services('CloseLot', LotId)
If Error_Services('NoError') then
LogData = ''
@ -1188,7 +1268,7 @@ Service AutoCloseTestWaferLot(LotId, CloseUserId)
LogData<3> = CloseUserId
LogData<4> = 'Error marking lot as closed.' : ErrorMessage
Logging_Services('AppendLog', objLotClosureLog, LogData, @RM, @FM, False$)
//Send a message to FI
// Send a message to FI
Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', NOTIFICATION_USER_ID$, 'X')
SentFrom = 'SYSTEM'
Subject = 'TEST WAFER LOT AUTO-CLOSURE FAILURE'
@ -1204,7 +1284,7 @@ Service AutoCloseTestWaferLot(LotId, CloseUserId)
LogData<3> = CloseUserId
LogData<4> = 'Error marking lot as closed.' : ErrorMessage
Logging_Services('AppendLog', objLotClosureLog, LogData, @RM, @FM, False$)
//Send a message to FI
// Send a message to FI
Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', NOTIFICATION_USER_ID$, 'X')
SentFrom = 'SYSTEM'
Subject = 'TEST WAFER LOT AUTO-CLOSURE FAILURE'
@ -1255,7 +1335,7 @@ Service ReduceLotWaferCount(LotId, ReductionQty, OperatorId)
LotRec<LOT_WAFER_QTY$> = LotNewWfrQty
Database_Services('WriteDataRow', 'LOT', LotId, LotRec, True$, False$, False$)
If Error_Services('NoError') then
//Write Lot Event
// Write Lot Event
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'REDUCE_WAFER_QTY', 'Reduced wafer count by ' : ReductionQty, '', OperatorId, False$, '')
if LotNewWfrQty EQ 0 AND LotType EQ 'TW' then
ServiceParms = 'AutoCloseTestWaferLot' : @VM : LotId : @VM : 'SYSTEM'
@ -1285,13 +1365,12 @@ Service ReduceLotWaferCount(LotId, ReductionQty, OperatorId)
end else
ErrorMessage = 'Error in Reduce Lot Wafer Count service, Lot Id ' : LotId : ' not found in lot table.'
end
if ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
@ -1314,7 +1393,7 @@ Service IncreaseLotWaferCount(LotId, IncreaseQty, OperatorId)
LotRec<LOT_WAFER_QTY$> = LotNewWfrQty
Database_Services('WriteDataRow', 'LOT', LotId, LotRec, True$, False$, False$)
If Error_Services('NoError') then
//Write Lot Event
// Write Lot Event
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'INCREASE_WAFER_QTY', 'Increased wafer count by ' : IncreaseQty, '', OperatorId, False$, '')
end else
ErrorMessage = 'Error in Increase Lot Wafer Count service, Error writing Lot Id ' : LotId : ' with new quantity.'
@ -1337,13 +1416,12 @@ Service IncreaseLotWaferCount(LotId, IncreaseQty, OperatorId)
end else
ErrorMessage = 'Error in Increase Lot Wafer Count service, Lot Id ' : LotId : ' not found in lot table.'
end
if ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
@ -1427,12 +1505,15 @@ Service CreateNewVoidedLotRecord(LotId, LegacyLotId, LotType=LOT_TYPES, Username
end else
ErrorMessage = 'Username ' : Username : ' passed to CreateVoidedLotRecord routine does not exist.'
end
If ErrorMessage NE '' then
//Todo Log Error Message
end
EndTick = GetTickCount()
Mona_Services('QueueLatencyAndCountMetrics', MonaResource, MetricName, StartTick, EndTick)
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
//----------------------------------------------------------------------------------------------------------------------
// Internal GoSubs
//----------------------------------------------------------------------------------------------------------------------