Automated Scan of MRP Log File

Andrew ClementsUtility

Over the last few months I have been frustrated by the lack of alerts from MRP when it encounters errors.

For example, there is an issue with the BOM on a part or a revision is unapproved.

I find myself manually opening up the log files and looking for errors and then letting the production planners know of any errors.

After a few week of doing this I decided to write console application in Visual Studio to automate this.

The console application is scheduled to run 6 hours after the regular run of MRP and two hours before the start of the working day.

The program is also set up  use the following MRP logging

The executable runs using the following values in the app.config file which define where the log files sit

Image

This isn’t the most detailed run through, but this is roughly how it works.

Typcially MRP is set to run on a schedule and generates a log file.

If MRP is run as the ‘manager’ user the log file is placed in the ‘C:\EpicorData\Log\manager’ directory.

Within the directory, you need to set up the following directory structure

This program takes the MRP001.log nd MRP002.log files, crawls through them and identifies any errors. Once it has finished, it moves the log files (except the main MRP.log), to the archive directory and appends any lines in the log files that contain ‘Error’ into a seperate file called mrperrors.log, with the timestamp appended to the mrperrors part of the file (e.g.¬†mrperrors20171110.txt).

The error file is then copied to the ‘errors’ directory and emailed to anyone in the ‘DistributionList’ in the app.config file.

The picture below shows the type of output you can expect

In the scenario above MRP will generate warehouse suggestions, but I just find this type of email prompt much more efficient.

A number of things could be done to make this more generic, so install it, use it and let me know what improvement you would like.

Cheers,

Andrew.