Enhancements to COC_AVAILABILITY to reduce false

positives and add additional logging.
This commit is contained in:
Infineon\Mitchem 2025-01-08 15:25:45 -07:00 committed by Mitchem Dakota (CSC FI SPS MESLEO External)
parent 0e51db912a
commit dd3aaad4a6
2 changed files with 44 additions and 26 deletions

View File

@ -22,6 +22,7 @@ Function FTP_Services(@Service, @Params)
History : (Date, Initials, Notes)
07/10/18 dmb Original programmer.
11/13/24 djm Add ListDirectory service.
01/08/24 djm Changed ListDirectory to preserve host error message and set Error_Services.
***********************************************************************************************************************/
@ -822,7 +823,6 @@ Service ListDirectory(Host=HOSTS, Username, Password, RemoteDirectory, Query, Sc
If (Host NE '') AND (RemoteDirectory NE '') then
ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, '', Username, Password, '', RemoteDirectory, Query, 'list', SSH)
If Error_Services('NoError') then
//FTP_Services('RunScript', ScriptPath, Host, Username, Password, '', RemoteDirectory, DeleteScript, SSH)
If SSH EQ True$ then
Command = 'psftp'
If Username NE '' then
@ -837,9 +837,12 @@ Service ListDirectory(Host=HOSTS, Username, Password, RemoteDirectory, Query, Sc
end else
Command = 'ftp -i -n -s:' : ScriptPath
end
//Command = 'psftp ' : ScriptPath
DirectoryList = SRP_Run_Command(Command, 'VAR')
Gosub LsToMls
If Count(DirectoryList, 'ssh_init') EQ 0 then
Gosub LsToMls
end else
Error_Services('Add', DirectoryList)
end
Response = DirectoryList
If OutputPath NE '' then
OutputDirectoryList = DirectoryList
@ -899,3 +902,4 @@ return

View File

@ -18,6 +18,7 @@ Compile function Shipment_Services(@Service, @Params)
History : (Date, Initials, Notes)
11/13/24 djm Original programmer.
1/8/2025 djm Added parsing for connection errors and logging for loop resets. Removed emails for COC_AVAILABILITY.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
@ -75,6 +76,7 @@ Service CycleRetentionDates()
PotentialEndDate = CurrEndDate - 10
Begin Case
Case CurrStartDate EQ EarliestDate
gosub LogLoopReset
StartDate = TodayDate - 10
EndDate = TodayDate
Case PotentialStartDate LT EarliestDate
@ -93,6 +95,7 @@ Service CycleRetentionDates()
EndDate = Oconv(EndDate, 'D4-')
Shipment_Services('CheckFileAvailability', StartDate, EndDate)
end else
gosub LogLoopReset
StartDate = TodayDate - 10
EndDate = TodayDate
NewRec = ''
@ -151,14 +154,16 @@ Service CheckFileAvailability(StartDate, EndDate)
DeleteScript = True$
Query = '*' : COCNo : '*'
QueryResult = FTP_Services('ListDirectory', FTPHost, Username, Password, RemoteDirectory, Query, '', DeleteScript, SSH, '')
If QueryResult EQ '' then
Error_Services('Add', 'Expected file for shipment ' : COCNo : ' missing.')
NewCOC<COC_FTP_EXISTS$> = False$
Gosub LogMissingFile
end else
NewCOC<COC_FTP_EXISTS$> = True$
If Count(QueryResult, 'ssh_init') EQ 0 then
If QueryResult EQ '' then
Error_Services('Add', 'Expected file for shipment ' : COCNo : ' missing.')
NewCOC<COC_FTP_EXISTS$> = False$
Gosub LogMissingFile
end else
NewCOC<COC_FTP_EXISTS$> = True$
end
Database_Services('WriteDataRow', 'COC', COCNo, NewCOC, True$, False$, False$)
end
Database_Services('WriteDataRow', 'COC', COCNo, NewCOC, True$, False$, False$)
end
END
REPEAT
@ -219,18 +224,18 @@ Service SetMONACritical(MONAResource=MONAResources, ErrorMessage)
IF MONAResource = 'FILE_GENERATION' OR MONAResource = 'FILE_TRANSMISSION' OR MONAResource = 'FILE_AVAILABILITY' then
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', MONAResource, 'CRITICAL')
If ErrorMessage NE '' then
// Send an internal OI message to FI Support
Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', 'USER_ID', 'X')
SentFrom = 'SYSTEM'
Subject = 'COC ' : MONAResource : ' Error!'
Message = ErrorMessage
AttachWindow = ''
AttachKey = ''
SendToGroup = ''
Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',Parms)
End
* If ErrorMessage NE '' then
* // Send an internal OI message to FI Support
* Recipients = Xlate('NOTIFICATION', 'FI_SUPPORT', 'USER_ID', 'X')
* SentFrom = 'SYSTEM'
* Subject = 'COC ' : MONAResource : ' Error!'
* Message = ErrorMessage
* AttachWindow = ''
* AttachKey = ''
* SendToGroup = ''
* Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
* obj_Notes('Create',Parms)
* End
end else
Error_Services('Add', 'Invalid COC MONA resource.')
end
@ -277,10 +282,7 @@ End Service
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
// LogMissingFile
//
//----------------------------------------------------------------------------------------------------------------------
LogMissingFile:
LogData = ''
@ -292,6 +294,17 @@ LogMissingFile:
return
LogLoopReset:
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = ''
LogData<3> = 'Loop Restart'
LogData<4> = ''
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
return
CompanyExceptionCheck:
@ -326,3 +339,4 @@ CompanyExceptionCheck:
return