At Deft Flux, we are often asked how users might customize the Epicor MES menu. For example, a company may want to allow all employees who use MES to access the PO Tracker. The empty buttons in the standard MES menu are not created to readily call new programs, so the path to customize the menu buttons is not obvious. We will step through one method of customization:
- Copy the Epicor <environment> MES menu item and rename it to Epicor <environment> MESC.
- Edit the properties of the new menu item and change the -MES at the end of the command line to -MESC.
public class Script
{
// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
// Begin Wizard Added Module Level Variables **
// End Wizard Added Module Level Variables **
// Add Custom Module Level Variables Here **
public void InitializeCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
// Begin Wizard Added Variable Initialization
this.btnPOTracker.Click += new System.EventHandler(this.btnPOTracker_Click);
this.MESControl_Column.ColumnChanging += new DataColumnChangeEventHandler(this.MESControl_BeforeFieldChange);
// End Wizard Added Variable Initialization
// Begin Wizard Added Custom Method Calls
// End Wizard Added Custom Method Calls
}
public void DestroyCustomCode()
{
// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
// Begin Wizard Added Object Disposal
this.btnPOTracker.Click -= new System.EventHandler(this.btnPOTracker_Click);
this.MESControl_Column.ColumnChanging -= new DataColumnChangeEventHandler(this.MESControl_BeforeFieldChange);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void btnPOTracker_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
ProcessCaller.LaunchForm(oTrans, "PMGO2002");
}
private void MESControl_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "LoggedIn":
btnPOTracker.Enabled = !(bool)args.Row["LoggedIn"];
break;
}
}
private void MESMenu_Load(object sender, EventArgs args)
{
// Add Event Handler Code
btnPOTracker.Enabled = false;
}
}
Now, when you run the custom version of the MES menu, you should have the custom PO tracker button, and it should only be enabled when an employee is logged in to MES. The problem we will have is that running MES in standard mode will still run the standard version. We need to tell Epicor to run our custom version of MES:
- Set the program to Epicor.Mfg.Menu.Mes.dll and set the Customization to the one we have just created (POTracker in our case).
- Set the Parent Menu Id to "PROCESS". This will remove the new menu item from Main Menu and place it under Processes. This menu is for processes that need to be called by other processes, but should not be on the main menu.