自动化立体仓库 - WCS系统
#
LSH
2023-06-03 352c66676507d76fedb6f7332a138391baf85937
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -47,18 +47,18 @@
//
//    }};
    public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
        add(100);add(101);add(102);add(103);
        add(104);add(105);add(106);add(107);
        add(101);add(102);add(103);
        add(104);add(105);add(106);
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(200);add(201);add(202);add(203);
        add(204);add(205);add(206);add(207);
        add(201);add(202);add(203);
        add(204);add(205);add(206);
    }};
    public static final ArrayList<Integer> staNos3 = new ArrayList<Integer>() {{
        add(300);add(301);add(302);add(303);
        add(304);add(305);add(306);add(307);
        add(301);add(302);add(303);
        add(304);add(305);add(306);
    }};
@@ -191,7 +191,7 @@
        ArrayList<Integer> staNos = getStaNo();
        int staNoSize = staNos.size();
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*2));
        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB101.0", (short) (staNoSize*2));
        OperateResultExOne<byte[]> result4 = siemensS7Net.Read("DB100.0", (short) (staNoSize*2));
        if (result.IsSuccess && result4.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
                Integer siteId = staNos.get(i); // 站点编号
@@ -222,10 +222,10 @@
//        }
        //条码扫描器
        Thread.sleep(200);
        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.200",(short)(barcodeSize/2*8));
        if (result2.IsSuccess) {
        OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB100.0",(short)(barcodeSize/3*8));
        if (result2.IsSuccess && 1!=1) {
            if (slave.getId()==1){
                for (int i = 0; i < barcodeSize/2; i++) {
                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)){
@@ -234,8 +234,17 @@
                    }
                }
            }else if (slave.getId()==2){
                for (int i = barcodeSize/2; i < barcodeSize; i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,(i-barcodeSize/2)*8,8, "UTF-8");
                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())) {
@@ -246,7 +255,7 @@
        }
        Thread.sleep(200);
        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB102.100", (short) (staNoSize * 2));
        OperateResultExOne<byte[]> result1 = siemensS7Net.Read("DB100.0", (short) (staNoSize * 2));
        if (result1.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
                Integer siteId = staNos.get(i); // 站点编号
@@ -271,59 +280,8 @@
                    //lfd入库印记  当stamp>=2时才入库
                    staProtocol.setStamp(staProtocol.getStamp()+1);
                }
//                //20230110,日志打印,确认收到入库站可入信号时,对应条码数据是否已有
//                if ((siteId==101 || siteId==109 || siteId==117 || siteId==201 || siteId==207 || siteId==213)
//                        && staProtocol.isInEnable()){
//                    Integer barcodeId = 0;
//                    switch (siteId){
//                        case 101:
//                            barcodeId=1;
//                            break;
//                        case 109:
//                            barcodeId=2;
//                            break;
//                        case 117:
//                            barcodeId=3;
//                            break;
//                        case 201:
//                            barcodeId=4;
//                            break;
//                        case 207:
//                            barcodeId=5;
//                            break;
//                        case 213:
//                            barcodeId=6;
//                            break;
//                    }
//                    BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcodeId);
//                    if(barcodeThread!=null){
//                        //lfd入库印记  当stamp>=2时才入库
//                        staProtocol.setStamp(staProtocol.getStamp()+1);
//                        News.info("{}站有可入信号时,条码值为{}", siteId, barcodeThread.getBarcode());
//                        if(Cools.isEmpty(barcodeThread.getBarcode())){
//                            staProtocol.setInEnable(false);//条码数据为空时,先清一次内存的站点可入信号,等待下一次获取可入信号
//                        }
//                    }
//                }
            }
        }
//        //RGV小车
//        Thread.sleep(200);
//        OperateResultExOne<byte[]> result3 = siemensS7Net.Read("DB100.160",(short)2);
//        if (result3.IsSuccess) {
//            Integer siteId = 16;
//            StaProtocol staProtocol = station.get(siteId);
//            if (null == staProtocol) {
//                staProtocol = new StaProtocol();
//                staProtocol.setSiteId(siteId);
//                station.put(siteId, staProtocol);
//            }
//            staProtocol.setNearbySta(String.valueOf(siemensS7Net.getByteTransform().TransInt16(result3.Content, 0)));
//        }
        if (result.IsSuccess && result1.IsSuccess) {