com.ibm.commerce.fulfillment.commands

Class InventoryManagementHelper

  • java.lang.Object
    • com.ibm.commerce.fulfillment.commands.InventoryManagementHelper


  • public class InventoryManagementHelper
    extends java.lang.Object
    This is a helper class for inventory management.
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.Long INVENTORY_RESERVE_TYPE_AUCTION
        Constant
      • NO_PARTIAL_ALLOCATION

        public static final java.lang.String NO_PARTIAL_ALLOCATION
        Constant
        See Also:
        Constant Field Values
      • PARTIAL_ALLOCATION

        public static final java.lang.String PARTIAL_ALLOCATION
        Constant
        See Also:
        Constant Field Values
      • EST_SHIP_DATE

        public static final java.lang.String EST_SHIP_DATE
        Constant
        See Also:
        Constant Field Values
      • FUFILLMENT_CENTER

        public static final java.lang.String FUFILLMENT_CENTER
        Constant
        See Also:
        Constant Field Values
      • STATUS_SUCCESS

        public static final java.lang.String STATUS_SUCCESS
        Constant
        See Also:
        Constant Field Values
      • ITEM_DISCONTINUED

        public static final java.lang.String ITEM_DISCONTINUED
        Constant
        See Also:
        Constant Field Values
      • ITEM_DELETED

        public static final java.lang.String ITEM_DELETED
        Constant
        See Also:
        Constant Field Values
      • ITEM_NOT_BACKORDERABLE

        public static final java.lang.String ITEM_NOT_BACKORDERABLE
        Constant
        See Also:
        Constant Field Values
      • INV_ALLOCATED

        public static final java.lang.String INV_ALLOCATED
        Constant
        See Also:
        Constant Field Values
      • INV_BACKORDERED

        public static final java.lang.String INV_BACKORDERED
        Constant
        See Also:
        Constant Field Values
      • INV_FULFILLED

        public static final java.lang.String INV_FULFILLED
        Constant
        See Also:
        Constant Field Values
      • INV_NOT_ALLOCATED

        public static final java.lang.String INV_NOT_ALLOCATED
        Constant
        See Also:
        Constant Field Values
      • INV_AVAILABLE

        public static final java.lang.String INV_AVAILABLE
        Specify inventory status for order item is inventory available
        See Also:
        Constant Field Values
      • INV_UNAVAILABLE

        public static final java.lang.String INV_UNAVAILABLE
        Specify inventory status for order item is inventory unavailable
        See Also:
        Constant Field Values
      • INV_FUTURE_ORDER

        public static final java.lang.String INV_FUTURE_ORDER
        Constant
        See Also:
        Constant Field Values
      • FF_STATUS_INT

        public static final java.lang.String FF_STATUS_INT
        Constant
        See Also:
        Constant Field Values
      • COMMIT_STATUS

        public static final java.lang.String COMMIT_STATUS
        Constant
        See Also:
        Constant Field Values
      • FFC_LIST_SEPARATOR

        public static final java.lang.String FFC_LIST_SEPARATOR
        Constant
        See Also:
        Constant Field Values
      • NO_CORRELATION_GROUP

        public static final java.lang.Long NO_CORRELATION_GROUP
        Constant
      • AVAILABLE_INVENTORY

        public static final java.lang.String AVAILABLE_INVENTORY
        Constant
        See Also:
        Constant Field Values
      • AVAILABLE_INVENTORY_RESP

        public static final java.lang.String AVAILABLE_INVENTORY_RESP
        Constant
        See Also:
        Constant Field Values
      • AVAILABLE_INVENTORY_LIST

        public static final java.lang.String AVAILABLE_INVENTORY_LIST
        Constant
        See Also:
        Constant Field Values
      • RA_DATE_LIST

        public static final java.lang.String RA_DATE_LIST
        Constant
        See Also:
        Constant Field Values
      • STORED_PROCEDURE_ERROR_CODE

        public static final java.lang.String STORED_PROCEDURE_ERROR_CODE
        Constant
        See Also:
        Constant Field Values
      • RELEASENUM_START

        public static final java.lang.String RELEASENUM_START
        Constant
        See Also:
        Constant Field Values
      • RELEASENUM_COUNT

        public static final java.lang.String RELEASENUM_COUNT
        Constant
        See Also:
        Constant Field Values
      • MERGE_PARAM_KEY

        public static final java.lang.String MERGE_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • REMERGE_PARAM_KEY

        public static final java.lang.String REMERGE_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • CHECK_PARAM_KEY

        public static final java.lang.String CHECK_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • ALLOCATE_PARAM_KEY

        public static final java.lang.String ALLOCATE_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • BACKORDER_PARAM_KEY

        public static final java.lang.String BACKORDER_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • REVERSE_PARAM_KEY

        public static final java.lang.String REVERSE_PARAM_KEY
        Constant
        See Also:
        Constant Field Values
      • NOMINALQUANTITY_DEFAULT

        public static final double NOMINALQUANTITY_DEFAULT
        Constant
        See Also:
        Constant Field Values
      • DEFAULT_STRATEGY

        public static final java.lang.Integer DEFAULT_STRATEGY
        Constant
      • REVERSE_INVENTORY_CONFIGURATION_FLAG

        public static final java.lang.String REVERSE_INVENTORY_CONFIGURATION_FLAG
        See Also:
        Constant Field Values
      • REVERSE_INVENTORY_ENABLED

        public static final java.lang.String REVERSE_INVENTORY_ENABLED
        See Also:
        Constant Field Values
      • REVERSE_INVENTORY_TRUE

        public static final java.lang.String REVERSE_INVENTORY_TRUE
        See Also:
        Constant Field Values
    • Constructor Detail

      • InventoryManagementHelper

        public InventoryManagementHelper(CommandContext aCmdContext,
                                         java.lang.Integer anStoreId)
        InventoryManagementHelper constructor comment.
        Parameters:
        aCmdContext -
        anStoreId -
    • Method Detail

      • addFulfillmentCentersForOrderItem

        public static void addFulfillmentCentersForOrderItem(java.util.Hashtable anhsOrderItemFulfillmentCentersMaps,
                                                             OrderItemAccessBean anabOrderItem,
                                                             java.util.Vector avFulfillmentCenters)
                                                      throws ECException
        addFulfillmentCentersForOrderItem
        Parameters:
        anhsOrderItemFulfillmentCentersMaps -
        anabOrderItem -
        avFulfillmentCenters -
        Throws:
        ECException
      • allocateInventory

        public java.util.Hashtable allocateInventory(java.util.Vector avOrderItemsToAllocate,
                                                     java.util.Hashtable anhsOrderItemFulfillmentCentersMaps,
                                                     java.util.Hashtable ahsSplitOutAllocatedOrderItems,
                                                     boolean abFlushBeforeAllocation,
                                                     java.lang.Integer theStoreId,
                                                     CommandContext theCommandContext)
                                              throws java.sql.SQLException,
                                                     javax.ejb.RemoveException,
                                                     ECSystemException,
                                                     ECApplicationException,
                                                     ECException
        Parameters:
        avOrderItemsToAllocate -
        anhsOrderItemFulfillmentCentersMaps -
        ahsSplitOutAllocatedOrderItems -
        abFlushBeforeAllocation -
        theStoreId -
        theCommandContext -
        Returns:
        Hashtable
        Throws:
        java.sql.SQLException
        javax.ejb.RemoveException
        ECSystemException
        ECApplicationException
        ECException
      • allocationExpired

        public static boolean allocationExpired(OrderAccessBean abOrder,
                                                StoreAccessBean anabStore)
                                         throws java.sql.SQLException
        Checks if any allocations or backorders for the order items in an order have expired.

        An allocation or back-order has expired if its order status is 'P', 'I', 'W', or 'N'. And its lastAllocationUpdate timestamp plus the Store's allocationGoodFor attribute is in the past.
        Parameters:
        abOrder -
        anabStore -
        Returns:
        true if any of the order items have expired allocations or backorders.
        Throws:
        java.sql.SQLException
      • calculateInventoryAllocationMultiple

        public static java.lang.Double calculateInventoryAllocationMultiple(OrderItemAccessBean abOrderItem)
                                                                     throws ECSystemException
        calculateInventoryAllocationMultiple
        Parameters:
        abOrderItem -
        Returns:
        Double
        Throws:
        ECSystemException
      • callAllocateInventoryCmd

        public static void callAllocateInventoryCmd(java.util.Enumeration anenOrderItems,
                                                    CommandContext aCmdContext,
                                                    java.lang.Integer anStoreId,
                                                    ATPParameters anATPParms)
                                             throws ECException
        callAllocateInventoryCmd
        Parameters:
        anenOrderItems -
        aCmdContext -
        anStoreId -
        anATPParms -
        Throws:
        ECException
      • callAllocateInventoryCmd

        public static void callAllocateInventoryCmd(java.util.Hashtable hsabOrderItems,
                                                    CommandContext aCmdContext,
                                                    java.lang.Integer anStoreId,
                                                    ATPParameters anATPParms)
                                             throws ECException
        callAllocateInventoryCmd
        Parameters:
        hsabOrderItems -
        aCmdContext -
        anStoreId -
        anATPParms -
        Throws:
        ECException
      • callAllocateInventoryCmd

        public static void callAllocateInventoryCmd(java.util.Hashtable hsabOrderItems,
                                                    java.util.Hashtable ahsMerge,
                                                    java.util.Hashtable ahsRemerge,
                                                    java.util.Hashtable ahsCheck,
                                                    java.util.Hashtable ahsAllocate,
                                                    java.util.Hashtable ahsBackorder,
                                                    java.util.Hashtable ahsReverse,
                                                    CommandContext aCmdContext,
                                                    java.lang.Integer anStoreId)
                                             throws ECException
        callAllocateInventoryCmd
        Parameters:
        hsabOrderItems -
        ahsMerge -
        ahsRemerge -
        ahsCheck -
        ahsAllocate -
        ahsBackorder -
        ahsReverse -
        aCmdContext -
        anStoreId -
        Throws:
        ECException
      • clearAllocationInformation

        public void clearAllocationInformation(OrderItemAccessBean anabOrderItem)
        clearAllocationInformation
        Parameters:
        anabOrderItem -
      • convertFromOrderItemABToData

        public static java.util.Vector convertFromOrderItemABToData(java.util.Enumeration aenabOrderItems)
                                                             throws ECException
        convertFromOrderItemABToData
        Parameters:
        aenabOrderItems -
        Returns:
        Vector
        Throws:
        ECException
      • ffcsToString

        public static java.lang.String ffcsToString(java.util.Enumeration anenFulfillmentCenters)
        ffcsToString
        Parameters:
        anenFulfillmentCenters -
        Returns:
        String
      • flush

        public static void flush()
        flush
      • getCmdContext

        public CommandContext getCmdContext()
        getCmdContext
        Returns:
        com.ibm.commerce.command.CommandContext
      • getFulfillmentCenters

        public static java.lang.String getFulfillmentCenters(java.util.Hashtable anhsOrderItemFulfillmentCentersMaps)
        getFulfillmentCenters
        Parameters:
        anhsOrderItemFulfillmentCentersMaps -
        Returns:
        String
      • getFulfillmentCenters

        public static java.util.Vector getFulfillmentCenters(java.util.Hashtable anhsOrderItemFulfillmentCentersMaps,
                                                             java.lang.Long anOrderItemId)
        getFulfillmentCenters
        Parameters:
        anhsOrderItemFulfillmentCentersMaps -
        anOrderItemId -
        Returns:
        Vector
      • getFulfillmentCenters

        public static java.lang.Object[] getFulfillmentCenters(java.util.Hashtable anhsOrderItemFulfillmentCentersMaps,
                                                               OrderItemAccessBean anabOrderItem,
                                                               java.lang.String astrOperation)
        Return a list of fulfillment centers that can be used for given inventory operation, such as check, allocate or backorder.
        Parameters:
        anhsOrderItemFulfillmentCentersMaps - Hashtable of fulfillment center lists
        anabOrderItem - Order item for which a list of eligible fulfillment centers to be determined
        astrOperation - Inventory operation
        Returns:
        Object[] Two-element array - 1) list of eligible fulfillment centers
      • getFulfillmentCenters

        public static java.lang.Object[] getFulfillmentCenters(java.util.Vector avFFCs,
                                                               java.lang.Long anItemSpecId,
                                                               java.lang.String astrOperation)
        Return a list of fulfillment centers and alternative fulfillment center that can be used for given inventory operation, such as check, allocate or backorder. An alternative fulfillment center can be used for given operation if other this operation fails for all other fulfillment centers in the list.
        Parameters:
        avFFCs - Input list of fulfillment centers to be processed
        anItemSpecId - Item specification for which a list of eligible fulfillment centers to be determined
        astrOperation - Inventory operation
        Returns:
        Object[] Two-element array - 1) list of eligible fulfillment centers 2) alternative fulfillment center to be used for given operation
      • removeOperationEnabledFFCs

        public static java.util.Vector removeOperationEnabledFFCs(java.util.Vector avFFCs,
                                                                  int anOperation)
        Parameters:
        avFFCs -
        anOperation -
        Returns:
        Vector
      • isItemDiscontinued

        public static boolean isItemDiscontinued(java.lang.Long anItemSpec)
        Parameters:
        anItemSpec -
        Returns:
        boolean
      • getMinimumQtyForSplit

        public static java.lang.Integer getMinimumQtyForSplit(OrderItemAccessBean anabOrderItem)
        Parameters:
        anabOrderItem -
        Returns:
        Integer
      • getShippingOffset

        public static java.lang.Integer getShippingOffset(java.lang.Long anItemSpecId,
                                                          java.lang.Integer anFuflillmentCenterId,
                                                          java.lang.Integer nStoreId)
                                                   throws java.sql.SQLException
        Parameters:
        anItemSpecId -
        anFuflillmentCenterId -
        nStoreId -
        Returns:
        Integer
        Throws:
        java.sql.SQLException
      • getStoreId

        public java.lang.Integer getStoreId()
        getStoreId
        Returns:
        java.lang.Integer
      • IsBackorder

        public static boolean IsBackorder(OrderAccessBean anabOrder)
        Parameters:
        anabOrder -
        Returns:
        boolean
      • refresh

        public static void refresh(java.util.Enumeration enOrderItems)
        Parameters:
        enOrderItems -
      • resolveOrderItemShippingMode

        public static java.lang.Integer resolveOrderItemShippingMode(Item anOrderItemData,
                                                                     CommandContext anCmdContext)
                                                              throws java.sql.SQLException,
                                                                     ECSystemException
        Parameters:
        anOrderItemData -
        anCmdContext -
        Returns:
        Integer
        Throws:
        java.sql.SQLException
        ECSystemException
      • setCmdContext

        public void setCmdContext(CommandContext newCmdContext)
        Parameters:
        newCmdContext -
      • setOrderItemAllocationInfo

        public static void setOrderItemAllocationInfo(OrderItemAccessBean anabOrderItem,
                                                      java.lang.Integer anFulfillmentCenter,
                                                      java.lang.Integer anQtyAllocated,
                                                      java.lang.String astrInventoryStatus,
                                                      java.lang.String astrAvailTime)
                                               throws java.sql.SQLException
        Parameters:
        anabOrderItem -
        anFulfillmentCenter -
        anQtyAllocated -
        astrInventoryStatus -
        astrAvailTime -
        Throws:
        java.sql.SQLException
      • setStoreId

        public void setStoreId(java.lang.Integer newStoreId)
        Parameters:
        newStoreId -
      • unlockOrder

        public static void unlockOrder(java.lang.String strOrderId)
                                throws java.sql.SQLException
        Parameters:
        strOrderId -
        Throws:
        java.sql.SQLException
      • unlockOrders

        public void unlockOrders()
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • validlyAllocated

        public static boolean validlyAllocated(OrderAccessBean abOrder,
                                               StoreAccessBean anabStore)
                                        throws java.sql.SQLException
        Checks if all order items in an order are validly allocated.

        An order is validly allocated or backordered if for all of its order items, they meet the following condition. The quantity, fulfillment center, and shipping address are the same as when they were most recently allocated or backordered. And the allocations or backorders have not yet expired.
        Parameters:
        abOrder -
        anabStore -
        Returns:
        boolean
        Throws:
        java.sql.SQLException
      • getInventorySystem

        public static int getInventorySystem(java.lang.Integer storeId)
                                      throws ECSystemException
        This method gets the inventory system from the inventory system value of store access bean.
        Parameters:
        storeId - The store id.
        Returns:
        The value of inventory system.
        Throws:
        ECSystemException
      • findInventoryAccessBean

        public static InventoryAccessBean findInventoryAccessBean(java.lang.Long catalogEntryId,
                                                                  java.lang.Integer fulfillmentCenterId,
                                                                  java.lang.Integer storeId)
                                                           throws ECSystemException
        This method gets the inventory access bean by specified catalog entry id, fulfillment center id and store id. If an Inventory item is not found in the store, it will search the related store to find a proper inventory item.
        Parameters:
        catalogEntryId - The catalog entry id.
        fulfillmentCenterId - The fulfillment center id.
        storeId - The store id.
        Returns:
        The inventory access bean of the catalog entry. If no inventory item is find, return null.
        Throws:
        ECSystemException
      • getSQLStatementSegmentSize

        public static java.lang.String getSQLStatementSegmentSize()
        This method returns the statement segment size if supplied, it is configured in instance xml: <Inventory SQLStatementSegmentSize="100"/>
        Returns:
        null if segment size is not supplied, it is also the default configuraton. else returns a string value as supplied.
      • mergeOrderItems

        public static java.util.Hashtable mergeOrderItems(java.util.Hashtable ahsMergeSource,
                                                          java.util.Hashtable ahsMergeFilter,
                                                          boolean mergeDifferentCorrelationGroups)
                                                   throws javax.ejb.RemoveException,
                                                          ECException,
                                                          java.sql.SQLException
        Merges all order items from the ahsMergeSource which have the same properties as order items in the ahsMergeFilter When mergeDifferentCorrelationGroups is set to 'true' consider order items with different correlation id for the merge
        Parameters:
        ahsMergeSource -
        ahsMergeFilter -
        mergeDifferentCorrelationGroups -
        Returns:
        Hashtable of merged order items
        Throws:
        javax.ejb.RemoveException
        ECException
        java.sql.SQLException
      • removeAllocatedOrderItems

        public static void removeAllocatedOrderItems(java.util.Hashtable ahsOrderItems)
        This method is to remove all of allocated order items.
        Parameters:
        ahsOrderItems -
      • getParentOrderItem

        public static OrderItemAccessBean getParentOrderItem(java.util.Hashtable ahsOrderItems,
                                                             OrderItemAccessBean anabDefaultParentOrderItem)
        Find parent order item, i.e., order item with the correlation id the same as order item id. If such an item does not exist, return the default passed in as a second parameter.
        Parameters:
        ahsOrderItems -
        anabDefaultParentOrderItem -
        Returns:
        OrderItemAccessBean