Serialized inventory gives you the ability to track available inventory abstractly & concretely at the same time.
For example, you could abstractly track your inventory of 100 cell phones with a SKU of CELL_PHONE_V11
, while also tracking the same inventory down to the serial number of the phone. When selling these phones, you can abstractly sell one of the 100 available phones, & then later allocate which of the 100 actual phones that you’re going to fulfill. Alternatively, you can directly sell a specific phone identified by the serial number.
Just like standard inventory, serialized inventory is tracked using SkuInventory
records (i.e. the BLC_SKU_INVENTORY
table), but it leverages the following additional fields:
serialized
hasChildren
parentSkuInventoryId
serializationValue
When using serialized inventory, a parent-child relationship is created between the abstract/generic representation of the inventory & the serialized records.
Generic Inventory Record (Parent)
Id | Quantity Available | Quantity Reserved | SKU | Serialized | Serialization Value | Has Children | Parent Sku Inventory ID |
---|---|---|---|---|---|---|---|
1 |
1 |
1 |
|
FALSE |
TRUE |
Serialized Inventory Records (Children)
Id | Quantity Available | Quantity Reserved | SKU | Serialized | Serialization Value | Has Children | Parent Sku Inventory ID |
---|---|---|---|---|---|---|---|
2 |
1 |
0 |
|
TRUE |
|
FALSE |
1 |
3 |
0 |
1 |
|
TRUE |
|
FALSE |
1 |
When checking for inventory availability, we must check both the generic & specific availability. Since sales may have been executed against the generic inventory, but the specific serialized inventory is not yet allocated, the sum of quantity available amongst the child records may not match the quantity available for the parent (generic inventory) record.
When checking availability for serialized inventory, the overall request is the exact same, except that you’ll need to pass the serialization value along with the sku reference in the following way: CELL_PHONE_V11?serializationValue=1234567890
.
Note
|
Even if serialized inventory is being used, available inventory can still be checked at the abstract/generic level by not including ?serializationValue=1234567890 .
|
When making inventory reservations (soft or hard) for serialized inventory, we create InventoryTransaction
(i.e. the BLC_INVENTORY_TX
table) records referencing both the generic & specific/serialized SkuInventory
records.
Example InventoryTransaction record for a generic inventory reservation:
Id | Sku Inventory Id | Transaction Type | Quantity | Reference Number |
---|---|---|---|---|
1 |
1 |
|
1 |
|
Example InventoryTransaction records for a specific/serialized inventory reservation:
Id | Sku Inventory Id | Transaction Type | Quantity | Reference Number |
---|---|---|---|---|
1 |
1 |
|
1 |
|
2 |
2 |
|
1 |
|
Note
|
For a specific/serialized inventory reservation, we expect both InventoryTransaction records to have the same reference number since the two records are related. |
When reserving serialized inventory, the overall request is the exact same, except that you’ll need to pass the serialization value along with the sku reference in the following way: CELL_PHONE_V11?serializationValue=1234567890
.
Note
|
Even if serialized inventory is being used, reservations can still be requested at the abstract/generic level by not including ?serializationValue=1234567890 .
|
When a soft reservation is made for serialized inventory, two InventoryTransaction records are created, as described above, with the same expiration timestamp. Once expired, both reservations are removed & quantity is restored to both the parent & child SkuInventory records.
Out of the box, an index is created with the combination of the following columns to facilitate serialized inventory queries in an performant way:
skuCode
serialized
serializationValue
If you use a different SKU reference other than the SKU code to manage SKU inventories, e.g. external id or UPC, then a new index should be created with the SKU reference column to make sure performance is not impacted, and the out-of-box index can be removed.