| | |
| | | log.error("堆垛机写入命令为空"); |
| | | return false; |
| | | } |
| | | if (command.getTaskNo() == 0) { |
| | | if (command.getTaskNo() == 0 && command.getAckFinish() == 0) { |
| | | command.setTaskNo((short) 9999); |
| | | } |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[9]; |
| | | if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) { |
| | | if (command.getAckFinish() == 0) { |
| | | array[0] = 5; |
| | | } else { |
| | | array[0] = 7; |
| | | array[0] = 0; |
| | | } |
| | | array[1] = command.getSourcePosZ(); |
| | | array[2] = command.getSourcePosY(); |
| | |
| | | array[8] = command.getDestinationStaNo(); |
| | | // 作业信息 |
| | | OperateResult result = siemensNet.Write("DB1000.0", array); |
| | | // 任务号 |
| | | OperateResult result1 = siemensNet.Write("DB1000.24", command.getTaskNo()); |
| | | // 任务号 + 完成位 |
| | | short[] array2 = new short[2]; |
| | | array2[0] = command.getTaskNo(); |
| | | array2[1] = command.getAckFinish(); |
| | | OperateResult result1 = siemensNet.Write("DB1000.24", array2); |
| | | |
| | | // 结束位 |
| | | OperateResult result2 = siemensNet.Write("DB1000.28.1", true); |
| | | if (command.getAckFinish() == 0) { |
| | | OperateResult result2 = siemensNet.Write("DB1000.28.1", true); |
| | | } |
| | | |
| | | // 日志记录 |
| | | try { |
| | | if (command.getAckFinish() != 1) { |
| | |
| | | } |
| | | } catch (Exception ignore) {} |
| | | |
| | | if (result.IsSuccess && result1.IsSuccess && result2.IsSuccess) { |
| | | if (result.IsSuccess && result1.IsSuccess) { |
| | | |
| | | log.info("堆垛机命令下发[id:{}] >>>>> {}", slave.getId(), JSON.toJSON(command)); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |