diff --git a/LSL2/STPROC/LOT_OPERATION_SERVICES.txt b/LSL2/STPROC/LOT_OPERATION_SERVICES.txt index 12c4a18..310abbc 100644 --- a/LSL2/STPROC/LOT_OPERATION_SERVICES.txt +++ b/LSL2/STPROC/LOT_OPERATION_SERVICES.txt @@ -3,8 +3,8 @@ 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 +Declare function Date_Services, SRP_Stopwatch +Declare subroutine Database_Services, Error_Services, SRP_JSON, Lot_Services, Lot_Event_Services, Lot_Operation_Services, SRP_Stopwatch $insert LOGICAL $insert LOT_EQUATES @@ -296,18 +296,29 @@ Service ConvertRecordToJson(LotOperationId) SRP_Json(objJSON, 'Set', 'AssociatedMetTests', objAssocMetTest) SRP_Json(objAssocMetTest, 'Release') end - //Add Available Met Test Record - AvailMetTestIds = Met_Test_Services('GetMetTests', LotId, LegacyLotId, '', '', True$) + RequiredClasses = LotOperationRec + AvailMetTestIds = '' + ThisOperationDTMIn = LotOperationRec + ThisOperationDTMOut = LotOperationRec + if RequiredClasses NE '' AND DatetimeIn NE '' AND DatetimeOut EQ '' then + AvailMetTestIds = Met_Test_Services('GetMetTests', LotId, LegacyLotId, '', True$, RequiredClasses, ThisOperationDTMIn, ThisOperationDTMOut) + end objAvailMetTest = '' If SRP_Json(objAvailMetTest, 'New', 'Array') then - for each MetTestId in AvailMetTestIds using @VM - MetTestJson = Met_Test_Services('ConvertRecordToJson', MetTestId) - If SRP_Json(objMetTest, 'Parse', MetTestJson) EQ '' then - SRP_Json(objAvailMetTest, 'Add', objMetTest) - SRP_Json(objMetTest, 'Release') - end - Next MetTestId + if AvailMetTestIds NE '' then + for each MetTestId in AvailMetTestIds using @VM + + SRP_Stopwatch('Start', 'MetTestJson') + MetTestJson = Met_Test_Services('ConvertRecordToJson', MetTestId) + SRP_Stopwatch('Stop', 'MetTestJson') + totalTime = SRP_Stopwatch('GetBenchmark', 'MetTestJson') + If SRP_Json(objMetTest, 'Parse', MetTestJson) EQ '' then + SRP_Json(objAvailMetTest, 'Add', objMetTest) + SRP_Json(objMetTest, 'Release') + end + Next MetTestId + end SRP_Json(objJSON, 'Set', 'AvailMetTests', objAvailMetTest) SRP_Json(objAvailMetTest, 'Release') end @@ -510,3 +521,4 @@ Service ValidateLotOperation(LotOperationId) Response = IsValid end service + diff --git a/LSL2/STPROC/MET_TEST_SERVICES.txt b/LSL2/STPROC/MET_TEST_SERVICES.txt index 0b03b08..76f401d 100644 --- a/LSL2/STPROC/MET_TEST_SERVICES.txt +++ b/LSL2/STPROC/MET_TEST_SERVICES.txt @@ -994,7 +994,7 @@ Service ConvertRecordToJson(MetTestId) SRP_JSON(objJSON, 'SetValue', 'outOfSpec', {OUT_OF_SPEC}, 'Boolean') SRP_JSON(objJSON, 'SetValue', 'complete', {COMPLETE}, 'Boolean') objMetPropArray = '' - If SRP_JSON(objMetPropArray, 'New', 'Array') then + If SRP_JSON(objMetPropArray, 'New', 'Array') then For PropIndex = 1 to NUM_PROPERTIES$ PropName = Xlate('MET_TEST', MetTestId, 'PROPERTY_':PropIndex, 'X') PropVals = Xlate('MET_TEST_DATA', MetTestDataIds, 'PROPERTY_':PropIndex:'_VALUE', 'X') @@ -1110,7 +1110,7 @@ end service // MET_TEST key ids. // //---------------------------------------------------------------------------------------------------------------------- -Service GetMetTests(LotId, LegacyLotId, LotOperationId, ToolId, ExcludeAssociated) +Service GetMetTests(LotId, LegacyLotId, ToolId, ExcludeAssociated, MatchClass, FromDtm, ToDtm) ErrorMsg = '' MetTestIds = '' @@ -1119,6 +1119,17 @@ Service GetMetTests(LotId, LegacyLotId, LotOperationId, ToolId, ExcludeAssociate If RowExists('LOT', LotId) then Open 'DICT.MET_TEST' to DictVar then SearchString = '' + If MatchClass NE '' then + If DCount(MatchClass, @VM) GT 1 then + SearchString := 'TOOL_CLASS':@VM:MatchClass<1,1> + for i = 2 to DCount(MatchClass, @VM) + SearchString := @VM : ';':MatchClass<1,i> + Next i + SearchString := @FM + end else + SearchString := 'TOOL_CLASS':@VM:MatchClass:@FM + end + end If LotId NE '' then SearchString := 'LOT_ID':@VM:LotId:@FM end @@ -1128,19 +1139,33 @@ Service GetMetTests(LotId, LegacyLotId, LotOperationId, ToolId, ExcludeAssociate If ToolId NE '' then SearchString := 'TOOL':@VM:ToolId:@FM end - Btree.Extract(SearchString, 'MET_TEST', DictVar, MetTestIds, '', '') - If MetTestIds NE '' then - If ExcludeAssociated then - for each MetTestId in MetTestIds using @VM setting mPos - MetTestLotOperationId = Database_Services('ReadDataColumn', 'MET_TEST', MetTestId, MET_TEST.LOT_OPERATION_ID$, True$, 0, False$) - If MetTestLotOperationId EQ '' then - RespMetTestIds<1,-1> = MetTestId - end - Next MetTestId + if FromDtm NE '' then + FromDtm = FromDtm + 0.000001 + If ToDtm NE '' then + ToDtm = ToDtm + 0.000001 + end else - RespMetTestIds = MetTestIds + ToDtm = DateTime() end + SearchString := 'TEST_DTM':@VM:FromDtm:'~':ToDtm:@FM end + Btree.Extract(SearchString, 'MET_TEST', DictVar, MetTestIds, '', '') + If Not(Get_status(errCode)) then + If MetTestIds NE '' then + If ExcludeAssociated then + for each MetTestId in MetTestIds using @VM setting mPos + MetTestLotOperationId = Database_Services('ReadDataColumn', 'MET_TEST', MetTestId, MET_TEST.LOT_OPERATION_ID$, True$, 0, False$) + If MetTestLotOperationId EQ '' then + RespMetTestIds<1,-1> = MetTestId + end + Next MetTestId + end else + RespMetTestIds = MetTestIds + end + end + end else + ErrorMsg = ErrCode + end end else ErrorMsg = 'Error in ' : Service : ' service. Error opening MET_TEST dictionary.' end @@ -1252,3 +1277,4 @@ end service +