A cocaine-addicted Wigan detective who stole drugs with a retail value of almost £400,000 from police stores and supplied them to criminals has been jailed for 19 years.