Class BOMServices

java.lang.Object
org.apache.ofbiz.manufacturing.bom.BOMServices

public class BOMServices extends Object
Bills of Materials' services implementation. These services are useful when dealing with product's bills of materials.
  • Constructor Details

    • BOMServices

      public BOMServices()
  • Method Details

    • getMaxDepth

      public static Map<String,Object> getMaxDepth(DispatchContext dctx, Map<String,? extends Object> context)
      Returns the product's low level code (llc) i.e. the maximum depth in which the productId can be found in any of the bills of materials of bomType type. If the bomType input field is not passed then the depth is searched for all the bom types and the lowest depth is returned.
      Parameters:
      dctx - the dispatch context
      context - the context
      Returns:
      returns the product's low level code (llc) i.e. the maximum depth
    • updateLowLevelCode

      public static Map<String,Object> updateLowLevelCode(DispatchContext dctx, Map<String,? extends Object> context)
      Updates the product's low level code (llc) Given a product id, computes and updates the product's low level code (field billOfMaterialLevel in Product entity). It also updates the llc of all the product's descendants. For the llc only the manufacturing bom ("MANUF_COMPONENT") is considered.
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      the results of the updates the product's low level code
    • initLowLevelCode

      public static Map<String,Object> initLowLevelCode(DispatchContext dctx, Map<String,? extends Object> context)
      Updates the product's low level code (llc) for all the products in the Product entity. For the llc only the manufacturing bom ("MANUF_COMPONENT") is considered.
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      the results of the updates the product's low level code
    • searchDuplicatedAncestor

      public static Map<String,Object> searchDuplicatedAncestor(DispatchContext dctx, Map<String,? extends Object> context)
      Returns the ProductAssoc generic value for a duplicate productIdKey ancestor if present, null otherwise. Useful to avoid loops when adding new assocs (components) to a bill of materials.
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      returns the ProductAssoc generic value for a duplicate productIdKey ancestor if present
    • getBOMTree

      public static Map<String,Object> getBOMTree(DispatchContext dctx, Map<String,? extends Object> context)
      It reads the product's bill of materials, if necessary configures it, and it returns an object (see BOMTree and BOMNode) that represents a configured bill of material tree. Useful for tree traversal (breakdown, explosion, implosion).
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      return the bill of material tree
    • getManufacturingComponents

      public static Map<String,Object> getManufacturingComponents(DispatchContext dctx, Map<String,? extends Object> context)
      It reads the product's bill of materials, if necessary configures it, and it returns its (possibly configured) components in a List of BOMNode).
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      return the list of manufacturing components
    • getNotAssembledComponents

      public static Map<String,Object> getNotAssembledComponents(DispatchContext dctx, Map<String,? extends Object> context)
    • createShipmentPackages

      public static Map<String,Object> createShipmentPackages(DispatchContext dctx, Map<String,? extends Object> context)
    • getProductsInPackages

      public static Map<String,Object> getProductsInPackages(DispatchContext dctx, Map<String,? extends Object> context)
      It reads the product's bill of materials, if necessary configures it, and it returns its (possibly configured) components in a List of BOMNode).
      Parameters:
      dctx - the distach context
      context - the context
      Returns:
      returns the list of products in packages