My Truck died!

Ok here it is....I need your help. My truck has been giving me issues for quite awhile. I have a 1997 Dodge Ram 2500 extended cab. 5.9 gas with AT. Codes only give a list of cylinder misfires of which it is all 8. It has been shutting off and will not start for a year or more but far worse. If I spray gas through the air cleaner it will fire up until the gas is burned up. If it sits a while it will fire up and run. But lately... almost everyday it will shut off at some point. I found if I tap on the computer with a small rubber mallet it will fire up and go again. Maybe until the next day or whenever. I have replaced the fuel pump and all sensors and whatnot. Last night in a 10 mile trip it shut off probably 20 times. I struggled to make it home. Each time I had to tap on the computer. It may run 1 minute or maybe for 3 or 4 miles. I NEED this truck! Right now it is my only mode of transportation (besides my motorcycle and it is raining everyday practically) I plan on taking tomorrow off. Do you think it is a computer? As I said reading the codes does nothing all it says is misfire on all 8 cylinders. I can go to a pull it yard. But what years will work? And does it have to be the 5.9 or will the computer for the 318 be the same. I know I will get the answer here. Thanks!