| | |
| | | |
| | | // 获取站点信息 |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(armSta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | StaProtocol staProtocol = null; |
| | | String barcode = null; |
| | | // 可以轮询读取,确保条码稳定不变 |
| | | for(int retry=0; retry<3; retry++){ |
| | | staProtocol = devpThread.getStation().get(armSta.getStaNo()); |
| | | barcode = staProtocol.getBarcode(); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | Thread.sleep(150); // 小延时等待PLC刷新 |
| | | } |
| | | String barcode = staProtocol.getBarcode(); |
| | | if(!Cools.isEmpty(barcode)) { |
| | | if("NG".endsWith(barcode) || "NoRead".equals(barcode) || "0".equals(barcode) || barcode.length()<5) { |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "拆垛条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | continue; |
| | | } |
| | | } else { |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "托盘条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | armTaskAssignmentCallApiLogSave(staProtocol, "拆垛条码为空", staProtocol.getSiteId()+"码垛位置,===》托盘条码为空", false); |
| | | continue; |
| | | } |
| | | String[] barcodeList = barcode.split(";"); |
| | |
| | | List<BasArm> basArmList = basArmService.selectList(new EntityWrapper<BasArm>().eq("arm_no",armSta.getArmNo())); |
| | | boolean sign = true; |
| | | for (BasArm basArm : basArmList){ |
| | | if (basArm.getStaNo()==2){//NG |
| | | continue; |
| | | } |
| | | // if (basArm.getStaNo()==2){//NG |
| | | // continue; |
| | | // } |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", basArm.getStaNoSou())); |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("D")){ |
| | | continue; |
| | |
| | | sign = false; |
| | | break; |
| | | } |
| | | if (sign){ |
| | | for (BasArm basArm : basArmList){ |
| | | if (basArm.getStaNo()==2){//NG |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", basArm.getStaNoSou())); |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("D")){ |
| | | continue; |
| | | } |
| | | BasArmMast basArmMast = new BasArmMast(armBarcodeTwoParam); |
| | | basArmMast.setArmNo(basArm.getArmNo()); |
| | | basArmMast.setStaNo(basArm.getStaNoSou()); |
| | | basArmMast.setSortingLine(basArm.getSortingLineSou()); |
| | | basArmMastService.insert(basArmMast); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // if (sign){ |
| | | // for (BasArm basArm : basArmList){ |
| | | // if (basArm.getStaNo()==2){//NG |
| | | // LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", basArm.getStaNoSou())); |
| | | // if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("D")){ |
| | | // continue; |
| | | // } |
| | | // BasArmMast basArmMast = new BasArmMast(armBarcodeTwoParam); |
| | | // basArmMast.setArmNo(basArm.getArmNo()); |
| | | // basArmMast.setStaNo(basArm.getStaNoSou()); |
| | | // basArmMast.setSortingLine(basArm.getSortingLineSou()); |
| | | // basArmMastService.insert(basArmMast); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | } |
| | | } catch (Exception e){ |