Added lock protection for COC service.

This commit is contained in:
Infineon\Mitchem 2024-12-03 10:20:52 -07:00
parent 8dce7988c6
commit 7782918afd

View File

@ -27,6 +27,7 @@ $Insert COC_EQUATES
$Insert COMPANY_EQUATES $Insert COMPANY_EQUATES
Declare function Error_Services, Company_Services, FTP_Services, Environment_Services, Logging_Services, Shipment_Services Declare function Error_Services, Company_Services, FTP_Services, Environment_Services, Logging_Services, Shipment_Services
Declare function Database_Services
Declare subroutine Error_Services, Mona_Services, Rlist, SRP_Stopwatch, Logging_Services, Database_Services Declare subroutine Error_Services, Mona_Services, Rlist, SRP_Stopwatch, Logging_Services, Database_Services
Declare subroutine Shipment_Services, OBJ_Notes Declare subroutine Shipment_Services, OBJ_Notes
@ -61,47 +62,51 @@ Options MonaResources = 'FILE_GENERATION', 'FILE_TRANSMISSION', 'FILE_AVAILABILI
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
Service CycleRetentionDates() Service CycleRetentionDates()
CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X') hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
TodayDate = Date() Lock hSysLists, ServiceKeyID then
EarliestDate = Shipment_Services('GetEarliestDate') CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X')
TodayDate = Date()
EarliestDate = Shipment_Services('GetEarliestDate')
If CycleRec<1> EQ TodayDate then If CycleRec<1> EQ TodayDate then
CurrStartDate = CycleRec<2> CurrStartDate = CycleRec<2>
CurrEndDate = CycleRec<3> CurrEndDate = CycleRec<3>
PotentialStartDate = CurrStartDate - 10 PotentialStartDate = CurrStartDate - 10
PotentialEndDate = CurrEndDate - 10 PotentialEndDate = CurrEndDate - 10
Begin Case Begin Case
Case CurrStartDate EQ EarliestDate Case CurrStartDate EQ EarliestDate
StartDate = TodayDate - 10 StartDate = TodayDate - 10
EndDate = TodayDate EndDate = TodayDate
Case PotentialStartDate LT EarliestDate Case PotentialStartDate LT EarliestDate
StartDate = EarliestDate StartDate = EarliestDate
EndDate = EarliestDate + 10 EndDate = EarliestDate + 10
Case Otherwise$ Case Otherwise$
StartDate = PotentialStartDate StartDate = PotentialStartDate
EndDate = PotentialEndDate EndDate = PotentialEndDate
End Case End Case
NewRec = CycleRec NewRec = CycleRec
NewRec<2> = StartDate NewRec<2> = StartDate
NewRec<3> = EndDate NewRec<3> = EndDate
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$)
StartDate = Oconv(StartDate, 'D4-') StartDate = Oconv(StartDate, 'D4-')
EndDate = Oconv(EndDate, 'D4-') EndDate = Oconv(EndDate, 'D4-')
Shipment_Services('CheckFileAvailability', StartDate, EndDate) Shipment_Services('CheckFileAvailability', StartDate, EndDate)
end else end else
StartDate = TodayDate - 10 StartDate = TodayDate - 10
EndDate = TodayDate EndDate = TodayDate
NewRec = '' NewRec = ''
NewRec<1> = TodayDate NewRec<1> = TodayDate
NewRec<2> = StartDate NewRec<2> = StartDate
NewRec<3> = EndDate NewRec<3> = EndDate
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$)
StartDate = Oconv(StartDate, 'D4-') StartDate = Oconv(StartDate, 'D4-')
EndDate = Oconv(EndDate, 'D4-') EndDate = Oconv(EndDate, 'D4-')
Shipment_Services('CheckFileAvailability', StartDate, EndDate) Shipment_Services('CheckFileAvailability', StartDate, EndDate)
end
Unlock hSysLists, ServiceKeyID else null
end end
end service end service
@ -320,3 +325,4 @@ CompanyExceptionCheck:
return return