【道岔转动联动处理】
This commit is contained in:
parent
8764511650
commit
389f393a7d
|
@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class CiSwitchControlService {
|
||||
|
@ -97,21 +98,27 @@ public class CiSwitchControlService {
|
|||
*/
|
||||
public boolean turn(Simulation simulation, Switch aSwitch) {
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
boolean isRP;
|
||||
if (vrSwitch.getCommand() != null) {
|
||||
switch (vrSwitch.getCommand()) {
|
||||
case NP:
|
||||
return this.turn2ReversePosition(simulation, aSwitch);
|
||||
case RP:
|
||||
return this.turn2NormalPosition(simulation, aSwitch);
|
||||
}
|
||||
isRP = vrSwitch.getCommand().equals(VirtualRealitySwitch.Operation.RP);
|
||||
} else {
|
||||
if (vrSwitch.isPosN()) {
|
||||
return this.turn2ReversePosition(simulation, aSwitch);
|
||||
} else if (vrSwitch.isPosR()) {
|
||||
return this.turn2NormalPosition(simulation, aSwitch);
|
||||
isRP = vrSwitch.isPosR();
|
||||
}
|
||||
if (simulation.getRepository().getConfig().isSwitchNRTurnChain()) {
|
||||
Switch linkedSwitch = aSwitch.queryLinkedSwitch();
|
||||
if (Objects.nonNull(linkedSwitch)) {
|
||||
if (isRP) {
|
||||
this.turn2NormalPosition(simulation, linkedSwitch);
|
||||
} else {
|
||||
this.turn2ReversePosition(simulation, linkedSwitch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.turn2NormalPosition(simulation, aSwitch);
|
||||
if (isRP) {
|
||||
return this.turn2NormalPosition(simulation, aSwitch);
|
||||
} else {
|
||||
return this.turn2ReversePosition(simulation, aSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue