Arduino UNO R3 using two outputs dependent to different inputs

See if you can follow what this code does. I can't test it, it does compile with your code.

bool okToPump = true;

// initial state of pump 2. call from setup()
void setupPump()
{
  bool ohTankFull = digitalRead(ohtankfull);
  bool ohTankLow = !digitalRead(ohtanklow);

// initial 2nd pump ON or OFF?

  if (!ohTankFull && ohTankLow) okToPump = true;
}

void pumpTwoControl()
{
// check the destination state

  bool ohTankFull = digitalRead(ohtankfull);
  bool ohTankLow = !digitalRead(ohtanklow);

  if (ohTankFull)
    okToPump = false;

  if (ohTankLow)
    okToPump = true;

// check the source
    
  bool tankOK = digitalRead(tankempty);

// set the pump on or off

  digitalWrite(motorUpPin, okToPump && tankOK);
}

Call setupPump() from setup().

Call pumpTwoControl where your current if/else thing is for the second pump.

It will turn on or off the motorUpPin controlled pump.

The wokwi I posted #17 shows the nature of the filling until and so forth. The above is more like closer to ready to go so see if you can give it a spin. I have no pumps.

a7