| | |
| | | } |
| | | |
| | | if (shuttleProtocol.getFree() == ShuttleStatusType.BUSY.id) { |
| | | //停止充电 |
| | | if(!(command.getRequest().getBody().get("requestType").equals("stopCharge") && shuttleProtocol.getChargState() == 1)){ |
| | | String requestType = command.getRequest().getBody().get("requestType").toString(); |
| | | //停止充电 管制命令 |
| | | if(!(requestType.equals("stopCharge") && shuttleProtocol.getChargState() == 1) && !requestType.equals("resume")){ |
| | | return false;//小车状态忙,禁止执行命令 |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | if (shuttleProtocol.getYCurrent() > shuttleProtocol.getYTarget()) { |
| | | //跑库结束 |
| | | shuttleProtocol.setMoveLoc(false); |
| | | shuttleProtocol.setMoveType(0); |
| | | shuttleProtocol.setXStart(0); |
| | | shuttleProtocol.setXTarget(0); |
| | | shuttleProtocol.setXCurrent(0); |
| | | shuttleProtocol.setYStart(0); |
| | | shuttleProtocol.setYTarget(0); |
| | | shuttleProtocol.setYCurrent(0); |
| | | return; |
| | | } |
| | | |
| | | if (shuttleProtocol.getMoveType() == 0) {//跑轨道 |
| | | ArrayList<String> locs = new ArrayList<>(); |
| | | for (int i = shuttleProtocol.getXCurrent(); i <= shuttleProtocol.getXTarget(); i++) { |
| | |
| | | } |
| | | } |
| | | }else {//跑库位 |
| | | Integer xCurrent = shuttleProtocol.getXCurrent(); |
| | | if (xCurrent > shuttleProtocol.getXTarget()) {//当X值大于X目标值,进行归零且Y方向+1 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXStart()); |
| | | shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | Integer yCurrent = shuttleProtocol.getYCurrent(); |
| | | String locNo = Utils.getLocNo(xCurrent, yCurrent, lev); |
| | | LocMast target = locMastService.selectById(locNo); |
| | | if (target == null) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | if (!target.getLocSts().equals("O")) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | return; |
| | | } |
| | | |
| | | //调度去目标位置 |
| | | if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) { |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);//小车和目标位置一致,跳过 |
| | | }else { |
| | | boolean result = shuttleDispatchUtils.dispatchShuttle(commonService.getWorkNo(3), target.getLocNo()); |
| | | if (result) {//调度成功 |
| | | shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |