There is some serious problem in stomach of your dog causing pain in it. Do not waste time and take it to vet. It seems as if something is hurting it inside or outside the body. Check its whole body thoroughly because there can be a wound. May be it is suffering from infection like arteries infection. It can be arthritis as well if your dog has hurt its body joint and is moaning now.