Class UOMUtil


  • public class UOMUtil
    extends Object
    Utility class for methods related to Unit of Measure functionality
    Author:
    Nono Carballo
    • Constructor Detail

      • UOMUtil

        public UOMUtil()
    • Method Detail

      • getDefaultAUMForDocument

        public static String getDefaultAUMForDocument​(String mProductId,
                                                      String documentTypeId)
        Get default AUM for a product in a given document
        Parameters:
        mProductId - The product Id
        documentTypeId - The document type id if the parent document
        Returns:
        The default AUM for the product for the given document
      • getDefaultAUMForSales

        public static String getDefaultAUMForSales​(String mProductId)
        Get default AUM for a product in a Sales Flow. Used when document does not have set document type.
        Parameters:
        mProductId - The product Id
        Returns:
        The default AUM for the product for the Sales Flow
      • getDefaultAUMForPurchase

        public static String getDefaultAUMForPurchase​(String mProductId)
        Get default AUM for a product in a Purchase Flow. Used when document does not have set document type.
        Parameters:
        mProductId - The product Id
        Returns:
        The default AUM for the product for the Purchase Flow
      • getDefaultAUMForLogistic

        public static String getDefaultAUMForLogistic​(String mProductId)
        Get default AUM for a product in Logistic Flow
        Parameters:
        mProductId - The Id of the product
        Returns:
        The default AUM to use in Logistic flow or Base UOM
      • getAvailableUOMsForDocument

        public static List<UOM> getAvailableUOMsForDocument​(String mProductId,
                                                            String docTypeId)
        Get all the available UOM for a product for a given document
        Parameters:
        mProductId - The product id
        docTypeId - The document type id if the parent document
        Returns:
        List of the available UOM
      • getConvertedQty

        public static BigDecimal getConvertedQty​(String mProductId,
                                                 BigDecimal qty,
                                                 String toUOM)
                                          throws OBException
        Computes base quantity based on alternative quantity
        Parameters:
        mProductId - The product
        qty - The alternative quantity
        toUOM - The UOM
        Throws:
        OBException
      • getConvertedAumQty

        public static BigDecimal getConvertedAumQty​(String mProductId,
                                                    BigDecimal qty,
                                                    String toUOM)
                                             throws OBException
        Computes alternative quantity based on base quantity
        Parameters:
        mProductId - The product
        qty - The base quantity
        toUOM - The UOM
        Throws:
        OBException
      • isUomManagementEnabled

        public static boolean isUomManagementEnabled()
        Returns if the UomManagement preference is enabled
        Returns:
        true if enabled, false otherwise
      • selectDefaultAUM

        public static FieldProvider[] selectDefaultAUM​(String productId,
                                                       String docTypeId)
        Returns a FieldProvider array containing the default AUM for a product in a given flow
        Parameters:
        productId - The product Id
        docTypeId - The document type Id
      • selectAUM

        public static FieldProvider[] selectAUM​(String productId,
                                                String docTypeId)
        Returns a FieldProvider array containing the available UOM for a product in a given flow
        Parameters:
        productId - The product Id
        docTypeId - The document type Id