Solving linear Diophantine systems via Polyhedral Omega and applications in optimization