Welcome to the chronic pain forum of Healing Well. It's very common for pain management doctors to require a pain contract, and as part of that it's often stated that you must use one pharmacy. Did you have a contract with your first doctor? Or the new one? If not, then your explanation, especially with the proof from the pharmacies, should in theory have been honored. But if you had a pain contract with one or both, it could have been in violation of the contract. Sadly all this is part of the process for most of us.
Do you have other PM doctors you can choose from on your insurance? If not, you might try writing to your first doctor and explaining what happened, and asking if he/she could help intervene for you. This may be needed even if you go to another doctor, because they will usually get your records from all other pm docs. Try to see if you can get this straightened out as soon as possible so the paper trail doesn't go on too long. Let us know if you had a pain contract, and what it said. That, to me, makes a huge difference.
It's frustrating, to say the least, but at least you've found a great site for support and understanding about all of this.