If the condition of the quest is to "Produce items", it means that you will need to produce new items.

For example:


If you had already started producing Denim in the Textile Factories before you actually got the quest, that Denim won't count. You will need to collect it and then start producing Denim again, because in this case it's the whole process that counts, not the result.

An opposite example:


Since Planks are actual items (unlike Denim, they are actually stored in your inventory), having them prepared beforehand will work. If you're producing actual collectible items and they don't count toward a quest, make sure that you don't use anywhere else: see this article for main reasons why players go missing their items.

There is also another possible reason for the items not counting in a quest: during long-term gaming sessions the game can disconnect from the server and your profits may stop being registered. To resolve this issue, simply reload the game and check if you can collect the necessary items from the buildings again.
To avoid this problem, reload the game every 20-30 minutes.