Some of my villagers just will not restock. I first encountered this when one of my farmers got stuck in a cow pen I made. I turns out that since the fence was right next to terrain they just walk into the pen from above. I sold some wheat to him until he was out of stock and even now that he is out of the pen for a while he has not restocked. I waited many Minecraft days but he did not restock so I just got another villager to sell my wheat to. This recently happened again but with my blacksmith when I made the same mistake and he got stuck in my sheep pen. Whilst he was in there I bought some diamond axes so I could level him up and once he ran out I went away. Later I can back to get him out and now the same problem has happened where he has not been restocking the diamond axes. Please not I do not know if he does not restock the other trades because in the farm's case I am only using him to sell wheat and no other item. For the blacksmith it cost me 17 emeralds (sometimes 13 during discounts) for 1 diamond axe with efficiency I already on it. It makes the best trade to just buy the axe with emeralds and it gives him alot of xp. Please tell me the cause, solution and how to prevent it in the future. Here are the screenshots:
Edit: It seemed to be fixed when I destroyed the grindstone and replaced I am front of my original blacksmith the con being that he was no where near the blacksmith building so I still need a way to get him to his original place to work.