Merged PR 21151: Return To Fab Operations and Processing

This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO)
2025-07-16 21:17:07 +02:00
parent b607432be4
commit aabd4c3a91
56 changed files with 8856 additions and 2508 deletions

View File

@ -3,12 +3,12 @@ Compile function Lot_Operation_Services(@Service, @Params)
Declare function Lot_Services, Database_Services, Error_Services, Srp_Sort_Array, Lot_Operation_Services
Declare function RTI_CreateGUID, MemberOf, SRP_JSON, Operation_Services, Datetime, Met_Test_Services, PSN_Services
Declare function Date_Services
Declare subroutine Database_Services, Error_Services, SRP_JSON, Lot_Services, Lot_Event_Services, Lot_Operation_Services
$insert LOGICAL
$insert LOT_EQUATES
$Insert LOT_OPERATION_EQUATES
$Insert METROLOGY_DATA_EXAMPLE_EQUATES
$Insert OPERATION_EQUATES
$Insert MET_TEST_EQUATES
$Insert WAFER_COUNTER_EQUATES
@ -30,7 +30,7 @@ Service AddOperationToLot(LotId, OperationId, PrescribedSequence, UserId)
If RowExists('LOT', LotId) then
If RowExists('OPERATION', OperationId) then
If PrescribedSequence AND Num(PrescribedSequence) then
If Lot_Operation_Services('CanUserAddLotOperation', UserId) then
If Lot_Services('CanUserModifyLot', UserId) then
LotCurrOperation = Lot_Services('GetLotCurrOperationId', LotId)
CurrOperationSequence = Xlate('LOT_OPERATION', LotCurrOperation, LOT_OPERATION_OPERATION_SEQUENCE$, 'X')
If CurrOperationSequence LT PrescribedSequence then
@ -74,7 +74,8 @@ Service AddOperationToLot(LotId, OperationId, PrescribedSequence, UserId)
IsOperationRework = Database_Services('ReadDataColumn', 'OPERATION', OperationId, OPERATION_REWORK$)
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationRecId, LotOperationRec)
If Error_Services('NoError') then
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'ADD_LOT_OPERATION', 'Added operation ' : Operation : ' to lot.', '', UserId)
OperationDesc = XLATE('OPERATION', OperationId, OPERATION_OPERATION_DESCRIPTION$, 'X')
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'ADD_LOT_OPERATION', 'Added operation ' : Quote(OperationDesc) : ' to lot.', '', UserId)
end else
ErrorMessage = Error_Services('GetMessage')
end
@ -86,7 +87,7 @@ Service AddOperationToLot(LotId, OperationId, PrescribedSequence, UserId)
ErrorMessage = 'Not allowed to add new operations prior to current operation'
end
end else
ErrorMessage = 'User ' : UserId : ' does not have permission to add operations to lots.'
ErrorMessage = 'User ' : UserId : ' does not have permission to modify lots.'
end
end else
ErrorMessage = 'Invalid operation sequence entered.'
@ -102,7 +103,6 @@ Service AddOperationToLot(LotId, OperationId, PrescribedSequence, UserId)
Response = Operation
end else
Error_Services('Add', 'Error in ' : Service : '.' : ErrorMessage)
// todo: add logging
end
end service
@ -114,48 +114,53 @@ Service RemoveLotOperation(LotOperationId, UserId)
Success = False$
If RowExists('LOT_OPERATION', LotOperationId) then
LotOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', LotOperationId, True$, 0, False$)
LotId = LotOperationRec<LOT_OPERATION_LOT_ID$>
MoveInTime = LotOperationRec<LOT_OPERATION_DATETIME_IN$>
MoveOutTime = LotOperationRec<LOT_OPERATION_DATETIME_OUT$>
Sequence = LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$>
OperationId = LotOperationRec<LOT_OPERATION_OPERATION_ID$>
OperationClass = XLATE('OPERATION', OperationId, OPERATION_CLASS_ID$, 'X')
If OperationClass NE 'RTF_DEFAULT' AND OperationClass NE 'RTF_DEFAULT_END' then
If MoveInTime EQ '' AND MoveOutTime EQ '' then
LotOperationRec<LOT_OPERATION_LOT_ID$> = '';//Nulling this value out should disassociated the lot operation record from the lot.
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationId, LotOperationRec)
If Error_Services('NoError') then
Lot_Operation_Services('UpdateLotOperationSequence', LotId, Sequence)
If Lot_Services('CanUserModifyLot', UserId) then
LotOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', LotOperationId, True$, 0, False$)
LotId = LotOperationRec<LOT_OPERATION_LOT_ID$>
MoveInTime = LotOperationRec<LOT_OPERATION_DATETIME_IN$>
MoveOutTime = LotOperationRec<LOT_OPERATION_DATETIME_OUT$>
Sequence = LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$>
OperationId = LotOperationRec<LOT_OPERATION_OPERATION_ID$>
OperationClass = XLATE('OPERATION', OperationId, OPERATION_CLASS_ID$, 'X')
If OperationClass NE 'RTF_DEFAULT' AND OperationClass NE 'RTF_DEFAULT_END' then
If MoveInTime EQ '' AND MoveOutTime EQ '' then
LotOperationRec<LOT_OPERATION_LOT_ID$> = '';//Nulling this value out should disassociated the lot operation record from the lot.
Database_Services('WriteDataRow', 'LOT_OPERATION', LotOperationId, LotOperationRec)
If Error_Services('NoError') then
Success = True$
Lot_Operation_Services('UpdateLotOperationSequence', LotId, Sequence)
If Error_Services('NoError') then
Success = True$
end else
ErrorMessage = Error_Services('GetMessage')
end
OperationDesc = XLATE('OPERATION', OperationId, OPERATION_OPERATION_DESCRIPTION$, 'X')
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'REMOVE_LOT_OPERATION', 'Removed operation ' : Quote(OperationDesc) : ' from lot.', '', UserId)
end else
ErrorMessage = Error_Services('GetMessage')
ErrorMessage = Error_Services('GetMessage')
end
Lot_Event_Services('CreateLotEvent', LotId, Datetime(), 'REMOVE_LOT_OPERATION', 'Removed operation ' : OperationId : ' from lot.', '', UserId)
end else
ErrorMessage = Error_Services('GetMessage')
ErrorMessage = 'Lot has already started processing on operation ' : OperationId
end
end else
ErrorMessage = 'Lot has already started processing on operation ' : OperationId
ErrorMessage = 'Unable to remove default operations.'
end
end else
ErrorMessage = 'Unable to remove default operations.'
ErrorMessage = 'User ' : UserId : ' does not have permission modify lots.'
end
end else
ErrorMessage = 'Lot Operation record not found'
end
If ErrorMessage NE '' then
Error_Services('Add', 'Error in service ': Service : ' : ' : ErrorMessage)
Error_Services('Add', ErrorMessage)
end
Response = Success
end service
Service UpdateLotOperationSequence(LotId, StartSequence)
ErrorMessage = ''
If StartSequence EQ '' then
StartSequence = 1
@ -189,17 +194,6 @@ Service UpdateLotOperationSequence(LotId, StartSequence)
end service
Service ModifyLotOperationSequence(LotOperationId, NewSequence, UserId)
ErrorMessage = ''
If ErrorMessage NE '' then
end
end service
Service GetAvailableSequences(LotId)
AvailableSequences = ''
@ -211,9 +205,7 @@ Service GetAvailableSequences(LotId)
OperationClass = Database_Services('ReadDataColumn', 'OPERATION', OperationId, OPERATION_CLASS_ID$)
StartDtm = LotOperationRec<LOT_OPERATION_DATETIME_IN$>
If StartDTM EQ '' then
If OperationClass NE 'RTF_DEFAULT' then
AvailableSequences<1, -1> = Sequence + 1
end
AvailableSequences<1, -1> = Sequence + 1
end
Next LotOperationId
end
@ -221,30 +213,6 @@ Service GetAvailableSequences(LotId)
Response = AvailableSequences
end service
Service AddSpecsToLotOperation(LotOperationId)
end service
Service CanUserAddLotOperation(UserId)
If UserId NE '' then
Begin Case
Case MemberOf(UserId, 'LEAD')
Response = True$
Case MemberOf(UserId, 'SUPERVISOR')
Response = True$
Case MemberOf(UserId, 'ENGINEER')
Response = True$
Case MemberOf(UserId, 'ENG_TECH')
Response = True$
Case Otherwise$
Response = False$
End Case
end
end service
Service ConvertRecordToJson(LotOperationId)
JsonString = ''
@ -258,8 +226,14 @@ Service ConvertRecordToJson(LotOperationId)
SRP_JSON(objJSON, 'SetValue', 'LotId', LotId, 'String')
SRP_JSON(objJSON, 'SetValue', 'LegacyLotId', LegacyLotId, 'String')
SRP_JSON(objJSON, 'SetValue', 'OperationId', LotOperationRec<LOT_OPERATION_OPERATION_ID$>, 'String')
SRP_JSON(objJSON, 'SetValue', 'DateTimeIn', OConv(LotOperationRec<LOT_OPERATION_DATETIME_IN$>, 'DT'), 'String')
SRP_JSON(objJSON, 'SetValue', 'DateTimeOut', OConv(LotOperationRec<LOT_OPERATION_DATETIME_OUT$>, 'DT'), 'String')
OperationDesc = XLATE('OPERATION', LotOperationRec<LOT_OPERATION_OPERATION_ID$>, OPERATION_OPERATION_DESCRIPTION$, 'X')
SRP_JSON(objJSON, 'SetValue', 'Description', OperationDesc, 'String')
OperationClass = XLATE('OPERATION', LotOperationRec<LOT_OPERATION_OPERATION_ID$>, OPERATION_CLASS_ID$, 'X')
SRP_JSON(objJSON, 'SetValue', 'OperationClass', OperationClass)
DatetimeIn = Date_Services('ConvertDateTimeToISO8601', LotOperationRec<LOT_OPERATION_DATETIME_IN$>)
SRP_JSON(objJSON, 'SetValue', 'DateTimeIn', DatetimeIn)
DatetimeOut = Date_Services('ConvertDateTimeToISO8601', LotOperationRec<LOT_OPERATION_DATETIME_OUT$>)
SRP_JSON(objJSON, 'SetValue', 'DateTimeOut', DatetimeOut)
EquipmentId = LotOperationRec<LOT_OPERATION_EQUIPMENT_ID$>
SRP_JSON(objJSON, 'SetValue', 'EquipmentId', EquipmentId)
SRP_JSON(objJSON, 'SetValue', 'WaferInQty', LotOperationRec<LOT_OPERATION_WAFER_IN_QTY$>, 'Number')
@ -267,8 +241,10 @@ Service ConvertRecordToJson(LotOperationId)
SRP_JSON(objJSON, 'SetValue', 'OperatorInId', LotOperationRec<LOT_OPERATION_OPERATOR_IN_ID$>)
SRP_JSON(objJSON, 'SetValue', 'OperatorOutId', LotOperationRec<LOT_OPERATION_OPERATOR_OUT_ID$>)
SRP_JSON(objJSON, 'SetValue', 'OperationSequence', LotOperationRec<LOT_OPERATION_OPERATION_SEQUENCE$>)
SRP_JSON(objJSON, 'SetValue', 'DateTimeStart', OConv(LotOperationRec<LOT_OPERATION_DATETIME_START$>, 'DT'), 'String')
SRP_JSON(objJSON, 'SetValue', 'DateTimeStop', OConv(LotOperationRec<LOT_OPERATION_DATETIME_STOP$>, 'DT'), 'String')
DatetimeStart = Date_Services('ConvertDateTimeToISO8601', LotOperationRec<LOT_OPERATION_DATETIME_START$>)
SRP_JSON(objJSON, 'SetValue', 'DateTimeStart', DatetimeStart)
DatetimeStop = Date_Services('ConvertDateTimeToISO8601', LotOperationRec<LOT_OPERATION_DATETIME_STOP$>)
SRP_JSON(objJSON, 'SetValue', 'DateTimeStop', DatetimeStop)
SRP_JSON(objJSON, 'SetValue', 'MetTestId', LotOperationRec<LOT_OPERATION_MET_TEST_ID$>)
SRP_JSON(objJSON, 'SetValue', 'CleanId', LotOperationRec<LOT_OPERATION_CLEAN_ID$>)
SRP_JSON(objJSON, 'SetValue', 'PackagingId', LotOperationRec<LOT_OPERATION_PACKAGING_ID$>)
@ -278,7 +254,22 @@ Service ConvertRecordToJson(LotOperationId)
SRP_JSON(objJson, 'SetValue', 'PackagingRequired', LotOperationRec<LOT_OPERATION_PACKAGING_REQUIRED$>, 'Boolean')
SRP_JSON(objJson, 'SetValue', 'CleanRequired', LotOperationRec<LOT_OPERATION_CLEAN_REQUIRED$>, 'Boolean')
SRP_JSON(objJson, 'SetValue', 'WaferCounterRequired', LotOperationRec<LOT_OPERATION_WAFER_COUNTER_REQUIRED$>, 'Boolean')
PSNo = Xlate('LOT', LotId, LOT_PROD_SPEC_ID$, 'X')
RecipeToolInfo = PSN_Services('GetAllMetrologyRecipes', PSNo, True$, True$, True$, True$)
objRecipeInfo = ''
If SRP_Json(objRecipeInfo, 'New', 'Array') then
for each RecipeLine in RecipeToolInfo using @FM
If SRP_Json(objRecipeLine, 'New', 'Object') then
SRP_Json(objRecipeLine, 'SetValue', 'ToolClass', RecipeLine<1,1>, 'String')
SRP_Json(objRecipeLine, 'SetValue', 'Recipe', RecipeLine<1,2>, 'String')
SRP_Json(objRecipeLine, 'SetValue', 'Stage', RecipeLine<1,3>, 'String')
SRP_Json(objRecipeInfo, 'Add', objRecipeLine)
SRP_Json(objRecipeLine, 'Release')
end
Next RecipeLine
SRP_Json(objJSON, 'Set', 'RecipeInfo', objRecipeInfo)
SRP_Json(objRecipeInfo, 'Release')
end
SRP_JSON(objJSON, 'SetValue', 'OperationType', LotOperationRec<LOT_OPERATION_OPERATION_TYPE$>)
//Add OPERATION Object
OperationJson = Operation_Services('ConvertRecordToJSON', LotOperationRec<LOT_OPERATION_OPERATION_ID$>)
@ -302,7 +293,7 @@ Service ConvertRecordToJson(LotOperationId)
end
//Add Available Met Test Record
AvailMetTestIds = Met_Test_Services('GetMetTests', LotId, LegacyLotId, '', EquipmentId, True$)
AvailMetTestIds = Met_Test_Services('GetMetTests', LotId, LegacyLotId, '', '', True$)
objAvailMetTest = ''
If SRP_Json(objAvailMetTest, 'New', 'Array') then
for each MetTestId in AvailMetTestIds using @VM
@ -316,8 +307,6 @@ Service ConvertRecordToJson(LotOperationId)
SRP_Json(objAvailMetTest, 'Release')
end
//Add in relevant recipes
//OperationType = LotOperationRec<LOT_OPERATION_OPERATION_TYPE$>
//MetTestTypeRequired = LotOperationRec<LOT_OPERATION_MET_TEST_TYPE_REQUIRED$>
Recipes = ''
ShowThickRecipes = False$
ShowResRecipes = False$
@ -340,7 +329,7 @@ Service ConvertRecordToJson(LotOperationId)
ShowCleanRecipes = True$
end
ProdSpecNo = XLATE('LOT', LotId, LOT_PROD_SPEC_ID$, 'X')
Recipes = PSN_Services('GetAllMetrologoyRecipes', ProdSpecNo, ShowSurfscanRecipes, ShowCleanRecipes, ShowResRecipes, ShowThickRecipes)
Recipes = PSN_Services('GetAllMetrologyRecipes', ProdSpecNo, ShowSurfscanRecipes, ShowCleanRecipes, ShowResRecipes, ShowThickRecipes)
If SRP_JSON(objRecipes, 'New', 'Array') then
for each Recipe in Recipes using @FM
//ToolClass : @VM : Recipe : @VM : Stage
@ -358,9 +347,8 @@ Service ConvertRecordToJson(LotOperationId)
SRP_JSON(objJSON, 'Set', 'RecipeParams', objRecipes)
SRP_JSON(objRecipes, 'Release')
end
JsonString = SRP_JSON(objJSON, 'Stringify', 'Styled')
JsonString = SRP_JSON(objJSON, 'Stringify', 'Fast')
SRP_JSON(objJSON, 'Release')
end
Response = JsonString
@ -370,12 +358,6 @@ end service
Service StartLotOperation(LotOperationId, UserId)
//1. Validate that it can be moved into the operation passed in.
//2. Move in the lot
//3. Return true is move in successfully
//4. Return false if error moving in
ErrorMessage = ''
If RowExists('LOT_OPERATION', LotOperationId) then
@ -414,11 +396,8 @@ Service StartLotOperation(LotOperationId, UserId)
end service
Service CompleteLotOperation(LotOperationId, UserId)
//1. Validate that the lot is moved into the operation
//2. Validate that the lot
ErrorMessage = ''
If RowExists('LOT_OPERATION', LotOperationId) then
If RowExists('LSL_USERS', UserId) then
//We can also add additional checks like security checks, training checks, etc here if needed.
@ -436,13 +415,15 @@ Service CompleteLotOperation(LotOperationId, UserId)
ErrorMessage = Error_Services('GetMessage')
end
end else
ErrorMessage = 'Lot Operation has not finished processing and cannot be moved out.'
ErrorMessage = 'Lot Operation has not finished processing and cannot be moved out.'
end
end else
ErrorMessage = 'Lot is already moved into this operation.'
ErrorMessage = 'Cannot complete operation because lot is not currently moved in.'
end
end else
CurrOperationId = Xlate('LOT_OPERATION', LotCurrentLotOpId, LOT_OPERATION_OPERATION_ID$, 'X')
CurrOperationDesc = Xlate('OPERATION', CurrOperationId, OPERATION_OPERATION_DESCRIPTION$, 'X')
ErrorMessage = 'Cannot complete operation. Lot is currently at ' : CurrOperationDesc
end
end else
ErrorMessage = 'Invalid user passed to routine.'
@ -452,10 +433,10 @@ Service CompleteLotOperation(LotOperationId, UserId)
end
If ErrorMessage EQ '' then
Response = True$
Response = True$
end else
Response = False$
Error_Services('Add', 'Error in ' : Service : '. ' : ErrorMessage)
Response = False$
Error_Services('Add', ErrorMessage)
end
end service
@ -472,14 +453,14 @@ Service ValidateLotOperation(LotOperationId)
PackagingRequired = LotOperationRec<LOT_OPERATION_PACKAGING_REQUIRED$>
CleanRequired = LotOperationRec<LOT_OPERATION_CLEAN_REQUIRED$>
WaferCountRequired = LotOperationRec<LOT_OPERATION_WAFER_COUNTER_REQUIRED$>
OperationClass = XLATE('OPERATION', OperationId, OPERATION_CLASS_ID$, 'X')
If MetTestRequired then
MetTestsInSpec = True$
AssociatedMetTestIds = LotOperationRec<LOT_OPERATION_MET_TEST_ID$>
If AssociatedMetTestIds NE '' then
for each MetTestId in AssociatedMetTestIds using @VM
MetTestOoS = Database_Services('ReadDataColumn', 'MET_TEST', MetTestId, MET_TEST.OUT_OF_SPEC$, True$, 0, False)
If MetTestOoS then
//ToDo Check that the met tests meet the requirements.
If MetTestOoS AND OperationClass NE 'RTF' AND OperationClass NE 'RTF_DEFAULT' then
MetTestsInSpec = False$
ErrorMessage = 'An associated Met test record is out of spec.'
end
@ -490,14 +471,29 @@ Service ValidateLotOperation(LotOperationId)
ErrorMessage = 'Met tests are required and none are assigned.'
end
end
If PackagingRequired then
If PackagingRequired AND IsValid then
AssociatedPackagingIds = LotOperationRec<LOT_OPERATION_PACKAGING_ID$>
If AssociatedPackagingIds NE '' then
end else
IsValid = False$
end
end
If CleanRequired then
If CleanRequired AND IsValid then
AssociatedCleanIds = LotOperationRec<LOT_OPERATION_CLEAN_ID$>
If AssociatedCleanIds NE '' then
IsValid = True$
end else
IsValid = False$
end
end
If WaferCountRequired then
If WaferCountRequired AND IsValid then
AssociatedWaferCountIds = LotOperationRec<LOT_OPERATION_WAFER_COUNTER_ID$>
If AssociatedWaferCountIds NE '' then
IsValid = True$
end else
IsValid = False$
end
end
end else
ErrorMessage = 'Lot Operation not found'
@ -509,27 +505,3 @@ Service ValidateLotOperation(LotOperationId)
Response = IsValid
end service
Service ValidateFQA(LotOperationId)
Response = False$
LotOperationRec = Database_Services('ReadDataRow', 'LOT_OPERATION', LotOperationId, True$, 0, False$)
LotId = LotOperationRec<LOT_OPERATION_LOT_ID$>
OperationStartDtm = LotOperationRec<LOT_OPERATION_DATETIME_IN$>
RelevantMetTests = ''
MetTests = Met_Test_Services('GetMetTestsByLotId', LotId)
For each MetTestId in MetTests using @VM
ThisMetTestRec = Database_Services('ReadDataRow', 'MET_TEST', MetTestId, True$, 0, False$)
Next MetTestId
end service
Service AssociateClean(LotOperationId, CleanId, UserId)
end service
Service GetFinalQAOperationJson(LotId, Stage)
end service