diff --git a/LSL2/STPROC/SHIPMENT_SERVICES.txt b/LSL2/STPROC/SHIPMENT_SERVICES.txt index c09ff0c..bbc06e4 100644 --- a/LSL2/STPROC/SHIPMENT_SERVICES.txt +++ b/LSL2/STPROC/SHIPMENT_SERVICES.txt @@ -34,24 +34,15 @@ 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' :@FM: 'Error Output' -ColumnWidths = 30 : @FM : 20 : @FM : 50 :@FM: 50 :@FM: 300 -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 @@ -112,6 +103,7 @@ Service CycleRetentionDates() end service + //---------------------------------------------------------------------------------------------------------------------- // CheckFileAvailability // @@ -120,7 +112,6 @@ end service // FILE_AVAILABILITY. Intended to be run by the Service Manager. // //---------------------------------------------------------------------------------------------------------------------- - Service CheckFileAvailability(StartDate, EndDate) Error_Services('Clear') @@ -186,9 +177,9 @@ Service CheckFileAvailability(StartDate, EndDate) Shipment_Services('ClearMONACritical', 'FILE_AVAILABILITY') end - end service + //---------------------------------------------------------------------------------------------------------------------- // GetEarliestDate // @@ -214,6 +205,7 @@ Service GetEarliestDate() End Service + //---------------------------------------------------------------------------------------------------------------------- // SetMONACritical // @@ -227,24 +219,38 @@ 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 + // Log error + LogDate = Oconv(Date(), 'D4/') + LogTime = Oconv(Time(), 'MTS') + LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\Shipment' + LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : '_MonA_Critical.log' + Headers = 'Logging DTM' : @FM : 'Error' + ColumnWidths = 30 : @FM : 300 + objMonaLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ' ', Headers, ColumnWidths, False$, False$) + LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM + LogData = '' + LogData<1> = LoggingDtm + LogData<2> = ErrorMessage + Logging_Services('AppendLog', objMonaLog, LogData, @RM, @FM) + // 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 // @@ -264,7 +270,6 @@ Service ClearMONACritical(MONAResource=MONAResources) End Service - //---------------------------------------------------------------------------------------------------------------------- // ResetAllCOCMonaStatus // @@ -281,13 +286,29 @@ Service ResetAllCOCMonaStatus() End Service + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +InitCocLog: + + 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' :@FM: 'Error Output' + ColumnWidths = 30 : @FM : 20 : @FM : 50 :@FM: 50 :@FM: 300 + objLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ' ', Headers, ColumnWidths, False$, False$) + LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM + +return + + LogMissingFile: + GoSub InitCocLog LogData = '' LogData<1> = LoggingDTM LogData<2> = COCNo @@ -298,8 +319,10 @@ LogMissingFile: return + LogLoopReset: - + + GoSub InitCocLog LogData = '' LogData<1> = LoggingDTM LogData<2> = ''