| | |
| | | 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; |
| | |
| | | OutputQueue.FORKLIFT.offer(MessageFormat.format("【{0}】{1}读取货叉提升机状态信息失败", DateUtils.convert(new Date()), slave.getId())); |
| | | } |
| | | |
| | | OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB102.0", (short) 8); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < this.slave.getSta().size(); i++) { |
| | | ForkLiftSlave.Sta sta = this.slave.getSta().get(i); |
| | | if (forkLiftStaProtocols.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | ForkLiftStaProtocol forkLiftStaProtocol = forkLiftStaProtocols.get(i); |
| | | boolean[] status1 = siemensS7Net.getByteTransform().TransBool(result2.Content, i * 2, 2); |
| | | forkLiftStaProtocol.setHasTray(status1[0]); |
| | | forkLiftStaProtocol.setHasCar(status1[1]); |
| | | } |
| | | } |
| | | |
| | | if (System.currentTimeMillis() - forkLiftProtocol.getDeviceDataLog() > 1000 * 5) { |
| | | //采集时间超过5s,保存一次数据记录 |
| | | //保存数据记录 |
| | |
| | | array[3] = command.getPut();//放货数据 |
| | | OperateResult result = siemensS7Net.Write("DB103.0", array); |
| | | if (result.IsSuccess) { |
| | | OperateResult result2 = siemensS7Net.Write("DB103.16", command.getConfirm()); |
| | | OperateResult result2 = siemensS7Net.Write("DB103.8", command.getConfirm()); |
| | | if (result2.IsSuccess) { |
| | | response.setResult(true); |
| | | } |
| | |
| | | @Override |
| | | public CommandResponse reset() { |
| | | CommandResponse response = new CommandResponse(false); |
| | | OperateResult result = siemensS7Net.Write("DB103.20", (short) 1); |
| | | OperateResult result = siemensS7Net.Write("DB103.10", (short) 1); |
| | | if (result.IsSuccess) { |
| | | News.info("货叉提升机确认命令下发成功,提升机号={}", forkLiftProtocol.getLiftNo()); |
| | | response.setResult(true); |
| | | } |
| | | return response; |
| | |
| | | } |
| | | |
| | | @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; |
| | | } |