|  |  | 
 |  |  |                 return false; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //调度小车避让 | 
 |  |  |             boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread); | 
 |  |  |             if (!result) { | 
 |  |  |                 return false; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //获取出库站点(目标站) | 
 |  |  |             BasDevp basDevp = basDevpService.selectById(wrkMast.getStaNo()); | 
 |  |  |             if (basDevp == null) { | 
 |  |  | 
 |  |  |             if (liftProtocol == null) { | 
 |  |  |                 return false; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (!liftProtocol.isIdle()) { | 
 |  |  |                 return false; | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 return false;//找不到站点 | 
 |  |  |             } | 
 |  |  |             Integer startSta = liftStaProtocol.getStaNo(); | 
 |  |  |  | 
 |  |  |             NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); | 
 |  |  |             if (shuttleProtocol.getCurrentLocNo().equals(liftStaProtocol.getLocNo())) { | 
 |  |  |                 //小车还在输送站点 | 
 |  |  |                 //调度小车避让 | 
 |  |  |                 boolean result = Utils.searchEmptyGroupToMoveShuttle(Utils.getLev(wrkMast.getSourceLocNo()), wrkMast.getShuttleNo(), shuttleThread); | 
 |  |  |                 if (!result) { | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //获目标站源站对应的输送站点 | 
 |  |  |             BasDevp targetBasDevp = basDevpService.selectById(wrkMast.getStaNo()); | 
 |  |  | 
 |  |  |                     targetSta = (short) 317; | 
 |  |  |  | 
 |  |  |                     if (wrkMast.getStaNo() != 303 && wrkMast.getStaNo() != 317) { | 
 |  |  |                         //向AGV发起组托请求 | 
 |  |  | //                        try { | 
 |  |  | //                            HashMap<String, Object> param = new HashMap<>(); | 
 |  |  | //                            param.put("wrkNo", wrkMast.getWrkNo()); | 
 |  |  | //                            String response = new HttpHandler.Builder() | 
 |  |  | //                                    .setUri(wmsUrl) | 
 |  |  | //                                    .setPath("/openAGV") | 
 |  |  | //                                    .setJson(JSON.toJSONString(param)) | 
 |  |  | //                                    .build() | 
 |  |  | //                                    .doPost(); | 
 |  |  | //                            JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  | //                            Integer code = jsonObject.getInteger("code"); | 
 |  |  | //                            if (code.equals(200)) {//AGV组托成功 | 
 |  |  | //                                //覆盖工作档目标站 | 
 |  |  | //                                wrkMast.setStaNo(targetSta.intValue()); | 
 |  |  | //                                wrkMast.setShuttleNo(null);//释放小车 | 
 |  |  | //                                if (wrkMastMapper.updateById(wrkMast) > 0) { | 
 |  |  | //                                    //向300站写入目标站 | 
 |  |  | //                                    staProtocol = staProtocol.clone(); | 
 |  |  | //                                    staProtocol.setStaNo(targetSta);//移动到目标站 | 
 |  |  | //                                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); | 
 |  |  | //                                    try { | 
 |  |  | //                                        Thread.sleep(500); | 
 |  |  | //                                    } catch (Exception e) { | 
 |  |  | //                                        e.printStackTrace(); | 
 |  |  | //                                    } | 
 |  |  | //                                    continue; | 
 |  |  | //                                } | 
 |  |  | //                            } | 
 |  |  | //                        } catch (Exception e) { | 
 |  |  | //                            e.printStackTrace(); | 
 |  |  | //                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  | //                        } | 
 |  |  |  | 
 |  |  |                         //覆盖工作档目标站 | 
 |  |  |                         wrkMast.setStaNo(targetSta.intValue()); | 
 |  |  |                         wrkMast.setShuttleNo(null);//释放小车 | 
 |  |  |                         if (wrkMastMapper.updateById(wrkMast) > 0) { | 
 |  |  |                             //向300站写入目标站 | 
 |  |  |                             staProtocol = staProtocol.clone(); | 
 |  |  | 
 |  |  |                 if (wrkMast.getInvWh() == null) { | 
 |  |  |                     wrkMast.setInvWh("Y");//标记已经下发机械臂任务 | 
 |  |  |                     if (wrkMastMapper.updateById(wrkMast) > 0) { | 
 |  |  |                         RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "317"); | 
 |  |  |                         RobotUtils.sendTask(staProtocol317.getWorkNo().toString(), wrkDetls.size(), "317"); | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * AGV补货(通知AGV取货) | 
 |  |  |      */ | 
 |  |  |     public void agvRestockInto() { | 
 |  |  |         //检测309和312站是否自动、有物 | 
 |  |  |         for (DevpSlave devp : slaveProperties.getDevp()) { | 
 |  |  |             // 获取入库站信息 | 
 |  |  |             DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); | 
 |  |  |             StaProtocol staProtocol309 = devpThread.getStation().get(309); | 
 |  |  |             StaProtocol staProtocol312 = devpThread.getStation().get(312); | 
 |  |  |             if (staProtocol309 == null || staProtocol312 == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             if (staProtocol309.isAutoing() && staProtocol309.isLoading()) { | 
 |  |  |                 // 获取条码扫描仪信息 | 
 |  |  |                 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 11);//308站条码器 | 
 |  |  |                 if (barcodeThread == null) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 String barcode = barcodeThread.getBarcode(); | 
 |  |  |                 if(!Cools.isEmpty(barcode)) { | 
 |  |  |                     //通知AGV取货 | 
 |  |  |                     agvRestockCall("CS-301-001-01@3", barcode); | 
 |  |  |                 } | 
 |  |  |             } else if (staProtocol312.isAutoing() && staProtocol312.isLoading()) { | 
 |  |  |                 // 获取条码扫描仪信息 | 
 |  |  |                 BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, 12);//311站条码器 | 
 |  |  |                 if (barcodeThread == null) { | 
 |  |  |                     continue; | 
 |  |  |                 } | 
 |  |  |                 String barcode = barcodeThread.getBarcode(); | 
 |  |  |                 if(!Cools.isEmpty(barcode)) { | 
 |  |  |                     //通知AGV取货 | 
 |  |  |                     agvRestockCall("CS-302-001-01@3", barcode); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     //通知AGV取货 | 
 |  |  |     private boolean agvRestockCall(String staNo, String barcode) { | 
 |  |  |         try { | 
 |  |  |             HashMap<String, Object> param = new HashMap<>(); | 
 |  |  |             param.put("staNo", staNo); | 
 |  |  |             param.put("barcode", barcode); | 
 |  |  |             String response = new HttpHandler.Builder() | 
 |  |  |                     .setUri(wmsUrl) | 
 |  |  |                     .setPath("/callAGV") | 
 |  |  |                     .setJson(JSON.toJSONString(param)) | 
 |  |  |                     .build() | 
 |  |  |                     .doPost(); | 
 |  |  |             JSONObject jsonObject = JSON.parseObject(response); | 
 |  |  |             Integer code = jsonObject.getInteger("code"); | 
 |  |  |             if (code.equals(200)) {//呼叫AGV | 
 |  |  |                 return true; | 
 |  |  |             } | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); | 
 |  |  |         } | 
 |  |  |         return false; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 300站拣料 | 
 |  |  | 
 |  |  |                 wrkMast.setModiTime(now); | 
 |  |  |                 wrkMastMapper.updateById(wrkMast); | 
 |  |  |  | 
 |  |  |                 shuttleProtocol.setShuttleNo((short) 0);//释放小车 | 
 |  |  |                 shuttleProtocol.setToken(0);//释放小车 | 
 |  |  |  | 
 |  |  |                 if (wrkMast.getWrkSts() == 111) { | 
 |  |  |                     // 保存工作主档历史档 | 
 |  |  |                     if (wrkMastLocMapper.save(wrkMast.getWrkNo()) <= 0) { |