diff --git a/LSL2/STPROC/REACTOR_LOG_SERVICES.txt b/LSL2/STPROC/REACTOR_LOG_SERVICES.txt index 8825f63..adc3688 100644 --- a/LSL2/STPROC/REACTOR_LOG_SERVICES.txt +++ b/LSL2/STPROC/REACTOR_LOG_SERVICES.txt @@ -237,37 +237,41 @@ Service SignReactorLog(ReactorLogID, UserID) If OpenPMKeys NE '' then * If more than one, which should not happen then close all KCnt = COUNT( OpenPMKeys, @VM ) + (OpenPMKeys NE '') - + PMResched = False$ For I = 1 to KCnt - OpenPMKeys = OpenPMKeys<1,I> + ThisOpenPMKey = OpenPMKeys<1,I> - otlParms = 'REACTOR_PM':@RM - otlParms := OpenPMKeys:@RM - otlParms := REACTOR_PM_COMPLETE_DATE$:@VM:REACTOR_PM_COMP_RL_NO$:@RM - otlParms := EndDate:@VM:ReactorLogID:@RM - If OpenPMKeys NE '' then + otlParms = 'REACTOR_PM':@RM + otlParms := ThisOpenPMKey:@RM + otlParms := REACTOR_PM_COMPLETE_DATE$:@VM:REACTOR_PM_COMP_RL_NO$:@RM + otlParms := EndDate:@VM:ReactorLogID:@RM + If ThisOpenPMKey NE '' then obj_Post_Log('Create',otlParms) ;* Closes previous PM record If Not(Get_Status(ErrCode)) then * Schedule next PM PMDays = XLATE( 'REACT_SERVS', CurService, REACT_SERVS_PM_DAYS$, 'X' ) - IF PMDays NE '' THEN - PMNo = NextKey('REACTOR_PM') - If Error_Services('NoError') then - NewPMRec = '' - NewPMRec = UserID - NewPMRec = Date() - NewPMRec = ReactorNo - NewPMRec = EndDate - NewPMRec = EndDate + PMDays - NewPMRec = CurService - NewPMRec = ReactorLogID - - Database_Services('WriteDataRow', 'REACTOR_PM', PMNo, NewPMRec) - If Error_Services('HasError') then - ErrorMsg = Error_Services('GetMessage') - end - end else - ErrorMsg = 'Error in ':Service:' service. Error calling NextKey("REACTOR_PM").' + IF PMDays NE '' THEN + If PMResched EQ False$ then + PMNo = NextKey('REACTOR_PM') + If Error_Services('NoError') then + NewPMRec = '' + NewPMRec = UserID + NewPMRec = Date() + NewPMRec = ReactorNo + NewPMRec = EndDate + NewPMRec = EndDate + PMDays + NewPMRec = CurService + NewPMRec = ReactorLogID + + Database_Services('WriteDataRow', 'REACTOR_PM', PMNo, NewPMRec) + If Error_Services('NoError') then + PMResched = True$ + end else + ErrorMsg = Error_Services('GetMessage') + end + end else + ErrorMsg = 'Error in ':Service:' service. Error calling NextKey("REACTOR_PM").' + end end end end else @@ -1280,3 +1284,4 @@ return +