diff --git a/LSL2/STPROC/PM_SERVICES.txt b/LSL2/STPROC/PM_SERVICES.txt index 85f3dd3..0f2dae5 100644 --- a/LSL2/STPROC/PM_SERVICES.txt +++ b/LSL2/STPROC/PM_SERVICES.txt @@ -426,20 +426,26 @@ Service FailedPM(PMNo, UserID, StartDTM) PMSNo = PMRec ToolID = Xlate('PM_SPEC', PMSNo, PM_SPEC_TOOL_ID$, 'X') If ( (PMSNo NE '') and (ToolID NE '') ) then - // Only change the tool mode if the tool is in one of the modes listed in the APP_INFO*QUAL_CHANGE_MODES - // record! This is to preserve other tool modes as the current mode such as SCHED_MTC. - CurrMode = Xlate('TOOL', ToolID, 'CURR_MODE', 'X')<1,1> - Locate CurrMode in ChangeModes using @FM setting fPos then - Reason = 'PM No. ':PMNo:' Failed' - NewMode = 'VER_FAILED' - Tool_Services('ChangeToolMode', ToolID, NewMode, Reason, UserID, True$) + EarlyStartDTM = IConv(Xlate('PM_SPEC', PMSNo, 'EARLY_START', 'X'), 'DT') + If StartDTM GE EarlyStartDTM then + // Only change the tool mode if the tool is in one of the modes listed in the APP_INFO*QUAL_CHANGE_MODES + // record! This is to preserve other tool modes as the current mode such as SCHED_MTC. + CurrMode = Xlate('TOOL', ToolID, 'CURR_MODE', 'X')<1,1> + Locate CurrMode in ChangeModes using @FM setting fPos then + Reason = 'PM No. ':PMNo:' Failed' + NewMode = 'VER_FAILED' + Tool_Services('ChangeToolMode', ToolID, NewMode, Reason, UserID, True$) + end else + LogData = '' + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<2> = ToolID + LogData<3> = 'Unable to locate curr mode in the list of modes to change from.' + LogData<4> = '' + Logging_Services('AppendLog', objLog, LogData, @RM, @FM) + end end else - LogData = '' - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<2> = ToolID - LogData<3> = 'Unable to locate curr mode in the list of modes to change from.' - LogData<4> = '' - Logging_Services('AppendLog', objLog, LogData, @RM, @FM) + // It is too early to start this PM + Error_Services('Add', 'Error in ':Service:' service. Too early to start PMNo ':PMNo:'.') end end end @@ -1087,3 +1093,4 @@ return +