Custom Business Logic

Custom Business Logic

Child MO – Check Available Inventory

You can add custom business logic (CBL) to MO Generator to control which subassemblies will have MOs created, and the quantity on those MOs, based on a calculation of Available Inventory.

By default, MO Generator creates an MO for each subassembly below the parent.  One use of the CBL would be to add your own calculation for whether or not there is enough inventory to meet the needed quantity, or to adjust the MO Quantity to meet a standard run quantity.

During the installation process, MO Generator creates a stored procedure in the Company Database called: wspMOGenInvenCheck.

NOTE: You should always keep a backup copy of your modifications, so you can easily re-apply your changes.  If changes are required to wspMOGenInvenCheck, the installation routine will drop the stored procedure and re-create it.

The default stored procedure does not contain any code, other than to always tell MO Generator that it should create an MO for the item as it normally would.

//willoware.com/wp-content/uploads/2016/10/MOGenCheckInven.png

A sample of the default stored procedure is shown above.  Your CBL should be added to the area show with the arrow (the existing two lines can be removed).

The input parameters are:

  • Parent MO Number
  • Child Item Number
  • Required Quantity (Parent MO Start Quantity * BOM Quantity).  If the Parent MO is for 10, and the BOM for the Parent Item requires 4-each of the Subassembly, the Required Quantity will be 40.

The output parameters are:

  • MakeIt (return 1 = make it, or 0 = do not make it)
  • MakeQty (return the quantity to build)

The net result of your CBL must be to set MakeIt to 1 (true = make the item) or 0 (false = do not make the item), and to set the Make Quantity.  By default the Make Quantity is set to the Required Quantity.

If items are rejected by wspMOGenInvenCheck they will be reported in the Error Report.  If the quantity returned is not valid for the Item (i.e. 10.25 is not valid if the Item has zero quantity decimals), it will be reported in the error log.

The default stored procedure does not contain any code, other than to always tell MO Generator that it should create an MO for the item as it normally would.

Child MO – Alternate Routing

You can add custom business logic (CBL) to MO Generator to control which Routing is used to when sub-assembly MOs are created.  By default, MO Generator always uses the Primary Routing for Child MOs.

During the installation process, MO Generator creates a stored procedure in the Company Database called: wspMOGenChildAltRouting.

The default stored procedure does not contain any functional code.  It just returns a blank Routing Name.  You can edit the stored procedure to return a Routing Name based on your business requirements.

//willoware.com/wp-content/uploads/2016/10/MOGenAltRoute.png

A sample of the default stored procedure is shown above.  Your CBL should be added to the area shown by the red arrow (the existing line can be removed).

The input parameters are:

  • ParentMO
  • ChildItem

The output parameter is:

  • Routing

Be default, the stored procedure returns nothing for the Routing, which will result in MOGen using the Primary Routing.

If the stored procedure returns an invalid Routing, it will be reported in the error log and MOGen will use the Primary Routing instead.