Merged PR 13809: ABORT/ALARM Nica Integration

## Background

Currently when a mode change sub mode is an ABORT/ALARM sub mode, operators must refer to an Excel spreadsheet matrix of which paper checklists to complete. This feature is part of an effort to further digitize work instructions and streamline the process of determining which checklists should be completed depending on the reason why a reactor alarmed / aborted.

## Description of Change

NICA_ORDERS_SERVICES (and the NICA Integration Service) now support an order type "ABORT_ALARM", which may be triggered when a reactor mode change occurs and the sub mode contains "ABORT/ALARM". Whether or not a NICA order is created depends on if the NICA checklist defined in OpenInsight applies to that reactor type (EpiPro is excluded for now). The "flows" of checklists to prescribe are defined in the REACT_PROB_CAT records for the ABORT/ALARM sub modes. Furthermore, NICA checklists defined in OpenInsight can now feature a property of whether or not they should _not_ be re-prescribed if a new NICA order is created of the same type while one is already active.

## Testing
- Local testing
- UAT by Jonathon Sperling

## Notes
In the previous NICA integration feature, Intrusive Maintenance, the MonA group resource name was stored in environment variables instead of in ENVIRONMENT_SERVICES. After further testing, this turned out to be an unviable option as environment variables that are picked up are from the user's client or the terminal server they are running OpenInsight from. Setting environment variables on all clients and the terminal servers is not practical, so this was removed in a previous PR.

Related work items: #175188
This commit is contained in:
Stieber Daniel (CSC FI SPS MESLEO)
2025-03-26 22:03:25 +01:00
parent 0716e25303
commit 6050b346a5
11 changed files with 352 additions and 150 deletions

View File

@ -53,6 +53,8 @@ $Insert REACTOR_DAILY_UPTIME_EQUATES
$Insert REACT_LL_EQUATES
$Insert IQS_VIOL_DATA_EQUATES
$Insert FEATURE_FLAGS_EQUATES
$Insert REACT_PROB_CAT_EQUATES
$Insert NICA_ORDERS_EQUATES
Equ WOCust$ to 2
@ -66,13 +68,13 @@ Equ ENG$ to 5
Declare subroutine Error_Services, Reactor_Services, Memory_Services, RList, Database_Services, SRP_JSON
Declare subroutine Excel_Services, Schedule_Services, Logging_Services, Set_Status, obj_React_Status, Errmsg
Declare subroutine Obj_Notes, Btree.Extract, SRP_Fastarray, Delay, Mona_Services, SRP_List, Msg, Rds_Services
Declare subroutine React_Assign_Conv, Nica_Orders_Services, obj_React_Mode
Declare subroutine React_Assign_Conv, Nica_Orders_Services, obj_React_Mode, Reactor_Log_Services
Declare function SRP_Array, Reactor_Services, Memory_Services, Database_Services, SRP_Sort_Array, Excel_Services
Declare function SRP_Math, SRP_Hash, SRP_JSON, Epi_Part_Services, Schedule_Services, Date_Services, Environment_Services
Declare function Logging_Services, GetCommandLine, NextKey, Reactor_Log_Services, SRP_DateTime, ole_getwebpage
Declare function Datetime, Reactor_Modes_Services, Work_Order_Services, React_Mode_NG_Services, Lsl_Users_Services
Declare function SRP_Time, Rds_Services, SRP_Fastarray, Httpclient_Services, SRP_List, Utility, Memberof, Error_Services
Declare function Nica_Orders_Services
Declare function Nica_Orders_Services, Max
// Report paths for various performance report services.
TemplatesFolder = Environment_Services('GetApplicationRootPath') : '\Reports\Scheduler\Templates\'
@ -1873,7 +1875,7 @@ end service
Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, ForceModeChange)
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\ReactorModeChg'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
@ -1885,13 +1887,13 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
ErrorMsg = ''
IF ForceModeChange NE True$ then ForceModeChange = False$
If ( (UserID NE '') and (ReactNo NE '') and (Mode NE '') and (ModeSubCat NE '')) then
CurTime = Time()
CurDate = Date()
NGPrevModeKey = Xlate('REACTOR_CHILD_KEY_IDS_NG', ReactNo, REACTOR_CHILD_KEY_IDS_REACT_MODE_KEY_IDS$, 'X')<1, 1>
PrevModeRec = Reactor_Services('GetReactCurrModeRec', ReactNo)
SelectedModeRec = Database_Services('ReadDataRow', 'REACTOR_MODES', Mode)
SelE10State = SelectedModeRec<REACTOR_MODES_E10_STATE$>
CurTime = Time()
CurDate = Date()
NGPrevModeKey = Xlate('REACTOR_CHILD_KEY_IDS_NG', ReactNo, REACTOR_CHILD_KEY_IDS_REACT_MODE_KEY_IDS$, 'X')<1, 1>
PrevModeRec = Reactor_Services('GetReactCurrModeRec', ReactNo)
SelectedModeRec = Database_Services('ReadDataRow', 'REACTOR_MODES', Mode)
SelE10State = SelectedModeRec<REACTOR_MODES_E10_STATE$>
RlComment = ''
CommentException = False$
Begin Case
@ -1990,6 +1992,53 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
end
end
If ErrorMsg EQ '' then
AbortAlarmFeatureFlag = Xlate('FEATURE_FLAGS', 'NICA_ABORT_ALARM', FEATURE_FLAGS.ENABLED$, 'X')
If AbortAlarmFeatureFlag EQ True$ then
ModeSubCatFlowId = Xlate('REACT_PROB_CAT', ModeSubCatId, REACT_PROB_CAT_ABORT_ALARM_FLOW_ID$, 'X')
ModeSubCatRespLvl = Xlate('REACT_PROB_CAT', ModeSubCatId, REACT_PROB_CAT_ABORT_ALARM_RESPONSE_LEVEL$, 'X')
AbortAlarmComp = Xlate('REACTOR', ReactNo, REACTOR_ABORT_ALARM_COMPLETE$, 'X')
ActiveAbortAlarmOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM')
AbortAlarmOrderActive = (ActiveAbortAlarmOrders NE '')
Begin Case
Case ( AbortAlarmOrderActive and (SelE10State _EQC 'Productive') )
ErrorMsg = "An ABORT/ALARM Checklist is active for this reactor and must be completed or overridden in order to change to a productive state."
Case ( AbortAlarmOrderActive and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') )
// If there is an active ABORT/ALARM NICA order, then we need to check if the new sub mode is different than the sub mode entered when the ABORT/ALARM
// NICA order was created and is of a higher response level or the new mode is WAITING_FOR_OPERATOR and the sub mode has changed. This means the maintenance
// team deemed the true ABORT/ALARM root cause was different than the cause the operators selected.
ActiveAbortAlarmFlowIds = Xlate('NICA_ORDERS', ActiveAbortAlarmOrders, NICA_ORDERS.ORDER_FLOW_IDS$, 'X')
ActiveAbortAlarmRespLvls = Xlate('NICA_ORDERS', ActiveAbortAlarmOrders, NICA_ORDERS.ORDER_RESPONSE_LEVEL$, 'X')
MaxActiveRespLvl = ''
For each ActiveAbortAlarmRespLvl in ActiveAbortAlarmRespLvls using @VM
MaxActiveRespLvl = Max(MaxActiveRespLvl, ActiveAbortAlarmRespLvl)
Next ActiveAbortAlarmRespLvl
If ( (Mode _EQC 'WAITING_FOR_OPERATOR') and (ModeSubCatFlowId NE ActiveAbortAlarmFlowIds) ) |
or ( (ModeSubCatFlowId NE ActiveAbortAlarmFlowIds) and (ModeSubCatRespLvl GT MaxActiveRespLvl) ) then
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', ModeSubCatFlowId, 'ABORT_ALARM', ReactorType)
If ChecklistIds NE '' then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'ABORT_ALARM', ModeSubCatFlowId, ModeSubCatRespLvl, ChecklistIds)
RlComment = 'ABORT/ALARM initiated for flow ':ModeSubCatFlowId:'.'
end
end
Case ( Not(AbortAlarmComp) and Not(AbortAlarmOrderActive) and IndexC(ModeSubCat, 'ABORT/ALARM', 1) and (ModeSubCatFlowId NE '') )
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', ModeSubCatFlowId, 'ABORT_ALARM', ReactorType)
If ChecklistIds NE '' then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'ABORT_ALARM', ModeSubCatFlowId, ModeSubCatRespLvl, ChecklistIds)
RlComment = 'ABORT/ALARM initiated for flow ':ModeSubCatFlowId:'.'
end
Case Otherwise$
// Don't create an ABORT/ALARM NICA order
Null
End Case
end
end
If ErrorMsg EQ '' then
If Len(Mode) GT 10 and Mode[1, 10] EQ 'CHANGEOVER' then
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactNo, 'CHANGEOVER')
@ -2005,7 +2054,7 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
end
If ErrorMsg EQ '' then
//Log the current Mode Change
// Log the current Mode Change
LogData = ''
LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') ; // Logging DTM
LogData<2> = 'Reactor No: ' : ReactNo : ' - Requested Mode Change: ' : Mode
@ -2025,7 +2074,7 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
**********************************************************************************
* WRITE OUT NEW MODE INFORMATION
//Create new React_Util record
// Create new React_Util record
NewRUKey = NextKey('REACT_UTIL')
If Error_Services('NoError') then
@ -2052,7 +2101,7 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
RUtilRec<react_util_cust_no$> = xlate( 'WO_LOG', WorkOrder, wo_log_cust_no$, 'X' ) ;
********************************************************************************************************
//Create a new Reactor_Log Entry
// Create a new Reactor_Log Entry
EntryId = UserID
RLRec = ''
@ -2118,7 +2167,7 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
END ;* End of check on Current Mode
* * * End of changes * * * * *
//Write new mode info to config table.
// Write new mode info to config table.
OrigConfigRec = Database_Services('ReadDataRow', 'CONFIG', RecName)
Database_Services('WriteDataRow', 'CONFIG', RecName, Rec)
@ -2168,6 +2217,24 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
// Reopen previous react mode
Database_Services('WriteDataRow', 'REACT_MODE_NG', NGPrevModeKey, PrevModeRec)
end else
If RlComment NE '' then Reactor_Log_Services('AddComment', ReactNo, RlComment, UserID)
If SelE10State _EQC 'Productive' then
// Reset ABORT/ALARM flag
Open 'REACTOR' to hReactor then
WriteV False$ to hReactor, ReactNo, REACTOR_ABORT_ALARM_COMPLETE$ then
LogData = ''
LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') ; // Logging DTM
LogData<2> = 'Successfully set ABORT_ALARM_COMPLETE flag to false for Reactor No: ' : ReactNo
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$)
end else
LogData = ''
LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') ; // Logging DTM
LogData<2> = 'Failed set ABORT_ALARM_COMPLETE flag to false for Reactor No: ' : ReactNo
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$)
end
end
end
// Check to see if notifications are active for this mode
If SelectedModeRec<REACTOR_MODES_NOTIFICATION_ACTIVE$> then
//If notifications are active get the classes from the REACTOR_MODE record