Added lock protection for COC service.
This commit is contained in:
parent
8dce7988c6
commit
7782918afd
@ -27,6 +27,7 @@ $Insert COC_EQUATES
|
||||
$Insert COMPANY_EQUATES
|
||||
|
||||
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 Shipment_Services, OBJ_Notes
|
||||
|
||||
@ -61,47 +62,51 @@ Options MonaResources = 'FILE_GENERATION', 'FILE_TRANSMISSION', 'FILE_AVAILABILI
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
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
|
||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||
Lock hSysLists, ServiceKeyID then
|
||||
CycleRec = Xlate('APP_INFO', 'COC_AVAILABILITY', '', 'X')
|
||||
TodayDate = Date()
|
||||
EarliestDate = Shipment_Services('GetEarliestDate')
|
||||
|
||||
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)
|
||||
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
|
||||
Unlock hSysLists, ServiceKeyID else null
|
||||
end
|
||||
|
||||
end service
|
||||
@ -320,3 +325,4 @@ CompanyExceptionCheck:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user