diff --git a/LSL2/STPROC/REACTOR_DAILY_UPTIME_SERVICES.txt b/LSL2/STPROC/REACTOR_DAILY_UPTIME_SERVICES.txt new file mode 100644 index 0000000..c55da0b --- /dev/null +++ b/LSL2/STPROC/REACTOR_DAILY_UPTIME_SERVICES.txt @@ -0,0 +1,138 @@ +Compile function Reactor_Daily_Uptime_Services(@Service, @Params) +#pragma precomp SRP_PreCompiler +$insert LOGICAL +$Insert REACTOR_DAILY_UPTIME_EQUATES + +EQU ReportPeriodStartDtm$ To 1 +EQU ReportPeriodEndDtm$ To 2 +EQU ReportAllUpTimePercent$ To 3 +EQU ReportAllUpTimeMinutes$ To 4 +EQU ReportAllAvailMinutes$ To 5 +EQU ReportASMUpTimePercent$ To 6 +EQU ReportASMUpTimeMinutes$ To 7 +EQU ReportASMAvailMinutes$ To 8 +EQU ReportHTRUpTimePercent$ To 9 +EQU ReportHTRUpTimeMinutes$ To 10 +EQU ReportHTRAvailMinutes$ To 11 +EQU ReportEPPUpTimePercent$ To 12 +EQU ReportEPPUpTimeMinutes$ To 13 +EQU ReportEPPAvailMinutes$ To 14 + +Declare function SRP_Datetime, Database_Services, SRP_Math, SRP_Json, Date_Services +Declare subroutine SRP_Json + +GoToService + +Return Response or "" + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Service Parameter Options +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Options BOOLEAN = True$, False$ +Options RESPONSE_OUTPUT = 'CSV', 'JSON', 'INTERNAL' + +//----------------------------------------------------------------------------- +// SERVICES +//----------------------------------------------------------------------------- + +Service GetReactorClassUpTimeMetricsByTimePeriod(StartDtm, EndDtm, ResponseType=RESPONSE_OUTPUT) + + MetricsData = '' + StartDate = SRP_Datetime('Date', StartDtm) + EndDate = SRP_Datetime('Date', EndDtm) + AllReportMinutes = 0 + AllUptimeMinutes = 0 + AllUptimePercentage = 0 + ASMReportMinutes = 0 + ASMUptimeMinutes = 0 + ASMUptimePercentage = 0 + HTRReportMinutes = 0 + HTRUptimeMinutes = 0 + HTRUptimePercentage = 0 + EPPReportMinutes = 0 + EPPUptimeMinutes = 0 + EPPUptimePercentage = 0 + + for ThisDate = StartDate to EndDate + ASMRecordId = 'ASM*':ThisDate + HTRRecordId = 'HTR*':ThisDate + EPPRecordId = 'EPP*':ThisDate + AllRecordId = 'ALL*':ThisDate + + ASMRecord = Database_Services('ReadDataRow', 'REACTOR_DAILY_UPTIME', ASMRecordId, True$, 0, False$) + ThisASMReportMinutes = ASMRecord + ThisASMUptimeMinutes = ASMRecord + ASMReportMinutes += ThisASMReportMinutes + ASMUptimeMinutes += ThisASMUptimeMinutes + + HTRRecord = Database_Services('ReadDataRow', 'REACTOR_DAILY_UPTIME', HTRRecordId, True$, 0, False$) + ThisHTRReportMinutes = HTRRecord + ThisHTRUptimeMinutes = HTRRecord + HTRReportMinutes += ThisHTRReportMinutes + HTRUptimeMinutes += ThisHTRUptimeMinutes + + EPPRecord = Database_Services('ReadDataRow', 'REACTOR_DAILY_UPTIME', EPPRecordId, True$, 0, False$) + ThisEPPReportMinutes = EPPRecord + ThisEPPUptimeMinutes = EPPRecord + EPPReportMinutes += ThisEPPReportMinutes + EPPUptimeMinutes += ThisEPPUptimeMinutes + + AllRecord = Database_Services('ReadDataRow', 'REACTOR_DAILY_UPTIME', AllRecordId, True$, 0, False$) + ThisALLReportMinutes = AllRecord + ThisALLUptimeMinutes = AllRecord + AllReportMinutes += ThisAllReportMinutes + AllUptimeMinutes += ThisAllUptimeMinutes + Next ThisDate + + if AllReportMinutes > 0 then AllUptimePercentage = SRP_Math('ROUND', AllUptimeMinutes, 0) / SRP_Math('ROUND', AllReportMinutes, 0) + + if ASMReportMinutes > 0 then ASMUptimePercentage = SRP_Math('ROUND', ASMUptimeMinutes, 0) / SRP_Math('ROUND', ASMReportMinutes, 0) + + if HTRReportMinutes > 0 then HTRUptimePercentage = SRP_Math('ROUND', HTRUptimeMinutes, 0) / SRP_Math('ROUND', HTRReportMinutes, 0) + + if EPPReportMinutes > 0 then EPPUptimePercentage = SRP_Math('ROUND', EPPUptimeMinutes, 0) / SRP_Math('ROUND', EPPReportMinutes, 0) + + Begin Case + Case ResponseType = 'JSON' + objJson = '' + If SRP_Json(objJson, 'New') then + StartDtmString = Date_Services('ConvertDateTimeToISO8601', StartDtm) + StopDtmString = Date_Services('ConvertDateTimeToISO8601', EndDtm) + SRP_Json(objJson, "SetValue", "PeriodStartDtm", StartDtmString) + SRP_Json(objJson, "SetValue", "PeriodEndDtm", StopDtmString) + SRP_Json(objJson, "SetValue", "AllUptimePercentage", AllUptimePercentage) + SRP_Json(objJson, "SetValue", "AllUptimeMinutes", AllUptimeMinutes) + SRP_Json(objJson, "SetValue", "AllAvailMinutes", AllReportMinutes) + SRP_Json(objJson, "SetValue", "ASMUptimePercentage", ASMUptimePercentage) + SRP_Json(objJson, "SetValue", "ASMUptimeMinutes", ASMUptimeMinutes) + SRP_Json(objJson, "SetValue", "ASMAvailMinutes", ASMReportMinutes) + SRP_Json(objJson, "SetValue", "HTRUptimePercentage", HTRUptimePercentage) + SRP_Json(objJson, "SetValue", "HTRUptimeMinutes", HTRUptimeMinutes) + SRP_Json(objJson, "SetValue", "HTRAvailMinutes", HTRReportMinutes) + SRP_Json(objJson, "SetValue", "EPPUptimePercentage", EPPUptimePercentage) + SRP_Json(objJson, "SetValue", "EPPUptimeMinutes", EPPUptimeMinutes) + SRP_Json(objJson, "SetValue", "EPPAvailMinutes", EPPReportMinutes) + MetricsData = SRP_Json(objJson, "Stringify", "STYLED") + SRP_Json(objJson, "Release") + end + Case Otherwise$ + MetricsData = StartDtm + MetricsData = EndDtm + MetricsData = AllUptimePercentage + MetricsData = AllUptimeMinutes + MetricsData = AllReportMinutes + MetricsData = ASMUptimePercentage + MetricsData = ASMUptimeMinutes + MetricsData = ASMReportMinutes + MetricsData = HTRUptimePercentage + MetricsData = HTRUptimeMinutes + MetricsData = HTRReportMinutes + MetricsData = EPPUptimePercentage + MetricsData = EPPUptimeMinutes + MetricsData = EPPReportMinutes + End Case + + Response = MetricsData + +End Service + diff --git a/LSL2/STPROC/REPORTS_API.txt b/LSL2/STPROC/REPORTS_API.txt index 075f611..3aa4889 100644 --- a/LSL2/STPROC/REPORTS_API.txt +++ b/LSL2/STPROC/REPORTS_API.txt @@ -42,7 +42,7 @@ $insert APP_INSERTS $insert API_SETUP $insert HTTP_INSERTS -Declare Function Report_Services, Oi_Wizard_Services, Logging_Services, Environment_Services, Test_Run_Services +Declare Function Report_Services, Oi_Wizard_Services, Logging_Services, Environment_Services, Test_Run_Services, Reactor_Daily_Uptime_Services Declare subroutine Report_Services, Logging_Services LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\API\Reports' @@ -133,6 +133,12 @@ CreateHALItem: ReportStartDtm = Http_Services('GetQueryField', 'StartDate') ReportEndDtm = Http_Services('GetQueryField', 'EndDate') RepJSON = Report_Services('GetDailyReactorUptimeDataJSON', ReportStartDtm, ReportEndDtm) + Case ReportID = 'ReactorPeriodUptime' + ReportStartDtm = Http_Services('GetQueryField', 'StartDate') + ReportEndDtm = Http_Services('GetQueryField', 'EndDate') + ReportStartDtm = IConv(ReportStartDtm, '[SRP_DATETIME]') + ReportEndDtm = IConv(ReportEndDtm, '[SRP_DATETIME]') + RepJSON = Reactor_Daily_Uptime_Services('GetReactorClassUpTimeMetricsByTimePeriod', ReportStartDtm, ReportEndDtm, 'JSON') Case ReportID = 'TestWaferWIPReport' RepJSON = Report_Services('GetOpenTestWaferLotWIPReportJson') Case ReportID = 'OpenNCRReport'