I have a commutative unital ring $A$ and $A$-modules $M_1,\ldots,M_n$, $N_1,\ldots,N_n$ with $$M_1\oplus\cdots\oplus M_n\cong N_1\oplus\cdots\oplus N_n.$$ Are there any particular conditions on $A$ and/or the modules in question under which we know that there exists a permutation $\sigma\in S_n$ for which $M_i\cong N_{\sigma(i)}$ for all $i$?
The specific example that motivated this question concerns the case where $A$ is a discrete valuation ring with irreducible element $p\in A$ and $$A/p^{k_1}A\oplus\cdots\oplus A/p^{k_n}A\cong A/p^{m_1}A\oplus\cdots\oplus A/p^{m_n}A.$$