Conditional statement help

Seems like your rather over complicating it, if I'm understanding your logic you need keep something happening until it no longer needs it then go back and service the next thing. Pop the pin of the variable and keep that state till it's fulfilled.

So something like this:

if (digitalRead(S1) == LOW && curS == 0) {
\\ Do Stuff
curS = S1; // Locks us to S1 untill it's high
}
else if (digitalRead(S1) == HIGH && curS == S1 ) }
//Undo S1 Stuff
curS = 0; // This releases the lock 
}

Just repeat that block for as many input you have. Now I would say you should de-bounce the inputs and outputs as you do not want to cycle relays and solenoids at high frequencies you will break them.