| | |
| | | import com.zy.core.action.ForkLiftAction; |
| | | import com.zy.core.action.ShuttleAction; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.ForkLiftIoModeType; |
| | | import com.zy.core.enums.ForkLiftProtocolStatusType; |
| | | import com.zy.core.enums.ForkLiftTaskModeType; |
| | | import com.zy.core.enums.RedisKeyType; |
| | |
| | | if (this.forkLiftProtocol.getTaskNo() == null |
| | | || this.forkLiftProtocol.getProtocolStatus() == null |
| | | || this.forkLiftProtocol.getModel() == null |
| | | || this.forkLiftProtocol.getErrorCode() == null |
| | | ) { |
| | | return false; |
| | | } |
| | |
| | | boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id |
| | | && this.forkLiftProtocol.getWrkNo() == 0 |
| | | && this.forkLiftProtocol.getTaskNo() == 0 |
| | | && this.forkLiftProtocol.getModel() == 2; |
| | | && this.forkLiftProtocol.getModel() == 2 |
| | | && this.forkLiftProtocol.getErrorCode() == 0 |
| | | ; |
| | | return res; |
| | | } |
| | | |
| | |
| | | if (this.forkLiftProtocol.getTaskNo() == null |
| | | || this.forkLiftProtocol.getProtocolStatus() == null |
| | | || this.forkLiftProtocol.getModel() == null |
| | | || this.forkLiftProtocol.getErrorCode() == null |
| | | ) { |
| | | return false; |
| | | } |
| | | |
| | | boolean res = this.forkLiftProtocol.getProtocolStatus() == ForkLiftProtocolStatusType.IDLE.id |
| | | && this.forkLiftProtocol.getWrkNo() == 0 |
| | | && this.forkLiftProtocol.getModel() == 2; |
| | | && this.forkLiftProtocol.getModel() == 2 |
| | | && this.forkLiftProtocol.getErrorCode() == 0 |
| | | ; |
| | | return res; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean switchIOMode(ForkLiftIoModeType type) { |
| | | OperateResult result = siemensS7Net.Write("DB103.12", type.id.shortValue()); |
| | | if (result.IsSuccess) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public int generateDeviceTaskNo(int taskNo, ForkLiftTaskModeType type) { |
| | | return taskNo; |
| | | } |
| | | |
| | | @Override |
| | | public List<ForkLiftCommand> getPickAndPutCommand(Integer taskNo, Integer pick, Integer put) { |
| | | Integer realPick = pick % 1000; |
| | | Integer realPut = put % 1000; |
| | | |
| | | List<ForkLiftCommand> commands = new ArrayList<>(); |
| | | ForkLiftCommand command = new ForkLiftCommand(); |
| | | command.setLiftNo(slave.getId()); |
| | | command.setTaskNo(taskNo.shortValue()); |
| | | command.setMode(ForkLiftTaskModeType.PICK_PUT.id.shortValue()); |
| | | command.setPick(pick.shortValue()); |
| | | command.setPut(put.shortValue()); |
| | | command.setPick(realPick.shortValue()); |
| | | command.setPut(realPut.shortValue()); |
| | | command.setConfirm((short) 1); |
| | | |
| | | commands.add(command); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ForkLiftCommand> getShuttleSwitchCommand(Integer taskNo, Integer originLev, Integer targetLev) { |
| | | public List<ForkLiftCommand> getShuttleSwitchCommand(Integer taskNo, Integer pick, Integer put) { |
| | | Integer realPick = pick % 1000; |
| | | Integer realPut = put % 1000; |
| | | |
| | | List<ForkLiftCommand> commands = new ArrayList<>(); |
| | | ForkLiftCommand command = new ForkLiftCommand(); |
| | | command.setLiftNo(slave.getId()); |
| | | command.setTaskNo(taskNo.shortValue()); |
| | | command.setMode(ForkLiftTaskModeType.SHUTTLE_SWITCH.id.shortValue()); |
| | | command.setPick(originLev.shortValue()); |
| | | command.setPut(targetLev.shortValue()); |
| | | command.setPick(realPick.shortValue()); |
| | | command.setPut(realPut.shortValue()); |
| | | command.setConfirm((short) 1); |
| | | |
| | | commands.add(command); |