| | |
| | | |
| | | //将四向穿梭车状态保存至数据库 |
| | | BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); |
| | | BasShuttle basShuttle = shuttleService.selectById(shuttleProtocol.getShuttleNo()); |
| | | BasShuttle basShuttle = shuttleService.selectById(slave.getId()); |
| | | if (basShuttle == null) { |
| | | basShuttle = new BasShuttle(); |
| | | //四向穿梭车号 |
| | |
| | | commands.add(getPalletCommand(assignCommand.getTaskMode() == 3 ? (short) 1 : (short) 2)); |
| | | break; |
| | | case 5://强制左移 |
| | | commands.add(getForceMoveCommand((short) 2)); |
| | | break; |
| | | case 6://强制右移 |
| | | commands.add(getForceMoveCommand((short) 1)); |
| | | break; |
| | | case 7://强制上移 |
| | | commands.add(getForceMoveCommand((short) 3)); |
| | | break; |
| | | case 8://强制下移 |
| | | commands.add(getForceMoveCommand((short) (assignCommand.getTaskMode() - 4))); |
| | | commands.add(getForceMoveCommand((short) 4)); |
| | | break; |
| | | case 9://状态复位 |
| | | ShuttleCommand reset = getResetCommand(); |
| | |
| | | * 获取托盘顶升命令 |
| | | * @param lift 1顶升,2下降 |
| | | */ |
| | | private ShuttleCommand getPalletCommand(Short lift) { |
| | | public ShuttleCommand getPalletCommand(Short lift) { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 2); |
| | | command.setStartCodeNum((short) 0); |
| | |
| | | * 正常移动命令 |
| | | * @return |
| | | */ |
| | | private ShuttleCommand getMoveCommand(Short startCodeNum, Short distCodeNum, Integer startToDistDistance, Short runDirection) { |
| | | public ShuttleCommand getMoveCommand(Short startCodeNum, Short distCodeNum, Integer startToDistDistance, Short runDirection) { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 1); |
| | | command.setStartCodeNum(startCodeNum); |
| | |
| | | * 强制移动命令 |
| | | * @param direction 移动方向 1左移,2右移,3前移,4后移 |
| | | */ |
| | | private ShuttleCommand getForceMoveCommand(Short direction) { |
| | | public ShuttleCommand getForceMoveCommand(Short direction) { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 3); |
| | | command.setStartCodeNum((short) 0); |
| | |
| | | /** |
| | | * 状态复位命令 |
| | | */ |
| | | private ShuttleCommand getResetCommand() { |
| | | public ShuttleCommand getResetCommand() { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 6); |
| | | command.setStartCodeNum((short) 0); |
| | |
| | | * 获取寻库位命令 |
| | | * @param direction 1:向正方向(左)寻库位,2:向负方向(右)寻库位,3:向负方向(后)寻库位,4:向正方向(前)寻库位 |
| | | */ |
| | | private ShuttleCommand getFindLocCommand(Short direction, Integer startToDistance, Short runSpeed) { |
| | | public ShuttleCommand getFindLocCommand(Short direction, Integer startToDistance, Short runSpeed) { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 4); |
| | | command.setRunDirection(direction); |
| | |
| | | * 获取寻库位命令,默认移动距离3000,运行速度1000 |
| | | * @param direction 1:向正方向(左)寻库位,2:向负方向(右)寻库位,3:向负方向(后)寻库位,4:向正方向(前)寻库位 |
| | | */ |
| | | private ShuttleCommand getFindLocCommand(Short direction) { |
| | | public ShuttleCommand getFindLocCommand(Short direction) { |
| | | return getFindLocCommand(direction, 3000, (short) 1000); |
| | | } |
| | | |
| | | /** |
| | | * 获取充电开关命令 |
| | | */ |
| | | private ShuttleCommand getChargeSwitchCommand() { |
| | | public ShuttleCommand getChargeSwitchCommand() { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 8); |
| | | command.setIOControl((short) 4); |
| | |
| | | return command; |
| | | } |
| | | |
| | | /** |
| | | * charge:1=>开始充电,2=>断开充电 |
| | | */ |
| | | public ShuttleCommand getChargeSwitchCommand(Short charge) { |
| | | ShuttleCommand command = new ShuttleCommand(); |
| | | command.setCommandWord((short) 5);//充电 |
| | | command.setShuttleNo(shuttleProtocol.getShuttleNo()); |
| | | command.setChargeSwitch(charge);//开始充电 |
| | | command.setCommandEnd((short) 1); |
| | | return command; |
| | | } |
| | | |
| | | /******************************************************************************************/ |
| | | /**************************************** 测试专用 *****************************************/ |
| | | /*****************************************************************************************/ |