Class BTImmediateSchedulingTeamExclusionByDistance
java.lang.Object
overit.geocall.bl.BusinessTask<ImmediateSchedulingTeamExclusionEvent>
overit.geocallapp.wfm.orchestrator.scheduling.bl.immediatescheduling.teamexclusion.task.BTImmediateSchedulingTeamExclusion
overit.geocallapp.wfm.orchestrator.scheduling.bl.immediatescheduling.teamexclusion.task.BTImmediateSchedulingTeamExclusionByDistance
- All Implemented Interfaces:
Serializable,Tool
@Event(value=ImmediateSchedulingTeamExclusionEvent.class,
priority=20)
public class BTImmediateSchedulingTeamExclusionByDistance
extends BTImmediateSchedulingTeamExclusion
Business Task for filtering teams based on straight-line distance between resource starting point and work order location.
Excludes teams whose foreman's starting point (at calendar or resource level) is too far from the work order location. The maximum distance is configured via parameter X.
Work order location is determined with the following priority:
- Scheduling address (AWOOSCHEDULEID_AADD) if exists
- Operation address (AWOOID_AADD)
- Work order header address (AWORID_AADD)
Note: This logic is not applied if the Re-optimization subtask is also being executed in the same run.
- Since:
- 22.0
- See Also:
- GCApi:
- task
-
Field Summary
Fields inherited from class overit.geocallapp.wfm.orchestrator.scheduling.bl.immediatescheduling.teamexclusion.task.BTImmediateSchedulingTeamExclusion
integrationService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecalculateStraightLineDistance(double[] point1, double[] point2) Calculate straight line distance between two coordinates using Haversine formula.protected voidfilter(ImmediateSchedulingTeamExclusionOutput output, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) Applies the specific exclusion filter logic.filterTeamsByDistance(ImmediateSchedulingTeamExclusionOutput output, Map<Long, BOAddress> teamStartingPoints, Map<Long, BOAddress> addressesByOperationId, Long maxDistance, boolean isReprocessing) Filter teams by distance.getAddressCoordinates(Map<Long, Long> operationAddresses, PoolKit poolKit) Load addresses in batch and build map: operationId -> BOAddress.protected LonggetResourceStartingPoints(List<Long> aliveTeams, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) Get resource starting points for all resources in alive teams.getStartingAddressesFromTeams(List<Long> teamsWithoutAddress, PoolKit poolKit) Get starting addresses from team master data (AWTEID_AADD).getStartingAddressesFromTeamShifts(List<Long> aliveTeams, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) Get starting addresses from team shifts (calendar level).Methods inherited from class overit.geocallapp.wfm.orchestrator.scheduling.bl.immediatescheduling.teamexclusion.task.BTImmediateSchedulingTeamExclusion
body, createInitialTeamCompatibilityMatrix, getIntegrationService, getOutput, recordResourceExclusions, removeTeamsWithoutWorkOrdersMethods inherited from class overit.geocall.bl.BusinessTask
start, start, startAlone, startInBackground
-
Constructor Details
-
BTImmediateSchedulingTeamExclusionByDistance
public BTImmediateSchedulingTeamExclusionByDistance()
-
-
Method Details
-
filter
protected void filter(ImmediateSchedulingTeamExclusionOutput output, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) throws DAValidateException, DAException Description copied from class:BTImmediateSchedulingTeamExclusionApplies the specific exclusion filter logic. Implementations should: 1. Remove teams from output.getForemanByAliveTeam() that should be excluded 2. Remove incompatible work orders from output.getTeamWorkOrderCompatibility() 3. Log the excluded resources with appropriate messages Note: Teams are automatically removed byBTImmediateSchedulingTeamExclusion.removeTeamsWithoutWorkOrders(overit.geocallapp.wfm.scheduling.bl.immediatescheduling.teamexclusion.event.ImmediateSchedulingTeamExclusionOutput)if they have no compatible work orders.- Specified by:
filterin classBTImmediateSchedulingTeamExclusion- Parameters:
output- the current output from previous filters (modify foremanByAliveTeam and teamWorkOrderCompatibility)input- the event input containing scheduling model and reference datepoolKit- the pool kit- Throws:
DAValidateException- if a validation error occursDAException- if a data access error occurs
-
getAddressCoordinates
protected Map<Long,BOAddress> getAddressCoordinates(Map<Long, Long> operationAddresses, PoolKit poolKit) throws DAValidateException, DAExceptionLoad addresses in batch and build map: operationId -> BOAddress.- Throws:
DAValidateExceptionDAException
-
getResourceStartingPoints
protected Map<Long,BOAddress> getResourceStartingPoints(List<Long> aliveTeams, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) throws DAValidateException, DAException Get resource starting points for all resources in alive teams. Priority: 1) Team shift start address (ATSHIDDAYSTART_AADD), 2) Team address (AWTEID_AADD) Returns map: teamId -> BOAddress- Throws:
DAValidateExceptionDAException
-
getStartingAddressesFromTeamShifts
protected Map<Long,Long> getStartingAddressesFromTeamShifts(List<Long> aliveTeams, ImmediateSchedulingTeamExclusionInput input, PoolKit poolKit) throws DAValidateException, DAException Get starting addresses from team shifts (calendar level). Returns map: teamId -> addressId- Throws:
DAValidateExceptionDAException
-
getStartingAddressesFromTeams
protected Map<Long,Long> getStartingAddressesFromTeams(List<Long> teamsWithoutAddress, PoolKit poolKit) throws DAValidateException, DAException Get starting addresses from team master data (AWTEID_AADD). Returns map: teamId -> addressId- Throws:
DAValidateExceptionDAException
-
filterTeamsByDistance
protected List<Long> filterTeamsByDistance(ImmediateSchedulingTeamExclusionOutput output, Map<Long, BOAddress> teamStartingPoints, Map<Long, BOAddress> addressesByOperationId, Long maxDistance, boolean isReprocessing) Filter teams by distance. Removes work orders that are too far from each team's starting point. Returns list of excluded teams.- Parameters:
output- the output containing team compatibility matrixteamStartingPoints- map of team starting addressesaddressesByOperationId- map of work order addressesmaxDistance- maximum allowed distance in metersisReprocessing- if true, excluded teams are NOT removed from recalibration maps- Returns:
- list of excluded team IDs
-
calculateStraightLineDistance
protected double calculateStraightLineDistance(double[] point1, double[] point2) Calculate straight line distance between two coordinates using Haversine formula. Same implementation as XFUSDISTANCE database function.- Parameters:
point1- First point as [longitude, latitude]point2- Second point as [longitude, latitude]- Returns:
- distance in meters
-
getMaxDistance
-