This is basically similar to a LIMS integration. So much depends on your inspection machine. But i think you want to look at LIMS intergration. Then you can send an Idoc to the machine. The Machine can read the requirements and create an I-doc to send back with your results.
That's a simple overview but your requirement is probably going to way more extensive than a forum like this can give you.
You also need to talk to you machince provider. They might have done something like this for another clietn already and can help you.
Craig