Serial Numbers
Tracking individual items via serial numbers.
Serial Numbers
For granular inventory tracking, Obelaw WMS uses the ProductSerial model. Every unit of stock effectively has a serial record, allowing for precise lifecycle management.
Relationship
- A
Stockrecord represents an aggregate link between a Product and a Location. - A
Stockhas manyProductSerialrecords.
Serial Status
The Obelaw\Wms\Enums\SerialStatus enum defines the state of a specific item:
AVAILABLE(1): Item is on the shelf and ready.IN_TRANSIT(2): Item is moving between locations.SOLD(3): Item has been allocated/sold.
Assigning Serials
You can assign specific serial numbers during stock creation:
use Obelaw\Wms\Facades\WMS;
WMS::stocks()->create(
stockable: $laptop,
locationId: $warehouseId,
quantity: 2,
serials: ['SN-X100', 'SN-X101']
);
Tracking
Each ProductSerial record tracks:
serial_number: The unique identifier.current_location_id: Where this specific unit is right now.status: The current status (Available/Sold).sold_item: Polymorphic relation to what consumed this item (e.g., an Order Line).
// Find specific unit
$serial = \Obelaw\Wms\Models\ProductSerial::where('serial_number', 'SN-X100')->first();
echo $serial->currentLocation->name;