| | |
| | | */ |
| | | private boolean backHpFlag = false; |
| | | |
| | | private Integer errId = 0; |
| | | |
| | | public SiemensCrnThread(CrnSlave slave) { |
| | | this.slave = slave; |
| | | } |
| | |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 56); |
| | | OperateResultExOne<byte[]> resultErr = siemensNet.Read("DB64.0", (short) 7); |
| | | if (result.IsSuccess) { |
| | | OperateResultExOne<byte[]> resultErr = siemensNet.Read("DB64.0", (short) 6); |
| | | if (result.IsSuccess && resultErr.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | | crnProtocol.setCrnNo(slave.getId()); |
| | |
| | | crnProtocol.setyDuration(siemensNet.getByteTransform().TransSingle(result.Content, 52)); |
| | | |
| | | |
| | | boolean[] statusSign = siemensNet.getByteTransform().TransBool(resultErr.Content, 0, 7); |
| | | boolean[] statusSign = siemensNet.getByteTransform().TransBool(resultErr.Content, 0, 6); |
| | | |
| | | crnProtocol.setIbDriveFault(statusSign[0]); // 行走变频器故障 |
| | | crnProtocol.setIbSupplyFault(statusSign[1]); // 提供变频器故障 |
| | |
| | | BasCrnErrorLog basCrnErrorLogs; |
| | | basCrnErrorLogs = crnProtocol.toSqlModelError(); |
| | | BasCrnErrorLogService basCrnErrorLogService = SpringUtils.getBean(BasCrnErrorLogService.class); |
| | | basCrnErrorLogService.insert(basCrnErrorLogs); |
| | | if(basCrnErrorLogService.insert(basCrnErrorLogs)){ |
| | | crnProtocol.setUuid(basCrnErrorLogs.getId().toString()); |
| | | } |
| | | crnProtocol.setWriteMk(false); |
| | | } catch (Exception ignore) { |
| | | log.error(ignore.getMessage()); |