Updated CreateLotEvent to use Transaction Queue instead of Proc Queue to avoid locking errors.

This commit is contained in:
Infineon\StieberD
2025-07-01 10:41:54 -07:00
parent ff0036d4c2
commit b796060529

View File

@ -1,16 +1,64 @@
Compile function Lot_Event_Services(@Service, @Params)
/***********************************************************************************************************************
Name : Lot_Event_Services
Description : Handler program for all LOT_EVENT 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 Modified CreateLotEvent to use Transaction Queue instead of Proc Queue to avoid locking
errors on LOT table. Updated error throwing.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
Declare function Error_Services, Logging_Services, Environment_Services, Database_Services, RTI_CreateGUID, Lot_Services
Declare function Lot_Event_Services
Declare subroutine Error_Services, Logging_Services, Database_Services, Lot_Services, Service_Services
$insert LOGICAL
$Insert SERVICE_SETUP
$insert APP_INSERTS
$Insert LOT_EVENT_EQUATES
$Insert LOT_EQUATES
$Insert LOT_OPERATION_EQUATES
Declare function Error_Services, Logging_Services, Environment_Services, Database_Services, RTI_CreateGUID
Declare function Lot_Event_Services, Lot_Services
Declare subroutine Error_Services, Logging_Services, Database_Services, Lot_Services, Service_Services
Declare subroutine Transaction_Services
Options EVENT_TYPES = 'MOVE_IN', 'MOVE_OUT', 'HOLD_ON', 'HOLD_OFF', 'REDUCE_WAFER_QTY', 'BONUS_WAFER_QTY', 'COMMENT', 'LOCATION', 'LOAD', 'UNSIGN_LOAD', 'TW_USE', 'CLOSE', 'SIGN_FQA', 'UNSIGN_FQA'
Options LOT_TYPES = 'TW', 'RDS', 'WM_OUT', 'WM_IN', 'WO_MAT', 'LOT'
Options LEGACY_LOT_TYPES = 'RDS', 'WM_OUT', 'WM_IN'
@ -20,15 +68,15 @@ GoToService
Return Response or ""
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// Services
//----------------------------------------------------------------------------------------------------------------------
Service CreateLotEvent(LotId, EventDateTime, EventType=EVENT_TYPES, EventNote, EventEquipmentId, OperatorId, IsLegacyLotId=BOOLEAN, LegacyLotType=LEGACY_LOT_TYPES)
GoSub InitEventLog
ErrorMessage = ''
//Handle Legacy Lots
// Handle Legacy Lots
If IsLegacyLotId then
If LegacyLotType NE '' then
LegacyLotId = LotId
@ -55,7 +103,8 @@ Service CreateLotEvent(LotId, EventDateTime, EventType=EVENT_TYPES, EventNote, E
NewEventRec<LOT_EVENT_SEQUENCE$> = NewEventSequence
Database_Services('WriteDataRow', 'LOT_EVENT', NewEventId, NewEventRec)
If Error_Services('NoError') then
Service_Services('PostProcedure', 'LOT_EVENT_SERVICES', 'SetLatestLotEvent':@VM:LotId:@VM:NewEventId)
Transaction_Services('PostWriteFieldTransaction', 'LOT', LotId, LOT_MOST_RECENT_LOT_EVENT_ID$, NewEventId)
If Error_Services('HasError') then ErrorMessage = Error_Services('GetMessage')
end else
ErrorMessage = 'Error creating new event : ' : Error_Services('GetMessage')
end
@ -89,6 +138,7 @@ Service CreateLotEvent(LotId, EventDateTime, EventType=EVENT_TYPES, EventNote, E
end service
Service GetLotEventNextSequence(LotId)
ErrorMessage = ''
@ -111,26 +161,37 @@ Service GetLotEventNextSequence(LotId)
end else
Error_Services('Add', ErrorMessage)
end
end service
//Returns a @FM delimited list of events in sequence
// Returns a @FM delimited list of events in sequence
Service GetLotEventsInSequence(LotId)
ErrorMsg = ''
LotEventsUnsorted = ''
LotEventsSorted = ''
LotEventsToReturn = ''
If LotID NE '' then
//Get Operations
// Get Operations
LotEvents = Xlate('LOT', LotId, LOT_LOT_EVENTS$, 'X')
for each LotEvent in LotEvents using @VM
ThisEventSequence = XLATE('LOT_EVENT', LotEvent, LOT_EVENT_SEQUENCE$, 'X')
LotEventsToReturn<ThisEventSequence> = LotEvent
Next LotOperation
end else
//error: lot id was null
ErrorMsg = 'Error in ':Service:' service. Null LotID passed into service.'
end
If ErrorMsg EQ '' then
Response = LotEventsToReturn
end else
Error_Services('Add', ErrorMsg)
end
end service
Service SetLatestLotEvent(LotId, LotEventId)
ErrorMessage = ''
@ -148,14 +209,14 @@ Service SetLatestLotEvent(LotId, LotEventId)
end else
ErrorMessage = 'Lot Id ' : LotId : ' not found in LOT table.'
end
If ErrorMessage NE '' then
Error_Services('Add', ErrorMessage)
end
If ErrorMessage NE '' then Error_Services('Add', ErrorMessage)
end service
/* * * * * * * * * *
* INTERNAL GOSUBS
* * * * * * * * * */
//----------------------------------------------------------------------------------------------------------------------
// Internal GoSubs
//----------------------------------------------------------------------------------------------------------------------
InitEventLog: