Criterion for a locally factorial domain Let $R$ be a Noetherian domain. Recall that $R$ is said to be locally factorial if $R_\mathfrak p$ is factorial for all prime ideals $\mathfrak p\subset R$. How do I show that $R$ is locally factorial iff every height one prime ideal in $R$ is a locally free $R$-module of rank one?
Update: Let me make this question more specific.
I think I figured out how to prove that 'locally factorial' implies 'locally principal'. So the question is how to prove the converse. What is written below is inspired by Proposition 19.22 from here.
Suppose every height one prime in $R$ is a locally free $R$-module of rank one. Let $Q$ be such a prime. The ring $(R_Q, QR_Q)$ is then a Noetherian local domain. Furthermore, because $Q$ is a locally free module of rank $1$, the maximal ideal $QR_Q=Q_Q$ is principal. There is a theorem (Theorem 17.19) saying that for a one-dimensional Noetherian local domain with maximal ideal $m$, the condition that $m$ be principal is equivalent to the condition that $R$ be a PID. I guess I have to use this result. But what I don't understand is why $R_Q$ has Krull dimension one. Moreover, even if one applies this theorem, one only proves that $R_Q$ is a UFD for height one primes. But how to establish this for all primes?
 A: The following two results are taken from section 3 of [CDZ]. They characterize
locally factorial domains generally.
Lemma 3.1 An integral domain $D$ is factorial if and only if every
minimal prime of a nonzero principal ideal of $D$ is principal.
Proof. Indeed, as a principal ideal is invertible and hence $t$-invertible,
by Kang's result, $D$ is Krull and as in a Krull domain the minimal primes
of nonzero principal ideals are of height one we have a Krull domain whose
height one primes are all principal which is a UFD. The converse is obvious.
Using Lemma 3.1. we can state the following characterization of locally
factorial domains.
Proposition 3.2. An integral domain $D$ is locally factorial if and only if
every minimal prime of a nonzero principal ideal is is locally principal.
Proof. Let $D$ be locally factorial and let $P$ be a minimal prime of a
nonzero principal ideal of $D$. Then for any maximal ideal $M,$ $PD_{M}$ is
a minimal prime of a nonzero principal ideal of $D_{M}$ and hence principal
if $P\subseteq M,$ otherwise $PD_{M}=D_{M}.$ Thus every minimal prime of a
principal ideal is locally principal. Conversely suppose that every minimal
prime of every principal ideal is locally principal and let $M$ \ be a
maximal ideal of $D.$ Now let $\mathcal{P}$ be a minimal prime of a
principal ideal of $D_{M}.$ Then it is easy to see that $\mathcal{P}$ $%
=PD_{M}$ where $P$ is a minimal prime of a principal ideal. But then $PD_{M}$
is principal and so is $\mathcal{P}.$ As $\mathcal{P}$ is arbitrary we
conclude, by Lemma 3.1$,$ that $D_{M}$ is factorial.
The Noetheran locally factorial domain is a special case and in a Noetheran
domain every minimal prime of a principal ideal is of height one and of
course in any integral domain a height one prime ideal is a minimal prime of
a principal ideal.
[CDZ] Gyu Whan Chang, Tiberiu Dumitrescu and Muhammad
Zafrullah, Locally GCD domains and the ring $D+XD_{S}[X],$ 42(2016), 263-284.
Note. User 26857 commented (and then deleted the comment) in another context that Lemma 3.1 follows from Kaplansky's theorem on UFD's. A lot of results do, but what we get from "misusing" Kaplansky is a general criterion. User 26857 didn't. To see that the readers may look up section 3 of [CDZ]. 
