Class MrpServices
java.lang.Object
org.apache.ofbiz.manufacturing.mrp.MrpServices
Services for running MRP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecuteMrp
(DispatchContext ctx, Map<String, ? extends Object> context) Launch the MRP.static BigDecimal
findProductMrpQoh
(String mrpId, String productId, String facilityId, LocalDispatcher dispatcher, Delegator delegator) static BigDecimal
findProductMrpQoh
(String mrpId, GenericValue product, String facilityId, LocalDispatcher dispatcher, Delegator delegator) Find the quantity on hand of products for MRP.initMrpEvents
(DispatchContext ctx, Map<String, ? extends Object> context) static void
logMrpError
(String mrpId, String productId, String errorMessage, Delegator delegator) static void
logMrpError
(String mrpId, String productId, Timestamp eventDate, String errorMessage, Delegator delegator) static void
processBomComponent
(String mrpId, GenericValue product, BigDecimal eventQuantity, Timestamp startDate, Map<String, Object> routingTaskStartDate, List<BOMNode> listComponent) Process the bill of material (bom) of the product to insert components in the MrpEvent table.
-
Constructor Details
-
MrpServices
public MrpServices()
-
-
Method Details
-
initMrpEvents
-
findProductMrpQoh
public static BigDecimal findProductMrpQoh(String mrpId, GenericValue product, String facilityId, LocalDispatcher dispatcher, Delegator delegator) Find the quantity on hand of products for MRP.- PreConditions : none
- Result : We get the quantity of product available in the stocks.
- Parameters:
product
- the product for which the Quantity Available is required- Returns:
- the sum of all the totalAvailableToPromise of the inventoryItem related to the product, if the related facility is Mrp available (not yet implemented!!)
-
findProductMrpQoh
public static BigDecimal findProductMrpQoh(String mrpId, String productId, String facilityId, LocalDispatcher dispatcher, Delegator delegator) -
logMrpError
-
logMrpError
-
processBomComponent
public static void processBomComponent(String mrpId, GenericValue product, BigDecimal eventQuantity, Timestamp startDate, Map<String, Object> routingTaskStartDate, List<BOMNode> listComponent) Process the bill of material (bom) of the product to insert components in the MrpEvent table. Before inserting in the entity, test if there is the record already existing to add quantity rather to create a new one.- Parameters:
mrpId
- the mrp idproduct
- GenericValue oject of the producteventQuantity
- the product quantity neededstartDate
- the startDate of the productionRun which will used to produce the productroutingTaskStartDate
- Map with all the routingTask as keys and startDate of each of themlistComponent
- a List with all the components
-
executeMrp
public static Map<String,Object> executeMrp(DispatchContext ctx, Map<String, ? extends Object> context) Launch the MRP.- PreConditions : none
- Result : The date when we must order or begin to build the products and subproducts we need are calculated
- INPUT : parameters to get from the context:
- String mrpName
- OUTPUT : Result to put in the map :
- none
- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input parameters, productId routingId, quantity, startDate.- Returns:
- Map with the result of the service, the output parameters.
-