| | |
| | | import com.zy.asrs.entity.BasRgvOpt; |
| | | import com.zy.asrs.service.BasRgvOptService; |
| | | import com.zy.asrs.service.BasRgvService; |
| | | import com.zy.asrs.utils.RouteUtils; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.OutputQueue; |
| | |
| | | command.setCommand((short)0); |
| | | write(command); |
| | | break; |
| | | // 回原点 避让 |
| | | case 9: |
| | | RgvCommand commandAvoidanceXY = (RgvCommand) task.getData(); |
| | | if (null == commandAvoidanceXY) { |
| | | commandAvoidanceXY = new RgvCommand(); |
| | | } |
| | | commandAvoidanceXY.setRgvNo(slave.getId()); // RGV编号 |
| | | commandAvoidanceXY.setTaskNo1((short) 29999); // 工作号 |
| | | commandAvoidanceXY.setAckFinish1((short) 1); // 任务完成确认位 |
| | | commandAvoidanceXY.setTaskMode1(RgvTaskModeType.X_MOVE); // 任务模式 |
| | | commandAvoidanceXY.setSourceStaNo1((short)0); // 源站 |
| | | commandAvoidanceXY.setDestinationStaNo1(slave.getId()==1? (short) 101:(short)116); // 目标站 |
| | | commandAvoidanceXY.setTaskNo2((short) 0); // 工作号 |
| | | commandAvoidanceXY.setAckFinish2((short) 1); // 任务完成确认位 |
| | | commandAvoidanceXY.setTaskMode2(RgvTaskModeType.X_MOVE); // 任务模式 |
| | | commandAvoidanceXY.setSourceStaNo2((short)0); // 源站 |
| | | commandAvoidanceXY.setDestinationStaNo2(slave.getId()==1? (short) 101:(short)117); // 目标站 |
| | | commandAvoidanceXY.setCommand((short)0); |
| | | write(commandAvoidanceXY); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | */ |
| | | private void readStatus(){ |
| | | try { |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB1.0", (short) 34); |
| | | OperateResultExOne<byte[]> result = siemensNet.Read("DB101.0", (short) 34); |
| | | if (result.IsSuccess) { |
| | | if (null == rgvProtocol) { |
| | | rgvProtocol = new RgvProtocol(); |
| | |
| | | rgvProtocol.setTaskNo1(siemensNet.getByteTransform().TransInt16(result.Content, 4)); |
| | | rgvProtocol.setStatus1(siemensNet.getByteTransform().TransInt16(result.Content, 6)); |
| | | rgvProtocol.setLoaded1(siemensNet.getByteTransform().TransInt16(result.Content, 8)); |
| | | rgvProtocol.setRgvPos(siemensNet.getByteTransform().TransInt16(result.Content, 10)); |
| | | rgvProtocol.setRgvPos(RouteUtils.RgvPosSta(slave.getId(),siemensNet.getByteTransform().TransInt16(result.Content, 10))); |
| | | rgvProtocol.setWalkPos(siemensNet.getByteTransform().TransInt16(result.Content, 12)); |
| | | rgvProtocol.setTaskNo2(siemensNet.getByteTransform().TransInt16(result.Content, 14)); |
| | | rgvProtocol.setStatus2(siemensNet.getByteTransform().TransInt16(result.Content, 16)); |
| | |
| | | return false; |
| | | } |
| | | |
| | | siemensNet.Write("DB100.20", command.getCommand()); |
| | | // siemensNet.Write("DB100.20", command.getCommand()); |
| | | |
| | | command.setRgvNo(slave.getId()); |
| | | short[] array = new short[5]; |
| | | array[0] = command.getAckFinish1(); |
| | | array[1] = command.getTaskNo1(); |
| | | array[2] = command.getTaskMode1(); |
| | | array[2] = command.getTaskMode1();//任务模式 |
| | | array[3] = command.getSourceStaNo1(); |
| | | array[4] = command.getDestinationStaNo1(); |
| | | siemensNet.Write("DB100.20", command.getCommand()); |
| | | // siemensNet.Write("DB100.20", 0); |
| | | |
| | | OperateResult result = siemensNet.Write("DB100.0", array); |
| | | |
| | |
| | | |
| | | command.setRgvNo(slave.getId()); |
| | | short[] array = new short[6]; |
| | | array[0] = command.getAckFinish2(); |
| | | array[1] = command.getTaskNo2(); |
| | | array[2] = command.getTaskMode2(); |
| | | array[3] = command.getSourceStaNo2(); |
| | | array[4] = command.getDestinationStaNo2(); |
| | | array[5] = command.getCommand(); |
| | | array[0] = command.getAckFinish2();//任务完成确认位 |
| | | array[1] = command.getTaskNo2();//任务号 |
| | | array[2] = command.getTaskMode2();//任务模式 |
| | | array[3] = command.getSourceStaNo2();//源站 |
| | | array[4] = command.getDestinationStaNo2();//目标站 |
| | | array[5] = command.getCommand();//任务下发确认 |
| | | |
| | | OperateResult result = siemensNet.Write("DB100.10", array); |
| | | |