The Okuma MTconnect adapter usually does a great job of counting parts properly by counting the number of times a part program is run. Usually a good part count requires no added work, M-codes or macros. If your machine is not counting properly, it may just need a software update.
In some rare cases, the machine may not count properly. if this is the case you can increment a common variable on the machine control to count parts instead.
1) Open up the MTConnect application on your machine's control.
2) Open up the "device configuration page"
3) Select what variable(s) you would like to use for part count
4) Increment the variable in you part program, just before the end of the program.
5) Let us know what variable you are using by giving us a call or opening a support ticket.