Not sure if this helps, but always try to "pull" production from the end to the beginning. Let's say I want trousers with an image sewn on them. I'll start with the "sew cloth image" job of size N. At first I don't add conditions for this job. Make it a one off. Around the clothier's workshop I make a stockpile that can hold M trousers and M cloth. Do yourself a favour and don't use bins. M should be some factor of N. So if N is 100, the M could be 10 (1/10 the size of N). It depends on how fast you can fill the stockpiles. You goal is to make M as small as you can so that the stockpile is never empty during production.
Next, I make a job for "create pigtail cloth trousers" of size O. The 'r'eagent condition is O dyed pigtail cloth. You want a clothier's shop with a stockpile that contains more than O cloth. Normally O should be the number of trousers you can make in a day. Often I set it to 1 because I don't care if my shops are idle -- it gives my dwarfs time to multitask. The 'p'roduct condition should be M undecorated pigtail cloth trousers. The "undecorated" is important here. At first, don't try to automate the last step -- only the intermediate steps.
What's going to happen here is that when you start up, the trouser shop will realise that there aren't enough undecorated trousers and start making them. As soon as one gets hauled the to image sewing shop stockpile, it will have an image sewn on it. Eventually all the decorated trousers will be finished and you will be left with a stockpile with M undecorated trousers (which is why you want to keep M small). But this will stop the trouser factory from making more undecorated trousers. Later, when you decide to decorate more trousers, it will automatically start up again.
Do the same thing with you dye shop. You need M dyed pigtail cloth for the decorating and O dyed pigtail cloth for the trousers. So this means that you need a "dye pigtail cloth" job. For simplicity, let's make the job size O as well (in practice I tend to always use O=1). The 'r'eagent condition is O dyeable pigtail cloth (or whatever it is) and O unrotten dye containing powder (or whatever it is). Your 'p'roduct condition is O+M dyed pigtail cloth. Make stockpile near your dye shop just like the stockpile for the trouser shop.
Just keep going backwards for the loom, farmers workshop for the thread, mill for the dye, bags for the dye, cloth for the bags, thread for the cloth for the bags.
So in the end, you can make a "sew cloth image" job on the trouser decorating clothier for 100 trousers and it will automate everything you need for those 100 decorated trousers. At *that* point you can guestimate how many decorated trousers you need to stockpile in your fortress to get your masterpiece trousers with masterpiece images and set up an automation job for it. However, the more I play with this, the more I realise that I really only need this for mundane things like doors, beds, barrels, etc. If I'm going to make swords, armour, etc it's going to be a one off job. Setting up all of the intermediate stuff is great, though, because I can say "Make 10 steel swords" and it makes charcoal, smelts the ores, makes steel and then finally makes the swords -- all without having to keep large stockpiles of the intermediate goods.