Added JSON body and response logging to CreateNewOrder service. Modified how reactor log comments are added for ABORT_ALARM NICA orders. Modified ABORT_ALARM solution to not trigger on WAITING_FOR_MAINTENANCE_UNSCHEDULED

This commit is contained in:
Infineon\StieberD
2025-08-12 16:24:12 -07:00
parent 1f2b73797b
commit f4f63c28e3
2 changed files with 55 additions and 17 deletions

View File

@ -425,7 +425,7 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
SRP_JSON(objJson, 'SetValue', 'reactorNumber', ReactNo)
NewChecklistInstIds = Xlate('NICA_CHECKLISTS', NewSortedChecklistIds, 'NICA_BASE_INSTRUCTION_ID', 'X')
SRP_JSON(objJson, 'SetValueArray', 'baseInstructionIds', NewChecklistInstIds, @VM)
Body = SRP_JSON(objJson, 'Stringify', 'Styled')
Body = SRP_JSON(objJson, 'Stringify', 'Fast')
Convert @FM to '' in Body
SRP_JSON(objJson, 'Release')
end else
@ -443,11 +443,12 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
IsSuccessful = False$
If ErrorMsg EQ '' then
AttemptNo = 0
Retries = 3
BackoffSeconds = 1
OrderId = ''
Loop
Loop
while (IsSuccessful EQ False$ and Retries GT 0)
WaitSeconds = (3 - retries) * BackoffSeconds
Delay(WaitSeconds)
@ -458,7 +459,32 @@ Service CreateNewOrder(EntityType=ENTITY_TYPES, EntityID, OrderType=ORDER_TYPES,
end else
Headers = 'Accept':@VM:'*/*'
end
LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') ; // Logging DTM
LogData<2> = Machine
AttemptNo += 1
LogData<3> = 'Attempt number ':AttemptNo:' to send HTTP POST request to ':NicaURL
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$)
// Write directly to the log file to avoid mangling the JSON
OSRead LogBytes from LogPath:'\':LogFileName then
LogBytes := CRLF$:Body
OSWrite LogBytes to LogPath:'\':LogFileName
end
HttpResponseJson = Httpclient_Services('SendHTTPRequest', 'POST', NicaURL, Headers, Body, '', '', False$, False$, '', IgnoreCertErrors)
LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') ; // Logging DTM
LogData<2> = Machine
LogData<3> = 'Attempt number ':AttemptNo:' HttpResponse from ':NicaURL:':'
Logging_Services('AppendLog', objLog, LogData, @RM, @FM, False$)
// Write directly to the log file to avoid mangling the JSON
OSRead LogBytes from LogPath:'\':LogFileName then
LogBytes := CRLF$:HttpResponseJson
OSWrite LogBytes to LogPath:'\':LogFileName
end
If HttpResponseJson NE '' then
ObjResponseJson = ''
If SRP_JSON(ObjResponseJson, 'Parse', HttpResponseJson) EQ '' then