ADR 0061: Proximity putaway is a storage strategy sort key, enabled by a Facility setting
Status: Accepted
Context
ADR 0060 gave Karyo the walk in metres
between two placed locations, and left proximity putaway, proximity picking and interleaving to
use it later. Before this change the putaway finder knew only grid steps: nearPickingLocation
ranked by the pick face's rack and then the X steps from it, and no sort key was a distance. Two
bins back to back in neighbouring aisles are one grid step apart and a long walk apart.
The finder orders candidates by a typed list of sort keys on the storage strategy, and an empty
list with nearPickingLocation off keeps the default order: emptiest first, then name. A putaway
for a product that names no strategy had no strategy at all.
The owner chose the shape before 2.0.0. Proximity putaway is a sort key that a strategy lists where it wants it, because it fits the ordered-keys model, keeps "no keys means today's order", and lets an operator see why a bin won. It ranks by walk metres with lift only as the tie-break. The owner chose that proximity is one setting of the Facility, and that each function interacts with it independently. A putaway strategy that is configured for proximity uses it when the Facility has it enabled; the pick route, pick source and interleaving will each opt in the same way in later changes.
Decision
A sort key. TRAVEL_DISTANCE (code 9) ranks candidates by the walk from the request's
originLocationId, nearest first, with the lift as the tie-break. Auto-putaway passes the unit
load's location as the origin. A strategy lists the key anywhere in sorts: the keys before it
win over the walk, and the keys after it break walk ties. nearPickingLocation ranks by the walk
from the pick face in the same way.
The Facility setting. karyo.proximity.enabled is a Boolean runtime setting of the Facility,
default false, in the settings catalogue. It is read through RuntimePropertyLookup for the Facility
of the search (FloorPlanService.proximityEnabled). Putaway ranks by distance only when the setting
is on and the strategy asks for it by listing TRAVEL_DISTANCE; nearPickingLocation measures walk
metres only when the setting is on. When the setting is off, both rank exactly as they did before this
change, for every candidate: TRAVEL_DISTANCE ranks nothing and nearPickingLocation keeps its grid
order.
Who is measured. When the setting is on, every candidate that has a place on the floor is measured,
in whatever Area it stands. Measured candidates come first. The others follow in the order the rest of
the strategy gives them. When TRAVEL_DISTANCE is the only key and nearPickingLocation is off,
nothing else is appended, so the unmeasured candidates keep the default order. An unmeasured
nearPickingLocation candidate keeps the old grid order.
Nearest first across the Facility. When a walk leads the ranking, the finder reads the place of every SQL candidate in one light query, measures each walk and reads its pages nearest first. Otherwise the pages come in the query's order, as before. The floor is read once for each search.
A default strategy for every Facility. Every Facility has one default storage strategy, marked
facility_default. Its only sort key is TRAVEL_DISTANCE and its other fields have their defaults.
It is the third rung of strategy resolution, after the request's strategy and the product's. Layout
V1608 seeds it for each active Facility; Warehouse setup and the first putaway search create it for a
later Facility. It has no effect until the Facility turns the setting on.
Consequences
An existing Facility ranks as before until an administrator sets karyo.proximity.enabled. Once it is
set, a Facility that never configured a strategy ranks free bins by the walk wherever its locations
have a place. Where nothing can be measured, it gets the suggestion it got before, because the
default's only key leaves unmeasured candidates in the default order. A product that names a strategy
without TRAVEL_DISTANCE is ranked as before, but turning the setting on also makes the product's
Facility zone the putaway zone, ahead of the strategy's zone, for every product that has one. An
administrator can clear a product's zone by emptying the Zone field of the product form or by sending
zoneId as null in the product update; a zone that no longer exists in the Facility is ignored.
A walk-led search costs more. On a Facility of 5,000 placed bins the median search took 82 ms with the walk and 43 ms without it (putaway and location finding).
Zone distance corrections. With proximity enabled, the console's Areas page shows every pair
of the Facility's zones, including pairs in different Areas. It shows the computed zone-door walk,
an optional correction in metres, and the effective value. An administrator with layout.write
can set or clear a correction; layout.read can read the table. Corrections are symmetric: the
model has one shared entry and exit per zone and no one-way paths, so direction would add a
meaning the layout cannot represent. One canonical pair belongs to one Facility, and both zones
must belong to it. A zone cannot pair with itself. Values allow zero and up to seven integer and
two decimal places, matching the layout's metre precision.
Setting or clearing a correction needs proximity enabled for the Facility: with
karyo.proximity.enabled off, PUT and DELETE on /api/v1/floor-plan/zone-distances/{a}/{b}
answer 409 proximity-disabled. Reading the table stays open to layout.read whatever the
setting says. Corrections already stored are physical layout facts: they stay when proximity is
turned off, and every distance consumer still applies them. Only the writes and the console table
depend on the setting.
FloorPlanService reads these sparse corrections into the immutable floor plan. Every cross-zone
walk replaces only the direct leg between those zone doors, not the walks inside the zones.
Same-zone and same-aisle travel stay unchanged. This is not a shortest-path graph: a correction
does not create a route through a third zone. The distance API, putaway and flow snapshots all
read the same effective distances. A snapshot already running retains its original values.
Putaway still ignores distance ranking while proximity is off: the distance service reports the
physical walk and each consumer owns its opt-in. Layout changes recompute the base value but never rewrite a
correction. Clearing returns to the current computed value. Layout V1610 stores the pair with
Facility-scoped zone keys and deletes its correction when either zone is deleted.
The pick route is added in ADR 0062,
with its own order-strategy option and this same Facility gate, and interleaving in
ADR 0063 with the dispatch strategy setting and this gate. Pick source independently opts in
through pickSourceOrder = SAME_DAY_NEAREST, default FIFO, under that same Facility gate.
Within each selection pass, older rotation days precede newer days, a day being the Facility's local
calendar day; distance ranks only within one day, from the depot and the order's earlier source locations. Matching preference and complete
handling retain their precedence. The rotation date remains strategyDate, including best-before
when present, so the change does not weaken day-level rotation. Equal and unmeasured walks retain
FIFO order. Orders V1615 opts all existing strategies out.
Stock selection owns the full rule. Pack is not part of this change.
The zone order is the request's preferredZoneId, then the product's Facility zone, then the
strategy's zone. The product's zone rung applies only while the Facility setting is on; with it off the
zone is the request's, then the strategy's, as before, so no existing Facility changes.
A receipt line has no zone of its own, so the first rung of the zone order, the request's
preferredZoneId, is not set by auto-putaway.
The grid fields stay authoritative for the POSITION_X and POSITION_Y keys and for the
unmeasured nearPickingLocation candidates.
Alternatives considered
- Distance first for every strategy. It needs no strategy change, but it overrides the order an administrator wrote, and "no keys means today's order" would no longer hold.
- A weighted score of distance, fill and lift. It could balance the three, but an operator could not see why a bin won, and nothing records the weights a site would use.
- On for every Facility on upgrade. It reorders putaway for sites that never asked for it. The owner chose a Facility setting that an administrator turns on.
- A new settings table. The settings catalogue already holds per-Facility Booleans.
- Ranking each page of the query's order. It reads less, but the nearest bin is missed when 200 emptier bins sort ahead of it.
- The
LocationDistanceLookup.distancesseam for each search. It reads the whole floor plan on each call as well, and the finder is in the layout module that owns the floor, so it reads the floor once and measures in process.
Evidence
services/warehouse-layout-service/karyo-layout-api/src/main/kotlin/com/karyo/layout/vo/StorageStrategySortType.ktservices/warehouse-layout-service/karyo-layout-api/src/main/kotlin/com/karyo/layout/spi/LocationFinder.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/CandidateOrdering.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/PutawayTravel.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/PutawayCandidatePages.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/LocationFinderService.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/StorageStrategyService.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/FloorPlanService.ktservices/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.ktservices/task-service/karyo-tasks-core/src/main/kotlin/com/karyo/tasks/service/PutawayLocationSearch.ktservices/karyo-app/src/main/resources/db/migration/layout/V1608__facility_default_storage_strategy.sqlservices/karyo-app/src/main/resources/db/migration/layout/V1610__zone_distance_corrections.sqlservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/ZoneDistanceService.ktservices/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/repository/ZoneDistanceRepository.ktservices/karyo-app/src/test/kotlin/com/karyo/layout/api/v1/PhysicalHierarchyResourceTest.ktfrontend/web/src/pages/areas/zone-distances.tsxservices/karyo-app/src/test/kotlin/com/karyo/layout/service/LocationFinderProximityTest.ktservices/karyo-app/src/test/kotlin/com/karyo/app/ProximityPutawayFlowTest.kt