com.ibm.commerce.fulfillment.commands

Class AllocateInventoryCmdImpl

    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AllocateInventoryCmdImpl

        public AllocateInventoryCmdImpl()
    • Method Detail

      • getAllocateOrderItems

        public java.util.Hashtable getAllocateOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be allocated from existing inventory.
        Returns:
        the order items to be allocated. Hashtable:
      • getAllOrderItems

        public java.util.Hashtable getAllOrderItems()
        Deprecated. This method will be changed to protected.
        Gets all order items to be considered when determining fulfillment centers or merging order items.
        Returns:
        the order items to be considered. Hashtable:
      • getBackorderOrderItems

        public java.util.Hashtable getBackorderOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be backordered (allocated from expected inventory).
        Returns:
        the order items to be backordered. Hashtable:
      • getCheckOrderItems

        public java.util.Hashtable getCheckOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be checked by the CheckInventoryAvailability task command.
        Returns:
        the order items to be checked. Hashtable:
      • getMergeOrderItems

        public java.util.Hashtable getMergeOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be merged, if possible.
        Returns:
        the order items to be merged. Hashtable:
      • getRemergeOrderItems

        public java.util.Hashtable getRemergeOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be merged, if possible, with other order items with the same correlation group.
        Returns:
        the order items to be merged. Hashtable:
      • getReverseOrderItems

        public java.util.Hashtable getReverseOrderItems()
        Deprecated. This method will be changed to protected.
        Gets the order items to be deallocated.
        Returns:
        the order items to be deallocated. Hashtable:
      • performExecute

        public void performExecute()
                            throws ECException
        Performs the actual business logic of the command.

        Behaviour:

        In the following description, the terms allOrderItems, remergeOrderItems, mergeOrderItems, checkOrderItems, allocateOrderItems, backOrderItems, and reverseOrderItems. They refer to the OrderItems specified by the caller as input parameters. These parameters are set using setAllOrderItems, setRemergeOrderItems, setMergeOrderItems, setCheckOrderItems, setAllocateOrderItems, setBackorderOrderItems, and setReverseOrderItems methods, respectively.
        1. Throughout this invocation, unlock an OrderItem's Order if its quantity or FulfillmentCenter is changed.
        2. To prevent changes to OrderItems that have already been released for fulfillment. Throughout this invocation, OrderItems in remergeOrderItems, mergeOrderItems, checkOrderItems, allocateOrderItems, backOrderItems, and reverseOrderItems are ignored. Unless their InventoryStatus attribute is one of "NALC", "BO", "FUL", or "ALLC".
        3. Any allocations of existing or expected inventory associated with the allocateOrderItems, backorderOrderItems, or reverseOrderItems are released by calling the DeallocateExistingInventory or calling DeallocateExpectedInventory task command respectively. Estimated availability times and shipping offsets and other allocation information are removed from those OrderItems. Except the FulfillmentCenters are left unchanged (that way they can be considered by GetEligibleFulfillmentCenters).
        4. For each currently unallocated OrderItem in mergeOrderItems determine what other unallocated OrderItems in allOrderItems exist with identical values for all columns except for ORDERITEMS_ID, QUANTITY, CORRELATIONGROUP, LASTCREATE, LASTUPDATE, information calculated by PrepareOrder (such as SHIPCHARGE, SHIPTAXAMOUNT, TAXAMOUNT, TOTALADJUSTMENT, and TOTALPRODUCT), and information specific to the allocation status such as FulfillmentCenter (unless it has been overridden in the prepareFlags attribute), availableQuantity, ALLOCATIONGROUP, LastAllocUpdate, EstAvailTime, PromisedAvailTime, ShippingOffset, NeededQuantity, AllocQuantity, AllocFFMC_ID, and AllocAddress_ID, and merge them into the same OrderItem by deleting the others and adding their quantity amounts to that OrderItem. Estimated availability times and shipping offsets and other allocation information such as availableQuantity (but not FulfillmentCenters overridden in the prepareFlags attribute) are removed from merged OrderItems. The CORRELATIONGROUP attributes of the merged OrderItems are set to their own OrderItemID.
        5. For each remaining unallocated OrderItem in remergeOrderItems determine what other unallocated OrderItems in allOrderItems exist with identical values for CORRELATIONGROUP. As well as all the other columns defined in the previous step (the mergeOrderItems case). If the CORRELATIONGROUP of one of those so determined OrderItems is the OrderItem's OrderItemID, then merge the other so determined OrderItems into that OrderItem. Otherwise, merge the so determined OrderItems into one of those so determined OrderItems. The order item should also appear in remergeOrderItems by deleting the others and adding their quantity amounts to that OrderItem. Estimated availability times and shipping offsets and other allocation information such as availableQuantity (but not FulfillmentCenters overridden in the prepareFlags attribute) are removed from merged OrderItems. The CORRELATIONGROUP attributes of the merged OrderItems are left unchanged.
        6. Call GetEligibleFulfillmentCenters to determine a list of eligible FulfillmentCenters for each remaining unallocated OrderItem in checkOrderItems, allocateOrderItems, and backorderOrderItems.
        7. Call CheckInventoryAvailability passing it the list of remaining unallocated OrderItems in checkOrderItems and their lists of eligible FulfillmentCenters. Update the estimated availability times and shipping offsets of the unallocated OrderItems with the information returned by CheckInventoryAvailability. The results and reason codes from this call are made available to an error JSP, in a way backward compatible with WCS V5.1.
        8. For each remaining unallocated OrderItem in allocateOrderItems, attempt to allocate it using its list of eligible FulfillmentCenters. Use the following algorithm for each OrderItem:
          1. Set the current strategy to zero.
          2. Set the previous strategy to something different and set the previous OrderItem to null.
          3. While the current OrderItem is unallocated or backordered. And either it is not the previous OrderItem or the current strategy is different than the previous strategy:
            1. Set the previous strategy to the current strategy and set the previous OrderItem to the current OrderItem.
            2. Call AllocateExistingInventory specifying the current OrderItem, its list of eligible FulfillmentCenters, and the current strategy.
            3. Set the current strategy to the nextStrategy (returned from AllocateExistingInventory).
            4. If the current OrderItem is partially allocated, and the unallocated part is greater than or equal to StoreItem.MinQtyForSplit. Create a new (unallocated) OrderItem to hold the unallocated part, and make it the current OrderItem. (Make sure to adjust the Quantity for both the old and the new OrderItem so that the ratio between OrderItems.Quantity and OrderItems.NeededQuantity remains the same. To avoid round off errors caused by discrepancies between CatEntShip.QuantityMultiple and BaseItem.QuantityMultiple. If the OrderItem has a CatEntry with a CatEntShip record, then multiply the resulting Quantity by CatEntShip.NominalQuantity. And round to the nearest multiple of CatEntShip.QuantityMultiple, and divide by CatEntShip.NominalQuantity. If the OrderItem has a CatEntry but no CatEntShip record, CatEntShip.NominalQuantity and CatEntShip.QuantityMultiple are assumed to be 1, and CatEntShip.QuantityMeasure is assumed to be 'C62'.)
            5. Otherwise, if the current OrderItem is partially allocated, and the unallocated part is less than StoreItem.MinQtyForSplit, reverse the partial allocation and leave the OrderItem unallocated.

          The above algorithm allows the AllocateInventory task command to control the splitting of OrderItems. While giving control of the details of inventory allocation decisions to the AllocateExistingInventory task command. For example, the inventory allocation decision may be whether or not partial allocation is performed.

          When an OrderItem is split, the new OrderItem contains the same information. Except for the ORDERITEMS_ID, QUANTITY, and information specific to the allocation such as FFMCENTER_ID, estimated availability time and shipping offset.
        9. For each remaining unallocated OrderItem in backorderOrderItems (and any created in the above step by splitting them). Attempt to backorder it using its list of eligible FulfillmentCenters, or its existing overridden FulfillmentCenter. This will involve making calls to AllocateExpectedInventory. Otherwise it should behave the same as specified in the previous step.
        10. For any allocations associated with remaining OrderItems in reverseOrderItems. And for any allocations for OrderItems created (in the above steps) while allocating any of those OrderItems. These allocations are released (by calling DeallocateExistingInventory or DeallocateExpectedInventory as appropriate). For their estimated availability time and shipping offset and other allocation information, such as FulfillmentCenter. They are left in the OrderItem allowing it to be displayed as how the OrderItems would have been allocated had they not been reversed.

        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECException
      • reset

        public void reset()
        This method should be called after a command has been executed to reset its instance variables.
        Specified by:
        reset in interface com.ibm.websphere.command.Command
        Overrides:
        reset in class AbstractECTargetableCommand
      • setAllocateOrderItems

        public void setAllocateOrderItems(java.util.Hashtable ahsAllocateOrderItems)
        Sets the order items to be allocated from existing inventory. Fulfillment centers and estimated shipping date offsets will be set for successfully allocated order items.
        Specified by:
        setAllocateOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsAllocateOrderItems - the order items to be allocated. Hashtable:
      • setAllOrderItems

        public void setAllOrderItems(java.util.Hashtable ahsAllOrderItems)
        Sets all order items to be considered when determining fulfillment centers or merging order items. Normally this is all the order items in an order.
        Specified by:
        setAllOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsAllOrderItems - all the order items to be considered. Hashtable:
      • setBackorderOrderItems

        public void setBackorderOrderItems(java.util.Hashtable ahsBackorderOrderItems)
        Sets the order items to be backordered (allocated from expected inventory). If an order item appears in both lists of order items, set by setAllocateOrderItems and setBackorderOrderItems. Then it is backordered only if it cannot be allocated from existing inventory. Fulfillment centers and estimated shipping date offsets will be set for successfully backordered order items.
        Specified by:
        setBackorderOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsBackorderOrderItems - the order items to be backordered. Hashtable:
      • setCheckOrderItems

        public void setCheckOrderItems(java.util.Hashtable ahsCheckOrderItems)
        Sets the order items to be checked by the CheckInventoryAvailability task command. Fulfillment centers and estimated shipping date offsets will be set for those order items that successfully pass the check.
        Specified by:
        setCheckOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsCheckOrderItems - the order items to be checked. Hashtable:
      • setMergeOrderItems

        public void setMergeOrderItems(java.util.Hashtable ashMergeOrderItems)
        Sets the order items to be merged, if possible.
        Specified by:
        setMergeOrderItems in interface AllocateInventoryCmd
        Parameters:
        ashMergeOrderItems - the order items to be merged. Hashtable:
      • setOrderItem

        public void setOrderItem(OrderItemAccessBean[] orderItems)
        Set a list of OrderItems. Each OrderItem is added to the set of all order items to be considered when determining fulfillment centers or merging order items.
        Parameters:
        orderItems - the order items to be added.
      • setOrderItem

        public void setOrderItem(OrderItemAccessBean anOrderItem)
        Set an OrderItem. The OrderItem is added to the set of all order items to be considered when determining fulfillment centers or merging order items.
        Parameters:
        anOrderItem - the order item to be added.
      • setRemergeOrderItems

        public void setRemergeOrderItems(java.util.Hashtable ahsRemergeOrderItems)
        Sets the order items to be merged, if possible, with other order items with the same correlation group.
        Specified by:
        setRemergeOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsRemergeOrderItems - the order items to be merged. Hashtable:
      • setReverseOrderItems

        public void setReverseOrderItems(java.util.Hashtable ahsReverseOrderItems)
        Sets the order items to be deallocated, if they are allocated or backordered. The DeallocateExistingInventory task command will be called to deallocate allocated order items. The DeallocateExpectedInventory task command will be called to deallocate backordered order items.
        Specified by:
        setReverseOrderItems in interface AllocateInventoryCmd
        Parameters:
        ahsReverseOrderItems - the order items to be deallocated. Hashtable: