Class DefaultAllocationService
java.lang.Object
de.hybris.platform.warehousing.allocation.impl.DefaultAllocationService
- All Implemented Interfaces:
AllocationService
Service to create consignments based on the sourcing results.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidautoReallocate(DeclineEntries declinedEntries) CreatesDeclineConsignmentEntryEventModelitems to represent the reallocations that can be retrieved byConsignmentEntryModel.getDeclineEntryEvents().protected voidconsolidateConsignmentEntries(List<ConsignmentModel> newConsignments, ConsignmentModel consignment, AbstractOrderModel order, DeclineConsignmentEntryEventModel event) Consolidates theConsignmentEntryModelif they belong to the sameWarehouseModelcreateConsignment(AbstractOrderModel order, String code, SourcingResult result) This implementation assumes that all order entries in SourcingResult have the same delivery POS.protected ConsignmentEntryModelcreateConsignmentEntry(AbstractOrderEntryModel orderEntry, Long quantity, ConsignmentModel consignment) Create a consignment entry.createConsignments(AbstractOrderModel order, 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 Optional<DeclineConsignmentEntryEventModel>declineConsignmentEntry(DeclineEntry declineEntry) Decline a single consignment entry.protected WarehousingCommentServiceprotected DeliveryModeServiceprotected GuidKeyGeneratorprotected InventoryEventServiceprotected ModelServiceprotected intgetNumDeclines(ConsignmentModel consignment) Gets the number of decline entry event for the given consignment.protected LonggetQuantityToDecline(DeclineEntry declineEntry) Get the quantity of items to decline.protected ShippingDateStrategyprotected StockLevelDaoprotected WarehousingConsignmentWorkflowServiceprotected WarehousingFulfillmentConfigDaomanualReallocate(DeclineEntries declinedEntries) Manually reallocate the consignment entries provided to a new point of service.protected voidreallocateAllocationEvent(DeclineEntry declineEntry, 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 LonguseQuantityPending(ConsignmentEntryModel consignmentEntry, DeclineEntry declineEntry)
-
Field Details
-
PICKUP_CODE
- See Also:
-
REALLOCATE_COMMENT_SUBJECT
- See Also:
-
-
Constructor Details
-
DefaultAllocationService
public DefaultAllocationService()
-
-
Method Details
-
createConsignments
public Collection<ConsignmentModel> createConsignments(AbstractOrderModel order, 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, 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 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(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
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
Gets the number of decline entry event for the given consignment.- Parameters:
consignment- - the consignment- Returns:
- number of decline entry event
-
declineConsignmentEntry
protected 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
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 Long useQuantityPending(ConsignmentEntryModel consignmentEntry, DeclineEntry declineEntry) -
createConsignmentEntry
protected ConsignmentEntryModel createConsignmentEntry(AbstractOrderEntryModel orderEntry, 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
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
-
setModelService
-
getDeliveryModeService
-
setDeliveryModeService
-
getConsignmentEntryCommentService
-
setConsignmentEntryCommentService
public void setConsignmentEntryCommentService(WarehousingCommentService consignmentEntryCommentService) -
getInventoryEventService
-
setInventoryEventService
-
getGuidKeyGenerator
-
setGuidKeyGenerator
-
getShippingDateStrategy
-
setShippingDateStrategy
-
getWarehousingConsignmentWorkflowService
-
setWarehousingConsignmentWorkflowService
public void setWarehousingConsignmentWorkflowService(WarehousingConsignmentWorkflowService warehousingConsignmentWorkflowService) -
getWarehousingFulfillmentConfigDao
-
setWarehousingFulfillmentConfigDao
public void setWarehousingFulfillmentConfigDao(WarehousingFulfillmentConfigDao warehousingFulfillmentConfigDao) -
getStockLevelDao
-
setStockLevelDao
-