| | |
| | | import com.zy.core.model.command.ShuttleRedisCommand; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.thread.ShuttleThread; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | // 系统任务 |
| | | if (assignCommand.getAuto()) { |
| | | if (!assignCommand.getCharge()) { |
| | | //对主线程抛出等待确认状态waiting |
| | | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING); |
| | | if (command.getMode() == ShuttleCommandModeType.UPDATE_LOCATION.id) { |
| | | //更新坐标任务无需抛出等待确认 |
| | | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE); |
| | | shuttleThread.setSyncTaskNo(0); |
| | | }else { |
| | | //对主线程抛出等待确认状态waiting |
| | | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING); |
| | | } |
| | | }else { |
| | | shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | int lev = Utils.getLev(currentLocNo); |
| | | boolean demoSwitchLev = false; |
| | | Config demoSwitchLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoSwitchLev")); |
| | | if (demoSwitchLevConfig != null) { |
| | | if (demoSwitchLevConfig.getValue().equals("Y")) { |
| | | demoSwitchLev = true; |
| | | } |
| | | } |
| | | |
| | | Config demoRunLevConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "demoRunLev")); |
| | | if (demoRunLevConfig == null) { |
| | | return; |
| | | } |
| | | List<Integer> levList = JSON.parseArray(demoRunLevConfig.getValue(), Integer.class); |
| | | |
| | | if (!demoSwitchLev) { |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | levList = new ArrayList<>(); |
| | | levList.add(Utils.getLev(currentLocNo)); |
| | | } |
| | | |
| | | LocMast targetLoc = null; |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("lev1", lev); |
| | | wrapper.in("lev1", levList); |
| | | wrapper.eq("loc_sts", "O"); |
| | | wrapper.last("ORDER BY RAND() LIMIT 1"); |
| | | for (int i = 0; i < 3; i++) { |
| | |
| | | } |
| | | |
| | | targetLoc = locMast; |
| | | break; |
| | | } |
| | | |
| | | if(targetLoc == null) { |