| | |
| | | array[8] = command.getDestinationPosZ(); |
| | | // array[9] = command.getCommand(); |
| | | array[9] = (short)0; |
| | | |
| | | |
| | | log.info("堆垛机任务写100.18:值:0 crnWrite-313行"); |
| | | OperateResult result18 = siemensNet.Write("DB100.18", (short)0); |
| | | |
| | | if (command.getAckFinish() == 0) { |
| | | log.info("堆垛机任务写100.0:值:0 crnWrite-317行"); |
| | | OperateResult result100 = siemensNet.Write("DB100.0", (short)0); |
| | | } |
| | | |
| | |
| | | Thread.sleep(50L); |
| | | } catch (Exception e){} |
| | | |
| | | log.info("堆垛机任务写100.0:值:array crnWrite-317行;array:"+JSON.toJSONString(array)); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | |
| | | int i=0; |
| | | do{ |
| | | i++; |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | try{ |
| | | Thread.sleep(100L); |
| | | } catch (Exception e){} |
| | | |
| | | log.info("堆垛机任务读100.0:值:20 crnWrite-317行;"); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 20); |
| | | if (resultRead.IsSuccess) { |
| | | CrnCommand one = new CrnCommand(); |
| | |
| | | || !command.getDestinationPosY().equals(one.getDestinationPosY()) |
| | | || !command.getDestinationPosZ().equals(one.getDestinationPosZ()) |
| | | ){ |
| | | i++; |
| | | CrnErrCache.updateCrnErr(slave.getId(), "堆垛机命令地址写入后回读失败"); |
| | | |
| | | log.error("堆垛机命令地址写入后回读失败[id:{}]>>>>重写[{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), i,JSON.toJSON(command),JSON.toJSON(one)); |
| | |
| | | } |
| | | break; |
| | | } |
| | | } else { |
| | | CrnErrCache.updateCrnErr(slave.getId(), "堆垛机命令读取失败"); |
| | | |
| | | log.error("堆垛机命令读取失败[id:{}]>>>>重写[{}] >>>>> 写入[{}],===>>回读[{}]", slave.getId(), i,JSON.toJSON(command),""); |
| | | |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("CrnErr", slave.getId(), "巷道号"+command.getLaneNo()+";写入次数"+i+";堆垛机命令读取失败:"+JSON.toJSONString(command.getNowTask())); |
| | | } catch (Exception e2){ |
| | | } |
| | | } |
| | | }while(i<5); |
| | | |
| | |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | int signFinish = 1; |
| | | while (signFinish<5){ |
| | | signFinish++; |
| | | OperateResultExOne<byte[]> result10018 = siemensNet.Read("DB100.18", (short) 2); |
| | | short transInt16 = siemensNet.getByteTransform().TransInt16(result10018.Content, 0); |
| | | if (transInt16 != commandFinish){ |
| | |
| | | } catch (Exception e3){ |
| | | } |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | signFinish++; |
| | | }else { |
| | | log.info("下发DB100.18" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.18" + "array:"+ JSON.toJSONString(array)); |