自动化立体仓库 - WCS系统
#
whycq
2024-01-30 3ac9f524f1f751015a3882f08d631233208953dc
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -48,10 +48,9 @@
    private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
    private short heartBeatVal = 1;
    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(108);add(109);add(110);add(111);
        add(112);add(113);add(114);add(115);add(116);add(117);add(118);add(119);add(120);add(121);add(122);add(123);
        add(100);add(101);add(102);add(103);add(104);add(105);add(106);add(107);
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
    /*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(208);add(209);add(210);add(211);
@@ -69,7 +68,7 @@
    public static final ArrayList<Integer> staNos4 = new ArrayList<Integer>() {{
        add(400);add(401);add(402);add(403);
        add(404);add(405);add(406);add(407);
    }};
    }};*/
    /**
     * 条码数量
@@ -90,12 +89,12 @@
        switch (slave.getId()) {
            case 1:
                return staNos1;
            case 2:
            /*case 2:
                return staNos2;
            case 3:
                return staNos3;
            case 4:
                return staNos4;
                return staNos4;*/
            default:
                throw new CoolException("服务器异常");
        }
@@ -126,10 +125,10 @@
                        write((StaProtocol)task.getData());
                        read();
                        break;
                    case 3:
                   /* case 3:
                        write2((StaProtocol)task.getData());
                        read();
                        break;
                        break;*/
                    default:
                        break;
                }
@@ -200,7 +199,7 @@
//        updateIoMode();
        ArrayList<Integer> staNos = getStaNo();
        int staNoSize = staNos.size();
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB100.0", (short) (staNoSize*4));
        OperateResultExOne<byte[]> result = siemensS7Net.Read("DB101.0", (short) (staNoSize*8));
        if (result.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
                Integer siteId = staNos.get(i); // 站点编号
@@ -210,9 +209,9 @@
                    staProtocol.setSiteId(siteId);
                    station.put(siteId, staProtocol);
                }
                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4));     // 工作号
                staProtocol.setWorkNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8));     // 工作号
                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*4 + 2));   // 目标站
                staProtocol.setStaNo(siemensS7Net.getByteTransform().TransInt16(result.Content, i*8 + 4));   // 目标站
            }
        }
@@ -242,7 +241,7 @@
        if (slave.getId() == 1){
            //条码
            //Thread.sleep(200);
            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.102",(short)60);
            OperateResultExOne<byte[]> result2 = siemensS7Net.Read("DB101.840.0",(short)60);
            if (result2.IsSuccess) {
                for (int i = 0; i < 6; i++) {
                    String barcode = siemensS7Net.getByteTransform().TransString(result2.Content,i*10,8, "UTF-8");