| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | |
| | | if (result.IsSuccess) { |
| | | if (null == steProtocol) { |
| | | steProtocol = new SteProtocol(); |
| | | steProtocol.setSteNo(slave.getId().shortValue()); |
| | | } |
| | | steProtocol.setSteNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 0)); |
| | | // steProtocol.setSteNo(siemensS7Net.getByteTransform().TransInt16(result.Content, 0)); |
| | | steProtocol.setMode(siemensS7Net.getByteTransform().TransInt16(result.Content, 2)); |
| | | steProtocol.setStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 4)); |
| | | OperateResultExOne<Boolean> executeRes = siemensS7Net.ReadBool("V2001.0"); |
| | |
| | | OperateResultExOne<Boolean> waitingRes = siemensS7Net.ReadBool("V2001.1"); |
| | | if (waitingRes.IsSuccess) { |
| | | steProtocol.setWaiting(waitingRes.Content); |
| | | } |
| | | OperateResultExOne<Boolean> inEmptyRes = siemensS7Net.ReadBool("V2001.2"); |
| | | if (inEmptyRes.IsSuccess) { |
| | | steProtocol.setInEmpty(inEmptyRes.Content); |
| | | } |
| | | OperateResultExOne<Boolean> outEmptyRes = siemensS7Net.ReadBool("V2001.3"); |
| | | if (outEmptyRes.IsSuccess) { |
| | | steProtocol.setOutEmpty(outEmptyRes.Content); |
| | | } |
| | | steProtocol.setAlarm(siemensS7Net.getByteTransform().TransInt16(result.Content, 6)); |
| | | steProtocol.setAlarm0(siemensS7Net.getByteTransform().TransInt16(result.Content, 8)); |
| | |
| | | steProtocol.setCrnStopRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 38)); |
| | | steProtocol.setCrnStopFork(siemensS7Net.getByteTransform().TransInt16(result.Content, 40)); |
| | | steProtocol.setCrnAllowRun(siemensS7Net.getByteTransform().TransInt16(result.Content, 42)); |
| | | steProtocol.setChargeStatus(siemensS7Net.getByteTransform().TransInt16(result.Content, 44)); |
| | | |
| | | OutputQueue.STE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | |
| | | if (result != null && result.IsSuccess) { |
| | | // 维护数据库排列层 |
| | | if (!steProtocol.getWaiting()) { |
| | | this.modifyPos(command.getRow().intValue(), command.getBay().intValue(), command.getLev().intValue()); |
| | | if (!Cools.isEmpty(command.getRow(), command.getBay(), command.getLev())) { |
| | | this.modifyPos(command.getRow().intValue(), command.getBay().intValue(), command.getLev().intValue()); |
| | | } |
| | | } |
| | | |
| | | log.info("穿梭车命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | |
| | | short[] arr = new short[] {row.shortValue(), bay.shortValue(), lev.shortValue()}; |
| | | OperateResult result = siemensS7Net.Write("V1002", arr); |
| | | if (!result.IsSuccess) { |
| | | log.error("更新{}号穿梭车定位失败 ===>> 排:【{}】, 列:【{}】,层:【{}】", this.slave.getId(), row, bay, lev); |
| | | return false; |
| | | } |
| | | BasSteService service = SpringUtils.getBean(BasSteService.class); |