Warehouse layout configuration
Laying out a warehouse is the largest single act of configuration in a Karyo deployment. It is
done entirely through data: fifteen entity types in the layout module, created and edited over
/api/v1/* with no build step and no code. What the resulting shape does - the putaway
finder's filter chain, the sort keys, the FIFO hiding - belongs to
putaway and location finding and is cited here
rather than re-derived. This document is about what an administrator creates, what the system
will refuse, and where the configuration surface stops.
The fifteen entities
All live in
services/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/domain/model/.
| Entity | What it is | Base class |
|---|---|---|
Area |
A physical part of the building that holds zones, with a start on the floor and optional sizes | FacilityConfigEntity |
Zone |
A named region in one Area, optionally chaining to an overflow zone | BaseEntity |
Aisle |
One walking line in a zone, with its order, positions per bay, faces and optional sizes | FacilityConfigEntity |
LocationClass |
A usage role - STORAGE, PICKING and so on | BaseEntity |
LocationCluster |
A named, self-nesting grouping of locations | BaseEntity |
StorageArea |
A named set of clusters, used to restrict putaway candidates | BaseEntity |
WorkingArea |
A named set of clusters, used to scope offered work items | BaseEntity |
LocationType |
Dimensions and three lifting capacities | BaseEntity |
TypeCapacityConstraint |
The (location type, unit load type) compatibility matrix | BaseEntity |
StorageStrategy |
Putaway policy - see strategies and policies | FacilityEntity |
StorageStrategyArea |
The strategy's ordered list of storage areas | BaseEntity |
StorageLocation |
A physical bin | FacilityEntity |
FixAssignment |
A product pinned to a location, with min/max/desired amounts | FacilityEntity |
ItemDataArea |
A per-product planned-occupancy threshold for a storage area | FacilityEntity |
LocationReservation |
A soft reserve held by an open putaway or replenishment transport order; carries its allocation percent, the pallet's weight and the pallet's unit load id | BaseEntity |
StorageArea and WorkingArea are the same shape and easy to confuse; the code says so and
distinguishes them. A storage area "restricts/hides putaway finder candidates"; a working area
"scopes which offered WORK ITEMS an operator sees" (WorkingArea). StorageArea
carries the further warning that it is a different concept from LocationClass entirely - a named set
of clusters versus a usage role - "do not conflate" (StorageArea). The terms are
near-synonyms, and both notes are worth keeping.
The physical Area is a fourth concept again: a part of the building, not a set of clusters and
not a usage role. Area, Zone and Aisle, with a location's bay, level and position or its floor
point, place every location on the floor, and FloorPlanService computes travel distances over
them (ADR 0060).
The aisle spacing, bay width, level height and rack depth default from the Facility's Floor plan settings, and
an Area, zone or aisle may override each one. Proximity putaway and proximity pick routes read these distances when the
Facility enables it and the strategy asks for them. Pick source and work dispatch do not yet. With proximity on, Areas also shows the computed zone-to-zone distances and lets a layout
administrator correct a pair where the building differs. Corrections apply in both directions;
clearing returns to the current computed value
(console instructions).
What the floor view draws
The floor view draws the building from the layout, not from a model of its own (ADR 0065). Four things beyond the hierarchy are stored, and everything else is worked out:
- The building. One row for each Facility: length along the floor, depth across it and wall
height, in metres, with the plan inside it (0 to length along and 0 to depth across). A Facility
that stores none has a building worked out from its plan, the end of its longest zone and of its
last Area, or of a location placed by a floor point of its own, with 6 m of apron, rounded up to a whole metre, and a wall of 4.4 m. The plan says which
it is with
source(STOREDorDERIVED). Saving a building checks that it holds the whole plan and every stored dock door. A later layout write is not refused for moving or lengthening a zone, or moving a location's floor point, past the walls; the plan serves the stored building unchanged withholdsPlanfalse until the zone or floor point is moved back inside it or the building is saved again. A derived building grows to hold every stored door. - Dock doors. A door has a name, a direction (
INBOUNDorOUTBOUND), a wall (WEST,EAST,NORTHorSOUTH), a position along that wall, a width and an optional location it serves. While none is stored, the plan lists doors worked out from the arrangement's flow and its two door counts:THROUGHputs goods in on the west wall and goods out on the east wall,Uputs both on the west wall, goods in on the first half, andCORNERputs goods in on the west wall and goods out on the south wall.AUTOworks out none. The first stored door ends the estimate, so a person's doors and estimated ones never mix. A location that a door names cannot be deleted. A door is checked against the walls only when a building is stored; with none stored it is not bounded, and the derived building grows to hold it. A door must start on its wall: its position is at least half its width. - Rooms. A zone is a room when it is
enclosed: its walls stand on the zone's own extent. An enclosed zone may have a set point range in degrees Celsius, both ends or neither. A set point on an open zone, a half range or an inverted range is refused. - Room temperature. A sensor feed or a person reports a zone's temperature with
PUT /api/v1/zones/{id}/temperature. Karyo keeps the latest reading and its time. The floor view shows it against the set point only while it is under 30 minutes old, and shows the set point alone otherwise. - Rack depth and cross-aisle width. The rack depth is one more size, overridable like the other three. The cross-aisle width is one Facility setting.
- The walking aisle. An aisle's walking aisle is its aisle spacing less one rack depth for each face
(two when double-sided). No write is refused for it. The floor plan serves each aisle's
walkingAisleMetres, clamped at zero when the sum is negative.
Cross-aisles, pack stations and dispatch lanes have no rows of their own. Each zone has the front and back cross-aisle of ADR 0060, pack stations are pack staging locations and dispatch lanes are ship staging locations, drawn at their floor points with their location type's size.
Layout configuration belongs to a Facility
Two Facilities are two separate stock and capacity spaces. If they describe the same physical racking, Karyo does not know the shared physical capacity: assign each Facility its own bins, or manage the shared limit outside Karyo.
The layout is the Facility's building. Zones, Location Classes, clusters, location types, storage areas and working
areas describe its racking and extend FacilityConfigEntity
(libs/karyo-common/src/main/kotlin/com/karyo/common/domain/BaseEntity.kt): they carry a facility_id
and no business_unit_id, so each Facility has its own set and the same name can exist in two Facilities. The
capacity matrix hangs off a location type and so belongs to that type's Facility. Strategies, fix
assignments, planned occupancy and the locations themselves are FacilityEntity rows: they carry the
Facility alone and have no business_unit_id; their Business Unit is the one that owns the Facility. The zone and storage areas a strategy names, and the storage area of a planned-occupancy
row, must belong to the owning Business Unit's Facility; another Facility's id is refused.
A StorageLocation belongs to one Facility and has no business_unit_id; the Business Unit that owns
that Facility is its owner
(ADR 0050).
There are no shared locations. The inert onlyClientLocation flag has been removed from storage,
the API and the form. Every candidate belongs to the named Facility.
StorageLocation.name is unique within its Facility, as are its scan code (when set), the clearing
location and the names of zones, Location Classes, location types, clusters, storage areas and working areas
(services/karyo-app/src/main/resources/db/migration/layout/V321__facility_scope.sql). Two
Facilities, including two of one Business Unit, can both hold a bin called A-01-01.
The Facility is the warehouse
Karyo has no Warehouse entity and no warehouses table; the place a warehouse operates is the
Facility. Every layout row belongs to one Facility, and every request that touches the layout works in
one (TenantContext.operationalFacilityId). A Business Unit has exactly one Facility until
multi-Facility operation is built, so the unit a request names is enough to name it. Karyo is
silo-tenanted - one instance per company
(ADR 0014) - and the admin
navigation states the corollary in its own comment, distinguishing a future SaaS "Tenants"
concept from a Business Unit (frontend/web/src/config/admin-navigation.ts, adminNavItems, visibleAdminNavItems).
The retired provider location hint is covered in users, roles and permissions.
What the system refuses
The layout services carry real referential guards, and they are the most consistent thing in this part of configuration - up to a point.
Seven entities refuse deletion while dependents exist, answering 409 has-dependents
(exception/LayoutException.kt, LayoutException, mapped at exception/LayoutExceptionMapper.kt, LayoutExceptionMapper):
Areawhile any zone or zone-less location references it (service/AreaService.kt,AreaService.delete)Zonewhile any location or aisle references it (service/ZoneService.kt,ZoneService.delete)Aislewhile any location references it (service/AisleService.kt,AisleService.delete)LocationTypewhile any location references it (service/LocationTypeService.kt,LocationTypeService.delete)LocationClasswhile any location references it (service/LocationClassService.kt,LocationClassService.delete)StorageAreawhile any strategy area or item-data area references it (service/StorageAreaService.kt,StorageAreaService.assertNoDependents)StorageLocation- the one that physically holds inventory - while a unit load, a fix assignment, a putaway reservation or an open transport order names it (service/LocationService.kt,LocationService.requireNoDependents)
The location guard asks four owners, in this order. Unit loads are inventory's rows, with no foreign key
on unit_loads.storage_location_id
(db/migration/inventory/V102__create_unit_loads.sql, unit_loads), so the layout module asks through
UnitLoadLookup.existsAtLocation. Any unit load at the location counts, whatever its state: a terminal one
blocks the delete until the stock purge removes it. Fix assignments and reservations are layout's own
tables, read directly (FixAssignmentRepository.existsAtLocation,
LocationReservationRepository.existsAtLocation). A reservation row counts whether or not it has
expired, because the sweeper renews the rows of an open order and reaps the rest. A manual move
holds no reservation, so the tasks module answers
TransportDemandLookup.hasOpenOrderAtLocation: an open order that starts at, targets or suggests the
location blocks the delete. The refusal names the
first kind of dependent it finds, for example "Location 12 has associated unit loads and cannot be
deleted". Clear that dependent - move the stock, remove the fix assignment, finish or cancel the transport
task - and delete again.
The route declares the layout.write action
(api/v1/LocationResource.kt, LocationResource.deleteLocation), which the standard manager and administrator profiles hold.
The console has no delete control for a location, so this guard is met only through the API.
The unit load type has the same guard. UnitLoadTypeService.delete refuses with 409 has-dependents
while a unit load, a TypeCapacityConstraint row (unitLoadTypeId, in the layout module) or a
product's ItemData.defaultUnitLoadTypeId names the type
(services/inventory-service/karyo-inventory-core/src/main/kotlin/com/karyo/inventory/service/UnitLoadTypeService.kt, UnitLoadTypeService.delete).
Neither of the last two has a foreign key, so inventory asks layout and product through lookups in
their -api modules. The guards are as good as the no-cross-module-foreign-key convention allows
(ADR 0007): an ASN advice's
unitLoadTypeId is not counted by the delete guard.
What cannot be deleted at all
LocationCluster and StorageStrategy have no delete method and no @DELETE route
(service/LocationClusterService.kt, service/StorageStrategyService.kt,
api/v1/StorageStrategyResource.kt, StorageStrategyResource). Neither does OrderStrategy
(services/order-service/karyo-orders-core/src/main/kotlin/com/karyo/orders/api/v1/OrderStrategyResource.kt, OrderStrategyResource).
Strategy and cluster lists only ever grow; a mistake made during commissioning is permanent and
must be worked around by renaming or by leaving the row unreferenced. See
strategies and policies for the
code that defends against a deletion the API cannot perform.
What an update will not check
LocationService.updateLocation accepts a new locationTypeId and a new locationClassId and applies
both without asking whether the location currently holds anything
(service/LocationService.kt, LocationService.updateLocation). Changing the location type changes the dimensions,
lifting capacity and the capacity-matrix rows that govern what may sit there; changing the Location Class
changes its usage role. Both can be done under a loaded pallet. There is no evidence either way
about whether this was considered - the method has extensive comments about the clearing-location
unique index and none about occupancy - so whether it is deliberate is not recorded.
The one thing updateLocation does guard carefully is isClearing. A partial unique index
allows at most one clearing location per Facility, and because that index fires at flush rather
than at the statement, the method forces the flush inside its own try-catch so the violation
becomes a clean 409 instead of a raw 500 (service/LocationService.kt, LocationService.updateLocation). The comment
also records the two alternatives it rejected: the clearing location is "NOT the free-text
kind taxonomy, NOT a magic id" (StorageLocation.isClearing).
Fields an administrator can set that steer nothing
Four columns on StorageLocation are honest about being descriptive: capacity,
temperatureZone, handlingClass and kind are labelled "honest, seeder-derived metadata"
and left nullable so an unset row renders as a gap rather than a fabricated value
(StorageLocation). plcCode is likewise declared "Search/display only, zero finder
semantics. An EquipmentAdapter address bridge is not implemented"
(StorageLocation.plcCode). Those are fine: the code says what they are.
allocationState is the opposite kind of field - it does steer behaviour, excluding a location
from the putaway finder when non-zero, and the comment notes that "no business writer flips it
automatically" (StorageLocation.allocationState). It is an operator's manual "mark full" and works
as described.
The layout module's genuinely inert configuration lives one module away, on the product: see
ItemData.zoneId in reference data.
Capacity
TypeCapacityConstraint is the (location type, unit load type) matrix. A location type with
no rows accepts every unit load type, one per location, since each is charged 100; once it has
a row, putaway's type filter only offers it to the unit load types that have one. The allocation percentage records how much of a
location one unit load occupies, and live allocation honours it: every stored or reserved
unit load is charged its row's percent (100 when no row matches), so 50 means two totes fit
in one bin and the finder's "at or above 100 is full" filter admits exactly as many loads as
fit. The KDoc still states plainly that the oversize case above 100 is "NOT enforced by
placement logic here" (TypeCapacityConstraint): such a unit load only ever goes
into a completely empty location. TypeCapacityConstraintService refuses a unitLoadTypeId
that names no unit load type with 422 invalid-reference, on create and on an update that changes the id,
asking inventory through ProductUnitLoadTypeLookup. The matrix is edited in the console at Admin > Capacity
(/admin/type-capacity-constraints), next to the Unit load types admin page.
LocationService.checkCapacity carries the most valuable comment in the module. It documents
that weight is computed on demand from the same read the group-capacity check uses, so the two
agree; that the check is deliberately unscoped by tenant because "a pallet presses on the rack
whoever owns the goods", closing with "Do not 'fix' this into a scoped read"; and that an
unweighed unit load contributes zero, degrading honestly rather than refusing on invisible
occupancy.
The built-in putaway finder, checkCapacity and the field/section group check share one
definition of committed weight (CommittedWeightReader): the gross weight resting at the
location plus the weight of the open reservations for it, meaning pallets that putaway has
sent there and that have not landed yet. Each LocationReservation stores the unit load's
gross weight when it is written, next to its allocation percent and the unit load's id. A
reservation whose own unit load already rests at the reserved location counts nothing, because
that pallet is counted once, as resting weight
(soft reservations). Putaway and checkCapacity
both require committed weight plus incoming gross weight to be less than or equal to the
location type's liftingCapacity. So a bin with a 1000 kg cap that holds 600 kg takes two 200
kg pallets of one goods receipt, because 600 + 200 + 200 = 1000, and the third goes elsewhere.
The group check adds the same reserved weight to the weight across a field or section.
Only null means unlimited. An explicit 0 is a real zero-weight limit: it refuses any
positive total weight, but allows a zero-weight load when current weight is also zero. This
keeps the existing LocationService.checkCapacity rule and removes the finder's former
zero-as-unlimited exception. To block all automatic placement regardless of weight, use
allocationState, not a zero weight limit.
A reservation counts only while it is open. A putaway that completes or is cancelled releases
its reservation, and the pallet then counts as resting weight if it landed. A reservation
whose transport order is still open is renewed every time its 10-minute TTL nears its end, so
a task left unstarted, claimed or paused keeps its claim on the bin's weight, and on the
allocation percent, for as long as the task is open. A reservation that nothing releases and
whose order is closed or gone stops counting when its TTL passes and is then deleted. A
reservation written before the weight column existed has weight zero. It still counts its
allocation percent and is renewed while its order stays open, so it counts no weight until its
task completes or is cancelled. A reservation written before the unit_load_id column existed
has unit load id zero, which no unit load has, so it always counts as before.
Unweighed unit loads contribute zero, and so do their reservations. The finder gives advice
against the stock and reservations present at search time; this is not an atomic guarantee
against later stock changes or concurrent putaways. Two searches that run at the same instant
can still read the same figures. checkCapacity takes the transport order of the pallet it
checks and leaves that order's own reservation out, and it remains an in-process method
without a production caller or REST route.
Warehouse setup creates this configuration in bulk
An administrator does not have to create the entities above one at a time. Warehouse setup
(Set up a warehouse,
ADR 0036) reads typed label ranges
or a pasted list and writes ordinary Zone, Aisle, LocationClass, LocationType and StorageLocation rows: no
setup-only location table exists. It follows these rules, all in
services/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/service/
(WarehouseSetupCatalog.kt and WarehouseSetupService.kt):
- Fixed names. A use maps to one Location Class -
Storage(storage),Picking(picking),Receiving(goods in),Packing(pack staging),Shipping(goods out and ship staging) - and a storage kind maps to one location type:Pallet position,Shelf bin,Floor positionorStaging lane, with the dimensions and lifting capacities in the user guide. - Reuse, never overwrite. A zone or location type with the exact name is reused as it is. A Location Class
is reused only when its usages are exactly the ones the use needs; otherwise the plan is refused
with a 409 rather than changing a Location Class that shared behaviour already relies on. Location Class names are
unique within the Facility, so this is a real constraint on a Facility that already has a
StorageLocation Class with other usages. - One Facility per plan. The request names its Facility as
targetFacilityId, which is required and has no default, and every new location is built in that Facility. A label already in the Facility is left unchanged. A label another Facility holds is that Facility's own and is no conflict. A zero, unknown or archived Facility, or one whose Business Unit is inactive, is refused.StorageLocation.capacitystays unset. - Two records of its own.
warehouse_arrangementsholds one row for each Facility, its flow of goods and its inbound and outbound dock-door counts (0 to 200 each). It has afacility_idand nobusiness_unit_id, like the zones and Location Classes it arranges, and only the Home drawing and its 3D view read it; a Facility that has saved none reads the automatic flow with no doors.warehouse_setup_runsholds one row per successful create: the Facility, the idempotency key, a hash of the plan, the target goods owner and the counts, never the plan or the pasted text, and a key is unique within its Facility. Both are created bylayout/V320__warehouse_setup_and_arrangement.sqland moved to the Facility bylayout/V321__facility_scope.sql, both underservices/karyo-app/src/main/resources/db/migration/. - A place on the floor. A new zone goes into the Facility's first
Area, created asMainwhen the Facility has none, after the zones already there. Each(zone, rack)is oneAisle, found or created after the zone's last aisle; a stored aisle only widens its positions per bay and faces. A location in an aisle gets its bay, level and position from its own label, so its place does not depend on how the setup was split into ranges or runs (ADR 0060). A listed single place gets no aisle. Setup writes no sizes. - Creates serialize per Facility. A create locks its Facility's arrangement row (creating it if the Facility has none), so two setups in one Facility cannot race to create the same zone, Location Class or label, while setups in other Facilities run alongside. A location created by hand at the same moment can still collide; the existing name uniqueness is the last guard, and setup reports it as a refusal with nothing created.
Related
- Putaway and location finding - what the finder does with this layout
- Strategies and policies - storage strategies and their flags
- Reference data - unit load types and product fields the layout depends on
- Data and persistence - why cross-module references carry no foreign key