Budget?
What level of programming are you talking about?
There are devices like this which can do most anything if you are prepared to code most every aspect of your application using something like Microsoft Visual Studio.
[Link: comfiletech.com]They also have simpler devices that can be programmed using Basic and/or Ladder Logic.
[Link: comfiletech.com]