| | |
| | | case 1: |
| | | readStatus(); |
| | | break; |
| | | // 工位1、2写入数据 |
| | | case 2: |
| | | write((RgvCommand) task.getData()); |
| | | break; |
| | | // // 工位1、2写入数据 |
| | | // case 2: |
| | | // write((RgvCommand) task.getData()); |
| | | // break; |
| | | //工位1写入数据 |
| | | case 4: |
| | | write1((RgvCommand) task.getData()); |
| | | break; |
| | | //工位2写入数据 |
| | | case 5: |
| | | write2((RgvCommand) task.getData()); |
| | | break; |
| | | // //工位2写入数据 |
| | | // case 5: |
| | | // write2((RgvCommand) task.getData()); |
| | | // break; |
| | | // 复位 |
| | | case 3: |
| | | RgvCommand command = (RgvCommand) task.getData(); |
| | |
| | | command.setTaskMode1(RgvTaskModeType.NONE); // 任务模式 |
| | | command.setSourceStaNo1((short)0); // 源站 |
| | | command.setDestinationStaNo1((short)0); // 目标站 |
| | | command.setTaskNo2((short) 0); // 工作号 |
| | | command.setAckFinish2((short) 1); // 任务完成确认位 |
| | | command.setTaskMode2(RgvTaskModeType.NONE); // 任务模式 |
| | | command.setSourceStaNo2((short)0); // 源站 |
| | | command.setDestinationStaNo2((short)0); // 目标站 |
| | | command.setCommand((short)0); |
| | | write(command); |
| | | write1(command); |
| | | break; |
| | | // 回原点 避让 |
| | | case 9: |
| | |
| | | commandAvoidanceXY.setTaskMode1(RgvTaskModeType.GO_ORIGIN); // 任务模式 |
| | | commandAvoidanceXY.setSourceStaNo1((short)0); // 源站 |
| | | commandAvoidanceXY.setDestinationStaNo1((short)0); // 目标站 |
| | | commandAvoidanceXY.setTaskNo2((short) 0); // 工作号 |
| | | commandAvoidanceXY.setAckFinish2((short) 1); // 任务完成确认位 |
| | | commandAvoidanceXY.setTaskMode2(RgvTaskModeType.GO_ORIGIN); // 任务模式 |
| | | commandAvoidanceXY.setSourceStaNo2((short)0); // 源站 |
| | | commandAvoidanceXY.setDestinationStaNo2((short)0); // 目标站 |
| | | // commandAvoidanceXY.setTaskNo2((short) 0); // 工作号 |
| | | // commandAvoidanceXY.setAckFinish2((short) 1); // 任务完成确认位 |
| | | // commandAvoidanceXY.setTaskMode2(RgvTaskModeType.GO_ORIGIN); // 任务模式 |
| | | // commandAvoidanceXY.setSourceStaNo2((short)0); // 源站 |
| | | // commandAvoidanceXY.setDestinationStaNo2((short)0); // 目标站 |
| | | commandAvoidanceXY.setCommand((short)0); |
| | | write(commandAvoidanceXY); |
| | | break; |
| | |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 30); |
| | | if (result.IsSuccess) { |
| | | if (null == rgvProtocol) { |
| | | if (null == rgvProtocol || rgvProtocol.getRgvNo() == null) { |
| | | rgvProtocol = new RgvProtocol(); |
| | | rgvProtocol.setRgvNo(slave.getId()); |
| | | } |
| | |
| | | array[2] = command.getTaskMode1(); |
| | | array[3] = command.getSourceStaNo1(); |
| | | array[4] = command.getDestinationStaNo1(); |
| | | array[5] = command.getAckFinish2(); |
| | | array[6] = command.getTaskNo2(); |
| | | array[7] = command.getTaskMode2(); |
| | | array[8] = command.getSourceStaNo2(); |
| | | array[9] = command.getDestinationStaNo2(); |
| | | array[10] = command.getCommand(); |
| | | // array[0] = command.getAckFinish1(); |
| | | // array[1] = command.getTaskNo1(); |
| | | // array[2] = command.getTaskMode1(); |
| | | // array[3] = command.getSourceStaNo1(); |
| | | // array[4] = command.getDestinationStaNo1(); |
| | | // array[5] = command.getAckFinish2(); |
| | | // array[6] = command.getTaskNo2(); |
| | | // array[7] = command.getTaskMode2(); |
| | | // array[8] = command.getSourceStaNo2(); |
| | | // array[9] = command.getDestinationStaNo2(); |
| | | // array[10] = command.getCommand(); |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | |
| | | // if (command.getAckFinish1() == 0 && command.getAckFinish2() == 0) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | siemensNet.Write("DB100.20", command.getCommand()); |
| | | // siemensNet.Write("DB100.20", command.getCommand()); |
| | | |
| | | command.setRgvNo(slave.getId()); |
| | | short[] array = new short[5]; |
| | |
| | | array[2] = command.getTaskMode1(); |
| | | array[3] = command.getSourceStaNo1(); |
| | | array[4] = command.getDestinationStaNo1(); |
| | | siemensNet.Write("DB100.20", command.getCommand()); |
| | | siemensNet.Write("DB100.10", command.getCommand()); |
| | | |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | |
| | | if (command.getAckFinish1() == 0) { |
| | | short commandFinish = 1; //工位1任务写入 |
| | | Thread.sleep(100L); |
| | | result = siemensNet.Write("DB100.20", commandFinish); |
| | | Thread.sleep(200); |
| | | result = siemensNet.Write("DB100.10", commandFinish); |
| | | } |
| | | |
| | | try { |
| | |
| | | null |
| | | ); |
| | | bean.insert(basRgvOpt); |
| | | } catch (Exception ignore) {} |
| | | } catch (Exception ignore) { |
| | | log.error(ignore.getMessage()); |
| | | } |
| | | |
| | | if (result != null && result.IsSuccess) { |
| | | Thread.sleep(200); |