| | |
| | | News.error("SiemensCrn"+" - 6"+" - 堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | System.out.println("------------------"); |
| | | System.out.println(command); |
| | | // convertRow(command); |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[17]; |
| | | short[] array = new short[16]; |
| | | array[0] = command.getTaskNo(); |
| | | array[1] = command.getTaskMode(); |
| | | array[2] = command.getSourcePosX(); |
| | |
| | | array[11] = command.getDestinationPosXTwo(); |
| | | array[12] = command.getDestinationPosYTwo(); |
| | | array[13] = command.getDestinationPosZTwo(); |
| | | array[14] = command.getCommand(); |
| | | //array[14] = command.getCommand(); |
| | | array[14] = 1; |
| | | array[15] = command.getAckFinish(); |
| | | |
| | | // array[9] = command.getSourceStaNo(); |
| | |
| | | |
| | | |
| | | log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), array); |
| | | |
| | | |
| | | |
| | | //堆垛机任务写入后,回读一次,看是否成功 |
| | | Thread.sleep(200); |
| | |
| | | writeCount++; |
| | | continue; |
| | | } |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 24); |
| | | OperateResultExOne<byte[]> resultRead = siemensNet.Read("DB100.0", (short) 32); |
| | | if (resultRead.IsSuccess) { |
| | | CrnCommand one = new CrnCommand(); |
| | | one.setTaskNo(siemensNet.getByteTransform().TransInt16(resultRead.Content, 2)); |
| | |
| | | if (command.getAckFinish() == 0) { |
| | | short commandFinish = 1; |
| | | Thread.sleep(100L); |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | result = siemensNet.Write("DB100.30", commandFinish); |
| | | int signFinish = 1; |
| | | while (signFinish<5){ |
| | | OperateResultExOne<byte[]> result10018 = siemensNet.Read("DB100.18", (short) 2); |
| | | OperateResultExOne<byte[]> result10018 = siemensNet.Read("DB100.30", (short) 2); |
| | | short transInt16 = siemensNet.getByteTransform().TransInt16(result10018.Content, 0); |
| | | if (transInt16 != commandFinish){ |
| | | log.info("下发DB100.18 回读失败" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.18 回读失败" + "array:"+ JSON.toJSONString(array)); |
| | | log.info("下发DB100.30 回读失败" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.30 回读失败" + "array:"+ JSON.toJSONString(array)); |
| | | result = siemensNet.Write("DB100.18", commandFinish); |
| | | signFinish++; |
| | | }else { |
| | | log.info("下发DB100.18" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.18" + "array:"+ JSON.toJSONString(array)); |
| | | log.info("下发DB100.30" + "commandFinish:"+commandFinish); |
| | | log.info("下发DB100.30" + "array:"+ JSON.toJSONString(array)); |
| | | break; |
| | | } |
| | | } |