Package org.openbravo.materialmgmt
Class UOMUtil
- java.lang.Object
-
- org.openbravo.materialmgmt.UOMUtil
-
public class UOMUtil extends Object
Utility class for methods related to Unit of Measure functionality- Author:
- Nono Carballo
-
-
Field Summary
Fields Modifier and Type Field Description static String
FIELD_PROVIDER_ID
static String
FIELD_PROVIDER_NAME
static String
UOM_PRIMARY
-
Constructor Summary
Constructors Constructor Description UOMUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<UOM>
getAvailableUOMsForDocument(String mProductId, String docTypeId)
Get all the available UOM for a product for a given documentstatic BigDecimal
getConvertedAumQty(String mProductId, BigDecimal qty, String toUOM)
Computes alternative quantity based on base quantitystatic BigDecimal
getConvertedQty(String mProductId, BigDecimal qty, String toUOM)
Computes base quantity based on alternative quantitystatic String
getDefaultAUMForDocument(String mProductId, String documentTypeId)
Get default AUM for a product in a given documentstatic String
getDefaultAUMForLogistic(String mProductId)
Get default AUM for a product in Logistic Flowstatic String
getDefaultAUMForPurchase(String mProductId)
Get default AUM for a product in a Purchase Flow.static String
getDefaultAUMForSales(String mProductId)
Get default AUM for a product in a Sales Flow.static boolean
isUomManagementEnabled()
Returns if the UomManagement preference is enabledstatic FieldProvider[]
selectAUM(String productId, String docTypeId)
Returns a FieldProvider array containing the available UOM for a product in a given flowstatic FieldProvider[]
selectDefaultAUM(String productId, String docTypeId)
Returns a FieldProvider array containing the default AUM for a product in a given flowstatic FieldProvider[]
selectUOM(String productId)
-
-
-
Field Detail
-
UOM_PRIMARY
public static final String UOM_PRIMARY
- See Also:
- Constant Field Values
-
FIELD_PROVIDER_ID
public static final String FIELD_PROVIDER_ID
- See Also:
- Constant Field Values
-
FIELD_PROVIDER_NAME
public static final String FIELD_PROVIDER_NAME
- See Also:
- Constant Field Values
-
-
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 IddocumentTypeId
- 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 iddocTypeId
- 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 productqty
- The alternative quantitytoUOM
- 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 productqty
- The base quantitytoUOM
- 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 IddocTypeId
- 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 IddocTypeId
- The document type Id
-
selectUOM
public static FieldProvider[] selectUOM(String productId)
-
-