Function GAN_CYCLE_TIME_SERVICES(@Service, @Params) /*********************************************************************************************************************** Name : GAN_CYCLE_TIME_SERVICES Description : Handler program for all module related services. Notes : Service module to support environmental state issues. Environmental refers to the state of the operating system, which includes version, client vs. server, and path to critical systems. 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) 09/30/2020 jro Original programmer. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler $insert LOGICAL $insert SERVICE_SETUP $INSERT REACT_RUN_EQUATES $INSERT GAN_CYCLE_TIME_EQUATES $INSERT GAN_STAGE_CYCLE_TIME_EQUATES $INSERT WO_LOG_EQUATES $INSERT PROD_VER_EQUATES $INSERT RUN_STAGE_WFR_EQUATES Declare Function Get.RecCount, GetTickCount, Obj_Tables, Gan_Services Declare Function DCount Declare Function Database_Services Declare Function Environment_Services, Logging_Services, Datetime Declare subroutine Copy_Record_To_SQL, Delete_Record_From_SQL,GetTickCount, Obj_Tables, Logging_Services LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\GAN_CYCLE_TIME' LogDate = Oconv(Date(), 'D4/') LogTime = Oconv(Time(), 'MTS') LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' GAN_CYCLE_TIME_Services.csv' Headers = 'Logging DTM' : @FM : 'User' : @FM : 'Notes' objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, Comma$, Headers, '', False$, False$) LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM GoToService else Error_Services('Add', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.') end Return Response OR '' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Services //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- Service ExportRecords() hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') Lock hSysLists, ServiceKeyID then StartTime = GetTickCount() Open "GAN_STAGE_CYCLE_TIME" to hTable then ClearSelect Select hTable Done = 0 Loop ReadNext Key else Done = 1 Until Done //0.00139 FmtKey = Key swap '*' with @VM in FmtKey //if FmtKey<1,1> EQ 386307 then Record = Xlate('GAN_STAGE_CYCLE_TIME', Key, '', 'X') LastWriteTime = Record Now = DateTime() //Difference = Now - LastWriteTime If (Now - LastWriteTime) LT 0.00139 then *Record is too new, may not be finished writing. Do Nothing LogData = '' LogData<1> = LoggingDTM LogData<2> = Key ' is <120 seconds... Doing nothing with it.' LogData<3> = 'Stage is ' : Record : '. Stop times are ' : Record '.' LogData<4> = '---------------------------------------------' Logging_Services('AppendLog', objLog, LogData, @FM, @VM) null; end else *Record is over 120 seconds old. Process it. //Fields from GAN_STAGE_CYCLE_TIME Stage = Record WfrID = Record OperatorStart = Record OperatorStop = Record Tool = Record ToolClass = Record RDSNo = Record //Fields from Other tables ReactRunRec = Xlate('REACT_RUN',RDSNo, '', 'X') WO_NO = ReactRunRec RunID = ReactRunRec ReactorNo = 'R':RunID[1,2] PartNo = XLATE('WO_LOG', WO_NO, WO_LOG_WAFER_TRACK_PART$,'X') ProdVerNo = XLATE('WO_LOG', WO_NO, WO_LOG_PROD_VER_NO$,'X') PSNo = Xlate('PROD_VER',ProdVerNo,PROD_VER_PROC_STEP_PSN$,'X') //Find Earliest and Latest START/STOP DTMs StartDTMs = Record StopDTMs = Record EarliestStart = StartDTMs<1,1> LatestStop = StopDTMs<1,1> //Find Earliest Start Time for stage For Each StartDTM in StartDTMs using @VM if StartDTM <= EarliestStart then EarliestStart = StartDTM end Next StartDTM //Find Latest Stop Time for stage For Each StopDTM in StopDTMs using @VM if StopDTM >= LatestStop then LatestStop = StopDTM end Next StopDTM IF Stage EQ 'EPI_DEPOSITION' then Recipe = ReactRunRec end else Recipe = '' end IF Stage EQ 'SPLIT' then RecToWrite = '' RecToWrite = WO_NO RecToWrite = RunID RecToWrite = RDSNo RecToWrite = Recipe RecToWrite = PartNo RecToWrite = PSNo RecToWrite = Stage RecToWrite = ToolClass RecToWrite = Tool RecToWrite = EarliestStart RecToWrite = LatestStop RecToWrite = OperatorStart RecToWrite = OperatorStop RecToWrite = '' RecToWrite = ReactorNo NewRecKey = RDSNo : '-' : Stage end else RecToWrite = '' RecToWrite = WO_NO RecToWrite = RunID RecToWrite = RDSNo RecToWrite = Recipe RecToWrite = PartNo RecToWrite = PSNo RecToWrite = Stage RecToWrite = ToolClass RecToWrite = Tool RecToWrite = EarliestStart RecToWrite = LatestStop RecToWrite = OperatorStart RecToWrite = OperatorStop RecToWrite = '' RecToWrite = ReactorNo NewRecKey = RDSNo : '-' : Stage: '-' : LatestStop end Obj_Tables('WriteRec', 'GAN_CYCLE_TIME':@RM:NewRecKey:@RM:@RM:RecToWrite) LogData = '' LogData<1> = LoggingDTM LogData<2> = Key ' is >120 seconds... Processing.' LogData<3> = 'Stage is ' : Record : '. Stop times are ' : Record '.' LogData<4> = '---------------------------------------------' Logging_Services('AppendLog', objLog, LogData, @FM, @VM) GoSub CheckFinishStatus Delete hTable, Key end //end Repeat end end Unlock hSysLists, ServiceKeyID else Null Return ////////////////////////////////////////////////////////////// end service * * * * * * * * * * CheckFinishStatus: * * * * * * * * * * InWfrIds = ReactRunRec WaferFinished = '' for each InWfrId in InWfrIds using @VM setting wfrPos WaferFinished<1,wfrPos> = Gan_Services('GetMetrologyStatus', InWfrId) Next InWfrId Locate '0' in WaferFinished using @VM setting wPos then //Do Nothing, Lot isn't finished all stages return end else //Create a GAN_CYCLE_TIME Record ReactRunRec = Xlate('REACT_RUN',RDSNo, '', 'X') Stage = 'FINISH' WfrID = '' OperatorStart = '' OperatorStop = '' Tool = '' ToolClass = '' RDSNo = Record WO_NO = ReactRunRec RunID = ReactRunRec ReactorNo = 'R':RunID[1,2] PartNo = XLATE('WO_LOG', WO_NO, WO_LOG_WAFER_TRACK_PART$,'X') ProdVerNo = XLATE('WO_LOG', WO_NO, WO_LOG_PROD_VER_NO$,'X') PSNo = Xlate('PROD_VER',ProdVerNo,PROD_VER_PROC_STEP_PSN$,'X') FinishTime = Datetime() RecToWrite = '' RecToWrite = WO_NO RecToWrite = RunID RecToWrite = RDSNo RecToWrite = Recipe RecToWrite = PartNo RecToWrite = PSNo RecToWrite = Stage RecToWrite = ToolClass RecToWrite = Tool RecToWrite = FinishTime RecToWrite = FinishTime RecToWrite = OperatorStart RecToWrite = OperatorStop RecToWrite = '' RecToWrite = ReactorNo NewRecKey = RDSNo : '-' : Stage Obj_Tables('WriteRec', 'GAN_CYCLE_TIME':@RM:NewRecKey:@RM:@RM:RecToWrite) LogData = '' LogData<1> = LoggingDTM LogData<2> = RDSNo ' is finished processing.' LogData<3> = 'Stage is ' : Record : '. Stop times are ' : Record '.' LogData<4> = '---------------------------------------------' Logging_Services('AppendLog', objLog, LogData, @FM, @VM) end return