Soliton, Wronskian and Grammian solutions to the generalized (3+1)-dimensional KP equation