Skip to main content

Bin locations

Controller. bin-location.controller.ts. Base path /v1/operations/bin-location.

CallUse
POST /Create one bin
POST /bulkCreate many
GET /layout-summary/:warehouseIdLayout summary
PUT /:id and DELETE /:idUpdate and delete

The controller tag in source is public.bin-location. That name is not @PublicRoute. The file has no @RequirePermissions and no @TenantScoped. The access JWT still applies. A missing permission decorator allows any authenticated user, subject to the warehouse guard.

Where a bin is checked​

FlowRule
Return restockrestoredToBinId must be in the return warehouse and tenant, and status must not be BLOCKED
PickA stocked line requires pickedFromBinId. On-hand in that bin must cover the new pick. See Pick and pack
RoutingBins are not chosen by WarehouseRouterService. That service chooses a warehouse

deriveBinStatus is a display helper, not a stored transition map. BLOCKED and UNAVAILABLE stay BLOCKED. Otherwise capacity reached is FULL, then RESERVED when reserved units are greater than 0, then LOW_STOCK, then OCCUPIED, otherwise EMPTY.

Delete​

delete loads the bin with its stocks. A missing bin is binLocation.error.binNotFound. Any related stock row throws binLocation.error.binIsNotEmpty. An empty bin is removed with Prisma delete, not deletedAt.

Bin codes are built at creation from aisle, rack, shelf, and bin, uppercased and joined with hyphens. Zone defaults to MAIN. Location type defaults to PICK when the value is not a BinLocationType.