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()
If CycleRec<1> EQ TodayDate then EarliestDate = Shipment_Services('GetEarliestDate')
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 If CycleRec<1> EQ TodayDate then
NewRec<2> = StartDate CurrStartDate = CycleRec<2>
NewRec<3> = EndDate CurrEndDate = CycleRec<3>
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) PotentialStartDate = CurrStartDate - 10
StartDate = Oconv(StartDate, 'D4-') PotentialEndDate = CurrEndDate - 10
EndDate = Oconv(EndDate, 'D4-') Begin Case
Shipment_Services('CheckFileAvailability', StartDate, EndDate) Case CurrStartDate EQ EarliestDate
end else StartDate = TodayDate - 10
StartDate = TodayDate - 10 EndDate = TodayDate
EndDate = TodayDate Case PotentialStartDate LT EarliestDate
NewRec = '' StartDate = EarliestDate
NewRec<1> = TodayDate EndDate = EarliestDate + 10
Case Otherwise$
NewRec<2> = StartDate StartDate = PotentialStartDate
NewRec<3> = EndDate EndDate = PotentialEndDate
Database_Services('WriteDataRow', 'APP_INFO', 'COC_AVAILABILITY', NewRec, True$, False$, False$) End Case
StartDate = Oconv(StartDate, 'D4-') NewRec = CycleRec
EndDate = Oconv(EndDate, 'D4-') NewRec<2> = StartDate
Shipment_Services('CheckFileAvailability', StartDate, EndDate) 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
Unlock hSysLists, ServiceKeyID else null
end end
end service end service
@ -320,3 +325,4 @@ CompanyExceptionCheck:
return return