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
258 lines
11 KiB
Plaintext
258 lines
11 KiB
Plaintext
Compile function React_Servs_Services(@Service, @Params)
|
|
/***********************************************************************************************************************
|
|
|
|
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_Servs_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
|
|
|
|
History : (Date, Initials, Notes)
|
|
08/02/22 djs Original programmer.
|
|
|
|
***********************************************************************************************************************/
|
|
|
|
#pragma precomp SRP_PreCompiler
|
|
|
|
$Insert SERVICE_SETUP
|
|
$Insert APP_INSERTS
|
|
$Insert RLIST_EQUATES
|
|
$Insert REACT_SERVS_EQUATES
|
|
|
|
Equ NEW_EXIST$ To 0
|
|
Equ NEXT_CUR$ To 1
|
|
Equ ADD_EXIST$ to 2
|
|
Equ THERMOCOUPLE_FRONT$ To 237
|
|
Equ THERMOCOUPLE_SIDE$ To 238
|
|
Equ THERMOCOUPLE_REAR$ To 239
|
|
Equ LAMP_ZONE_1A$ to 10700
|
|
Equ LAMP_ZONE_1B$ to 10701
|
|
Equ LAMP_ZONE_1C$ to 10702
|
|
Equ LAMP_ZONE_2A$ to 10703
|
|
Equ LAMP_ZONE_2B$ to 10704
|
|
Equ LAMP_ZONE_3A$ to 10705
|
|
Equ LAMP_ZONE_3B$ to 10706
|
|
Equ LAMP_ZONE_3C$ to 10707
|
|
Equ LAMP_ZONE_3D$ to 10708
|
|
Equ LAMP_ZONE_4$ to 10709
|
|
Equ LAMP_ZONE_5$ to 10710
|
|
Equ LAMP_ZONE_8A$ to 10711
|
|
Equ LAMP_ZONE_8B$ to 10712
|
|
Equ LAMP_ZONE_9B$ to 10713
|
|
Equ LAMP_ZONE_6A$ to 10714
|
|
Equ LAMP_ZONE_7A$ to 10715
|
|
Equ LAMP_ZONE_10A$ to 10716
|
|
Equ LAMP_ZONE_10B$ to 10717
|
|
Equ LAMP_ZONE_9A$ to 10718
|
|
Equ LAMP_ZONE_6C$ to 10720
|
|
Equ LAMP_ZONE_6B$ to 10721
|
|
Equ LAMP_ZONE_7B$ to 10722
|
|
Equ LAMP_ZONE_11A$ to 10723
|
|
Equ LAMP_ZONE_11B$ to 10724
|
|
Equ LAMP_ZONE_12$ to 10725
|
|
|
|
Declare function Database_Services, Error_Services, SRP_JSON, React_Servs_Services, SrP_Array
|
|
Declare subroutine SRP_JSON, Error_Services, React_Servs_Services, Extract_Si_Keys
|
|
|
|
GoToService
|
|
|
|
Return Response or ""
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// SERVICES
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
Service GetIntrMaintFlowIds(ReactServIds)
|
|
|
|
ErrorMsg = ''
|
|
IntrMaintFlowIds = ''
|
|
If ReactServIds NE '' then
|
|
ReactServIds = SRP_Array('Clean', ReactServIds, 'TrimAndMakeUnique', @VM)
|
|
Convert @VM to @FM in ReactServIds
|
|
If RowExists('REACT_SERVS', ReactServIds) then
|
|
IntrusiveReactServs = ''
|
|
Extract_Si_Keys('REACT_SERVS', 'IS_INTRUSIVE', True$, IntrusiveReactServs)
|
|
ErrCode = ''
|
|
If Not(Get_Status(ErrCode)) then
|
|
Convert @FM to @VM in ReactServIds
|
|
ReactServIds = SRP_Array('Join', IntrusiveReactServs, ReactServIds, 'AND', @VM)
|
|
If ReactServIds NE '' then
|
|
IntrMaintFlowIds = Xlate('REACT_SERVS', ReactServIds, REACT_SERVS_INTR_MAINT_FLOW_ID$, 'X')
|
|
NumTCSvcs = 0
|
|
NumLampSvcs = 0
|
|
For each ReactServId in ReactServIds using @VM
|
|
NumTCSvcs += ( (ReactServId EQ THERMOCOUPLE_FRONT$) or (ReactServId EQ THERMOCOUPLE_SIDE$) or (ReactServId EQ THERMOCOUPLE_REAR$) )
|
|
NumLampSvcs += (ReactServId EQ LAMP_ZONE_1A$) or (ReactServId EQ LAMP_ZONE_1B$) or (ReactServId EQ LAMP_ZONE_1C$) |
|
|
or (ReactServId EQ LAMP_ZONE_2A$) or (ReactServId EQ LAMP_ZONE_2B$) or (ReactServId EQ LAMP_ZONE_3A$) |
|
|
or (ReactServId EQ LAMP_ZONE_3B$) or (ReactServId EQ LAMP_ZONE_3C$) or (ReactServId EQ LAMP_ZONE_3D$) |
|
|
or (ReactServId EQ LAMP_ZONE_4$) or (ReactServId EQ LAMP_ZONE_5$) or (ReactServId EQ LAMP_ZONE_8A$) |
|
|
or (ReactServId EQ LAMP_ZONE_8B$) or (ReactServId EQ LAMP_ZONE_9B$) or (ReactServId EQ LAMP_ZONE_6A$) |
|
|
or (ReactServId EQ LAMP_ZONE_7A$) or (ReactServId EQ LAMP_ZONE_10A$) or (ReactServId EQ LAMP_ZONE_10B$) |
|
|
or (ReactServId EQ LAMP_ZONE_9A$) or (ReactServId EQ LAMP_ZONE_6C$) or (ReactServId EQ LAMP_ZONE_6B$) |
|
|
or (ReactServId EQ LAMP_ZONE_7B$) or (ReactServId EQ LAMP_ZONE_11A$) or (ReactServId EQ LAMP_ZONE_11B$) |
|
|
or (ReactServId EQ LAMP_ZONE_12$)
|
|
Until ( (NumTCSvcs GT 1) and (NumLampSvcs GT 1) )
|
|
Next ReactServId
|
|
If (NumLampSvcs GT 1) then
|
|
// If two or more lamps are replaced, use flow "C" instead
|
|
// of "I" per EpiMSA WI-0022-1 Rev C Intrusive Maintenance Checklist.xlsx
|
|
Swap 'I' with 'C' in IntrMaintFlowIds
|
|
end
|
|
If (NumTCSvcs GT 1) then
|
|
// If two or more thermocouples are replaced, use flow "C" instead
|
|
// of "C" per EpiMSA WI-0022-1 Rev C Intrusive Maintenance Checklist.xlsx
|
|
Swap 'E' with 'C' in IntrMaintFlowIds
|
|
end
|
|
end
|
|
end else
|
|
ErrorMsg = 'Error in service ':Service:'. Error calling Extract_Si_Keys on the IS_INTRUSIVE column within the REACT_SERVS table.'
|
|
end
|
|
end else
|
|
Convert @FM to ',' in ReactServIds
|
|
ErrorMsg = 'Error in service ':Service:'. One or more keys, ':ReactServIds:', do not exist in the REACT_SERVS table.'
|
|
end
|
|
end else
|
|
ErrorMsg = 'Error in service ':Service:'. Null ReactServIds passed in.'
|
|
end
|
|
If ErrorMsg NE '' then
|
|
Error_Services('Add', ErrorMsg)
|
|
end else
|
|
Response = SRP_Array('Clean', IntrMaintFlowIds, 'TrimAndMakeUnique', @VM)
|
|
end
|
|
|
|
end service
|
|
|
|
|
|
Service GetReactMetrics()
|
|
|
|
Response = ''
|
|
ReactMetrics = Xlate('APP_INFO', 'REACTOR_METRICS', 1, 'X', '')
|
|
Swap @VM with @FM in ReactMetrics
|
|
Response = ReactMetrics
|
|
|
|
end service
|
|
|
|
|
|
Service GetAssociatedMetrics(ServID)
|
|
|
|
AssocMetrics = Xlate('REACT_SERVS', ServID, REACT_SERVS_ASSOC_METRICS$, 'X', '')
|
|
Response = AssocMetrics
|
|
|
|
end service
|
|
|
|
|
|
Service GetReactServs()
|
|
|
|
Response = ''
|
|
Query = 'SELECT REACT_SERVS BY SERV_ID'
|
|
GoSub ClearCursors
|
|
RList(Query, TARGET_ACTIVELIST$, '', '', '')
|
|
If Not(Get_Status(ErrCode)) then
|
|
EOF = False$
|
|
Loop
|
|
ReadNext KeyID else EOF = True$
|
|
Until EOF
|
|
Response<-1> = KeyID
|
|
Repeat
|
|
end
|
|
|
|
End Service
|
|
|
|
|
|
Service ConvertRecordToJSON(KeyID, Record, itemURL)
|
|
|
|
jsonRecord = ''
|
|
|
|
If KeyID NE '' then
|
|
|
|
If Record EQ '' then Record = Database_Services('ReadDataRow', 'REACT_SERVS', KeyID)
|
|
If Error_Services('NoError') then
|
|
@DICT = Database_Services('GetTableHandle', 'DICT.REACT_SERVS')
|
|
@ID = KeyID
|
|
@RECORD = Record
|
|
If SRP_JSON(objJSON, 'New', 'Object') then
|
|
|
|
If SRP_JSON(objReactServ, 'New', 'Object') then
|
|
SRP_JSON(objReactServ, 'SetValue', 'keyId', @ID)
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactType', {REACT_TYPE})
|
|
SRP_JSON(objReactServ, 'SetValue', 'action', {ACTION})
|
|
SRP_JSON(objReactServ, 'SetValue', 'description', {DESCRIPTION})
|
|
//SRP_JSON(objReactServ, 'SetValue', 'graphiteOrTube', OConv({GRAPHITE_OR_TUBE}, '[GRAPHITE_OR_TUBE_CONV]'))
|
|
SRP_JSON(objReactServ, 'SetValue', 'graphiteOrTube', {GRAPHITE_OR_TUBE})
|
|
SRP_JSON(objReactServ, 'SetValue', 'inactiveDate', OConv({INACTIVE_DATE}, 'D4/'))
|
|
SRP_JSON(objReactServ, 'SetValue', 'injectorChange', {INJECTOR_CHANGE}, 'Boolean')
|
|
SRP_JSON(objReactServ, 'SetValue', 'noteRequired', {NOTE_REQ}, 'Boolean')
|
|
SRP_JSON(objReactServ, 'SetValue', 'pmDays', {PM_DAYS})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactGas', {REACT_GAS})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactItem', {REACT_ITEM})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactItemDesc', {REACT_ITEM_DESC})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactItemType', {REACT_ITEM_TYPE})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactServCatId', {REACT_SERV_CAT_ID})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactServCatDesc', {REACT_SERV_CAT_DESC})
|
|
SRP_JSON(objReactServ, 'SetValue', 'reactSystem', {REACT_SYSTEM})
|
|
SRP_JSON(objReactServ, 'SetValue', 'requireArmWandData', {REQ_ARM_WAND_DATA})
|
|
SRP_JSON(objReactServ, 'SetValue', 'status', {STATUS})
|
|
SRP_JSON(objReactServ, 'SetValue', 'svcDesc', {SVC_DESC})
|
|
SRP_JSON(objReactServ, 'SetValue', 'sysDesc', {SYS_DESC})
|
|
SRP_JSON(objReactServ, 'SetValue', 'tcChangeService', {TC_CHANGE_SERVICE})
|
|
SRP_JSON(objJSON, 'Set', 'reactServ', objReactServ)
|
|
SRP_JSON(objReactServ, 'Release')
|
|
end
|
|
|
|
If itemURL NE '' then
|
|
// The itemURL was passed in so add HAL+JSON properties.
|
|
|
|
// Create the _links property and then all link objects needed for this resource.
|
|
If SRP_JSON(objLinks, 'New', 'Object') then
|
|
// Create a self link.
|
|
If SRP_JSON(objLink, 'New', 'Object') then
|
|
SRP_JSON(objLink, 'SetValue', 'href', ItemURL, 'String')
|
|
SRP_JSON(objLink, 'SetValue', 'title', 'Self', 'String')
|
|
SRP_JSON(objLinks, 'Set', 'self', objLink)
|
|
SRP_JSON(objLink, 'Release')
|
|
end
|
|
SRP_JSON(objJSON, 'Set', '_links', objLinks)
|
|
SRP_JSON(objLinks, 'Release')
|
|
end
|
|
|
|
// Create the _class property for this resource.
|
|
SRP_JSON(objJSON, 'SetValue', '_class', 'resource')
|
|
end
|
|
jsonRecord = SRP_JSON(objJSON, 'Stringify', 'Styled')
|
|
SRP_JSON(objJSON, 'Release')
|
|
end else
|
|
Error_Services('Add', 'Unable to create JSON representation in the ' : Service : ' service.')
|
|
end
|
|
end
|
|
end else
|
|
Error_Services('Add', 'KeyID argument was missing in the ' : Service : ' service.')
|
|
end
|
|
|
|
Response = jsonRecord
|
|
|
|
end service
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Internal GoSubs
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
ClearCursors:
|
|
|
|
For counter = 0 to 8
|
|
ClearSelect counter
|
|
Next counter
|
|
|
|
return
|
|
|