added intrusive maintenance flow logic
updated headers for nica order request Added reactor type support to nica checklists. Refactored flow logic to just use NICA_CHECKLISTS table. added feature flag support gated Feature Flags menu item to supervisors removed debug added auto comment for intr maint flows on reactor log, intr maint flow id to react servs form, and cancel order on unsign reactor log added exceptions for lamp and tc services, added control to edit flow id on react servs form, added auto-reactor log comment, added cancel order on unsign event removed debug modified NicaOrdersServices to use env variables for group resource name added logic to filter out service flow ids for servics with is_intrusive set to false, modified security group for feature flag menu, added ability to clear intr main flow id to react serv form removed unused equates
This commit is contained in:
@ -32,6 +32,7 @@ $Insert REACT_ITEM_EQUATES
|
||||
$Insert RDS_EQUATES
|
||||
$Insert REACT_SERVS_EQUATES
|
||||
$Insert REACTOR_EQUATES
|
||||
$Insert FEATURE_FLAGS_EQUATES
|
||||
|
||||
Declare function Database_Services, Reactor_Log_Services, Obj_React_Item, Set_Status, Errmsg, Error_Services, Utility
|
||||
Declare function obj_Calendar, NextKey, SRP_JSON, Datetime, Reactor_Services, React_Servs_Services, Logging_Services
|
||||
@ -86,8 +87,6 @@ Service SignReactorLog(ReactorLogID, UserID)
|
||||
ErrCode = ''
|
||||
ErrorMsg = ''
|
||||
If RowExists('REACTOR_LOG', ReactorLogID) then
|
||||
// Update any NICA checklist order statuses
|
||||
Nica_Orders_Services('GetOrderUpdates')
|
||||
If Error_Services('NoError') then
|
||||
If RowExists('LSL_USERS', UserID) then
|
||||
ReactorLogRec = Database_Services('ReadDataRow', 'REACTOR_LOG', ReactorLogID)
|
||||
@ -199,96 +198,110 @@ Service SignReactorLog(ReactorLogID, UserID)
|
||||
If ErrorMsg EQ '' then
|
||||
// Check reactor prevent maintenance records
|
||||
CurServices = ReactorLogRec<REACTOR_LOG_REACT_SERV_ID$>
|
||||
|
||||
Loop
|
||||
TestChar = CurServices[-1,1]
|
||||
Until TestChar NE @VM or CurServices = ''
|
||||
CurServices[-1,1] = ''
|
||||
Repeat
|
||||
|
||||
CCnt = COUNT(CurServices,@VM) + (CurServices NE '')
|
||||
|
||||
For N = 1 to CCnt
|
||||
CurService = CurServices<1,N>
|
||||
|
||||
Open 'REACTOR_PM' to ReactorPMTable then
|
||||
|
||||
Open 'DICT.REACTOR_PM' to DictReactorPMTable then
|
||||
|
||||
SearchStr = 'REACT_SERV_ID':@VM:CurService:@FM
|
||||
SearchStr := 'REACTOR':@VM:ReactorNo:@FM
|
||||
SearchStr := 'COMPLETE_DATE':@VM:'':@FM
|
||||
|
||||
Btree.Extract(SearchStr, 'REACTOR_PM', DictReactorPMTable, OpenPMKeys, '', Flag)
|
||||
|
||||
If Flag EQ 0 then
|
||||
EndDate = Date()
|
||||
* Add Maintenance metric reset
|
||||
AssocMetrics = ''
|
||||
AssocMetrics = React_Servs_Services('GetAssociatedMetrics', CurService)
|
||||
If AssocMetrics NE '' then
|
||||
MetricCount = Dcount(AssocMetrics, @VM)
|
||||
For MetricIndex = 1 to MetricCount
|
||||
ThisMetric = AssocMetrics<1,MetricIndex>
|
||||
Reactor_Services('ResetWfrMetric', ReactorNo, ThisMetric)
|
||||
Next MetricIndex
|
||||
End
|
||||
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
|
||||
ThisOpenPMKey = OpenPMKeys<1,I>
|
||||
|
||||
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
|
||||
If PMResched EQ False$ then
|
||||
PMNo = NextKey('REACTOR_PM')
|
||||
If Error_Services('NoError') then
|
||||
NewPMRec = ''
|
||||
NewPMRec<REACTOR_PM_ENTRY_ID$> = UserID
|
||||
NewPMRec<REACTOR_PM_ENTRY_DATE$> = Date()
|
||||
NewPMRec<REACTOR_PM_REACTOR$> = ReactorNo
|
||||
NewPMRec<REACTOR_PM_PREV_PM_COMP_DT$> = EndDate
|
||||
NewPMRec<REACTOR_PM_DUE_DT$> = EndDate + PMDays
|
||||
NewPMRec<REACTOR_PM_REACT_SERV_ID$> = CurService
|
||||
NewPMRec<REACTOR_PM_ENTRY_RL_NO$> = 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
|
||||
ErrorMsg = 'Error in ':Service:' service. Error calling obj_Post_Log("Create"). Error code: ':ErrCode
|
||||
end
|
||||
end
|
||||
Next I
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' serivce. Error calling Btree.Extract. Error code: ':Flag
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_PM table.'
|
||||
CCnt = COUNT(CurServices,@VM) + (CurServices NE '')
|
||||
IntrMaintFeatureFlag = Xlate('FEATURE_FLAGS', 'NICA_INTRUSIVE_MAINTENANCE', FEATURE_FLAGS.ENABLED$, 'X')
|
||||
If ( (IntrMaintFeatureFlag EQ True$) and (CCnt GT 0) ) then
|
||||
IntrMaintFlowCodes = React_Servs_Services('GetIntrMaintFlowIds', CurServices)
|
||||
If IntrMaintFlowCodes NE '' then
|
||||
// Create INTRUSIVE_MAINT NICA order
|
||||
Nica_Orders_Services('CreateNewOrder', 'REACTOR', ReactorNo, 'INTRUSIVE_MAINT', IntrMaintFlowCodes)
|
||||
If Error_Services('NoError') then
|
||||
LogFlows = IntrMaintFlowCodes
|
||||
Convert @VM to ', ' in LogFlows
|
||||
Reactor_Log_Services('AddComment', ReactorNo, 'Intrusive Maintenance initiated for flow(s) ':LogFlows:'.', UserID)
|
||||
end else
|
||||
ErrorMsg = Error_Services('GetMessage')
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening REACTOR_PM table.'
|
||||
end
|
||||
Next N
|
||||
end
|
||||
If ErrorMsg EQ '' then
|
||||
For ReactServsIndex = 1 to CCnt
|
||||
CurService = CurServices<1,ReactServsIndex>
|
||||
Open 'REACTOR_PM' to ReactorPMTable then
|
||||
Open 'DICT.REACTOR_PM' to DictReactorPMTable then
|
||||
|
||||
SearchStr = 'REACT_SERV_ID':@VM:CurService:@FM
|
||||
SearchStr := 'REACTOR':@VM:ReactorNo:@FM
|
||||
SearchStr := 'COMPLETE_DATE':@VM:'':@FM
|
||||
|
||||
Btree.Extract(SearchStr, 'REACTOR_PM', DictReactorPMTable, OpenPMKeys, '', Flag)
|
||||
|
||||
If Flag EQ 0 then
|
||||
EndDate = Date()
|
||||
* Add Maintenance metric reset
|
||||
AssocMetrics = ''
|
||||
AssocMetrics = React_Servs_Services('GetAssociatedMetrics', CurService)
|
||||
If AssocMetrics NE '' then
|
||||
MetricCount = Dcount(AssocMetrics, @VM)
|
||||
For MetricIndex = 1 to MetricCount
|
||||
ThisMetric = AssocMetrics<1,MetricIndex>
|
||||
Reactor_Services('ResetWfrMetric', ReactorNo, ThisMetric)
|
||||
Next MetricIndex
|
||||
End
|
||||
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
|
||||
ThisOpenPMKey = OpenPMKeys<1,I>
|
||||
|
||||
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
|
||||
If PMResched EQ False$ then
|
||||
PMNo = NextKey('REACTOR_PM')
|
||||
If Error_Services('NoError') then
|
||||
NewPMRec = ''
|
||||
NewPMRec<REACTOR_PM_ENTRY_ID$> = UserID
|
||||
NewPMRec<REACTOR_PM_ENTRY_DATE$> = Date()
|
||||
NewPMRec<REACTOR_PM_REACTOR$> = ReactorNo
|
||||
NewPMRec<REACTOR_PM_PREV_PM_COMP_DT$> = EndDate
|
||||
NewPMRec<REACTOR_PM_DUE_DT$> = EndDate + PMDays
|
||||
NewPMRec<REACTOR_PM_REACT_SERV_ID$> = CurService
|
||||
NewPMRec<REACTOR_PM_ENTRY_RL_NO$> = 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
|
||||
ErrorMsg = 'Error in ':Service:' service. Error calling obj_Post_Log("Create"). Error code: ':ErrCode
|
||||
end
|
||||
end
|
||||
Next I
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' serivce. Error calling Btree.Extract. Error code: ':Flag
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening DICT.REACTOR_PM table.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error opening REACTOR_PM table.'
|
||||
end
|
||||
Next ReactServsIndex
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Error creating INTRUSIVE_MAINT NICA order.'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -319,6 +332,8 @@ Service SignReactorLog(ReactorLogID, UserID)
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
// Pull in a fresh copy of the record in case comments were added above
|
||||
ReactorLogRec = Database_Services('ReadDataRow', 'REACTOR_LOG', ReactorLogID)
|
||||
// Set signature, end date, and end time
|
||||
ReactorLogRec<REACTOR_LOG_TECH_SIG$> = UserID
|
||||
ReactorLogRec<REACTOR_LOG_END_DATE$> = Date()
|
||||
@ -349,6 +364,17 @@ Service ClearSignature(RLKey)
|
||||
RLRec<REACTOR_LOG_LO_NA$> = ''
|
||||
RLRec<REACTOR_LOG_REACT_WFR_CNT_START$> = ''
|
||||
Database_Services('WriteDataRow', 'REACTOR_LOG', RLKey, RLRec, True$, False$, False$)
|
||||
If Error_Services('NoError') then
|
||||
// Cancel active Intrusive Maintenance NICA orders in the event the maintenance user set an
|
||||
// invalid service id or a difference service was required.
|
||||
ReactorNo = RLRec<REACTOR_LOG_REACTOR$>
|
||||
CurrActiveOrders = Nica_Orders_Services('GetActiveOrders', 'REACTOR', ReactorNo, 'INTRUSIVE_MAINT')
|
||||
If CurrActiveOrders NE '' then
|
||||
For each ActiveIntrMaintOrderId in CurrActiveOrders using @VM
|
||||
Nica_Orders_Services('CancelOrder', ActiveIntrMaintOrderId)
|
||||
Next ActiveIntrMaintOrderId
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user