Class DefaultAllocationService
- java.lang.Object
-
- de.hybris.platform.warehousing.allocation.impl.DefaultAllocationService
-
- All Implemented Interfaces:
AllocationService
public class DefaultAllocationService extends java.lang.Object implements AllocationService
Service to create consignments based on the sourcing results.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringPICKUP_CODEprotected static java.lang.StringREALLOCATE_COMMENT_SUBJECT
-
Constructor Summary
Constructors Constructor Description DefaultAllocationService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidautoReallocate(DeclineEntries declinedEntries)CreatesDeclineConsignmentEntryEventModelitems to represent the reallocations that can be retrieved byConsignmentEntryModel.getDeclineEntryEvents().protected voidconsolidateConsignmentEntries(java.util.List<ConsignmentModel> newConsignments, ConsignmentModel consignment, AbstractOrderModel order, DeclineConsignmentEntryEventModel event)Consolidates theConsignmentEntryModelif they belong to the sameWarehouseModelConsignmentModelcreateConsignment(AbstractOrderModel order, java.lang.String code, SourcingResult result)This implementation assumes that all order entries in SourcingResult have the same delivery POS.protected ConsignmentEntryModelcreateConsignmentEntry(AbstractOrderEntryModel orderEntry, java.lang.Long quantity, ConsignmentModel consignment)Create a consignment entry.java.util.Collection<ConsignmentModel>createConsignments(AbstractOrderModel order, java.lang.String code, SourcingResults results)Create consignments for the sourcing results gathered from the sourcing strategies executions.
All consignments and order will be persisted after creations and updates.protected java.util.Optional<DeclineConsignmentEntryEventModel>declineConsignmentEntry(DeclineEntry declineEntry)Decline a single consignment entry.protected WarehousingCommentServicegetConsignmentEntryCommentService()protected DeliveryModeServicegetDeliveryModeService()protected GuidKeyGeneratorgetGuidKeyGenerator()protected InventoryEventServicegetInventoryEventService()protected ModelServicegetModelService()protected intgetNumDeclines(ConsignmentModel consignment)Gets the number of decline entry event for the given consignment.protected java.lang.LonggetQuantityToDecline(DeclineEntry declineEntry)Get the quantity of items to decline.protected ShippingDateStrategygetShippingDateStrategy()protected StockLevelDaogetStockLevelDao()protected WarehousingConsignmentWorkflowServicegetWarehousingConsignmentWorkflowService()protected WarehousingFulfillmentConfigDaogetWarehousingFulfillmentConfigDao()java.util.Collection<ConsignmentModel>manualReallocate(DeclineEntries declinedEntries)Manually reallocate the consignment entries provided to a new point of service.protected voidreallocateAllocationEvent(DeclineEntry declineEntry, java.lang.Long quantityToDecline)Delete or update the allocation event which has been created for a specific entry to declinevoidsetConsignmentEntryCommentService(WarehousingCommentService consignmentEntryCommentService)voidsetDeliveryModeService(DeliveryModeService deliveryModeService)voidsetGuidKeyGenerator(GuidKeyGenerator guidKeyGenerator)voidsetInventoryEventService(InventoryEventService inventoryEventService)voidsetModelService(ModelService modelService)voidsetShippingDateStrategy(ShippingDateStrategy shippingDateStrategy)voidsetStockLevelDao(StockLevelDao stockLevelDao)voidsetWarehousingConsignmentWorkflowService(WarehousingConsignmentWorkflowService warehousingConsignmentWorkflowService)voidsetWarehousingFulfillmentConfigDao(WarehousingFulfillmentConfigDao warehousingFulfillmentConfigDao)protected java.lang.LonguseQuantityPending(ConsignmentEntryModel consignmentEntry, DeclineEntry declineEntry)
-
-
-
Field Detail
-
PICKUP_CODE
protected static final java.lang.String PICKUP_CODE
- See Also:
- Constant Field Values
-
REALLOCATE_COMMENT_SUBJECT
protected static final java.lang.String REALLOCATE_COMMENT_SUBJECT
- See Also:
- Constant Field Values
-
-
Method Detail
-
createConsignments
public java.util.Collection<ConsignmentModel> createConsignments(AbstractOrderModel order, java.lang.String code, SourcingResults results)
Description copied from interface:AllocationServiceCreate consignments for the sourcing results gathered from the sourcing strategies executions.
All consignments and order will be persisted after creations and updates.- Specified by:
createConsignmentsin interfaceAllocationService- Parameters:
order- - the order to create consignments forcode- - the consignment code; never nullresults- - the sourcing results collected from the sourcing strategies; never null- Returns:
- a collection of
ConsignmentModel; never null
-
createConsignment
public ConsignmentModel createConsignment(AbstractOrderModel order, java.lang.String code, SourcingResult result)
This implementation assumes that all order entries in SourcingResult have the same delivery POS.- Specified by:
createConsignmentin interfaceAllocationService- Parameters:
order- - the order to create consignments forcode- - the consignment code; never nullresult- - the sourcing results collected from the sourcing strategies; never null- Returns:
- a
ConsignmentModel; never null
-
manualReallocate
public java.util.Collection<ConsignmentModel> manualReallocate(DeclineEntries declinedEntries) throws AllocationException
Description copied from interface:AllocationServiceManually reallocate the consignment entries provided to a new point of service. Creates new consignments for the items that were reallocated. This will also createDeclineConsignmentEntryEventModelitems to represent the reallocations that can be retrieved byConsignmentEntryModel.getDeclineEntryEvents().Furthermore, the service can only reallocate an item if it is pending as in
ConsignmentEntryModel.getQuantityPending().- Specified by:
manualReallocatein interfaceAllocationService- Parameters:
declinedEntries- - the collection of decline entries to be reallocated- Returns:
- the collection of newly created consignments
- Throws:
AllocationException
-
consolidateConsignmentEntries
protected void consolidateConsignmentEntries(java.util.List<ConsignmentModel> newConsignments, ConsignmentModel consignment, AbstractOrderModel order, DeclineConsignmentEntryEventModel event)
Consolidates theConsignmentEntryModelif they belong to the sameWarehouseModel- Parameters:
newConsignments- the list of new consignmentsconsignment- the originalConsignmentModelorder- the relatedAbstractOrderModelevent- theDeclineConsignmentEntryEventModel
-
autoReallocate
public void autoReallocate(DeclineEntries declinedEntries)
Description copied from interface:AllocationServiceCreatesDeclineConsignmentEntryEventModelitems to represent the reallocations that can be retrieved byConsignmentEntryModel.getDeclineEntryEvents().Furthermore, the service can only reallocate an item if it is pending as in
ConsignmentEntryModel.getQuantityPending().- Specified by:
autoReallocatein interfaceAllocationService- Parameters:
declinedEntries- - the collection of decline entries to be reallocated
-
getNumDeclines
protected int getNumDeclines(ConsignmentModel consignment)
Gets the number of decline entry event for the given consignment.- Parameters:
consignment- - the consignment- Returns:
- number of decline entry event
-
declineConsignmentEntry
protected java.util.Optional<DeclineConsignmentEntryEventModel> declineConsignmentEntry(DeclineEntry declineEntry)
Decline a single consignment entry. This will decline as many quantities as are still pending. Any quantities that could not be declined will be ignored.- Parameters:
declineEntry- - the decline entry to process; contains the consignment entry, the new warehouse to which the items are being reallocated to and quantity to be declined- Returns:
- the consignment entry event with the items that were successfully declined
-
getQuantityToDecline
protected java.lang.Long getQuantityToDecline(DeclineEntry declineEntry)
Get the quantity of items to decline.- Parameters:
declineEntry- - the consignment entry being declined- Returns:
- returns the consignment entry pending quantity if it is greater than or equal to the decline entry's requested decline quantity; otherwise return the decline entry's requested decline quantity
-
useQuantityPending
protected java.lang.Long useQuantityPending(ConsignmentEntryModel consignmentEntry, DeclineEntry declineEntry)
-
createConsignmentEntry
protected ConsignmentEntryModel createConsignmentEntry(AbstractOrderEntryModel orderEntry, java.lang.Long quantity, ConsignmentModel consignment)
Create a consignment entry.- Parameters:
orderEntry- - the order entryquantity- - the ordered quantityconsignment- - the consignment to which the consignment entry will be added to- Returns:
- the consignment entry; never null
-
reallocateAllocationEvent
protected void reallocateAllocationEvent(DeclineEntry declineEntry, java.lang.Long quantityToDecline)
Delete or update the allocation event which has been created for a specific entry to decline- Parameters:
declineEntry- the entry to decline/reallocatequantityToDecline- the quantity to decline/reallocate
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getDeliveryModeService
protected DeliveryModeService getDeliveryModeService()
-
setDeliveryModeService
public void setDeliveryModeService(DeliveryModeService deliveryModeService)
-
getConsignmentEntryCommentService
protected WarehousingCommentService getConsignmentEntryCommentService()
-
setConsignmentEntryCommentService
public void setConsignmentEntryCommentService(WarehousingCommentService consignmentEntryCommentService)
-
getInventoryEventService
protected InventoryEventService getInventoryEventService()
-
setInventoryEventService
public void setInventoryEventService(InventoryEventService inventoryEventService)
-
getGuidKeyGenerator
protected GuidKeyGenerator getGuidKeyGenerator()
-
setGuidKeyGenerator
public void setGuidKeyGenerator(GuidKeyGenerator guidKeyGenerator)
-
getShippingDateStrategy
protected ShippingDateStrategy getShippingDateStrategy()
-
setShippingDateStrategy
public void setShippingDateStrategy(ShippingDateStrategy shippingDateStrategy)
-
getWarehousingConsignmentWorkflowService
protected WarehousingConsignmentWorkflowService getWarehousingConsignmentWorkflowService()
-
setWarehousingConsignmentWorkflowService
public void setWarehousingConsignmentWorkflowService(WarehousingConsignmentWorkflowService warehousingConsignmentWorkflowService)
-
getWarehousingFulfillmentConfigDao
protected WarehousingFulfillmentConfigDao getWarehousingFulfillmentConfigDao()
-
setWarehousingFulfillmentConfigDao
public void setWarehousingFulfillmentConfigDao(WarehousingFulfillmentConfigDao warehousingFulfillmentConfigDao)
-
getStockLevelDao
protected StockLevelDao getStockLevelDao()
-
setStockLevelDao
public void setStockLevelDao(StockLevelDao stockLevelDao)
-
-