diff --git a/LSL2/STPROC/REACTOR_SERVICES.txt b/LSL2/STPROC/REACTOR_SERVICES.txt index 5e68fb5..6ab26cb 100644 --- a/LSL2/STPROC/REACTOR_SERVICES.txt +++ b/LSL2/STPROC/REACTOR_SERVICES.txt @@ -3577,37 +3577,45 @@ end service Service GetReactorsWithDownLLByDtm(DtmToCheck, ReactType) ErrMsg = '' - AllReactors = Reactor_Services('GetReactorNumbers', ReactType) SLLReactors = '' - If AllReactors NE '' then - for each ReactNo in AllReactors using @FM - PickPlaceFlag = XLATE('REACTOR', ReactNo, REACTOR_PICK_PLACE$, 'X') - If PickPlaceFlag then - Open 'DICT.REACT_LL' to DictReactLL then - SearchString = '' - SearchString := 'REACT_NO':@VM:ReactNo:@FM - ReactLLKeys = '' - Btree.Extract(SearchString, 'REACT_LL', DictReactLL, ReactLLKeys) - - For each ReactLLKey in ReactLLKeys using @VM - ReactLLRec = Database_Services('ReadDataRow', 'REACT_LL', ReactLLKey, True$, 0, False$) - ReactLLStartDTM = Field(ReactLLKey, '*', 2) - ReactLLEndDTM = ReactLLRec - ReactLLApplicable = false$ - If ReactLLStartDTM LE DtmToCheck AND (ReactLLEndDTM EQ '' OR ReactLLEndDtm GT DtmToCheck) then - Locate ReactNo in SLLReactors using @VM setting iPos else - SLLReactors<1, -1> = ReactNo - end - end + If DtmToCheck NE '' then + AllReactors = Reactor_Services('GetReactorNumbers', ReactType) + If AllReactors NE '' then + for each ReactNo in AllReactors using @FM + PickPlaceFlag = XLATE('REACTOR', ReactNo, REACTOR_PICK_PLACE$, 'X') + If PickPlaceFlag then + Open 'DICT.REACT_LL' to DictReactLL then + SearchString = '' + SearchString := 'REACT_NO':@VM:ReactNo:@FM + ReactLLKeys = '' + Btree.Extract(SearchString, 'REACT_LL', DictReactLL, ReactLLKeys) - Next ReactLLKey - end else - ErrMsg = 'Unable to open the REACT_LL dictionary.' + For each ReactLLKey in ReactLLKeys using @VM + ReactLLRec = Database_Services('ReadDataRow', 'REACT_LL', ReactLLKey, True$, 0, False$) + ReactLLStartDTM = Field(ReactLLKey, '*', 2) + ReactLLEndDTM = ReactLLRec + ReactLLApplicable = false$ + If ReactLLStartDTM LE DtmToCheck AND (ReactLLEndDTM EQ '' OR ReactLLEndDtm GT DtmToCheck) then + Locate ReactNo in SLLReactors using @VM setting iPos else + SLLReactors<1, -1> = ReactNo + end + end + + Next ReactLLKey + end else + ErrMsg = 'Unable to open the REACT_LL dictionary.' + end end - end - Next ReactNo + Next ReactNo + end else + ErrMsg = 'No Reactor IDs found!' + end end else - ErrMsg = 'No Reactor IDs found!' + ErrMsg = 'Datetime to check variable was null.' + end + + If ErrMsg NE '' then + Error_Services('Add', ErrMsg) end Response = SLLReactors diff --git a/LSL2/STPROC/REPORTS_API.txt b/LSL2/STPROC/REPORTS_API.txt index 0776e02..79131b6 100644 --- a/LSL2/STPROC/REPORTS_API.txt +++ b/LSL2/STPROC/REPORTS_API.txt @@ -141,7 +141,12 @@ CreateHALItem: //Single Load Lock Report from Metrology Services ReportStartDtm = Http_Services('GetQueryField', 'StartDate') ReportEndDtm = Http_Services('GetQueryField', 'EndDate') - RepJson = Report_Services('GetSLLReportJson', ReportStartDtm, ReportEndDtm) + If ReportStartDtm NE '' AND ReportEndDtm NE '' then + RepJson = Report_Services('GetSLLReportJson', ReportStartDtm, ReportEndDtm) + end else + Error_Services('Add', 'Missing parameters for report.') + end + Case Otherwise$ Error_Services('Add', 'Unsupported report') End Case diff --git a/LSL2/STPROC/REPORT_SERVICES.txt b/LSL2/STPROC/REPORT_SERVICES.txt index 7519724..56218f5 100644 --- a/LSL2/STPROC/REPORT_SERVICES.txt +++ b/LSL2/STPROC/REPORT_SERVICES.txt @@ -2379,26 +2379,35 @@ Service GetSLLReportJson(FromDt, ToDt) ErrorMessage = '' SLLReportJson = '' objSLLReportJson = '' + If FromDt NE '' OR ToDt NE '' then + If SRP_Json(objSLLReportJson, 'New', 'Array') then + For StartDt = FromDt to ToDt + ThisDate = Date_Services('ConvertDateTimeToISO8601', StartDt) + ThisDtASMDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'ASM') + ThisDtASMPlusDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'ASM+') + ThisDtHTRDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'HTR') + ThisDtASMDownLLCount = DCount(ThisDtASMDownLL, @VM) + DCount(ThisDtASMPlusDownLL, @VM) + ThisDtHTRDownLLCount = DCount(ThisDtHTRDownLL, @VM) + objSLLDay = '' + If SRP_Json(objSLLDay, 'New', 'Object') then + SRP_Json(objSLLDay, 'SetValue', 'Date', ThisDate) + SRP_Json(objSLLDay, 'SetValue', 'ASM', ThisDtASMDownLLCount) + SRP_Json(objSLLDay, 'SetValue', 'HTR', ThisDtHTRDownLLCount) + SRP_Json(objSLLReportJson, 'Add', objSLLDay) + SRP_Json(objSLLDay, 'Release') + end + Next StartDt + SLLReportJson = SRP_Json(objSLLReportJson, 'Stringify', 'Fast') + SRP_Json(objSLLReportJson, 'Release') + end else + ErrorMessage = 'Error creating the root JSON for the report.' + end + end else + ErrorMessage = 'From Date or To Date was null.' + end - If SRP_Json(objSLLReportJson, 'New', 'Array') then - For StartDt = FromDt to ToDt - ThisDate = Date_Services('ConvertDateTimeToISO8601', StartDt) - ThisDtASMDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'ASM') - ThisDtASMPlusDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'ASM+') - ThisDtHTRDownLL = Reactor_Services('GetReactorsWithDownLLByDtm', StartDt + 1, 'HTR') - ThisDtASMDownLLCount = DCount(ThisDtASMDownLL, @VM) + DCount(ThisDtASMPlusDownLL, @VM) - ThisDtHTRDownLLCount = DCount(ThisDtHTRDownLL, @VM) - objSLLDay = '' - If SRP_Json(objSLLDay, 'New', 'Object') then - SRP_Json(objSLLDay, 'SetValue', 'Date', ThisDate) - SRP_Json(objSLLDay, 'SetValue', 'ASM', ThisDtASMDownLLCount) - SRP_Json(objSLLDay, 'SetValue', 'HTR', ThisDtHTRDownLLCount) - SRP_Json(objSLLReportJson, 'Add', objSLLDay) - SRP_Json(objSLLDay, 'Release') - end - Next StartDt - SLLReportJson = SRP_Json(objSLLReportJson, 'Stringify', 'Fast') - SRP_Json(objSLLReportJson, 'Release') + If ErrorMessage NE '' then + Error_Services('Add', ErrorMessage) end Response = SLLReportJson