Find a Hobby
Writing is something I love. It is also something I really, really enjoy. And while those seem like the same thing, they're really not, and here's why.
When you have a job doing something that you love, you feel more content, do better work, take greater pride in what you do, and just all around feel good. Unfortunately, just doing what you love won't stop the mundane from trickling in. For example, if an IT tech loves working with computers, they'll enjoy the computer aspect of their job, but if they don't love working with people (especially stupid people) then even that tec's love of IT will slowly become strained. It's the same with writing.
If you plan to make a living on being a writer--and, let's face it, most of us do--then you need to find something to do when you don't love your job. What I mean by that is, just sitting down to work on a story doesn't make the story magically fall perfectly into place. There's a lot of plotting and planning and writing and revising that goes into making a good story great and, a lot of the time, just when you think you've got it perfect you realize that you wrote "thirty" the first time "and thirty-five" every time after, and while that may seem like only a simple word-exchange is necessary, you quickly realize that it's actually a very big deal and will change the entire course of your story because it was supposed to be thirty but by writing thirty-five later you inadvertently changed the entire flow of the story and now both the thirty and the thirty-five are in-extractable from the text and you realize you'll have to write the entire thing over again from the beginning.
It's times like these that you need to just walk away. Not forever, obviously, but at least for a breather. Because as much as you love writing, in moments like that, there is nothing you could possibly enjoy less. So go find something you do enjoy. Join a sports team, start painting (I do this despite being absolutely terrible), take up bird watching or cloud watching or fishing. Just do something that is not work.
My favorite thing to do when I'm really frustrated is writing fanfiction.
"But you just said to stay away from writing!"
No, I said to stay away from work. Fanfiction involves writing, but it's a passtime; a hobby. It's something I do to unwind and have some fun. Because despite everything, I really love writing. But even more than that, I really, really enjoy it. So the fact that my work and my hobby employ the same basic idea is perfectly acceptable. So long as I'm not writing work I'm still able to re-find my focus, realize that my mistake wasn't actually the huge, earth-shattering event I thought it was, and get back to enjoying what I do.
So, that being said: go play, have fun, enjoy yourself, and then get back to work.