| | |
| | | } |
| | | |
| | | if (wrkMast.getInvWh() == null) { |
| | | wrkMast.setInvWh("Y");//标记已经下发机械臂任务 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303"); |
| | | boolean result = RobotUtils.sendTask(staProtocol303.getWorkNo().toString(), wrkDetls.size(), "303"); |
| | | if (result) { |
| | | wrkMast.setInvWh("Y");//标记已经下发机械臂任务 |
| | | wrkMastMapper.updateById(wrkMast); |
| | | } |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | if (wrkMast.getInvWh() == null) { |
| | | wrkMast.setInvWh("Y");//标记已经下发机械臂任务 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | RobotUtils.sendTask(staProtocol317.getWorkNo().toString(), wrkDetls.size(), "317"); |
| | | boolean result = RobotUtils.sendTask(staProtocol317.getWorkNo().toString(), wrkDetls.size(), "317"); |
| | | if (result) { |
| | | wrkMast.setInvWh("Y");//标记已经下发机械臂任务 |
| | | wrkMastMapper.updateById(wrkMast); |
| | | } |
| | | } |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | //通知WMS当前拣料站点信息 |
| | | private boolean agvCureentCall(String staNo, String barcode) { |
| | | try { |
| | | HashMap<String, Object> param = new HashMap<>(); |
| | | param.put("devNo", staNo); |
| | | param.put("containerCode", barcode); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/current/containerCode") |
| | | .setJson(JSON.toJSONString(param)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | News.info("悬挂线,WMS返回结果:" + jsonObject); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code.equals(200)) {//呼叫AGV |
| | | return true; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * AGV补货(悬挂线通知AGV取货) |
| | | */ |
| | | public void agvRestockIntoByHangingWire() { |
| | | try { |
| | | //检测350和351扫码器 |
| | | int[] barcodeStaNo = {11, 12};//11 => 350站扫码器,12 => 351站扫码器 |
| | | int[] barcodeStaNo = {11, 12,14,16,18,20};//11 => 350站扫码器,12 => 351站扫码器 |
| | | for (int staNo : barcodeStaNo) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, staNo); |
| | |
| | | String agvStaNo = null; |
| | | if (staNo == 11) { |
| | | agvStaNo = "303-1"; |
| | | } else { |
| | | } else if(staNo == 12){ |
| | | agvStaNo = "304-1"; |
| | | } else if(staNo == 14){ |
| | | agvStaNo = "311-1"; |
| | | } else if(staNo == 16){ |
| | | agvStaNo = "313-1"; |
| | | } else if(staNo == 18){ |
| | | agvStaNo = "315-1"; |
| | | } else if(staNo == 20){ |
| | | agvStaNo = "317-1"; |
| | | } |
| | | //通知AGV取货 |
| | | boolean result = agvRestockCall(agvStaNo, barcode); |
| | | if (result) { |
| | | barcodeThread.setBarcode(""); |
| | | } |
| | | log.info(barcodeThread.getSlave().getId() + "号扫码器,通知AGV取货,条码号:" + barcode); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * AGV拣料站点信息 |
| | | */ |
| | | public void agvCurrentContainerCodeInfoWire() { |
| | | try { |
| | | //检测350和351扫码器 |
| | | int[] barcodeStaNo = {13, 15,17,19};//11 => 350站扫码器,12 => 351站扫码器 |
| | | for (int staNo : barcodeStaNo) { |
| | | // 获取条码扫描仪信息 |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, staNo); |
| | | if (barcodeThread == null) { |
| | | continue; |
| | | } |
| | | String barcode = barcodeThread.getBarcode(); |
| | | if (!Cools.isEmpty(barcode)) { |
| | | if (barcode.contains("NoRead")) { |
| | | continue; |
| | | } |
| | | |
| | | String agvStaNo = null; |
| | | if (staNo == 13) { |
| | | agvStaNo = "CS-310"; |
| | | } else if(staNo == 15){ |
| | | agvStaNo = "CS-311"; |
| | | } else if(staNo == 17){ |
| | | agvStaNo = "CS-312"; |
| | | } else if(staNo == 19){ |
| | | agvStaNo = "CS-313"; |
| | | } |
| | | //通知WMS当前容器码 |
| | | boolean result = agvCureentCall(agvStaNo, barcode); |
| | | if (result) { |
| | | barcodeThread.setBarcode(""); |
| | | } |
| | |
| | | ledCommand.setStaNo(wrkStaNo); |
| | | ledCommand.setBarcode(barcode); |
| | | if (ioType != 110 && ioType != 10) { |
| | | List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo)); |
| | | if (ioType == 101) { |
| | | locDetls.forEach(locDetl -> { |
| | | Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no", wrkNo); |
| | | Utils.wapperSetCondition(wrapper, "batch", locDetl.getBatch()); |
| | | Utils.wapperSetCondition(wrapper, "three_code", locDetl.getThreeCode()); |
| | | Utils.wapperSetCondition(wrapper, "dead_time", locDetl.getDeadTime()); |
| | | Utils.wapperSetCondition(wrapper, "supp_code", locDetl.getSuppCode());//料箱码 |
| | | List<WrkDetl> detl = wrkDetlService.selectList(wrapper); |
| | | if (Cools.isEmpty(detl)) { |
| | | String suppCode = ""; |
| | | if (locDetl.getSuppCode() != null) { |
| | | suppCode = locDetl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode)); |
| | | } else { |
| | | //出库数量累计 |
| | | Double conut = 0.0; |
| | | for (WrkDetl wrkDetl : detl) { |
| | | conut = conut + wrkDetl.getAnfme(); |
| | | } |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo)); |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), wrkDetl.getStock(), wrkDetl.getSpecs(), wrkDetl.getSuppCode())); |
| | | }); |
| | | |
| | | for (WrkDetl wrkDetl : detl) { |
| | | String suppCode = ""; |
| | | if (wrkDetl.getSuppCode() != null) { |
| | | suppCode = wrkDetl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), (locDetl.getAnfme() - conut), wrkDetl.getSpecs(), suppCode, wrkDetl.getOrderNo())); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | } else { |
| | | locDetls.forEach(locDetl -> { |
| | | Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no", wrkNo); |
| | | Utils.wapperSetCondition(wrapper, "batch", locDetl.getBatch()); |
| | | Utils.wapperSetCondition(wrapper, "three_code", locDetl.getThreeCode()); |
| | | Utils.wapperSetCondition(wrapper, "dead_time", locDetl.getDeadTime()); |
| | | Utils.wapperSetCondition(wrapper, "supp_code", locDetl.getSuppCode());//料箱码 |
| | | List<WrkDetl> detl = wrkDetlService.selectList(wrapper); |
| | | if (Cools.isEmpty(detl)) { |
| | | String suppCode = ""; |
| | | if (locDetl.getSuppCode() != null) { |
| | | suppCode = locDetl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode)); |
| | | } else { |
| | | //出库数量累计 |
| | | Double conut = 0.0; |
| | | for (WrkDetl wrkDetl : detl) { |
| | | conut = conut + wrkDetl.getAnfme(); |
| | | } |
| | | |
| | | for (WrkDetl wrkDetl : detl) { |
| | | String suppCode = ""; |
| | | if (wrkDetl.getSuppCode() != null) { |
| | | suppCode = wrkDetl.getSuppCode(); |
| | | } |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), 0D, wrkDetl.getSpecs(), suppCode, wrkDetl.getOrderNo())); |
| | | } |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | if (ioType == 101 || ioType == 107) {//全板出库或盘点出库,查询wrkDetl |
| | | locDetls = new ArrayList<>(); |
| | | ledCommand.setMatDtos(new ArrayList<>()); |
| | | } |
| | | |
| | | if (locDetls.isEmpty()) { |
| | | List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo)); |
| | | wrkDetls.forEach(wrkDetl -> { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), wrkDetl.getAnfme(), wrkDetl.getSpecs(), wrkDetl.getSuppCode())); |
| | | }); |
| | | |
| | | if (wrkDetls.isEmpty()) {//从历史档查询 |
| | | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectLatestByWorkNo(wrkNo, barcode); |
| | | for (WrkDetlLog wrkDetlLog : wrkDetlLogs) { |
| | | ledCommand.getMatDtos().add(new MatDto(wrkDetlLog.getMatnr(), wrkDetlLog.getMaktx(), wrkDetlLog.getAnfme(), wrkDetlLog.getAnfme(), wrkDetlLog.getSpecs(), wrkDetlLog.getSuppCode())); |
| | | } |
| | | } |
| | | } |
| | | // List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", sourceLocNo)); |
| | | // if (ioType == 101) { |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo)); |
| | | // wrkDetls.forEach(wrkDetl -> { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), 0D, wrkDetl.getSpecs(), wrkDetl.getSuppCode())); |
| | | // }); |
| | | //// locDetls.forEach(locDetl -> { |
| | | //// Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no", wrkNo); |
| | | //// Utils.wapperSetCondition(wrapper, "batch", locDetl.getBatch()); |
| | | //// Utils.wapperSetCondition(wrapper, "three_code", locDetl.getThreeCode()); |
| | | //// Utils.wapperSetCondition(wrapper, "dead_time", locDetl.getDeadTime()); |
| | | //// Utils.wapperSetCondition(wrapper, "supp_code", locDetl.getSuppCode());//料箱码 |
| | | //// List<WrkDetl> detl = wrkDetlService.selectList(wrapper); |
| | | //// if (Cools.isEmpty(detl)) { |
| | | //// String suppCode = ""; |
| | | //// if (locDetl.getSuppCode() != null) { |
| | | //// suppCode = locDetl.getSuppCode(); |
| | | //// } |
| | | //// ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode)); |
| | | //// } else { |
| | | //// //出库数量累计 |
| | | //// Double conut = 0.0; |
| | | //// for (WrkDetl wrkDetl : detl) { |
| | | //// conut = conut + wrkDetl.getAnfme(); |
| | | //// } |
| | | //// |
| | | //// for (WrkDetl wrkDetl : detl) { |
| | | //// String suppCode = ""; |
| | | //// if (wrkDetl.getSuppCode() != null) { |
| | | //// suppCode = wrkDetl.getSuppCode(); |
| | | //// } |
| | | //// ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), (locDetl.getAnfme() - conut), wrkDetl.getSpecs(), suppCode, wrkDetl.getOrderNo())); |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// }); |
| | | // } else { |
| | | // locDetls.forEach(locDetl -> { |
| | | // Wrapper<WrkDetl> wrapper = new EntityWrapper<WrkDetl>().eq("matnr", locDetl.getMatnr()).eq("wrk_no", wrkNo); |
| | | // Utils.wapperSetCondition(wrapper, "batch", locDetl.getBatch()); |
| | | // Utils.wapperSetCondition(wrapper, "three_code", locDetl.getThreeCode()); |
| | | // Utils.wapperSetCondition(wrapper, "dead_time", locDetl.getDeadTime()); |
| | | // Utils.wapperSetCondition(wrapper, "supp_code", locDetl.getSuppCode());//料箱码 |
| | | // List<WrkDetl> detl = wrkDetlService.selectList(wrapper); |
| | | // if (Cools.isEmpty(detl)) { |
| | | // String suppCode = ""; |
| | | // if (locDetl.getSuppCode() != null) { |
| | | // suppCode = locDetl.getSuppCode(); |
| | | // } |
| | | // ledCommand.getMatDtos().add(new MatDto(locDetl.getMatnr(), locDetl.getMaktx(), 0D, locDetl.getAnfme(), locDetl.getSpecs(), suppCode)); |
| | | // } else { |
| | | // //出库数量累计 |
| | | // Double conut = 0.0; |
| | | // for (WrkDetl wrkDetl : detl) { |
| | | // conut = conut + wrkDetl.getAnfme(); |
| | | // } |
| | | // |
| | | // for (WrkDetl wrkDetl : detl) { |
| | | // String suppCode = ""; |
| | | // if (wrkDetl.getSuppCode() != null) { |
| | | // suppCode = wrkDetl.getSuppCode(); |
| | | // } |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), (wrkDetl.getStock() - conut), wrkDetl.getSpecs(), suppCode, wrkDetl.getOrderNo())); |
| | | // } |
| | | // } |
| | | // |
| | | // }); |
| | | // } |
| | | // |
| | | // |
| | | // if (ioType == 107) { |
| | | // locDetls = new ArrayList<>(); |
| | | // ledCommand.setMatDtos(new ArrayList<>()); |
| | | // } |
| | | // |
| | | // if (locDetls.isEmpty() && ioType != 101) { |
| | | // List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo)); |
| | | // wrkDetls.forEach(wrkDetl -> { |
| | | // if (wrkDetl.getAnfme() > 0D) { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetl.getMatnr(), wrkDetl.getMaktx(), wrkDetl.getAnfme(), wrkDetl.getAnfme(), wrkDetl.getSpecs(), wrkDetl.getSuppCode())); |
| | | // } |
| | | // }); |
| | | // |
| | | // if (wrkDetls.isEmpty()) {//从历史档查询 |
| | | // List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectLatestByWorkNo(wrkNo, barcode); |
| | | // for (WrkDetlLog wrkDetlLog : wrkDetlLogs) { |
| | | // if (wrkDetlLog.getAnfme() > 0D) { |
| | | // ledCommand.getMatDtos().add(new MatDto(wrkDetlLog.getMatnr(), wrkDetlLog.getMaktx(), wrkDetlLog.getAnfme(), wrkDetlLog.getAnfme(), wrkDetlLog.getSpecs(), wrkDetlLog.getSuppCode())); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | commands.add(ledCommand); |