Scheduling MOGenerator

Overview

MOGenerator provides a number of useful Manufacturing integration utilities, such as the ability to create MOs, reschedule MOs, create child-MOs, and receive MOs.  Collectively these utilities will be referred to as MOGen in this post.

MOGen can be run manually, where it runs one time and processes all available records in the integration tables, and then stops.  Or, it can be run continuously.  When running continuously, it periodically polls the integration tables to see if there is anything to process.

When MOGen is part of a system integration, a common need is to have it run automatically on an unattended machine.  The steps below describe how a GP client can be configured to launch automatically everyday, run MOGen during business hours, then shut down.  The benefits of this process are that it ensures no GP clients remain connected to the SQL server during maintenance periods, and it provides for regular “refreshing” of the GP client (which tends to run better if it is regularly restarted).

 

Configuring MOGen

See the MOGen documentation for more information about this window.

All of the Timer settings are saved automatically, and reload when each time the window is opened.

The Timer must be ENABLED.

Stop After x-Hours.  Enter the number of hours the utility should run before it shuts down.  For example, 10-hours would calculate an end time 10-hours in the future from the moment the IMPORT button is clicked.

Close GP When Done.  MARK this box.  The macro discussed below will launch MOGen, when the stop time is reached, MOGen will stop processing and close GP.

If the utility will run overnight, add this setting to the DEX.INI file:

SuppressChangeDateDialog=TRUE

This setting keeps GP from popping the “Do you want to change the date” dialog at midnight.

Login Macro

The Login Macro will be used by Windows Scheduler to launch and log-in to Dynamics GP.  It then opens MOGen and clicks the Import button.

There are a few import sections of the macro.

The logging file entry:

Using a logging file keeps GP from popping up a dialog box when the macro finishes running.  The dialog box would interfere with MOGen, and also prevent GP from closing.  Set the path name to an appropriate location for your system.  A good place is in the GP\Data folder.

Username and password:

The Username and password are in plain text.

Selecting the company:

Edit the macro so that the “item 1” line selects the correct company from your login window:

As shown above “item 1” corresponds to “Fabrikam”, and “item 3” corresponds to “ZArchive”.

Download the MOGen login macro text file at the link below.  After downloading the file, change the extension to “.mac”.  Save the file into the GP Program folder, in the same location as DYNAMICS.EXE.

GPLoginMacroMOGen

Windows Scheduler

Use Windows Scheduler to create a Basic Task to “Start a program”.

The Program/Script is the path to DYNAMICS.EXE, such as

“c:\Program Files (x86)\Microsoft Dynamics\GP2016\DYNAMICS.EXE”

In the Add Argument field, enter:

DYNAMICS.SET GPLoginMacroMOGen.mac

Set up the Task Schedule as desired.  The frequency with which the Task runs must be coordinated with the Timer Settings on MOGen to prevent launching GP before MOGen has closed GP from the previous run.

 

Monitoring MOGen

MOGen updates a record in a “heartbeat” table every time it runs.  So if MOGen is set to run once every 15 minutes, the heartbeat will be updated every 15 minutes.   The heartbeat table can be monitored to see if MOGen is still running–if it has quit updating the date/time stamp, it has quit running.

See the MOGen documentation for more information about monitoring MOGen remotely.