Class MrpServices


  • public class MrpServices
    extends java.lang.Object
    Services for running MRP
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String module  
      static java.lang.String resource  
    • Constructor Summary

      Constructors 
      Constructor Description
      MrpServices()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Map<java.lang.String,​java.lang.Object> executeMrp​(DispatchContext ctx, java.util.Map<java.lang.String,​? extends java.lang.Object> context)
      Launch the MRP.
      static java.math.BigDecimal findProductMrpQoh​(java.lang.String mrpId, java.lang.String productId, java.lang.String facilityId, LocalDispatcher dispatcher, Delegator delegator)  
      static java.math.BigDecimal findProductMrpQoh​(java.lang.String mrpId, GenericValue product, java.lang.String facilityId, LocalDispatcher dispatcher, Delegator delegator)
      Find the quantity on hand of products for MRP.
      static java.util.Map<java.lang.String,​java.lang.Object> initMrpEvents​(DispatchContext ctx, java.util.Map<java.lang.String,​? extends java.lang.Object> context)  
      static void logMrpError​(java.lang.String mrpId, java.lang.String productId, java.lang.String errorMessage, Delegator delegator)  
      static void logMrpError​(java.lang.String mrpId, java.lang.String productId, java.sql.Timestamp eventDate, java.lang.String errorMessage, Delegator delegator)  
      static void processBomComponent​(java.lang.String mrpId, GenericValue product, java.math.BigDecimal eventQuantity, java.sql.Timestamp startDate, java.util.Map<java.lang.String,​java.lang.Object> routingTaskStartDate, java.util.List<BOMNode> listComponent)
      Process the bill of material (bom) of the product to insert components in the MrpEvent table.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • module

        public static final java.lang.String module
    • Constructor Detail

      • MrpServices

        public MrpServices()
    • Method Detail

      • initMrpEvents

        public static java.util.Map<java.lang.String,​java.lang.Object> initMrpEvents​(DispatchContext ctx,
                                                                                           java.util.Map<java.lang.String,​? extends java.lang.Object> context)
      • findProductMrpQoh

        public static java.math.BigDecimal findProductMrpQoh​(java.lang.String mrpId,
                                                             GenericValue product,
                                                             java.lang.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 java.math.BigDecimal findProductMrpQoh​(java.lang.String mrpId,
                                                             java.lang.String productId,
                                                             java.lang.String facilityId,
                                                             LocalDispatcher dispatcher,
                                                             Delegator delegator)
      • logMrpError

        public static void logMrpError​(java.lang.String mrpId,
                                       java.lang.String productId,
                                       java.lang.String errorMessage,
                                       Delegator delegator)
      • logMrpError

        public static void logMrpError​(java.lang.String mrpId,
                                       java.lang.String productId,
                                       java.sql.Timestamp eventDate,
                                       java.lang.String errorMessage,
                                       Delegator delegator)
      • processBomComponent

        public static void processBomComponent​(java.lang.String mrpId,
                                               GenericValue product,
                                               java.math.BigDecimal eventQuantity,
                                               java.sql.Timestamp startDate,
                                               java.util.Map<java.lang.String,​java.lang.Object> routingTaskStartDate,
                                               java.util.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 id
        product - GenericValue oject of the product
        eventQuantity - the product quantity needed
        startDate - the startDate of the productionRun which will used to produce the product
        routingTaskStartDate - Map with all the routingTask as keys and startDate of each of them
        listComponent - a List with all the components
      • executeMrp

        public static java.util.Map<java.lang.String,​java.lang.Object> executeMrp​(DispatchContext ctx,
                                                                                        java.util.Map<java.lang.String,​? extends java.lang.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.