Class BOMTree
java.lang.Object
org.apache.ofbiz.manufacturing.bom.BOMTree
It represents an (in-memory) bill of materials (in which each
component is an BOMNode)
Useful for tree traversal (breakdown, explosion, implosion).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionBOMTree
(String productId, String bomTypeId, Date inDate, int type, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) Creates a new instance of BOMTree by reading the productId's bill of materials (upward or downward).BOMTree
(String productId, String bomTypeId, Date inDate, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) Creates a new instance of BOMTree by reading downward the productId's bill of materials (explosion). -
Method Summary
Modifier and TypeMethodDescriptioncreateManufacturingOrders
(String facilityId, Date date, String workEffortName, String description, String routingId, String orderId, String orderItemSeqId, String shipGroupSeqId, String shipmentId, GenericValue userLogin) It visits the in-memory tree that represents a bill of materials and it creates a manufacturing order for each of the nodes that needs to be manufactured.It visits the in-memory tree that represents a bill of materials and it collects all the productId it contains.Getter for property bomTypeId.Getter for property inDate.Gets input product.void
getProductsInPackages
(List<BOMNode> arr) Gets products in packages.getRoot()
Getter for property root.Getter for property rootAmount.Getter for property rootQuantity.boolean
It tells if the current (in-memory) tree representing a product's bill of materials is completely configured or not.void
print
(StringBuffer sb) It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the StringBuffer.void
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List.void
Print.void
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List.void
Print.void
setRootAmount
(BigDecimal rootAmount) Setter for property rootAmount.void
setRootQuantity
(BigDecimal rootQuantity) Setter for property rootQuantity.void
sumQuantities
(Map<String, BOMNode> quantityPerNode) It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the Map.
-
Field Details
-
EXPLOSION
public static final int EXPLOSION- See Also:
-
EXPLOSION_SINGLE_LEVEL
public static final int EXPLOSION_SINGLE_LEVEL- See Also:
-
EXPLOSION_MANUFACTURING
public static final int EXPLOSION_MANUFACTURING- See Also:
-
IMPLOSION
public static final int IMPLOSION- See Also:
-
-
Constructor Details
-
BOMTree
public BOMTree(String productId, String bomTypeId, Date inDate, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException Creates a new instance of BOMTree by reading downward the productId's bill of materials (explosion). If virtual products are found, it tries to configure them by running the Product Configurator.- Parameters:
productId
- The product for which we want to get the bom.bomTypeId
- The bill of materials type (e.g. manufacturing, engineering, ...)inDate
- Validity date (if null, today is used).delegator
- The delegator used.- Throws:
GenericEntityException
- If a db problem occurs.
-
BOMTree
public BOMTree(String productId, String bomTypeId, Date inDate, int type, Delegator delegator, LocalDispatcher dispatcher, GenericValue userLogin) throws GenericEntityException Creates a new instance of BOMTree by reading the productId's bill of materials (upward or downward). If virtual products are found, it tries to configure them by running the Product Configurator.- Parameters:
productId
- The product for which we want to get the bom.bomTypeId
- The bill of materials type (e.g. manufacturing, engineering, ...)inDate
- Validity date (if null, today is used).type
- if equals to EXPLOSION, a downward visit is performed (explosion); if equals to EXPLOSION_SINGLE_LEVEL, a single level explosion is performed; if equals to EXPLOSION_MANUFACTURING, a downward visit is performed (explosion), including only the product that needs manufacturing; if equals to IMPLOSION an upward visit is done (implosion);delegator
- The delegator used.- Throws:
GenericEntityException
- If a db problem occurs.
-
-
Method Details
-
getInputProduct
Gets input product.- Returns:
- the input product
-
isConfigured
public boolean isConfigured()It tells if the current (in-memory) tree representing a product's bill of materials is completely configured or not.- Returns:
- true if no virtual nodes (products) are present in the tree.
-
getRootQuantity
Getter for property rootQuantity.- Returns:
- Value of property rootQuantity.
-
setRootQuantity
Setter for property rootQuantity.- Parameters:
rootQuantity
- New value of property rootQuantity.
-
getRootAmount
Getter for property rootAmount.- Returns:
- Value of property rootAmount.
-
setRootAmount
Setter for property rootAmount.- Parameters:
rootAmount
- New value of property rootAmount.
-
getRoot
Getter for property root.- Returns:
- Value of property root.
-
getInDate
Getter for property inDate.- Returns:
- Value of property inDate.
-
getBomTypeId
Getter for property bomTypeId.- Returns:
- Value of property bomTypeId.
-
print
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the StringBuffer. Method used for debug purposes.- Parameters:
sb
- The StringBuffer used to collect tree info.
-
print
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List. Method used for bom breakdown (explosion/implosion).- Parameters:
arr
- The List used to collect tree info.initialDepth
- The depth of the root node.
-
print
Print.- Parameters:
arr
- the arrinitialDepth
- the initial depthexcludeWIPs
- the exclude wi ps
-
print
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the List. Method used for bom breakdown (explosion/implosion).- Parameters:
arr
- The List used to collect tree info.
-
print
Print.- Parameters:
arr
- the arrexcludeWIPs
- the exclude wi ps
-
sumQuantities
It visits the in-memory tree that represents a bill of materials and it collects info of its nodes in the Map. Method used for bom summarized explosion.- Parameters:
quantityPerNode
- The Map that will contain the summarized quantities per productId.
-
getAllProductsId
It visits the in-memory tree that represents a bill of materials and it collects all the productId it contains.- Returns:
- List containing all the tree's productId.
-
createManufacturingOrders
public String createManufacturingOrders(String facilityId, Date date, String workEffortName, String description, String routingId, String orderId, String orderItemSeqId, String shipGroupSeqId, String shipmentId, GenericValue userLogin) throws GenericEntityException It visits the in-memory tree that represents a bill of materials and it creates a manufacturing order for each of the nodes that needs to be manufactured.- Parameters:
facilityId
- the facility iddate
- the context dateworkEffortName
- the work effort namedescription
- the descriptionroutingId
- the routing idorderId
- the order idorderItemSeqId
- the order item idshipGroupSeqId
- the shipment group item idshipmentId
- the shipment id delegator useduserLogin
- the GenericValue object of userLogin- Returns:
- returns the work effort id
- Throws:
GenericEntityException
- If a db problem occurs.
-
getProductsInPackages
Gets products in packages.- Parameters:
arr
- the arr
-