From 52504272f99e61ac7cbe8c02a058bac852235df5 Mon Sep 17 00:00:00 2001 From: Chase Tucker Date: Thu, 2 Oct 2025 12:41:17 -0700 Subject: [PATCH] HgCV metrology validation from upstream --- LSL2/STPROC/METROLOGY_SERVICES.txt | 55 ++++++++++++++++++-------- LSL2/STPROC/TEST_METROLOGYSERVICES.txt | 24 +++++++++++ 2 files changed, 62 insertions(+), 17 deletions(-) diff --git a/LSL2/STPROC/METROLOGY_SERVICES.txt b/LSL2/STPROC/METROLOGY_SERVICES.txt index 27e5e7f..c452195 100644 --- a/LSL2/STPROC/METROLOGY_SERVICES.txt +++ b/LSL2/STPROC/METROLOGY_SERVICES.txt @@ -82,12 +82,15 @@ $Insert NOTIFICATION_EQUATES $Insert RLIST_EQUATES $Insert WM_OUT_EQUATES $Insert IQS_VIOL_DATA_EQUATES +$Insert FEATURE_FLAGS_EQUATES Common /MetrologyServices/ MachineType@, LegacyLotId@ Equ RETRY_ATTEMPTS$ TO 3 Equ MINUTES_UNTIL_RETRY$ TO 3 +Equ IMPORT_VALIDATION_IDX$ TO 99 + Equ ORP$THICK_READS TO 1 Equ ORP$SHEET_RHO_READS TO 2 Equ ORP$HGCV1_READS TO 3 @@ -338,6 +341,7 @@ Service GetHgCV(Handle) Result<5> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:'].PSN'); // PSN Result<8> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:'].Wafer'); // LayerZonePair Result<11> = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:'].Date'); // Timestamp + Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:'].IndexOf'); // Validation END ForOffset = (RecordIndex - 1) * FieldPositionIncrement; Result = SRP_JSON(Handle, 'GETVALUE', 'Records[':RecordIndex:'].Site'); // Position @@ -404,6 +408,7 @@ end service //---------------------------------------------------------------------------------------------------------------------- Service ImportMetrologyFiles(Machine=MACHINE_TYPES) + ErrMsg = '' If Machine NE '' then hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') Lock hSysLists, ServiceKeyID:'*':Machine then @@ -430,10 +435,10 @@ Service ImportMetrologyFiles(Machine=MACHINE_TYPES) Case Machine _EQC 'SRP' DataPath = Environment_Services('GetApplicationRootPath') : '\Metrology\MET08ANLYSDIFAAST230\Source\MET08ANLYSDIFAAST230\' Case Otherwise$ - Error_Services('Add', 'Error in ':Service:' service. Unsupported Machine "':Machine:'" passed into service') + ErrMsg = 'Error in ':Service:' service. Unsupported Machine "':Machine:'" passed into service' End Case - If Error_Services('NoError') then + If Error_Services('NoError') and ErrMsg EQ '' then SearchPattern = '*.pdsf'; InitDir DataPath:SearchPattern FileList = DirList() @@ -525,23 +530,28 @@ Service ImportMetrologyFiles(Machine=MACHINE_TYPES) ************************* * Import metrology data * ************************* - IF RunData NE '' then - Metrology_Services('ImportMetrologyRunData', Machine, DataPath, FileName, RunData) + AllowImport = Metrology_Services('AllowImport', RunData) + If AllowImport EQ True$ then + Metrology_Services('ImportMetrologyRunData', Machine, DataPath, FileName, RunData) + end else + ErrMsg = 'Import validation failed' + Metrology_Services('LogResults', PSN, Machine, 'UID002', Service : ' : ' : ErrMsg); + end END ELSE - Error_Services('Add', 'RunData argument was missing') - Metrology_Services('LogResults', '', '', 'UID001', Service : ' : ' : Error_Services('GetMessage')) + ErrMsg = 'RunData argument was missing' + Metrology_Services('LogResults', '', '', 'UID001', Service : ' : ' : ErrMsg) END - If Error_Services('NoError') then - Continue = True$ + If Error_Services('NoError') and ErrMsg EQ '' then + Continue = True$ end else - ErrorMessage = Error_Services('GetMessage') - FQAError = IndexC(ErrorMessage, 'FQA has already been signed', 1) - If ( Index(ErrorMessage, 'UID002', 1) and (ImportAttempts LE RETRY_ATTEMPTS$) and Not(FQAError) ) then - Continue = False$ + If ErrMsg EQ '' then ErrMsg = Error_Services('GetMessage') + FQAError = IndexC(ErrMsg, 'FQA has already been signed', 1) + If ( Index(ErrMsg, 'UID002', 1) and (ImportAttempts LE RETRY_ATTEMPTS$) and Not(FQAError) ) then + Continue = False$ end else - Continue = True$ + Continue = True$ end end @@ -561,10 +571,9 @@ Service ImportMetrologyFiles(Machine=MACHINE_TYPES) Metrology_Services('LogResults', '', Machine, 'UID001', 'Delete : ' : FileName : ', Size : ' : FileSize : ', Error : ' : ErrCode) end END else - - ErrorMessage = Error_Services('GetMessage') + If ErrMsg EQ '' then ErrMsg = Error_Services('GetMessage') MetrologyLog = Database_Services('ReadDataRow', 'SYSLISTS', UCase(Machine):'_METROLOGY_LOG') - MetrologyLog := ErrorMessage : @FM + MetrologyLog := ErrMsg : @FM Database_Services('WriteDataRow', 'SYSLISTS', UCase(Machine):'_METROLOGY_LOG', MetrologyLog, True$) end @@ -577,13 +586,16 @@ Service ImportMetrologyFiles(Machine=MACHINE_TYPES) NEXT FileLoopIndex end else - Metrology_Services('LogResults', '', '', 'UID001', Error_Services('GetMessage')) + If ErrMsg EQ '' then ErrMsg = Error_Services('GetMessage') + Metrology_Services('LogResults', '', '', 'UID001', ErrMsg) end Unlock hSysLists, ServiceKeyID:'*':Machine else Null end end else Metrology_Services('LogResults', '', '', 'UID001', 'Null Machine passed into service') end + + If ErrMsg NE '' then Error_Services('Add', ErrMsg) end service @@ -3203,6 +3215,13 @@ Service ScanNumDataPointsMatchesRdsTestSpecThickMPattern(RdsNo, RecipeLayer, Sca Response = MatchFound end service +Service AllowImport(RunData) + MetrologyImportValidationFeatureFlag = Xlate('FEATURE_FLAGS', 'METROLOGY_IMPORT_VALIDATION', FEATURE_FLAGS.ENABLED$, 'X') + FeatureDisabled = MetrologyImportValidationFeatureFlag NE True$ + ImportValidated = RunData EQ '' or RunData EQ 1 + Response = FeatureDisabled or ImportValidated +end service + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs @@ -3646,3 +3665,5 @@ LoadRunDataToDatabase: end return + + diff --git a/LSL2/STPROC/TEST_METROLOGYSERVICES.txt b/LSL2/STPROC/TEST_METROLOGYSERVICES.txt index b9d1485..4334286 100644 --- a/LSL2/STPROC/TEST_METROLOGYSERVICES.txt +++ b/LSL2/STPROC/TEST_METROLOGYSERVICES.txt @@ -179,3 +179,27 @@ Test ScanNumDataPointsMatchesRdsTestSpecThickMPatternEpiProWithCorrectArgsShould Matches = Metrology_Services('ScanNumDataPointsMatchesRdsTestSpecThickMPattern', '650028', '2', 9, '1722253':@VM:'1722259', 'FTIR', 2) Assert Matches equals True$ end test + +//----------------------------------------------------------------------------- +// AllowImport Tests +//----------------------------------------------------------------------------- +Test AllowImportWithFeatureFlagTurnedOffShouldReturnTrue + RunData = '' + RunData<99> = 1 + AllowImport = Metrology_Services('AllowImport', RunData) + Assert AllowImport equals True$ +end test + +Test AllowImportWithFeatureFlagTurnedOnAndImportFlagTrueShouldReturnTrue + RunData = '' + RunData<99> = 1 + AllowImport = Metrology_Services('AllowImport', RunData) + Assert AllowImport equals True$ +end test + +Test AllowImportWithFeatureFlagTurnedOnAndImportFlagFalseShouldReturnFalse + RunData = '' + RunData<99> = 'not valid' + AllowImport = Metrology_Services('AllowImport', RunData) + Assert AllowImport equals False$ +end test