public class DefaultStockService extends AbstractBusinessService implements StockService
StockService.| Modifier and Type | Class and Description |
|---|---|
protected class |
DefaultStockService.StockLevelTransactionBody
Deprecated.
use
StockLevelDao to deal with the concurrency. |
AbstractService.SerializableDTOmodelService, sessionService, txManagertenantBEAN_NAME| Constructor and Description |
|---|
DefaultStockService() |
| Modifier and Type | Method and Description |
|---|---|
protected StockLevelModel |
createStockLevel(ProductModel product,
WarehouseModel warehouse,
int available)
Creates a new stock level.
|
protected StockLevelModel |
createStockLevel(ProductModel product,
WarehouseModel warehouse,
int available,
int overSelling,
int reserved,
InStockStatus status,
int maxStockLevelHistoryCount,
boolean treatNegativeAsZero)
Creates a new stock level.
|
protected StockLevelHistoryEntryModel |
createStockLevelHistoryEntry(de.hybris.platform.stock.impl.DefaultStockService.StockLevelUpdateSnapshot snapshot,
StockLevelUpdateType updateType,
String comment)
Deprecated.
|
protected StockLevelHistoryEntryModel |
createStockLevelHistoryEntry(StockLevelModel stockLevel,
int actual,
int reserved,
StockLevelUpdateType updateType,
String comment)
Creates a new stock level history entry.
|
Collection<StockLevelModel> |
getAllStockLevels(ProductModel product)
Finds the stock levels of the specified product from all warehouses.
|
Map<WarehouseModel,Integer> |
getAvailability(List<WarehouseModel> warehouses,
ProductModel product,
Date date)
Gets the product quantity for the specified product, warehouses and date.
|
Map<WarehouseModel,Date> |
getAvailability(List<WarehouseModel> warehouses,
ProductModel product,
int quantity)
Returns product availability, passing product, and quantity as parameters
|
String |
getAvailability(ProductModel product,
List<WarehouseModel> warehouses,
Date date,
LanguageModel language)
Gets the available quantity of the product for the specified warehouses by invoking injected strategy.
|
String |
getAvailability(ProductModel product,
List<WarehouseModel> warehouses,
int quantity,
LanguageModel language)
Gets availability date by invoking strategy for calculating product availability, passing product, quantity and
warehouses as parameters by invoking injected strategy.
|
String |
getAvailability(ProductModel product,
WarehouseModel warehouse,
Date date,
LanguageModel language)
Gets the available quantity of the product for the specified warehouse.
|
String |
getAvailability(ProductModel product,
WarehouseModel warehouse,
int quantity,
LanguageModel language)
Gets availability date by invoking strategy for calculating product availability, passing product, quantity and
warehouse as parameters.
|
WarehouseModel |
getBestMatchOfAvailability(Map<WarehouseModel,Date> map)
Returns the warehouse which offers the "best" product "availability" by invoking injected strategy.
Configuration: |
WarehouseModel |
getBestMatchOfQuantity(Map<WarehouseModel,Integer> map)
Returns the warehouse which offers the "best" product "quantity" by invoking injected strategy.
Configuration: |
InStockStatus |
getInStockStatus(ProductModel product,
WarehouseModel warehouse)
Checks the stock level status of the product in the specified warehouses.
|
StockLevelStatus |
getProductStatus(ProductModel product,
Collection<WarehouseModel> warehouses)
Checks the stock level status of the product in all specified warehouses.
|
StockLevelStatus |
getProductStatus(ProductModel product,
WarehouseModel warehouse)
Checks the stock level status of the product in the specified warehouse.
|
StockLevelModel |
getStockLevel(ProductModel product,
WarehouseModel warehouse)
Finds the stock level of the specified product at the specified warehouse.
|
int |
getStockLevelAmount(ProductModel product,
WarehouseModel warehouse)
Finds the stock level of the specified product in the specified warehouse, and calculates the actual available
amount.
|
Collection<StockLevelModel> |
getStockLevels(ProductModel product,
Collection<WarehouseModel> warehouses)
Finds all stock levels of the specified product in the specified warehouses.
|
int |
getTotalStockLevelAmount(ProductModel product)
Finds the stock levels of the specified product from all warehouses, and calculates the total actual amount.
|
int |
getTotalStockLevelAmount(ProductModel product,
Collection<WarehouseModel> warehouses)
Finds all stock levels of the specified product in the specified warehouses, and calculates the total actual
amount.
|
void |
release(ProductModel product,
WarehouseModel warehouse,
int amount,
String comment)
Release the product in the specified warehouse.
|
void |
reserve(ProductModel product,
WarehouseModel warehouse,
int amount,
String comment)
Reserves the product in the specified warehouse.
|
void |
setInStockStatus(ProductModel product,
Collection<WarehouseModel> warehouses,
InStockStatus status)
Sets the in stock status of all stock levels of the product in the specified warehouses.
|
void |
setProductAvailabilityStrategy(ProductAvailabilityStrategy productAvailabilityStrategy)
The injected strategy will be used for calculating the availability of the specified product.
|
void |
setStockLevelDao(StockLevelDao stockLevelDao) |
void |
setStockLevelProductStrategy(StockLevelProductStrategy stockLevelProductStrategy) |
void |
setStockLevelStatusStrategy(StockLevelStatusStrategy stockLevelStatusStrategy) |
void |
updateActualStockLevel(ProductModel product,
WarehouseModel warehouse,
int actualAmount,
String comment)
Updates the actual stock level of the specified product in the specified warehouse.
|
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerafterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, setTenantScope, writeReplacepublic StockLevelStatus getProductStatus(ProductModel product, WarehouseModel warehouse)
StockServicegetProductStatus in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic StockLevelStatus getProductStatus(ProductModel product, Collection<WarehouseModel> warehouses)
StockServicegetProductStatus in interface StockServiceproduct - the productwarehouses - warehouses of the productprotected StockLevelModel createStockLevel(ProductModel product, WarehouseModel warehouse, int available)
StockLevelModel is saved.product - the productwarehouse - warehouse of the productavailable - amount of available productsStockLevelModelprotected StockLevelModel createStockLevel(ProductModel product, WarehouseModel warehouse, int available, int overSelling, int reserved, InStockStatus status, int maxStockLevelHistoryCount, boolean treatNegativeAsZero)
StockLevelModel is saved.product - the productwarehouse - warehouse of the productavailable - amount of available productsoverSelling - amount of over-selling productsreserved - amount of reserved productsstatus - tag of in stock, out of stock, or not specifiedmaxStockLevelHistoryCount - max count of StockLevelHistoryEntryModel, negative value for unlimitedtreatNegativeAsZero - true if negative stock level is treated as zeroStockLevelModel@Deprecated protected StockLevelHistoryEntryModel createStockLevelHistoryEntry(de.hybris.platform.stock.impl.DefaultStockService.StockLevelUpdateSnapshot snapshot, StockLevelUpdateType updateType, String comment)
protected StockLevelHistoryEntryModel createStockLevelHistoryEntry(StockLevelModel stockLevel, int actual, int reserved, StockLevelUpdateType updateType, String comment)
StockLevelHistoryEntryModel is saved.stockLevel - the stock level whose history entry should be createdactual - the actual amountreserved - the reserved amountupdateType - the update typecomment - the commentStockLevelHistoryEntryModelpublic int getStockLevelAmount(ProductModel product, WarehouseModel warehouse)
StockServicegetStockLevelAmount in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic int getTotalStockLevelAmount(ProductModel product)
StockServicegetTotalStockLevelAmount in interface StockServiceproduct - the productpublic int getTotalStockLevelAmount(ProductModel product, Collection<WarehouseModel> warehouses)
StockServicegetTotalStockLevelAmount in interface StockServiceproduct - the productwarehouses - the warehousespublic void setInStockStatus(ProductModel product, Collection<WarehouseModel> warehouses, InStockStatus status)
StockServicesetInStockStatus in interface StockServiceproduct - the productwarehouses - the warehousesstatus - the in stock statuspublic InStockStatus getInStockStatus(ProductModel product, WarehouseModel warehouse)
StockServicegetInStockStatus in interface StockServiceproduct - the productwarehouse - the warehousepublic void reserve(ProductModel product, WarehouseModel warehouse, int amount, String comment) throws InsufficientStockLevelException
StockServicereserve in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'amount - the amount of the reservationcomment - the comment for the reservationInsufficientStockLevelException - if not enough products are available in the stockpublic void release(ProductModel product, WarehouseModel warehouse, int amount, String comment)
StockServicerelease in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'amount - the amount of the releasecomment - the comment for the releasepublic void updateActualStockLevel(ProductModel product, WarehouseModel warehouse, int actualAmount, String comment)
StockServiceupdateActualStockLevel in interface StockServiceproduct - the productwarehouse - the warehouse where product is 'stored'actualAmount - the actual amount of the productcomment - the comment for the update operationpublic Map<WarehouseModel,Integer> getAvailability(List<WarehouseModel> warehouses, ProductModel product, Date date)
getAvailability in interface StockServicewarehouses - the warehousesproduct - the productdate - the date the specified quantity has to be available at least.public Map<WarehouseModel,Date> getAvailability(List<WarehouseModel> warehouses, ProductModel product, int quantity)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesquantity - the asked quantitypublic String getAvailability(ProductModel product, WarehouseModel warehouse, Date date, LanguageModel language)
StockServicegetAvailability in interface StockServiceproduct - the productwarehouse - the warehousedate - the date the specified quantity has to be available at least (could be null).language - language for which the text should be localizedpublic String getAvailability(ProductModel product, List<WarehouseModel> warehouses, Date date, LanguageModel language)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesdate - the date the specified quantity has to be available at least (could be null).language - language for which the text should be localizedpublic String getAvailability(ProductModel product, WarehouseModel warehouse, int quantity, LanguageModel language)
StockServicegetAvailability in interface StockServiceproduct - the productwarehouse - the warehousequantity - the asked quantitypublic String getAvailability(ProductModel product, List<WarehouseModel> warehouses, int quantity, LanguageModel language)
getAvailability in interface StockServiceproduct - the productwarehouses - the warehousesquantity - the asked quantitypublic WarehouseModel getBestMatchOfQuantity(Map<WarehouseModel,Integer> map)
getBestMatchOfQuantity in interface StockServicemap - the mapped quantities of a certain productpublic WarehouseModel getBestMatchOfAvailability(Map<WarehouseModel,Date> map)
getBestMatchOfAvailability in interface StockServicemap - the mapped available dates of a certain productpublic void setStockLevelStatusStrategy(StockLevelStatusStrategy stockLevelStatusStrategy)
public void setStockLevelProductStrategy(StockLevelProductStrategy stockLevelProductStrategy)
stockLevelProductStrategy - the stockLevelProductStrategy to setpublic void setProductAvailabilityStrategy(ProductAvailabilityStrategy productAvailabilityStrategy)
productAvailabilityStrategy - the productAvailabilityStrategy to setpublic StockLevelModel getStockLevel(ProductModel product, WarehouseModel warehouse)
StockServicegetStockLevel in interface StockServiceproduct - the productwarehouse - warehouse of the productpublic Collection<StockLevelModel> getAllStockLevels(ProductModel product)
StockServicegetAllStockLevels in interface StockServiceproduct - the productpublic Collection<StockLevelModel> getStockLevels(ProductModel product, Collection<WarehouseModel> warehouses)
StockServicegetStockLevels in interface StockServiceproduct - the productwarehouses - the warehousespublic void setStockLevelDao(StockLevelDao stockLevelDao)
Copyright © 2017 SAP SE. All Rights Reserved.