zhangchao
2024-08-30 0cd7adb27af908b7d0ce0db697f9567d77bcbeb2
对照协议调整
4个文件已修改
125 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/model/SearchLocParam.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/StaProtocol.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/SiemensDevpThread.java 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -128,7 +128,6 @@
                }
                String barcode11 = barcodeThread.getBarcode();
                if (Cools.isEmpty(barcode11)) {
                    System.out.println("0000");
                    if (staProtocol.isAutoing() && !staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 9999 && staProtocol.isPakMk() && staProtocol.getStamp() == 2) {
                        staProtocol.setStamp(3);
                        News.info("" + mark + " - 7" + " - 扫码失败2 ===>> {}号条码扫描器检测条码信息:{},站点:{}", inSta.getBarcode(), barcode11, inSta.getStaNo());
@@ -1382,6 +1381,14 @@
                        param.setIoType(10);
                        param.setSourceStaNo(emptyInSta.getStaNo());
                        param.setLocType1(locTypeDto.getLocType1());
                        if (emptyInSta.getStaNo() == 102) {
                            param.setLocType2((short) 3);
                        } else if (emptyInSta.getStaNo() == 211) {
                            param.setLocType1((short) 5);
                            param.setLocType2((short) 4);
                        } else if (emptyInSta.getStaNo() == 201) {
                            param.setLocType2((short) 4);
                        }
                        String response = new HttpHandler.Builder()
                                .setUri(wmsUrl)
                                .setPath("/rpc/pakin/loc/v1")
src/main/java/com/zy/common/model/SearchLocParam.java
@@ -15,9 +15,12 @@
    private String barcode;
    // 库位规格( 0:未知, 1:低库位, 2:中库位, 3:高库位 )
    // 库位规格( 0:未知, 1:窄库位, 2:宽库位,5超宽库位)
    private Short locType1;
    //3托盘 4平板
    private Short locType2;
    public static void main(String[] args) {
        SearchLocParam searchLocParam = new SearchLocParam();
        searchLocParam.setIoType(1);
src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -81,19 +81,19 @@
    // 扫码失败
    private boolean barcodeErr;
    public BasDevp toSqlModel(){
    public BasDevp toSqlModel() {
        BasDevp basDevp = new BasDevp();
        basDevp.setDevNo(siteId);
        basDevp.setWrkNo(workNo.intValue());
        basDevp.setAutoing(autoing?"Y":"N");
        basDevp.setLoading(loading?"Y":"N");
        basDevp.setInEnable(inEnable?"Y":"N");
        basDevp.setOutEnable(outEnable?"Y":"N");
        basDevp.setLocType1((short) 0);  // 高低类型{0:未知,1:低库位,2:高库位}
        basDevp.setLocType2((short) 0);  // 宽窄类型{0:未知,1:窄库位,2:宽库位}
        basDevp.setLocType3((short) 0);  // 轻重类型{0:未知,1:轻库位,2:重库位}
        basDevp.setAutoing(autoing ? "Y" : "N");
        basDevp.setLoading(loading ? "Y" : "N");
        basDevp.setInEnable(inEnable ? "Y" : "N");
        basDevp.setOutEnable(outEnable ? "Y" : "N");
        // basDevp.setLocType1((short) 0);  // 高低类型{0:未知,1:低库位,2:高库位}
        // basDevp.setLocType2((short) 0);  // 宽窄类型{0:未知,1:窄库位,2:宽库位}
        // basDevp.setLocType3((short) 0);  // 轻重类型{0:未知,1:轻库位,2:重库位}
        basDevp.setLocType1(high != low && low ? (short) 1 : (short) 2);
        basDevp.setInQty(inQty !=null ?(int)inQty : 0);
        basDevp.setInQty(inQty != null ? (int) inQty : 0);
        return basDevp;
    }
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -50,7 +50,7 @@
        add(101);
        add(102);
        add(103);
        add(104);
        //add(104);
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
@@ -194,7 +194,7 @@
//        updateIoMode();
        ArrayList<Integer> staNos = getStaNo();
        int staNoSize = staNos.size();
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 4));
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize * 8));
//        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.2", (short) (staNoSize*2));
        if (result.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
@@ -205,19 +205,11 @@
                    staProtocol.setSiteId(siteId);
                    station.put(siteId, staProtocol);
                }
                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4));     // 工作号
                staProtocol.setWorkNo((short) siemensS7Net.getByteTransform().TransInt32(result.Content, i * 8));     // 工作号
                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 4 + 2));   // 目标站
            }
        }
                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i * 8 + 4));   // 目标站
        Thread.sleep(200);
        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB101.6", (short) (staNoSize * 4));
        if (result1.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
                Integer siteId = staNos.get(i); // 站点编号
                boolean[] status = siemensS7Net.getByteTransform().TransBool(result1.Content, i * 4, 1);
                StaProtocol staProtocol = station.get(siteId);
                boolean[] status = siemensS7Net.getByteTransform().TransBool(result.Content, i * 8 + 6, 1);
                staProtocol.setAutoing(status[0]);  // 自动
                staProtocol.setLoading(status[1]);  // 有物
                staProtocol.setInEnable(status[2]); // 可入
@@ -226,7 +218,6 @@
                staProtocol.setFullPlt(status[5]);  // 满托盘
                staProtocol.setHigh(status[6]);     // 高库位
                staProtocol.setLow(status[7]);      // 低库位
                if (!staProtocol.isPakMk() && !staProtocol.isLoading()) {
                    staProtocol.setPakMk(true);
                }
@@ -237,8 +228,10 @@
                    //lfd入库印记  当stamp>=2时才入库
                    staProtocol.setStamp(staProtocol.getStamp() + 1);
                }
            }
        }
//        Thread.sleep(200);
//        OperateResultExOne<byte[]> result0 = siemensS7Net.Read("DB101.0", (short) 186);
@@ -254,43 +247,57 @@
//                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result0.Content, i*2));   // 目标站
//            }
//        }
        //条码扫描器
        Thread.sleep(200);
        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.2", (short) (barcodeSize * 8));
        //ArrayList<Integer> barcodeList = BarcodeList;
        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.200", (short) (3 * 8));
        if (result2.IsSuccess) {
            if (slave.getId() == 1) {
                for (int i = 0; i < barcodeSize / 3; i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
//                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
                        barcodeThread.setBarcode(barcode);
                    }
                }
            } else if (slave.getId() == 2) {
                for (int i = barcodeSize / 3; i < barcodeSize; i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, (i - barcodeSize / 3) * 8, 8, "UTF-8");
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
//                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
                        barcodeThread.setBarcode(barcode);
                    }
                }
            } else if (slave.getId() == 3) {
                for (int i = barcodeSize / 3 + 1; i < barcodeSize; i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, (i - (barcodeSize / 3) * 2) * 8, 8, "UTF-8");
                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
//                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
                        barcodeThread.setBarcode(barcode);
                    }
            for (int i = 0; i < 3; i++) {
                String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
                BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i);
                if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
                    barcodeThread.setBarcode(barcode);
                }
            }
        }
        //条码扫描器
//        Thread.sleep(200);
//        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.2", (short) (barcodeSize * 8));
//        if (result2.IsSuccess) {
//            if (slave.getId() == 1) {
//                for (int i = 0; i < barcodeSize / 3; i++) {
//                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, i * 8, 8, "UTF-8");
//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
//                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
////                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
//                        barcodeThread.setBarcode(barcode);
//                    }
//                }
//            } else if (slave.getId() == 2) {
//                for (int i = barcodeSize / 3; i < barcodeSize; i++) {
//                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, (i - barcodeSize / 3) * 8, 8, "UTF-8");
//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
//                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
////                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
//                        barcodeThread.setBarcode(barcode);
//                    }
//                }
//            } else if (slave.getId() == 3) {
//                for (int i = barcodeSize / 3 + 1; i < barcodeSize; i++) {
//                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content, (i - (barcodeSize / 3) * 2) * 8, 8, "UTF-8");
//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, i + 1);
//                    if (!Cools.isEmpty(barcodeThread) && !barcodeThread.getBarcode().equals(barcode)) {
////                            && !Cools.isEmpty(barcode) && Cools.isEmpty(barcodeThread.getBarcode())) {
//                        barcodeThread.setBarcode(barcode);
//                    }
//                }
//            }
//        }
        Thread.sleep(200);
        OperateResultExOne<byte[]> resultError = siemensS7Net.Read("DB101.1", (short) (32));
        OperateResultExOne<byte[]> resultError = siemensS7Net.Read("DB101.100", (short) (32));
        if (resultError.IsSuccess) {
            ArrayList<Integer> staNoError = new ArrayList<Integer>() {{
                add(102);
@@ -317,7 +324,7 @@
        }
        if (result.IsSuccess && result1.IsSuccess) {
        if (result.IsSuccess) {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功", DateUtils.convert(new Date()), slave.getId()));