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

@ -231,3 +231,4 @@ Restore_System_Variables:
return

View File

@ -27,11 +27,14 @@ $Insert SERVICE_SETUP
$Insert REACTOR_EQUATES
$Insert REACTOR_LOG_EQUATES
$Insert NICA_ORDERS_EQUATES
$Insert NICA_CHECKLISTS_EQUATES
$Insert NICA_ORDERS_CHECKLISTS_EQUATES
$Insert RLIST_EQUATES
Equ SECONDS_IN_DAY$ to 86400
Declare function Environment_Services, Database_Services, Error_Services, Logging_Services, Nica_Orders_Services
Declare function Httpclient_Services, SRP_JSON, Reactor_Services, Reactor_Log_Services, SRP_Array
Declare function Httpclient_Services, SRP_JSON, Reactor_Services, Reactor_Log_Services, SRP_Array, Datetime
Declare subroutine Error_Services, Btree.Extract, Database_Services, Logging_Services, Nica_Orders_Services, Delay
Declare subroutine Httpclient_Services, SRP_JSON, Mona_Services, Service_Services, Extract_SI_Keys
@ -49,7 +52,7 @@ Return Response or ""
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Options BOOLEAN = True$, False$
Options ENTITY_TYPES = 'REACTOR','REACTOR_LOG'
Options ORDER_TYPES = 'INTRUSIVE_MAINT','CHANGEOVER','INITIATE_IDLE','IDLE','ASM_HTR_TUBE_CHANGE','ASM_HTR_ANNUAL_PM','ASM_HTR_SEMIANNUAL_PM','ASM_HTR_FIVE_AND_TEN_YEAR_PM','IQS_HGCV_ALARM'
Options ORDER_TYPES = 'INTRUSIVE_MAINT','CHANGEOVER','INITIATE_IDLE','IDLE','ASM_HTR_TUBE_CHANGE','ASM_HTR_ANNUAL_PM','ASM_HTR_SEMIANNUAL_PM','ASM_HTR_FIVE_AND_TEN_YEAR_PM','IQS_HGCV_ALARM','ABORT_ALARM'
Options ORDER_STATUSES = 'new','creating','not-started','in-progress','cancelled','done'
Options REACTOR_TYPES = 'ASM','ASM+','HTR','EPP'
@ -128,6 +131,7 @@ Service UpdateNicaFlags()
ProveInActive = Reactor_Services('GetProveInActive', ReactNo)
HgCVChecklistActive = (Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'IQS_HGCV_ALARM') NE '')
IntrMaintChecklistActive = (Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'INTRUSIVE_MAINT') NE '')
AbortAlarmChecklistActive = (Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM') NE '')
Open 'REACTOR' to hReactor then
ReadV CacheProveInActive from hReactor, ReactNo, REACTOR_PROVE_IN_ACTIVE$ then
If CacheProveInActive NE ProveInActive then
@ -153,6 +157,14 @@ Service UpdateNicaFlags()
end
end
end
ReadV CacheAbortAlarmChecklistActive from hReactor, ReactNo, REACTOR_ABORT_ALARM_CHECKLIST_ACTIVE$ then
If CacheAbortAlarmChecklistActive NE AbortAlarmChecklistActive then
Lock hReactor, ReactNo then
WriteV AbortAlarmChecklistActive on hReactor, ReactNo, REACTOR_ABORT_ALARM_CHECKLIST_ACTIVE$ else Null
Unlock hReactor, ReactNo else Null
end
end
end
end
CurrModeKey = Xlate('REACTOR_CHILD_KEY_IDS_NG', ReactNo, 'REACT_MODE_KEY_IDS', 'X')
CurrModeKey = CurrModeKey[-1, 'B':@VM]
@ -182,12 +194,12 @@ Service GetActiveOrders(EntityType=ENTITY_TYPES, EntityId, OrderTypes=ORDER_TYPE
end service
Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES, OrderFlows)
Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES, OrderFlows, OrderResponseLevel, ChecklistIds)
ErrorMsg = ''
EntityTypes = 'REACTOR,REACTOR_LOG'
OrderTypes = 'INTRUSIVE_MAINT,CHANGEOVER,INITIATE_IDLE,IDLE,ASM_HTR_TUBE_CHANGE,ASM_HTR_ANNUAL_PM,'
OrderTypes := 'ASM_HTR_SEMIANNUAL_PM,ASM_HTR_FIVE_AND_TEN_YEAR_PM,IQS_HGCV_ALARM'
OrderTypes := 'ASM_HTR_SEMIANNUAL_PM,ASM_HTR_FIVE_AND_TEN_YEAR_PM,IQS_HGCV_ALARM,ABORT_ALARM'
Machine = Environment_Services('GetServer')
Headers = 'Logging DTM' : @FM : 'Machine' : @FM : 'Log'
@ -220,7 +232,7 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', EntityType, EntityID, OrderType)
OrderTypeAlreadyActive = (CurrActiveOrders NE '')
If ( (OrderTypeAlreadyActive EQ False$) or (OrderType EQ 'INTRUSIVE_MAINT') ) then
If ( (OrderTypeAlreadyActive EQ False$) or (OrderType EQ 'INTRUSIVE_MAINT') or (OrderType EQ 'ABORT_ALARM') ) then
Begin Case
Case EntityType EQ 'REACTOR'
@ -233,7 +245,7 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
// Build request
Body = ''
NewSortedChecklistIds = ''
If OrderType NE 'INTRUSIVE_MAINT' then
If ( (OrderType NE 'INTRUSIVE_MAINT') and (OrderType NE 'ABORT_ALARM') ) then
// Original API endpoint just uses query params, no body.
NicaURL = Environment_Services("GetProveInApiUrl"):'/checklists?'
NicaURL := 'checklistType=':OrderType
@ -242,13 +254,14 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
// New API endpoint uses JSON body instead of query params.
NicaURL = Environment_Services("GetProveInApiUrl"):'/order'
If OrderFlows NE '' then
ReactorType = Xlate('REACTOR', ReactNo, REACTOR_REACT_TYPE$, 'X')
NewChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', OrderFlows, OrderType, ReactorType)
// Get incomplete checklists and add them to the new order
If ChecklistIds NE '' then
NewChecklistIds = ChecklistIds
If CurrActiveOrders NE '' then
IncompleteChecklistIds = ''
CompleteChecklistIds = ''
Open 'DICT.NICA_ORDERS_CHECKLISTS' to hDict then
For each ActiveNicaOrdersId in CurrActiveOrders using @VM
// Get incomplete checklists so we can add them to the new order
IncompleteOrderChecklistIds = ''
Flag = ''
Query = 'NICA_ORDERS_ID':@VM:ActiveNicaOrdersId:@FM
@ -260,6 +273,27 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
Swap '*' with @VM in PrevChecklistIds
IncompleteChecklistIds<0, -1> = PrevChecklistIds
end
// Build a list of completed checklists which should not be prescribed again in the replacement NICA order
CompleteOrderChecklistIds = ''
Flag = ''
Query = 'NICA_ORDERS_ID':@VM:ActiveNicaOrdersId:@FM
Query := 'IS_COMPLETE':@VM:True$:@FM
Btree.Extract(Query, 'NICA_ORDERS_CHECKLISTS', hDict, CompleteOrderChecklistIds, 'E', Flag)
If Flag EQ 0 then
CompleteOrderChecklistIdsRot = SRP_Array('Rotate', CompleteOrderChecklistIds, @VM, '*')
CompChecklistIds = CompleteOrderChecklistIdsRot<0, 2>
Swap '*' with @VM in CompChecklistIds
end
For each CompChecklistId in CompChecklistIds using @VM
RemoveIfComp = Xlate('NICA_CHECKLISTS', CompChecklistId, NICA_CHECKLISTS.REMOVE_IF_COMPLETE$, 'X')
If RemoveIfComp then
Locate CompChecklistId in NewChecklistIds using @VM setting vPos then
NewChecklistIds = Delete(NewChecklistIds, 0, vPos, 0)
end
end
Next CompChecklistId
Next ActiveNicaOrdersId
end
NewChecklistIds<0, -1> = IncompleteChecklistIds
@ -283,6 +317,9 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
end else
ErrorMsg = 'Error in ':Service:' service. Failed to initialize JSON object for request body.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null ChecklistIds variable passed in.'
end
end else
ErrorMsg = 'Error in ':Service:' service. Null Orderflows variable passed in.'
end
@ -314,18 +351,24 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
OrderId = SRP_JSON(ObjResponseJson, 'GetValue', 'id')
If OrderId NE '' then
Convert @Lower.Case to @Upper.Case in OrderId
ReqDtm = SRP_JSON(ObjResponseJson, 'GetValue', 'requestedDate')
ReqDate = IConv(ReqDtm[1, 'FT'], 'DJ')
ReqTime = IConv(ReqDtm[Col2() + 1, 'F.'], 'MT')
CreatedDtm = ReqDate + (ReqTime/SECONDS_IN_DAY$)
NicaOrderRec = ''
NicaOrderRec<NICA_ORDERS.ORDER_TYPE$> = OrderType
NicaOrderRec<NICA_ORDERS.ORDER_STATUS$> = SRP_JSON(ObjResponseJson, 'GetValue', 'state')
NicaOrderRec<NICA_ORDERS.ENTITY_TYPE$> = EntityType
NicaOrderRec<NICA_ORDERS.ENTITY_ID$> = EntityID
NicaOrderRec<NICA_ORDERS.IS_COMPLETE$> = SRP_JSON(ObjResponseJson, 'GetValue', 'isComplete')
NicaOrderRec<NICA_ORDERS.CREATED_DTM$> = CreatedDtm
If NicaOrderRec<NICA_ORDERS.IS_COMPLETE$> EQ False$ then
NicaOrderRec<NICA_ORDERS.PROGRESS_PERCENTAGE$> = SRP_JSON(ObjResponseJson, 'GetValue', 'progressPercentage')
end else
NicaOrderRec<NICA_ORDERS.PROGRESS_PERCENTAGE$> = 100
end
NicaOrderRec<NICA_ORDERS.ORDER_FLOW_IDS$> = OrderFlows
NicaOrderRec<NICA_ORDERS.ORDER_RESPONSE_LEVEL$> = OrderResponseLevel
LogNicaOrderRec = NicaOrderRec
Swap @FM with ',' in LogNicaOrderRec
LogData = ''
@ -343,7 +386,7 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
end
end
end
If OrderType _EQC 'INTRUSIVE_MAINT' then
If ( (OrderType _EQC 'INTRUSIVE_MAINT') or (OrderType _EQC 'ABORT_ALARM') ) then
// Create NICA_ORDERS_CHECKLISTS child records for each checklist
If NewSortedChecklistIds NE '' then
For each ChecklistId in NewSortedChecklistIds using @VM
@ -395,10 +438,10 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
ErrorMsg = 'Error encountered when attempting to create Nica in order for reactor ':ReactNo:' of type ':OrderType
Mona_Services('SendBufferedStatus', MonAResource, StatusName, 'Critical')
end
end
end else
ErrorMsg = 'Error encountered when attempting to create Nica order for entity ':EntityType:' ' :EntityID:' of type ':OrderType:'. Active order already exists.'
end
end
end else
ErrorMsg = 'Error in ':Service:' service. Null EntityType, EntityID, or OrderType passed in.'
end
@ -495,6 +538,8 @@ Service CancelOrder(OrderId)
IsComplete = SRP_JSON(ObjResponseJson, 'GetValue', 'pendingUpdate')
NicaOrderRec<NICA_ORDERS.ORDER_STATUS$> = SRP_JSON(ObjResponseJson, 'GetValue', 'state')
NicaOrderRec<NICA_ORDERS.IS_COMPLETE$> = SRP_JSON(ObjResponseJson, 'GetValue', 'isComplete')
CloseDtm = Datetime()
NicaOrderRec<NICA_ORDERS.CLOSED_DTM$> = CloseDtm
If IsComplete EQ False$ then
NicaOrderRec<NICA_ORDERS.PROGRESS_PERCENTAGE$> = SRP_JSON(ObjResponseJson, 'GetValue', 'progressPercentage')
end else
@ -510,6 +555,17 @@ Service CancelOrder(OrderId)
end
end
end
If (OrderType EQ 'ABORT_ALARM') then
ActiveAbortAlarmOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM')
AbortAlarmOrderActive = (ActiveAbortAlarmOrders NE '')
If (AbortAlarmOrderActive EQ False$) then
Open 'REACTOR' to hReactor then
WriteV True$ on hReactor, ReactNo, REACTOR_ABORT_ALARM_COMPLETE$ else
ErrorMsg = 'Error in ':Service:' service. Error setting ABORT_ALARM_COMPLETE flag in REACTOR record.'
end
end
end
end
If ( (Response EQ True$) or (Response EQ False$) ) then IsSuccessful = True$
end else
ErrorMsg = Error_Services('GetMessage')
@ -646,8 +702,14 @@ Service GetOrderStatusUpdate(OrderId)
ObjResponseJson = ''
If SRP_JSON(ObjResponseJson, 'Parse', HttpResponseJson) EQ '' then
IsComplete = SRP_JSON(ObjResponseJson, 'GetValue', 'isComplete')
NicaOrderRec<NICA_ORDERS.ORDER_STATUS$> = SRP_JSON(ObjResponseJson, 'GetValue', 'state')
State = SRP_JSON(ObjResponseJson, 'GetValue', 'state')
NicaOrderRec<NICA_ORDERS.ORDER_STATUS$> = State
NicaOrderRec<NICA_ORDERS.IS_COMPLETE$> = IsComplete
CloseDtm = NicaOrderRec<NICA_ORDERS.CLOSED_DTM$>
If ( (CloseDtm EQ '' ) and ( (State _EQC 'done') or (State _EQC 'cancelled') ) ) then
CloseDtm = Datetime()
NicaOrderRec<NICA_ORDERS.CLOSED_DTM$> = CloseDtm
end
If IsComplete EQ False$ then
NicaOrderRec<NICA_ORDERS.PROGRESS_PERCENTAGE$> = SRP_JSON(ObjResponseJson, 'GetValue', 'progressPercentage')
end else
@ -656,7 +718,7 @@ Service GetOrderStatusUpdate(OrderId)
Database_Services('WriteDataRow', 'NICA_ORDERS', OrderId, NicaOrderRec, True$, False$, False$)
If Error_Services('NoError') then
OrderType = NicaOrderRec<NICA_ORDERS.ORDER_TYPE$>
If (OrderType _EQC 'INTRUSIVE_MAINT') then
If ( (OrderType _EQC 'INTRUSIVE_MAINT') or (OrderType _EQC 'ABORT_ALARM') ) then
// Update NICA_ORDERS_CHECKLISTS records (documents)
Open 'NICA_ORDERS_CHECKLISTS' to hNicaOrdersChecklists then
// Parse documents array for their isComplete flag
@ -704,7 +766,17 @@ Service GetOrderStatusUpdate(OrderId)
ErrorMsg = 'Error in ':Service:' service. Error opening NICA_ORDERS_CHECKLISTS table.'
end
end
If ( (OrderType _EQC 'ABORT_ALARM') and ( (State _EQC 'done') or (State _EQC 'cancelled') ) ) then
ActiveAbortAlarmOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM')
AbortAlarmOrderActive = (ActiveAbortAlarmOrders NE '')
If (AbortAlarmOrderActive EQ False$) then
Open 'REACTOR' to hReactor then
WriteV True$ on hReactor, ReactNo, REACTOR_ABORT_ALARM_COMPLETE$ else
ErrorMsg = 'Error in ':Service:' service. Error setting ABORT_ALARM_COMPLETE flag in REACTOR record.'
end
end
end
end
If IsComplete EQ True$ then
If ( (OrderType _EQC 'IDLE') and (EntityType _EQC 'REACTOR') ) then
Open 'REACTOR' to hReactor then

View File

@ -208,8 +208,11 @@ Service SignReactorLog(ReactorLogID, UserID)
If ( (IntrMaintFeatureFlag EQ True$) and (CCnt GT 0) ) then
IntrMaintFlowCodes = React_Servs_Services('GetIntrMaintFlowIds', CurServices)
If IntrMaintFlowCodes NE '' then
ReactorType = Xlate('REACTOR', ReactorNo, REACTOR_REACT_TYPE$, 'X')
ChecklistIds = Nica_Orders_Services('GetFlowChecklistIds', IntrMaintFlowCodes, 'INTRUSIVE_MAINT', ReactorType)
If ChecklistIds NE '' then
// Create INTRUSIVE_MAINT NICA order
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactorNo, 'INTRUSIVE_MAINT', IntrMaintFlowCodes)
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactorNo, 'INTRUSIVE_MAINT', IntrMaintFlowCodes, '', ChecklistIds)
If Error_Services('NoError') then
LogFlows = IntrMaintFlowCodes
Convert @VM to ', ' in LogFlows
@ -219,6 +222,7 @@ Service SignReactorLog(ReactorLogID, UserID)
end
end
end
end
If ErrorMsg EQ '' then
For ReactServsIndex = 1 to CCnt
CurService = CurServices<1,ReactServsIndex>

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\'
@ -1891,7 +1893,7 @@ Service CreateReactModeChange(UserID, ReactNo, Mode, ModeSubCat, ModeText, Force
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

View File

@ -280,7 +280,19 @@ Event APPLY.CLICK()
end
If Error_Services('NoError') then
Def = ""
Def<MCAPTION$> = "Changing Reactor Mode..."
Def<MCOL$> = -2
Def<MROW$> = -2
Def<MTYPE$> = "U"
MsgHandle = Msg(@Window, Def)
Reactor_Services('CreateReactModeChange', @User4, ReactNo, NewMode, NewReactModeSvc, NewNoteText)
// Take down the message
Msg(@Window, MsgHandle)
If Error_Services('NoError') then
End_Dialog(@Window, NewMode)
@ -293,7 +305,7 @@ Event APPLY.CLICK()
ActiveProveInOrder = ReactorRec<REACTOR_PROVE_IN_ACTIVE$>
ActiveHgCVOrder = ReactorRec<REACTOR_HGCV_CHECKLIST_ACTIVE$>
ActiveIntrMaintOrder = ReactorRec<REACTOR_INTRUSIVE_MAINT_CHECKLIST_ACTIVE$>
ActiveAbortAlarmOrder = ReactorRec<REACTOR_ABORT_ALARM_CHECKLIST_ACTIVE$>
Begin Case
Case ActiveProveInOrder
@ -387,6 +399,32 @@ Event APPLY.CLICK()
end
end
Case ActiveAbortAlarmOrder
OverrideGroups = 'LEAD':@VM:'SUPERVISOR'
UserMsg = "ABORT/ALARM Checklist must be completed in NICA. Override required from a lead or supervisor to bypass NICA."
UserVerification = Dialog_Box('NDW_VERIFY_USER', @WINDOW, @USER4:@FM:OverrideGroups:@FM:'':@FM:UserMsg)
Override = UserVerification<1>
If Override then
ResponseComment = Dialog_Box('NDW_ADD_COMMENT', @WINDOW)<2>
If Assigned(ResponseComment) and Len(ResponseComment) GT 4 then
ActiveIntrMaintOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactNo, 'ABORT_ALARM')
For each ActiveIntrMaintOrderId in ActiveIntrMaintOrders using @VM
Nica_Orders_Services('CancelOrder', ActiveIntrMaintOrderId)
Next ActiveIntrMaintOrderId
Override_Log_Services('Create', 'REACTOR', ReactNo, UserVerification<2>, ResponseComment, 'ABORT_ALARM_CHECKLIST')
Reactor_Services('CreateReactModeChange', @User4, ReactNo, NewMode, NewReactModeSvc, NewNoteText)
If Error_Services('NoError') then
End_Dialog(@Window, NewMode)
end
end else
Message_Box(@Window, 'You must enter a comment greater than 4 letters!', 'Error', MSG_ICON_EXCLAM$)
end
end
End Case
end else
Error_Services('DisplayError')

View File

@ -1,46 +1,58 @@
Compile function React_Prob_Cat_Services(@Service, @Params)
Declare Function Next_Key, Date
Declare Subroutine Msg, Database_Services
/***********************************************************************************************************************
This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
permission from SRP Computer Solutions, Inc.
Name : React_Prob_Cat_Services
Description : Handler program for all module related services.
Notes : The generic parameters should contain all the necessary information to process the services. Often
this will be information like the data Record and Key ID.
Parameters :
Service [in] -- Name of the service being requested
Param1-10 [in/out] -- Additional request parameter holders
Response [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
Metadata :
History : (Date, Initials, Notes)
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert LOGICAL
$Insert SERVICE_SETUP
$Insert APP_INSERTS
$insert REACT_PROB_CAT_EQUATES
Declare Function NextKey
Declare Subroutine Database_Services, Error_Services
GoToService
Return Response or ""
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
Service Create(ReactProbCatName, ReactProbCat)
OPEN 'REACT_PROB_CAT' TO RPTable ELSE
MSG( '', 'Unable to open REACT_PROB_CAT...' )
RETURN
END
Response = ''
If ReactProbCatName NE '' then
RPRec = ''
NewCatKey = Next_Key('REACT_PROB_CAT', RPTable, 'NEXT', '')
NewCatKey = NextKey('REACT_PROB_CAT')
RPRec<REACT_PROB_CAT_CAT_DESC$> = ReactProbCatName
RPRec<REACT_PROB_CAT_ENTRY_ID$> = @User4
RPRec<REACT_PROB_CAT_ENTRY_DATE$> = Date()
RPRec<REACT_PROB_CAT_REACT_PROB_ID$> = ''
//RPRec<5> = 0
RPRec<6> = ReactProbCat
WRITE RPRec ON RPTable, NewCatKey ELSE
MSG( '', 'Damn')
RETURN
END
UNLOCK RPTable, NewCatKey else
MSG( '', 'Damn' )
RETURN
END
Database_Services('WriteDataRow', 'REACT_PROB_CAT', NewCatKey, RPRec, True$, False$, False$)
Response = NewCatKey
end else
Error_Services('Add', 'Error in ':Service:' service. Null ReactProbCatName passed into service.')
end
End Service
Service Delete(ProbCatId)
end service

View File

@ -83,14 +83,14 @@ ChecklistButton:
If ReactorPmOrderIds NE '' then
For each ReactorPmOrderId in ReactorPmOrderIds using @VM setting vPos
ProgressPercentage = Xlate('NICA_ORDERS', ReactorPmOrderId, 'PROGRESS_PERCENTAGE', 'X')
ChecklistInfo<-1> = Xlate('NICA_ORDERS', ReactorPmOrderId, 'ORDER_TYPE', 'X') : '- ' : ProgressPercentage :'% Complete.'
ChecklistInfo<-1> = Xlate('NICA_ORDERS', ReactorPmOrderId, 'ORDER_TYPE', 'X') : ' - ' : ProgressPercentage :'% Complete.'
Next RlPmType
end
If ReactorNicaOrders NE '' then
For each NicaOrderId in ReactorNicaOrders using @VM
ProgressPercentage = Xlate('NICA_ORDERS', NicaOrderId, 'PROGRESS_PERCENTAGE', 'X')
ChecklistInfo<-1> = Xlate('NICA_ORDERS', NicaOrderId, 'ORDER_TYPE', 'X') : '- ' : ProgressPercentage :'% Complete.'
ChecklistInfo<-1> = Xlate('NICA_ORDERS', NicaOrderId, 'ORDER_TYPE', 'X') : ' - ' : ProgressPercentage :'% Complete.'
Next NicaOrderId
end
@ -271,17 +271,13 @@ FORM_CREATE:
end
Status_HgCV_Alarm = Xlate('REACTOR', I, REACTOR_HGCV_CHECKLIST_ACTIVE$, 'X')
If Status_HgCV_Alarm EQ True$ then
Set_Property(Window:'.OLE_PIC_':I, 'OLE.Image', '.\BMPS\ActiveProveIn.png')
end
Status_Intrusive_Maint = Xlate('REACTOR', I, REACTOR_INTRUSIVE_MAINT_CHECKLIST_ACTIVE$, 'X')
If Status_Intrusive_Maint EQ True$ then
Status_Abort_Alarm = Xlate('REACTOR', I, REACTOR_ABORT_ALARM_CHECKLIST_ACTIVE$, 'X')
If Status_HgCV_Alarm or Status_Intrusive_Maint or Status_Abort_Alarm then
Set_Property(Window:'.OLE_PIC_':I, 'OLE.Image', '.\BMPS\ActiveProveIn.png')
end
OlePicVisible = ( Status_ProveIn or Status_0311 or Status_ReactorPM or Status_HgCV_Alarm or Status_Intrusive_Maint)
OlePicVisible = ( Status_ProveIn or Status_0311 or Status_ReactorPM or Status_HgCV_Alarm or Status_Intrusive_Maint or Status_Abort_Alarm )
Set_Property(Window:'.OLE_PIC_':I,'VISIBLE', OlePicVisible)
IQSPicControl = @Window : '.OLE_PIC_IQS_': i
@ -329,3 +325,4 @@ REACT_DETAIL:
return
*===============================================================================================*

View File

@ -12,5 +12,7 @@ compile insert NICA_CHECKLISTS_EQUATES
equ NICA_CHECKLISTS.NICA_ORDER_FLOW_IDS$ to 3
equ NICA_CHECKLISTS.NICA_ORDER_FLOW_TYPE$ to 4
equ NICA_CHECKLISTS.REACTOR_TYPES$ to 5
equ NICA_CHECKLISTS.REMOVE_IF_COMPLETE$ to 6
#endif

View File

@ -14,6 +14,10 @@ compile insert NICA_ORDERS_EQUATES
equ NICA_ORDERS.IS_COMPLETE$ to 5
equ NICA_ORDERS.PROGRESS_PERCENTAGE$ to 6
equ NICA_ORDERS.ORDER_CHECKLIST_IDS$ to 7
equ NICA_ORDERS.ORDER_FLOW_IDS$ to 8
equ NICA_ORDERS.ORDER_RESPONSE_LEVEL$ to 9
equ NICA_ORDERS.CREATED_DTM$ to 10
equ NICA_ORDERS.CLOSED_DTM$ to 11
#endif

View File

@ -81,4 +81,6 @@ Equ REACTOR_IQS_ALARM_DTM$ To 69
Equ REACTOR_IQS_ALARM_TEST$ To 70
Equ REACTOR_HGCV_CHECKLIST_ACTIVE$ To 71
Equ REACTOR_INTRUSIVE_MAINT_CHECKLIST_ACTIVE$ To 72
Equ REACTOR_ABORT_ALARM_CHECKLIST_ACTIVE$ To 73
Equ REACTOR_ABORT_ALARM_COMPLETE$ To 74

View File

@ -13,3 +13,6 @@ Equ REACT_PROB_CAT_ENTRY_ID$ To 2
Equ REACT_PROB_CAT_ENTRY_DATE$ To 3
Equ REACT_PROB_CAT_REACT_PROB_ID$ To 4
Equ REACT_PROB_CAT_NOTES$ To 5
Equ REACT_PROB_CAT_ABORT_ALARM_FLOW_ID$ To 6
Equ REACT_PROB_CAT_ABORT_ALARM_RESPONSE_LEVEL$ To 7