Daimler has said it will lay off 18,000 workers for several months at its German truck plants.