zyx
2024-02-06 e53d36a01183ebe660ab2d77c9bcd4e0ab6c42a3
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -2739,13 +2739,38 @@
        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);
@@ -2763,13 +2788,13 @@
                        agvStaNo = "303-1";
                    } else if(staNo == 12){
                        agvStaNo = "304-1";
                    } else if(staNo == 13){
                        agvStaNo = "311-1";
                    } else if(staNo == 14){
                        agvStaNo = "313-1";
                    } else if(staNo == 15){
                        agvStaNo = "315-1";
                        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取货
@@ -2785,6 +2810,48 @@
        }
    }
    /**
     * 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 = "310-1";
                    } else if(staNo == 15){
                        agvStaNo = "312-1";
                    } else if(staNo == 17){
                        agvStaNo = "314-1";
                    } else if(staNo == 19){
                        agvStaNo = "316-1";
                    }
                    //通知WMS当前容器码
                    boolean result = agvCureentCall(agvStaNo, barcode);
                    if (result) {
                        barcodeThread.setBarcode("");
                    }
                    log.info(barcodeThread.getSlave().getId() + "号扫码器,通知AGV取货,条码号:" + barcode);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    // 300站拣料
    public void pick300() {
        try {