Add monitoring for COC file generation and

transmission.

Commit to save progress.

Commit to save progress.

Finished ListDirectory service with full 'mls'
command functionality.

Final commit for COC availability checks.

Implement further changes requested by Daniel.
Add notifications to critical statuses and automatic status clearing.

Change Mona resource from dev to prod.
This commit is contained in:
Infineon\Mitchem 2024-11-04 15:49:55 -07:00
parent 8716caf86c
commit 8dce7988c6
8 changed files with 590 additions and 87 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
LSL2/STPROC/TEST_DANIEL3.txt LSL2/STPROC/TEST_DANIEL3.txt
LSL2/STPROC/TEST_DAKOTA.txt
LSL2/STPROC/TEST_DAKOTA.txt
LSL2/STPROC/TEST_DAKOTA.txt

View File

@ -315,6 +315,8 @@ FOR I = 1 TO ShipCnt
ShipRec<COC_EMAIL_DTM$,NewTxPos> = SendDtm ShipRec<COC_EMAIL_DTM$,NewTxPos> = SendDtm
ShipRec<COC_EMAIL_USER$,NewTxPos> = SendUser ShipRec<COC_EMAIL_USER$,NewTxPos> = SendUser
ShipRec<COC_EMAIL_REASON$,NewTxPos> = SendReason ShipRec<COC_EMAIL_REASON$,NewTxPos> = SendReason
ShipRec<COC_FTP_SHOULD_EXIST$> = True$
ShipRec<COC_FTP_EXISTS$> = True$
Database_Services('WriteDataRow', 'COC', ShipNo, ShipRec, True$, False$, True$) Database_Services('WriteDataRow', 'COC', ShipNo, ShipRec, True$, False$, True$)
@ -331,3 +333,4 @@ GOSUB Refresh
RETURN RETURN

View File

@ -8,7 +8,7 @@ COMPILE FUNCTION DIALOG_FTP_QUEUE(EntID,Event,Parm1,Parm2,Parm3,Parm4,Parm5)
DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status, obj_Shipment, obj_Tables DECLARE SUBROUTINE Set_Property, End_Dialog, Set_Status, obj_Shipment, obj_Tables
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow, DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow,
DECLARE SUBROUTINE End_Window DECLARE SUBROUTINE End_Window, Mona_Services
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Popup, Collect.Ixvals DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Popup, Collect.Ixvals
DECLARE FUNCTION Send_Message, Msg, Security_Check, obj_Shipment DECLARE FUNCTION Send_Message, Msg, Security_Check, obj_Shipment
@ -277,7 +277,6 @@ REPEAT
ShipCnt = COUNT(ShipNos,@VM) + (ShipNos NE '') ShipCnt = COUNT(ShipNos,@VM) + (ShipNos NE '')
if @user4 EQ 'DAN_CR' then debug
FOR I = 1 TO ShipCnt FOR I = 1 TO ShipCnt
ShipNo = ShipNos<1,I> ShipNo = ShipNos<1,I>
@ -315,3 +314,4 @@ RETURN

View File

@ -21,6 +21,7 @@ Function FTP_Services(@Service, @Params)
History : (Date, Initials, Notes) History : (Date, Initials, Notes)
07/10/18 dmb Original programmer. 07/10/18 dmb Original programmer.
11/13/24 djm Add ListDirectory service.
***********************************************************************************************************************/ ***********************************************************************************************************************/
@ -31,9 +32,10 @@ $insert SERVICE_SETUP
$insert FTP_REQUESTS_EQUATES $insert FTP_REQUESTS_EQUATES
$insert NOTIFICATION_EQUATES $insert NOTIFICATION_EQUATES
Equ CRLF$ to \0D0A\ Equ CRLF$ to \0D0A\
Equ Tab$ to Char(9)
Declare function FTP_Services, Memory_Services, Logging_Services, SRP_Path, SRP_Decode, RTI_CreateGUID Declare function FTP_Services, Memory_Services, Logging_Services, SRP_Path, SRP_Decode, RTI_CreateGUID
Declare function Environment_Services, Database_Services, Utility Declare function Environment_Services, Database_Services, Utility, SRP_Run_Command
Declare subroutine FTP_Services, Memory_Services, Logging_Services, SRP_Run_Command, GetTempPath, GetTempFileName Declare subroutine FTP_Services, Memory_Services, Logging_Services, SRP_Run_Command, GetTempPath, GetTempFileName
Declare subroutine Database_Services, RList, Obj_Notes Declare subroutine Database_Services, RList, Obj_Notes
@ -84,7 +86,7 @@ Options SERVERS = 'MESSA005', 'MESSA01EC'
// Sends the indicated local file or encoded data to the indicated host. // Sends the indicated local file or encoded data to the indicated host.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service SendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN) Service SendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service LogData<2> = 'Start ' : Service
@ -92,7 +94,7 @@ Service SendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDi
LogData<4> = LocalFile LogData<4> = LocalFile
LogData<5> = RemoteDirectory LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
If (Host NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then If (Host NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then
If LocalFile EQ '' then If LocalFile EQ '' then
// Data to send to the FTP server is coming in as Base64 string rather than a path to a local file. Decode the // Data to send to the FTP server is coming in as Base64 string rather than a path to a local file. Decode the
@ -109,7 +111,7 @@ Service SendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDi
end else end else
Error_Services('Add', 'Host, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.') Error_Services('Add', 'Host, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.')
end end
ServiceError = Error_Services('GetMessage') ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
@ -119,7 +121,7 @@ Service SendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDi
LogData<6> = Error_Services('GetMessage') LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError) Error_Services('Set', ServiceError)
end service end service
@ -141,7 +143,7 @@ end service
// Appends the indicated local file or encoded data to the indicated host. // Appends the indicated local file or encoded data to the indicated host.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service AppendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN) Service AppendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service LogData<2> = 'Start ' : Service
@ -149,7 +151,7 @@ Service AppendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, Local
LogData<4> = LocalFile LogData<4> = LocalFile
LogData<5> = RemoteDirectory LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
If (Host NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then If (Host NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then
If LocalFile EQ '' then If LocalFile EQ '' then
// Data to send to the FTP server is coming in as Base64 string rather than a path to a local file. Decode the // Data to send to the FTP server is coming in as Base64 string rather than a path to a local file. Decode the
@ -201,7 +203,7 @@ Service AppendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, Local
end else end else
Error_Services('Add', 'Host, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.') Error_Services('Add', 'Host, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.')
end end
ServiceError = Error_Services('GetMessage') ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
@ -211,7 +213,7 @@ Service AppendFile(Host=HOSTS, LocalFile, EncodedData, Username, Password, Local
LogData<6> = Error_Services('GetMessage') LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError) Error_Services('Set', ServiceError)
end service end service
@ -232,7 +234,7 @@ end service
// Gets the indicated remote file from the indicated host. // Gets the indicated remote file from the indicated host.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service GetFile(Host=HOSTS, RemoteFile, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN) Service GetFile(Host=HOSTS, RemoteFile, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service LogData<2> = 'Start ' : Service
@ -240,7 +242,7 @@ Service GetFile(Host=HOSTS, RemoteFile, LocalFile, Username, Password, LocalDire
LogData<4> = LocalFile LogData<4> = LocalFile
LogData<5> = RemoteDirectory LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
If (Host NE '') AND (RemoteFile NE '') then If (Host NE '') AND (RemoteFile NE '') then
ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, 'get', SSH) ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, 'get', SSH)
If Error_Services('NoError') then If Error_Services('NoError') then
@ -249,7 +251,7 @@ Service GetFile(Host=HOSTS, RemoteFile, LocalFile, Username, Password, LocalDire
end else end else
Error_Services('Add', 'Host or RemoteFile argument was missing from the ' : Service : ' service.') Error_Services('Add', 'Host or RemoteFile argument was missing from the ' : Service : ' service.')
end end
ServiceError = Error_Services('GetMessage') ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
@ -259,7 +261,7 @@ Service GetFile(Host=HOSTS, RemoteFile, LocalFile, Username, Password, LocalDire
LogData<6> = Error_Services('GetMessage') LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError) Error_Services('Set', ServiceError)
end service end service
@ -278,7 +280,7 @@ end service
// Deletes the indicated remote file from the indicated host. // Deletes the indicated remote file from the indicated host.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service DeleteFile(Host=HOSTS, RemoteFile, Username, Password, RemoteDirectory, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN) Service DeleteFile(Host=HOSTS, RemoteFile, Username, Password, RemoteDirectory, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service LogData<2> = 'Start ' : Service
@ -286,7 +288,7 @@ Service DeleteFile(Host=HOSTS, RemoteFile, Username, Password, RemoteDirectory,
LogData<4> = RemoteFile LogData<4> = RemoteFile
LogData<5> = RemoteDirectory LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
If (Host NE '') AND (RemoteFile NE '') then If (Host NE '') AND (RemoteFile NE '') then
ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, '', Username, Password, '', RemoteDirectory, RemoteFile, 'delete', SSH) ScriptPath = FTP_Services('CreateScript', ScriptPath, Host, '', Username, Password, '', RemoteDirectory, RemoteFile, 'delete', SSH)
If Error_Services('NoError') then If Error_Services('NoError') then
@ -295,7 +297,7 @@ Service DeleteFile(Host=HOSTS, RemoteFile, Username, Password, RemoteDirectory,
end else end else
Error_Services('Add', 'Host or RemoteFile argument was missing from the ' : Service : ' service.') Error_Services('Add', 'Host or RemoteFile argument was missing from the ' : Service : ' service.')
end end
ServiceError = Error_Services('GetMessage') ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
@ -305,7 +307,7 @@ Service DeleteFile(Host=HOSTS, RemoteFile, Username, Password, RemoteDirectory,
LogData<6> = Error_Services('GetMessage') LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError) Error_Services('Set', ServiceError)
end service end service
@ -326,10 +328,10 @@ end service
// Runs the indicated FTP script. // Runs the indicated FTP script.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service RunScript(ScriptPath, Host, Username, Password, LocalFile, RemoteDirectory, DeleteScript, SSH) Service RunScript(ScriptPath, Host, Username, Password, LocalFile, RemoteDirectory, DeleteScript, SSH)
If ScriptPath NE '' then If ScriptPath NE '' then
Output = 'VAR' ; // Use when running in production. Output = 'VAR' ; // Use when running in production.
* Output = 'DOSOPEN' ; // Use only for debugging the console. * Output = 'DOSOPEN' ; // Use only for debugging the console.
If SSH EQ True$ then If SSH EQ True$ then
Command = 'psftp' Command = 'psftp'
If Username NE '' then If Username NE '' then
@ -371,7 +373,7 @@ Service RunScript(ScriptPath, Host, Username, Password, LocalFile, RemoteDirecto
end else end else
Error_Services('Add', 'ScriptPath argument was missing from the ' : Service : ' service.') Error_Services('Add', 'ScriptPath argument was missing from the ' : Service : ' service.')
end end
end service end service
@ -392,10 +394,10 @@ end service
// Creates a script file based on the indicated arguments. This will be writen to the resulting script path. // Creates a script file based on the indicated arguments. This will be writen to the resulting script path.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service CreateScript(ScriptPath, Host, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, Command=COMMANDS, SSH) Service CreateScript(ScriptPath, Host, LocalFile, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, Command=COMMANDS, SSH)
// First, create the script list of commands based on the indicated arguments. // First, create the script list of commands based on the indicated arguments.
Script = '' Script = ''
If SSH EQ True$ then If SSH EQ True$ then
// PSFTP requires credentials to be entered in the command line rather than in the script. // PSFTP requires credentials to be entered in the command line rather than in the script.
end else end else
@ -439,11 +441,17 @@ Service CreateScript(ScriptPath, Host, LocalFile, Username, Password, LocalDirec
end else end else
Script := command : ' ' : RemoteFile Script := command : ' ' : RemoteFile
end end
Case Command _EQC 'list'
Script := 'ls '
If RemoteFile NE '' then
Script := ' ' : RemoteFile
end
End Case End Case
Script := @FM Script := @FM
Script := 'quit' Script := 'quit'
Swap @FM with CRLF$ in Script Swap @FM with CRLF$ in Script
// Second, validate the script path. Use the specific directory and/or filename provided in the ScriptPath argument // Second, validate the script path. Use the specific directory and/or filename provided in the ScriptPath argument
// if possible. Otherwise use temp names. // if possible. Otherwise use temp names.
ScriptDirectory = '' ScriptDirectory = ''
@ -476,16 +484,16 @@ Service CreateScript(ScriptPath, Host, LocalFile, Username, Password, LocalDirec
end else end else
ScriptPath = SRP_Path('Combine', ScriptDirectory, ScriptFile) ScriptPath = SRP_Path('Combine', ScriptDirectory, ScriptFile)
end end
// Finally, create the script file in the indicated ScriptPath. // Finally, create the script file in the indicated ScriptPath.
Status() = 0 Status() = 0
OSWrite Script to ScriptPath OSWrite Script to ScriptPath
If Status() then If Status() then
Error_Services('Add', 'Error creating ' : ScriptPath : ' in the ' : Service : ' service. Description: ' : Field('Bad OS filename.,Access denied by operating system.,Disk or directory full.,File does not exist.,Unknown error.,Attempt to write to a read-only file.', ',', Status())) Error_Services('Add', 'Error creating ' : ScriptPath : ' in the ' : Service : ' service. Description: ' : Field('Bad OS filename.,Access denied by operating system.,Disk or directory full.,File does not exist.,Unknown error.,Attempt to write to a read-only file.', ',', Status()))
end end
Response = ScriptPath Response = ScriptPath
end service end service
@ -497,9 +505,9 @@ end service
// Converts Base64 encoded data to plaint text and writes to a temporary file. // Converts Base64 encoded data to plaint text and writes to a temporary file.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service ConvertEncodedData(EncodedData) Service ConvertEncodedData(EncodedData)
LocalFile = '' LocalFile = ''
If EncodedData NE '' then If EncodedData NE '' then
Data = SRP_Decode(EncodedData, 'BASE64') Data = SRP_Decode(EncodedData, 'BASE64')
If Data NE '' then If Data NE '' then
@ -518,9 +526,9 @@ Service ConvertEncodedData(EncodedData)
end else end else
Error_Services('Add', 'EncodedData argument was missing from the ' : Service : ' service.') Error_Services('Add', 'EncodedData argument was missing from the ' : Service : ' service.')
end end
Response = LocalFile Response = LocalFile
end service end service
@ -530,17 +538,17 @@ end service
// Returns the path to a newly created temporary file. // Returns the path to a newly created temporary file.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service GetTempFile() Service GetTempFile()
TempFile = '' TempFile = ''
TempDirectory = Str(\00\, 1024) TempDirectory = Str(\00\, 1024)
GetTempPath(Len(TempDirectory), TempDirectory) GetTempPath(Len(TempDirectory), TempDirectory)
Convert \00\ to '' in TempDirectory Convert \00\ to '' in TempDirectory
TempFile = Str(\00\, 1024) TempFile = Str(\00\, 1024)
GetTempFileName(TempDirectory : \00\, \00\, 0, TempFile) GetTempFileName(TempDirectory : \00\, \00\, 0, TempFile)
Response = TempFile Response = TempFile
end service end service
@ -569,7 +577,7 @@ end service
// Posts the FTP request into the FTP_REQUESTS database table for future processing. // Posts the FTP request into the FTP_REQUESTS database table for future processing.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service PostRequest(Command=COMMANDS, Host=HOSTS, Server=SERVERS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN, ProcessDirectory, NumberAttempts, DeleteLocalFile) Service PostRequest(Command=COMMANDS, Host=HOSTS, Server=SERVERS, LocalFile, EncodedData, Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN, ProcessDirectory, NumberAttempts, DeleteLocalFile)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service LogData<2> = 'Start ' : Service
@ -577,9 +585,9 @@ Service PostRequest(Command=COMMANDS, Host=HOSTS, Server=SERVERS, LocalFile, Enc
LogData<4> = Command : ' ' : LocalFile LogData<4> = Command : ' ' : LocalFile
LogData<5> = RemoteDirectory LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
FTPRequestID = '' FTPRequestID = ''
If (Command NE '') AND (Host NE '') AND (Server NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then If (Command NE '') AND (Host NE '') AND (Server NE '') AND ((LocalFile NE '') OR (EncodedData NE '')) then
RequestDate = Date() RequestDate = Date()
RequestTime = Time() RequestTime = Time()
@ -632,7 +640,7 @@ Service PostRequest(Command=COMMANDS, Host=HOSTS, Server=SERVERS, LocalFile, Enc
end else end else
Error_Services('Add', 'Command, Host, Server, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.') Error_Services('Add', 'Command, Host, Server, LocalFile, or EncodedData argument was missing from the ' : Service : ' service.')
end end
ServiceError = Error_Services('GetMessage') ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
@ -642,9 +650,9 @@ Service PostRequest(Command=COMMANDS, Host=HOSTS, Server=SERVERS, LocalFile, Enc
LogData<6> = Error_Services('GetMessage') LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError) Error_Services('Set', ServiceError)
Response = FTPRequestID Response = FTPRequestID
end service end service
@ -656,12 +664,12 @@ end service
// Processes the FTP request specified by the FTPRequestID. // Processes the FTP request specified by the FTPRequestID.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service ProcessRequest(FTPRequestID) Service ProcessRequest(FTPRequestID)
If (FTPRequestID NE '') then If (FTPRequestID NE '') then
FTPRequestRow = Database_Services('ReadDataRow', 'FTP_REQUESTS', FTPRequestID) FTPRequestRow = Database_Services('ReadDataRow', 'FTP_REQUESTS', FTPRequestID)
If Error_Services('NoError') then If Error_Services('NoError') then
Server = FTPRequestRow<FTP_REQUESTS.SERVER$> Server = FTPRequestRow<FTP_REQUESTS.SERVER$>
* If Server EQ 'MESSA01EC' THEN Debug * If Server EQ 'MESSA01EC' THEN Debug
ThisServer = Environment_Services('GetServer') ThisServer = Environment_Services('GetServer')
If Server _EQC ThisServer then If Server _EQC ThisServer then
// This is the designated server to process this request. // This is the designated server to process this request.
@ -672,7 +680,7 @@ Service ProcessRequest(FTPRequestID)
LogData<4> = FTPRequestID LogData<4> = FTPRequestID
LogData<5> = '' LogData<5> = ''
Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
RequestDate = FTPRequestRow<FTP_REQUESTS.REQUEST_DATE$> RequestDate = FTPRequestRow<FTP_REQUESTS.REQUEST_DATE$>
RequestTime = FTPRequestRow<FTP_REQUESTS.REQUEST_TIME$> RequestTime = FTPRequestRow<FTP_REQUESTS.REQUEST_TIME$>
Command = FTPRequestRow<FTP_REQUESTS.FTP_COMMAND$> Command = FTPRequestRow<FTP_REQUESTS.FTP_COMMAND$>
@ -699,7 +707,7 @@ Service ProcessRequest(FTPRequestID)
Case Command _EQC 'delete' Case Command _EQC 'delete'
FTP_Services('DeleteFile', Host, RemoteFile, Username, Password, RemoteDirectory, ScriptPath, DeleteScript, SSH) FTP_Services('DeleteFile', Host, RemoteFile, Username, Password, RemoteDirectory, ScriptPath, DeleteScript, SSH)
End Case End Case
If Error_Services('NoError') then If Error_Services('NoError') then
Result = 'Success' Result = 'Success'
If (ProcessDirectory NE '') AND (LocalFile NE '') then If (ProcessDirectory NE '') AND (LocalFile NE '') then
@ -727,7 +735,7 @@ Service ProcessRequest(FTPRequestID)
MessageParms = Recipients:@RM:SendFrom:@RM:Subject:@RM:Result:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup MessageParms = Recipients:@RM:SendFrom:@RM:Subject:@RM:Result:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',MessageParms) obj_Notes('Create',MessageParms)
end end
// Update the FTP request with the latest attempt details. // Update the FTP request with the latest attempt details.
AttemptCount = FTPRequestRow<FTP_REQUESTS.ATTEMPT_COUNT$> AttemptCount = FTPRequestRow<FTP_REQUESTS.ATTEMPT_COUNT$>
AttemptCount += 1 AttemptCount += 1
@ -736,7 +744,7 @@ Service ProcessRequest(FTPRequestID)
FTPRequestRow<FTP_REQUESTS.ATTEMPT_TIME$, AttemptCount> = Time() FTPRequestRow<FTP_REQUESTS.ATTEMPT_TIME$, AttemptCount> = Time()
FTPRequestRow<FTP_REQUESTS.RESULT$, AttemptCount> = Result FTPRequestRow<FTP_REQUESTS.RESULT$, AttemptCount> = Result
Database_Services('WriteDataRow', 'FTP_REQUESTS', FTPRequestID, FTPRequestRow, True$, False$, True$) Database_Services('WriteDataRow', 'FTP_REQUESTS', FTPRequestID, FTPRequestRow, True$, False$, True$)
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service LogData<2> = 'Stop ' : Service
LogData<3> = '' LogData<3> = ''
@ -750,7 +758,7 @@ Service ProcessRequest(FTPRequestID)
end else end else
Error_Services('Add', 'FTPRequestID argument was missing from the ' : Service : ' service.') Error_Services('Add', 'FTPRequestID argument was missing from the ' : Service : ' service.')
end end
end service end service
@ -781,19 +789,110 @@ Service ProcessRequests()
ClearSelect 0 ClearSelect 0
Unlock hSysLists, ServiceKeyID else Null Unlock hSysLists, ServiceKeyID else Null
end end
end service end service
//----------------------------------------------------------------------------------------------------------------------
// ListDirectory
//
// Host - FTP server name or IP. - [Required]
// Query - Specify wildcard query. - [Optional]
// Username - Username to authenticate against the FTP server. - [Optional]
// Password - Password to authenticate against the FTP server. - [Optional]
// RemoteDirectory - Required working directory of the remote computer. Used with the "cd' FTP command. - [Optional]
// ScriptPath - Local directory and/or file name to use for the script file. - [Optional]
// DeleteScript - Boolean flag to indicate if the script file should be deleted after being ran. - [Optional]
// SSH - Boolean flag to indicate if SSH (Secure FTP) is required. Default is False. - [Optional]
// OutputPath - Path to output file list to file. - [Optional]
//
// Gets the indicated remote file from the indicated host. Functions as 'mls' command.
//----------------------------------------------------------------------------------------------------------------------
Service ListDirectory(Host=HOSTS, Username, Password, RemoteDirectory, Query, ScriptPath, DeleteScript=BOOLEAN, SSH=BOOLEAN, OutputPath)
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = 'Start ' : Service
LogData<3> = Host
LogData<4> = ''
LogData<5> = RemoteDirectory
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
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
If Host NE '' then Command := ' ' : Username : '@' : Host
end else
If Host NE '' then Command := ' ' : Host
end
If Password NE '' then
Command := ' -pw ' : Password
end
Command := ' -b ' : ScriptPath
end else
Command = 'ftp -i -n -s:' : ScriptPath
end
//Command = 'psftp ' : ScriptPath
DirectoryList = SRP_Run_Command(Command, 'VAR')
Gosub LsToMls
Response = DirectoryList
If OutputPath NE '' then
OutputDirectoryList = DirectoryList
Swap @FM with CRLF$ in OutputDirectoryList
OSWrite OutputDirectoryList to OutputPath
end
end
end else
Error_Services('Add', 'Host or RemoteFile argument was missing from the ' : Service : ' service.')
end
If DeleteScript EQ True$ then
OSDelete ScriptPath
end
ServiceError = Error_Services('GetMessage')
LogData<1> = LoggingDTM
LogData<2> = 'Stop ' : Service
LogData<3> = Host
LogData<4> = ''
LogData<5> = RemoteDirectory
LogData<6> = Error_Services('GetMessage')
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
Error_Services('Set', ServiceError)
end service
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs // Internal GoSubs
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// GoSubLabel // LsToMls
// //
// Parse output of ls command to remove directory paths and other unneccessary metadata. Functions as mls command.
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
GoSubLabel: LsToMls:
OldDirectoryList = DirectoryList
DirectoryList = ''
// Skip the first period because it is related to username.
FileCount = Count(OldDirectoryList, '.') - 1
// Index starts at 5 because that CRLF$ Field is the first containing a file name.
FieldIndex = 5
For FileIndex = 1 to FileCount
FileName = Field(OldDirectoryList, CRLF$, FieldIndex)
SpaceCount = DCount(FileName, ' ')
FileName = Field(FileName, ' ', SpaceCount)
DirectoryList<-1> = FileName
FieldIndex += 1
Next FileIndex
return return

View File

@ -3,6 +3,7 @@ COMPILE FUNCTION obj_Shipment(Method,Parms)
Methods for Shipment (COC) table Methods for Shipment (COC) table
02/02/2005 JCH - Initial Coding 02/02/2005 JCH - Initial Coding
11/13/2024 djm - Add MONA monitoring.
Properties: Properties:
@ -24,7 +25,7 @@ DECLARE FUNCTION Export_Coa, Export_Cds, Database_Services, Company_Services, RT
DECLARE FUNCTION Export_IR, Export_Tower_Met, obj_Calendar, Error_Services, Environment_Services, RTI_Task_Submit, RTI_Task_Status, SRP_Encode DECLARE FUNCTION Export_IR, Export_Tower_Met, obj_Calendar, Error_Services, Environment_Services, RTI_Task_Submit, RTI_Task_Status, SRP_Encode
DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, obj_WO_Step, obj_WO_Log, obj_RDS, Btree.Extract, Yield, Print_Shipment, Print_Shipment_Dev DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, ErrMsg, obj_WO_Step, obj_WO_Log, obj_RDS, Btree.Extract, Yield, Print_Shipment, Print_Shipment_Dev
DECLARE SUBROUTINE obj_Vision, obj_WM_Out, obj_Post_Log, obj_WO_Mat, obj_Notes, obj_Post_Log, obj_Export, ErrMsg, obj_WO_Mat_Log, Error_Services DECLARE SUBROUTINE obj_Vision, obj_WM_Out, obj_Post_Log, obj_WO_Mat, obj_Notes, obj_Post_Log, obj_Export, ErrMsg, obj_WO_Mat_Log, Error_Services
DECLARE SUBROUTINE obj_Shipment, Logging_Services, FTP_Services, Database_Services, Error_Services DECLARE SUBROUTINE obj_Shipment, Logging_Services, FTP_Services, Database_Services, Error_Services, Mona_Services, Shipment_Services
$Insert LOGICAL $Insert LOGICAL
@ -121,11 +122,13 @@ SAPCreate:
OPEN 'DICT.WO_LOG' TO DictWO ELSE OPEN 'DICT.WO_LOG' TO DictWO ELSE
ErrMsg("Unable to open DICT.WO_LOG' FOR Btree IN obj_SAP('Create' method") ErrMsg("Unable to open DICT.WO_LOG' FOR Btree IN obj_SAP('Create' method")
Shipment_Services('SetMONACritical', 'FILE_GENERATION', "Unable to open DICT.WO_LOG' FOR Btree IN obj_SAP('Create' method")
RETURN RETURN
END END
OPEN 'DICT.WO_MAT' TO DictWOMat ELSE OPEN 'DICT.WO_MAT' TO DictWOMat ELSE
ErrMsg("Unable to open DICT.WO_MAT' FOR Btree IN obj_SAP('Create' method") ErrMsg("Unable to open DICT.WO_MAT' FOR Btree IN obj_SAP('Create' method")
Shipment_Services('SetMONACritical', 'FILE_GENERATION', "Unable to open DICT.WO_MAT' FOR Btree IN obj_SAP('Create' method")
RETURN RETURN
End End
@ -161,6 +164,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'SAP_DEL_NO' ErrFields<1,ErrCnt> = 'SAP_DEL_NO'
ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo
ErrValues<1,ErrCnt> = '<null>' ErrValues<1,ErrCnt> = '<null>'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo)
End End
If ProdOrdNo = '' Then If ProdOrdNo = '' Then
@ -168,6 +172,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'PROD_ORD_NO' ErrFields<1,ErrCnt> = 'PROD_ORD_NO'
ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo
ErrValues<1,ErrCnt> = '<null>' ErrValues<1,ErrCnt> = '<null>'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo)
End End
If Trim(ProdOrdNo) _EQC 'NA' then If Trim(ProdOrdNo) _EQC 'NA' then
@ -176,6 +181,7 @@ SAPCreate:
// the original problem will be resolved. - dmb - 01/22/2018 // the original problem will be resolved. - dmb - 01/22/2018
ProdOrdNo = SAPBatchNo[1, '.'] : '.1' ProdOrdNo = SAPBatchNo[1, '.'] : '.1'
Error_Services('Add', 'SAP Delivery No #' : SAPDeliveryNo : 'imported with ProdOrderNo having a value of "NA".') Error_Services('Add', 'SAP Delivery No #' : SAPDeliveryNo : 'imported with ProdOrderNo having a value of "NA".')
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'SAP Delivery No #' : SAPDeliveryNo : 'imported with ProdOrderNo having a value of "NA".')
end end
If SAPBatchNo = '' Then If SAPBatchNo = '' Then
@ -183,6 +189,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'SAP_BATCH_NO' ErrFields<1,ErrCnt> = 'SAP_BATCH_NO'
ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo ErrDescs<1,ErrCnt> = 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo
ErrValues<1,ErrCnt> = '<null>' ErrValues<1,ErrCnt> = '<null>'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'Line ':I:' SAP_DEL_NO: ':SAPDeliveryNo:' PROD_ORD_NO: ':ProdOrdNo:' SAP_BATCH_NO: ':SAPBatchNo)
END END
LOCATE ProdOrdNo IN WOMap<2> USING @VM SETTING WOPos THEN LOCATE ProdOrdNo IN WOMap<2> USING @VM SETTING WOPos THEN
@ -196,6 +203,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'PROD_ORD_NO' ErrFields<1,ErrCnt> = 'PROD_ORD_NO'
ErrDescs<1,ErrCnt> = "No Work Order found for ProdOrdNo. Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo ErrDescs<1,ErrCnt> = "No Work Order found for ProdOrdNo. Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo
ErrValues<1,ErrCnt> = ProdOrdNo ErrValues<1,ErrCnt> = ProdOrdNo
Shipment_Services('SetMONACritical', 'FILE_GENERATION', "No Work Order found for ProdOrdNo. Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo)
END END
IF INDEX(WONo,@VM,1) Then IF INDEX(WONo,@VM,1) Then
@ -205,6 +213,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'PROD_ORD_NO' ErrFields<1,ErrCnt> = 'PROD_ORD_NO'
ErrDescs<1,ErrCnt> = "Multiple WO's found ( ":ErrWONos:" ) Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo ErrDescs<1,ErrCnt> = "Multiple WO's found ( ":ErrWONos:" ) Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo
ErrValues<1,ErrCnt> = ProdOrdNo ErrValues<1,ErrCnt> = ProdOrdNo
Shipment_Services('SetMONACritical', 'FILE_GENERATION', "Multiple WO's found ( ":ErrWONos:" ) Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo)
END END
WOMap = INSERT(WOMap,1,WOPos,0,WONo) WOMap = INSERT(WOMap,1,WOPos,0,WONo)
@ -225,6 +234,7 @@ SAPCreate:
ErrFields<1,ErrCnt> = 'SAP_BATCH_NO' ErrFields<1,ErrCnt> = 'SAP_BATCH_NO'
ErrDescs<1,ErrCnt> = "SAPBatchNo not in WO_MAT Batch Nos for WONo ":WONo:" Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo ErrDescs<1,ErrCnt> = "SAPBatchNo not in WO_MAT Batch Nos for WONo ":WONo:" Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo
ErrValues<1,ErrCnt> = SAPBatchNo ErrValues<1,ErrCnt> = SAPBatchNo
Shipment_Services('SetMONACritical', 'FILE_GENERATION', "SAPBatchNo not in WO_MAT Batch Nos for WONo ":WONo:" Line ":I:" SAP_DEL_NO: ":SAPDeliveryNo:" PROD_ORD_NO: ":ProdOrdNo:" SAP_BATCH_NO: ":SAPBatchNo)
END END
IF CassNo NE '' THEN IF CassNo NE '' THEN
@ -386,8 +396,8 @@ SAPCreate:
obj_Tables('WriteRec',OtParms) obj_Tables('WriteRec',OtParms)
IF Get_Status(errCode) THEN IF Get_Status(errCode) THEN
Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrCode)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '1. Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '1. Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
obj_Tables('UnlockRec',OtParms) obj_Tables('UnlockRec',OtParms)
END ELSE END ELSE
@ -396,8 +406,8 @@ SAPCreate:
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated COC Record : ' : ShipNo, @RM, @FM, '') Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated COC Record : ' : ShipNo, @RM, @FM, '')
IF Get_Status(errCode) THEN IF Get_Status(errCode) THEN
Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrCode)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '1.1 Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '1.1 Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
obj_Tables('UnlockRec',OtParms) obj_Tables('UnlockRec',OtParms)
END ELSE END ELSE
@ -414,9 +424,12 @@ SAPCreate:
obj_Tables('WriteRec',sqParms) obj_Tables('WriteRec',sqParms)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated SHIP_EMAIL_QUEUE Record : ' : ShipNo, @RM, @FM, '') Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated SHIP_EMAIL_QUEUE Record : ' : ShipNo, @RM, @FM, '')
IF Get_Status(errCode) THEN IF Get_Status(errCode) THEN
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '2. Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrCode)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '2. Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
obj_Tables('UnlockRec',sqParms) obj_Tables('UnlockRec',sqParms)
END END else
Shipment_Services('ClearMONACritical', 'FILE_GENERATION')
end
If AutoDataFlag then If AutoDataFlag then
// This customer has the Auto Data flag set. This means the code to produce the data files // This customer has the Auto Data flag set. This means the code to produce the data files
@ -441,11 +454,19 @@ SAPCreate:
TaskResponse = '' TaskResponse = ''
Loop Loop
Status = RTI_Task_Status(TaskID, TaskResponse) Status = RTI_Task_Status(TaskID, TaskResponse)
If (Status EQ 'COMPLETED') OR (Status EQ 'ERROR') then Done = True$ If (Status EQ 'COMPLETED') OR (Status EQ 'ERROR') then
Done = True$
If Status EQ 'ERROR' then
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'Error generating file for shipment ' : ShipNo)
end else
Shipment_Services('ClearMONACritical', 'FILE_GENERATION')
end
end
Until Done Until Done
Repeat Repeat
end else end else
// Track if task id wasn't created at all. // Track if task id wasn't created at all.
Shipment_Services('SetMONACritical', 'FILE_GENERATION', 'Error generating file for shipment ' : ShipNo)
end end
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Finished PRINT_SHIPMENT_DEV Task. Status : ' : Status, @RM, @FM, '') Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Finished PRINT_SHIPMENT_DEV Task. Status : ' : Status, @RM, @FM, '')
@ -462,10 +483,10 @@ SAPCreate:
obj_Tables('WriteOnlyRec',cocParms) obj_Tables('WriteOnlyRec',cocParms)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated COC Record : ' : ShipNo, @RM, @FM, '') Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : ' Updated COC Record : ' : ShipNo, @RM, @FM, '')
end else end else
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '3. Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '3. Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
end end
end else end else
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '4. Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '4. Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
end end
end end
END END
@ -503,9 +524,12 @@ SAPCreate:
obj_Tables('WriteRec',fpParms) obj_Tables('WriteRec',fpParms)
IF Get_Status(errCode) THEN IF Get_Status(errCode) THEN
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '5. Error = ' : ErrCode, @RM, @FM, '', 'dstieber@srpcs.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode) Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrCode)
Logging_Services('AppendLog', objLog, LoggingDTM : @FM : WONo : @FM: ShipNo : @FM : '5. Error = ' : ErrCode, @RM, @FM, '', 'Daniel.Stieber@infineon.com,jonathan.ouellette@infineon.com', LoggingDTM : ' ' : 'WONo = ' : WONo : ', ShipNo = ' : ShipNo : ', Error = ' : ErrCode)
obj_Tables('UnlockRec',fpParms) obj_Tables('UnlockRec',fpParms)
END END else
Shipment_Services('ClearMONACritical', 'FILE_GENERATION')
end
end end
END ;* End of check for FTP_QUEUE flag in the COMPANY (Customer) table. END ;* End of check for FTP_QUEUE flag in the COMPANY (Customer) table.
@ -1671,19 +1695,26 @@ SendTechnical:
FTPColumnWidths = 20 : @FM : 15 : @FM : 10 : @FM : 150 FTPColumnWidths = 20 : @FM : 15 : @FM : 10 : @FM : 150
FTPobjLog = Logging_Services('NewLog', FTPLogPath, FTPLogFileName, CRLF$, ' ', FTPHeaders, FTPColumnWidths, False$, False$) FTPobjLog = Logging_Services('NewLog', FTPLogPath, FTPLogFileName, CRLF$, ' ', FTPHeaders, FTPColumnWidths, False$, False$)
FTPLoggingDTM = FTPLogDate : ' ' : FTPLogTime ; // Logging DTM FTPLoggingDTM = FTPLogDate : ' ' : FTPLogTime ; // Logging DTM
IF Not(Assigned(ShipNo)) THEN IF Not(Assigned(ShipNo)) THEN
ShipNo = Parms[1,@RM] ShipNo = Parms[1,@RM]
AutoFlag = Parms[Col2() + 1, @RM] AutoFlag = Parms[Col2() + 1, @RM]
END END
IF ShipNo = '' THEN IF ShipNo = '' THEN
ErrorMsg = 'Null parameter "ShipNo" passed to routine. (':Method:')' ErrorMsg = 'Null parameter "ShipNo" passed to routine. (':Method:')'
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
RETURN RETURN
END END
OtParms = 'COC':@RM:ShipNo OtParms = 'COC':@RM:ShipNo
ShipRec = obj_Tables('ReadOnlyRec',OtParms) ShipRec = obj_Tables('ReadOnlyRec',OtParms)
If ShipRec EQ '' then
ErrorMsg = 'Invalid "ShipNo" passed to routine. ShipRec does not exist. (':Method:')'
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
RETURN
end
ShipDt = ShipRec<COC_SHIP_DT$> ShipDt = ShipRec<COC_SHIP_DT$>
If ShipDt NE '' then If ShipDt NE '' then
SendDate = OCONV(ShipDt, 'D4-') SendDate = OCONV(ShipDt, 'D4-')
@ -1742,16 +1773,21 @@ SendTechnical:
IF FTPHost EQ '' then IF FTPHost EQ '' then
LoggingErrMsg = 'Missing FTP Host in COMPANY record for ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Missing FTP Host in COMPANY record for ' : CustNo : '. Shipment #': ShipNo
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
end end
IF RemoteDirectory EQ '' then IF RemoteDirectory EQ '' then
LoggingErrMsg = 'Missing FTP Directory in COMPANY record for ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Missing FTP Directory in COMPANY record for ' : CustNo : '. Shipment #': ShipNo
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
end end
IF RTI_OS_Directory( "EXISTS", CustPath ) NE True$ AND LoggingErrMsg EQ '' then IF RTI_OS_Directory( "EXISTS", CustPath ) NE True$ AND LoggingErrMsg EQ '' then
successful = RTI_OS_Directory("CREATE", CustPath) successful = RTI_OS_Directory("CREATE", CustPath)
If successful NE True$ then If successful NE True$ then
LoggingErrMsg = 'Unable to create shipment directory for ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Unable to create shipment directory for ' : CustNo : '. Shipment #': ShipNo
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
end else
Shipment_Services('ClearMONACritical', 'FILE_TRANSMISSION')
end end
end end
IF LoggingErrMsg EQ '' then IF LoggingErrMsg EQ '' then
@ -1779,14 +1815,19 @@ SendTechnical:
IF SRP_Path("Exists", LocalFile) then IF SRP_Path("Exists", LocalFile) then
FTP_Services('PostRequest', 'put', FTPHost, Server, LocalFile, '', Username, Password, CustPath, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$) FTP_Services('PostRequest', 'put', FTPHost, Server, LocalFile, '', Username, Password, CustPath, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
If Error_Services('HasError') then
ErrorMsg = Error_Services('GetMessage')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
end
end else end else
LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location' LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location'
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -1797,29 +1838,35 @@ SendTechnical:
If ReactType Eq 'EPP' then If ReactType Eq 'EPP' then
IF SRP_Path("Exists", LocalFileCDS) then IF SRP_Path("Exists", LocalFileCDS) then
FTP_Services('PostRequest', 'put', FTPHost, Server, LocalFileCDS, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$) FTP_Services('PostRequest', 'put', FTPHost, Server, LocalFileCDS, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
If Error_Services('HasError') then
ErrorMsg = Error_Services('GetMessage')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
end
end else end else
LoggingErrMsg = 'Unable to send CSV COA CDS via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location' LoggingErrMsg = 'Unable to send CSV COA CDS via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location'
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
SentFlag = 0 Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
Subject = 'COC Generation Failue.' SendFrom = 'System'
AttachWindow = '' Subject = 'COC Generation Failure.'
AttachKey = '' AttachWindow = ''
SendToGroup = '' AttachKey = ''
MessageParms = Recipients:@RM:SendFrom:@RM:Subject:@RM:LoggingErrMsg:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup SendToGroup = ''
obj_Notes('Create',MessageParms) MessageParms = Recipients:@RM:SendFrom:@RM:Subject:@RM:LoggingErrMsg:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
obj_Notes('Create',MessageParms)
end end
end end
end else end else
LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -1838,6 +1885,7 @@ SendTechnical:
SentFlag = 1 SentFlag = 1
IF KeyList = '' THEN IF KeyList = '' THEN
ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)' ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrorMsg)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = CustNo LogData<2> = CustNo
@ -1869,14 +1917,19 @@ SendTechnical:
SSH = False$ SSH = False$
IF SRP_Path("Exists", LocalFile) then IF SRP_Path("Exists", LocalFile) then
FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$) FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
If Error_Services('HasError') then
ErrorMsg = Error_Services('GetMessage')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
end
end else end else
LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location' LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location'
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -1889,6 +1942,7 @@ SendTechnical:
SentFlag = 1 SentFlag = 1
IF KeyList = '' THEN IF KeyList = '' THEN
ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)' ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrorMsg)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = CustNo LogData<2> = CustNo
@ -1905,6 +1959,8 @@ SendTechnical:
successful = RTI_OS_Directory("CREATE", CustPath) successful = RTI_OS_Directory("CREATE", CustPath)
If successful NE True$ then If successful NE True$ then
null null
end else
Shipment_Services('ClearMONACritical', 'FILE_TRANSMISSION')
end end
end end
DosTable = CustPath : ShipNo:'.csv' DosTable = CustPath : ShipNo:'.csv'
@ -1926,14 +1982,19 @@ SendTechnical:
SSH = True$ = Error_Services('GetMessage') SSH = True$ = Error_Services('GetMessage')
IF SRP_Path("Exists", LocalFile) then IF SRP_Path("Exists", LocalFile) then
FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$) FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
If Error_Services('HasError') then
ErrorMsg = Error_Services('GetMessage')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
end
end else end else
LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location' LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location'
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -1943,12 +2004,13 @@ SendTechnical:
end else end else
LoggingErrMsg = 'Export ' : ExportID: ' does not exist for customer ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Export ' : ExportID: ' does not exist for customer ' : CustNo : '. Shipment #': ShipNo
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -1962,6 +2024,7 @@ SendTechnical:
IF KeyList = '' THEN IF KeyList = '' THEN
ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)' ErrorMsg = 'There are no RDS records attached to this shipment. No data will be sent to the customer. (EpiPRO process)'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', ErrorMsg)
LogData = '' LogData = ''
LogData<1> = LoggingDTM LogData<1> = LoggingDTM
LogData<2> = CustNo LogData<2> = CustNo
@ -1977,6 +2040,8 @@ SendTechnical:
successful = RTI_OS_Directory("CREATE", CustPath) successful = RTI_OS_Directory("CREATE", CustPath)
If successful NE True$ then If successful NE True$ then
null null
end else
Shipment_Services('ClearMONACritical', 'FILE_TRANSMISSION')
end end
end end
DosTable = CustPath :ShipNo:'.csv' DosTable = CustPath :ShipNo:'.csv'
@ -1997,14 +2062,19 @@ SendTechnical:
SSH = True$ SSH = True$
IF SRP_Path("Exists", LocalFile) then IF SRP_Path("Exists", LocalFile) then
FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$) FTP_Services('PostRequest', 'put', Host, Server, LocalFile, '', Username, Password, LocalDirectory, RemoteDirectory, RemoteFile, ScriptPath, DeleteScript, SSH, '', 3, False$)
If Error_Services('HasError') then
ErrorMsg = Error_Services('GetMessage')
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', ErrorMsg)
end
end else end else
LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location' LoggingErrMsg = 'Unable to send CSV COA via FTP for customer ' : CustNo : '. Shipment #': ShipNo :'. File was not found in the expected location'
Shipment_Services('SetMONACritical', 'FILE_GENERATION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -2013,12 +2083,13 @@ SendTechnical:
end end
end else end else
LoggingErrMsg = 'Export ' : ExportID: ' does not exist for customer ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Export ' : ExportID: ' does not exist for customer ' : CustNo : '. Shipment #': ShipNo
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X') Recipients = XLATE('NOTIFICATION','COC_DELIVERY',NOTIFICATION_USER_ID$,'X')
SendFrom = 'System' SendFrom = 'System'
Subject = 'COC Generation Failue.' Subject = 'COC Generation Failure.'
AttachWindow = '' AttachWindow = ''
AttachKey = '' AttachKey = ''
SendToGroup = '' SendToGroup = ''
@ -2028,6 +2099,7 @@ SendTechnical:
Case 1 Case 1
LoggingErrMsg = 'Shipment settings do not exist for customer ' : CustNo : '. Shipment #': ShipNo LoggingErrMsg = 'Shipment settings do not exist for customer ' : CustNo : '. Shipment #': ShipNo
Shipment_Services('SetMONACritical', 'FILE_TRANSMISSION', LoggingErrMsg)
Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '') Logging_Services('AppendLog', FTPobjLog, FTPLoggingDTM : @FM : CustNo : @FM: ShipNo : @FM : LoggingErrMsg, @RM, @FM, '')
SentFlag = 0 SentFlag = 0
End Case End Case
@ -2140,3 +2212,4 @@ RETURN

View File

@ -617,7 +617,7 @@ Main:
LengthSourceFile = Dir(PDFFileName)<1> LengthSourceFile = Dir(PDFFileName)<1>
LengthDestFile = Dir(TruePDFFileName)<1> LengthDestFile = Dir(TruePDFFileName)<1>
If Success NE True$ then If Success NE True$ then
EmailAddresses = 'dstieber@srpcs.com,francois.rivard@infineon.com,dan.crisp@infineon.com,jonathan.ouellette@infineon.com' EmailAddresses = 'Daniel.Stieber@infineon.com,francois.rivard@infineon.com,jonathan.ouellette@infineon.com'
EmailMessage = LoggingDTM : ' ' : 'WONo = ' : ShipWONo : ', ShipNo = ' : ShipNo : ', COPYFILE Success = ' : Success EmailMessage = LoggingDTM : ' ' : 'WONo = ' : ShipWONo : ', ShipNo = ' : ShipNo : ', COPYFILE Success = ' : Success
end else end else
EmailAddresses = '' EmailAddresses = ''
@ -905,3 +905,4 @@ RETURN

View File

@ -0,0 +1,322 @@
Compile function Shipment_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 : Shipment_Services
Description : Handler program for all Shipment services.
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)
11/13/24 djm Original programmer.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
$insert LOGICAL
$Insert SERVICE_SETUP
$Insert COC_EQUATES
$Insert COMPANY_EQUATES
Declare function Error_Services, Company_Services, FTP_Services, Environment_Services, Logging_Services, Shipment_Services
Declare subroutine Error_Services, Mona_Services, Rlist, SRP_Stopwatch, Logging_Services, Database_Services
Declare subroutine Shipment_Services, OBJ_Notes
Equ CRLF$ to \0D0A\
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\COC_Availability'
LogDate = Oconv(Date(), 'D4/')
LogTime = Oconv(Time(), 'MTS')
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : '_Error' '.log'
Headers = 'Logging DTM' : @FM : 'Shipment ID' : @FM : 'Expected Remote Directory' :@FM: 'Customer/COMPANY Number'
ColumnWidths = 30 : @FM : 20 : @FM : 50 :@FM: 50
objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ' ', Headers, ColumnWidths, False$, False$)
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
GoToService
Return Response or ""
Options MonaResources = 'FILE_GENERATION', 'FILE_TRANSMISSION', 'FILE_AVAILABILITY'
//-----------------------------------------------------------------------------
// SERVICES
//-----------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// CycleRetentionDates
//
//
// Cycles the APP_INFO*COC_AVAILABILITY record dates to check a portion of the retention period at a time.
// Intended to be run by the Service Manager.
//
//----------------------------------------------------------------------------------------------------------------------
Service CycleRetentionDates()
CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X')
TodayDate = Date()
EarliestDate = Shipment_Services('GetEarliestDate')
If CycleRec<1> EQ TodayDate then
CurrStartDate = CycleRec<2>
CurrEndDate = CycleRec<3>
PotentialStartDate = CurrStartDate - 10
PotentialEndDate = CurrEndDate - 10
Begin Case
Case CurrStartDate EQ EarliestDate
StartDate = TodayDate - 10
EndDate = TodayDate
Case PotentialStartDate LT EarliestDate
StartDate = EarliestDate
EndDate = EarliestDate + 10
Case Otherwise$
StartDate = PotentialStartDate
EndDate = PotentialEndDate
End Case
NewRec = CycleRec
NewRec<2> = StartDate
NewRec<3> = EndDate
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$)
StartDate = Oconv(StartDate, 'D4-')
EndDate = Oconv(EndDate, 'D4-')
Shipment_Services('CheckFileAvailability', StartDate, EndDate)
end else
StartDate = TodayDate - 10
EndDate = TodayDate
NewRec = ''
NewRec<1> = TodayDate
NewRec<2> = StartDate
NewRec<3> = EndDate
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$)
StartDate = Oconv(StartDate, 'D4-')
EndDate = Oconv(EndDate, 'D4-')
Shipment_Services('CheckFileAvailability', StartDate, EndDate)
end
end service
//----------------------------------------------------------------------------------------------------------------------
// CheckFileAvailability
//
//
// Confirms the availabiliy of generated files on the FTP serve, otherwise sets a MONA critical status for COC
// FILE_AVAILABILITY. Intended to be run by the Service Manager.
//
//----------------------------------------------------------------------------------------------------------------------
Service CheckFileAvailability(StartDate, EndDate)
Error_Services('Clear')
OPEN 'COC' TO COCTable ELSE
Error_Services('Add', 'Unable to open COC Table')
Return
END
Statement1 = 'SELECT COC BY ENTRY_DATE WITH ENTRY_DATE GE ' : Quote(StartDate)
Statement2 = 'SELECT COC WITH ENTRY_DATE LE ' : Quote(EndDate)
Clearselect
RList(Statement1, 5, '', '', '')
RList(Statement2, 5, '', '', '')
If @List_Active EQ 3 AND @RecCount NE 0 then
Done = 0
LOOP
READNEXT COCNo ELSE Done = 1
UNTIL Done
READ COCRec FROM COCTable, COCNo THEN
WONo = COCRec<COC_WO_NO$>
CustNo = XLATE('COC', COCNo, 'WO_CUST_NO_EX', 'X')
If CustNo EQ '' then CustNo = XLATE('WO_LOG',WONo,'CUST_NO','X')
AutoDataFlag = XLATE('COMPANY',CustNo,COMPANY_AUTO_FTP_FLAG$,'X')
If AutoDataFlag then
NewCOC = COCRec
NewCOC<COC_FTP_SHOULD_EXIST$> = True$
Gosub CompanyExceptionCheck
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$
end
Database_Services('WriteDataRow', 'COC', COCNo, NewCOC, True$, False$, False$)
end
END
REPEAT
end
// Code to run COC SELECT and change MONA Status
EarliestDate = Shipment_Services('GetEarliestDate')
EarliestDate = OConv(EarliestDate, 'D4-')
Statement1 = 'SELECT COC BY ENTRY_DATE WITH ENTRY_DATE GE ' : Quote(EarliestDate)
Statement2 = 'SELECT COC WITH FTP_SHOULD_EXIST EQ 1 AND WITH FTP_EXISTS EQ 0'
Clearselect
RList(Statement1, 5, '', '', '')
RList(Statement2, 5, '', '', '')
If @List_Active EQ 3 AND @RecCount NE 0 then
Shipment_Services('SetMONACritical', 'FILE_AVAILABILITY', 'Error locating expected COC file(s). Please review the logs and correct.')
end else
Shipment_Services('ClearMONACritical', 'FILE_AVAILABILITY')
end
end service
//----------------------------------------------------------------------------------------------------------------------
// GetEarliestDate
//
//
// Returns the earliest date that the service should check for.
//
//
//----------------------------------------------------------------------------------------------------------------------
Service GetEarliestDate()
TodayDate = Date()
/////// Earliest Date where all documents to date are accounted for. To be used until 3-2-25, after which the earliest date should always just be 1 year before the current date.////////////////////////////////////
TempEarliestDate = '3-2-24'
TempEarliestDate = Iconv(TempEarliestDate, 'D')
LastYearDate = TodayDate - 365
If LastYearDate LT TempEarliestDate then
EarliestDate = TempEarliestDate
end else
EarliestDate = LastYearDate
end
Response = EarliestDate
End Service
//----------------------------------------------------------------------------------------------------------------------
// SetMONACritical
//
//
// Sets a MONA Critical Status for the specified COC monitoring resource.
// Sends a notification to the FI_SUPPORT notification group with the specified message.
//
//
//----------------------------------------------------------------------------------------------------------------------
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
end else
Error_Services('Add', 'Invalid COC MONA resource.')
end
End Service
//----------------------------------------------------------------------------------------------------------------------
// ClearMONACritical
//
//
// Sets a MONA OK Status for the specified COC monitoring resource.
//
//
//----------------------------------------------------------------------------------------------------------------------
Service ClearMONACritical(MONAResource=MONAResources)
IF MONAResource = 'FILE_GENERATION' OR MONAResource = 'FILE_TRANSMISSION' OR MONAResource = 'FILE_AVAILABILITY' then
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', MONAResource, 'OK')
end else
Error_Services('Add', 'Invalid COC MONA resource.')
end
End Service
//----------------------------------------------------------------------------------------------------------------------
// ResetAllCOCMonaStatus
//
//
// Resets MONA critical status for COC FILE_GENERATION, FILE_TRANSMISSION, and FILE_AVAILABILITY.
//
//
//----------------------------------------------------------------------------------------------------------------------
Service ResetAllCOCMonaStatus()
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', 'FILE_GENERATION', 'OK')
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', 'FILE_TRANSMISSION', 'OK')
Mona_Services('SendBufferedStatus', 'GRP_OPENINSIGHT_MES_OP_FE_COC', 'FILE_AVAILABILITY', 'OK')
End Service
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------------
// LogMissingFile
//
//----------------------------------------------------------------------------------------------------------------------
LogMissingFile:
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = COCNo
LogData<3> = RemoteDirectory
LogData<4> = CustNo
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
return
CompanyExceptionCheck:
Begin Case
Case CustNo EQ '6593' OR CustNo EQ '408' OR CustNo EQ '7076'
FTPHost = '10.72.176.48'
Username = 'Infineon\TEMFTPEPIMesa'
Password = 'fW&EHJhKWg!skUKV4_34'
RemoteDirectory = '\TEMFTP_EPIMesa\Archive'
SSH = False$
Case CustNo EQ '6775'
FTPHost = 'sFTPNA.extra.infineon.com'
Username = 'DNAMesaFI-FTP'
Password = 'OpenInsight2018....!'
RemoteDirectory = '/Tower'
SSH = True$
Case CustNo EQ '7053' OR CustNo EQ '7092'
FTPHost = 'sFTPNA.extra.infineon.com'
Username = 'DNAMesaFI-FTP'
Password = 'OpenInsight2018....!'
RemoteDirectory = '/Tower'
SSH = True$
Case Otherwise$
FTPSettings = Company_Services('GetFTPServer', CustNo)
FTPHost = FTPSettings<1>;//this is new
Username = FTPSettings<2>;//this is new
Password = FTPSettings<3>;//this is new
RemoteDirectory = '/' : FTPSettings<5>;//this is new
SSH = FTPSettings<6>;//this is new
End Case
return

View File

@ -57,3 +57,5 @@ Equ COC_TECH_DATA_DTM$ To 46
Equ COC_EMAIL_DTM$ To 47 Equ COC_EMAIL_DTM$ To 47
Equ COC_EMAIL_USER$ To 48 Equ COC_EMAIL_USER$ To 48
Equ COC_EMAIL_REASON$ To 49 Equ COC_EMAIL_REASON$ To 49
Equ COC_FTP_SHOULD_EXIST$ To 50
Equ COC_FTP_EXISTS$ To 51