| | |
| | | } |
| | | command.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | command.setTaskNo((short) 0); // 工作号 |
| | | command.setAckFinish((short) 1); // 任务完成确认位 |
| | | // command.setAckFinish((short) 1); // 任务完成确认位 |
| | | command.setTaskMode(CrnTaskModeType.NONE); // 任务模式 |
| | | command.setSourcePosX((short)0); // 源库位排 |
| | | command.setSourcePosY((short)0); // 源库位列 |
| | |
| | | @Override |
| | | public boolean connect() { |
| | | boolean result = false; |
| | | siemensNet = new SiemensS7Net(SiemensPLCS.S300, slave.getIp()); |
| | | siemensNet = new SiemensS7Net(SiemensPLCS.S1200, slave.getIp()); |
| | | siemensNet.setRack(slave.getRack().byteValue()); |
| | | siemensNet.setSlot(slave.getSlot().byteValue()); |
| | | OperateResult connect = siemensNet.ConnectServer(); |
| | |
| | | * 读取状态 |
| | | */ |
| | | private void readStatus(){ |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB8.18", (short) 62); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB11.2", (short) 90); |
| | | if (result.IsSuccess) { |
| | | if (null == crnProtocol) { |
| | | crnProtocol = new CrnProtocol(); |
| | |
| | | return false; |
| | | } |
| | | command.setCrnNo(slave.getId()); |
| | | short[] array = new short[9]; |
| | | array[0] = command.getAckFinish(); |
| | | array[1] = command.getTaskNo(); |
| | | array[2] = command.getTaskMode(); |
| | | short[] array = new short[13]; |
| | | if (!command.getTaskModeType().equals(CrnTaskModeType.CLEAR)) { |
| | | array[0] = 5; |
| | | } else { |
| | | array[0] = 7; |
| | | } |
| | | array[1] = command.getSourcePosZ(); |
| | | array[2] = command.getSourcePosY(); |
| | | array[3] = command.getSourcePosX(); |
| | | array[4] = command.getSourcePosY(); |
| | | array[5] = command.getSourcePosZ(); |
| | | array[4] = command.getDestinationPosZ(); |
| | | array[5] = command.getDestinationPosY(); |
| | | array[6] = command.getDestinationPosX(); |
| | | array[7] = command.getDestinationPosY(); |
| | | array[8] = command.getDestinationPosZ(); |
| | | OperateResult result = siemensNet.Write("DB8.0", array); |
| | | array[7] = command.getSourceStaNo(); |
| | | array[8] = command.getDestinationStaNo(); |
| | | array[9] = command.getSourceLane(); |
| | | array[10] = command.getDestinationLane(); |
| | | array[11] = |
| | | |
| | | OperateResult result = siemensNet.Write("DB10.0", array); |
| | | if (result.IsSuccess) { |
| | | |
| | | try { |