public interface InventoryReservationStrategy
InventoryReservations for a FulfillmentGroup when
an order is checked out. There are a few different strategies provided out of the box that you can use directly or
extend from for your own purposes. These are:
MultipleReservationPerItemReservationStrategySingleLocationPerGroupReservationStrategySingleLocationPerGroupReservationStrategy
All of these out of the box strategies prioritize the the list of Inventory by minimum or maximum quantity using
the advanced-inventory.prioritize.higher.quantity or advanced-inventory.prioritize.lower.quantity system properties
To create your own strategy (like one that prioritizes inventory based on location), you will need to do 3 things:
InventoryReservationStrategyType to add your own custom typeadvanced-inventory.item.reservation.strategy system property to the value of your new
InventoryReservationStrategyType.getType()AdvancedInventoryServiceExtensionHandler#decrementInventory(java.util.Map, java.util.Map)},
AbstractInventoryReservationStrategy},
MultipleReservationPerItemReservationStrategy},
SingleLocationPerGroupReservationStrategy},
SingleLocationPerItemReservationStrategy}| Modifier and Type | Method and Description |
|---|---|
List<InventoryReservation> |
getReservations(org.broadleafcommerce.core.order.domain.FulfillmentGroup fg)
This attempts to resolve a fulfillment (inventory) location for a particular fulfillment group for the given Sku
and quantity.
|
org.broadleafcommerce.core.catalog.domain.Sku |
getSkuForItem(org.broadleafcommerce.core.order.domain.FulfillmentGroupItem item)
Convenience method to determine the SKU from the FulfillmentGroupItem
|
InventoryReservationStrategyType |
getType()
The type of this strategy, used for configuring the active strategy for selecting between.
|
List<Inventory> |
prioritizeInventory(List<Inventory> inventory)
Takes the given list of inventory and returns a new sorted list.
|
InventoryReservationStrategyType getType()
org.broadleafcommerce.core.catalog.domain.Sku getSkuForItem(org.broadleafcommerce.core.order.domain.FulfillmentGroupItem item)
item - List<InventoryReservation> getReservations(org.broadleafcommerce.core.order.domain.FulfillmentGroup fg)
This attempts to resolve a fulfillment (inventory) location for a particular fulfillment group for the given Sku
and quantity. This is used within the AdvancedInventoryWorkflowExtensionHandler to determine the corresponding
InventoryReservations to create when checking out an Order and decrementing Inventory.
Persisting the list of InventoryReservations that is returned should occur within the same transaction that
actually decrements the quantity available for an Inventory record within a FulfillmentLocation.
fg - the FulfillmentGroup being used to get reservations forInventoryReservations for the given fg. If no suitable reservations could be made,
this should return an empty listAdvancedInventoryServiceExtensionHandler#decrementInventory(java.util.Map, java.util.Map)},
AdvancedInventoryService#decrementInventoryFromLocations(java.util.Map, List)}List<Inventory> prioritizeInventory(List<Inventory> inventory)
Takes the given list of inventory and returns a new sorted list. Example use cases would be to sort this list by maximum inventory at a location or to exclude specific instances of inventory.
No modifications should be performed on the original list of inventory passed in.
The out-of-the-box implementations of InventoryReservationStrategy prioritize inventory according to the
advanced-inventory.prioritize.higher.quantity and advanced-inventory.prioritize.lower.quantity
system properties.
Copyright © 2020. All rights reserved.