#
lsh
2024-03-20 2831a88603cf5e7548f586d01c64adcdf8d82b70
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -262,6 +262,34 @@
            }
        }
        OperateResultExOne<byte[]> resultAgvAndPlcOk = siemensS7Net.Read("DB102.0", (short) 30);
        if (resultAgvAndPlcOk.IsSuccess) {
            for (int i = 0; i < staNoSize; i++) {
                int sign =(i+2)/2-1;
                if ((i+2)%2!=0){
                    Integer siteId = staNos.get(i); // 站点编号
                    StaProtocol staProtocol = station.get(siteId);
                    if (null == staProtocol) {
                        staProtocol = new StaProtocol();
                        staProtocol.setSiteId(siteId);
                        station.put(siteId, staProtocol);
                    }
                    staProtocol.setAgvTargetPick(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6+4));     // 允许取货
                    staProtocol.setAgvTargetPlace((short)0);   // 允许放货
                    continue;
                }
                Integer siteId = staNos.get(i); // 站点编号
                StaProtocol staProtocol = station.get(siteId);
                if (null == staProtocol) {
                    staProtocol = new StaProtocol();
                    staProtocol.setSiteId(siteId);
                    station.put(siteId, staProtocol);
                }
                staProtocol.setAgvTargetPick(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6));     // 允许取货
                staProtocol.setAgvTargetPlace(siemensS7Net.getByteTransform().TransInt16(resultAgvAndPlc.Content, sign*6 + 2));   // 允许放货
            }
        }
        if (slave.getId() == 1) {
            //条码
@@ -363,7 +391,7 @@
        }
        ArrayList<Integer> staNos = getStaNo();
        int index = staNos.indexOf(staProtocol.getSiteId());
        if (staProtocol.getAgvTypeSign()==0){  //0取货
        if (staProtocol.getAgvTypeSign()==0 || staProtocol.getAgvTypeSign()==2 ){  //0取货
            switch (staProtocol.getSiteId()){
                case 100:
                    index=32;
@@ -415,7 +443,11 @@
        //任务下发次数
        int writeCount = 0;
        do {
            write = siemensS7Net.Write("DB102." + index, true);    // 任务完成
            short textWrite = 1;// 任务完成
            if (staProtocol.getAgvTypeSign()>1){
                textWrite = 0;// 任务复位
            }
            write = siemensS7Net.Write("DB102." + index, textWrite);
            if(write.IsSuccess){
                writeCount=6;
            }else {
@@ -461,7 +493,8 @@
                taskWrk.setCommandStep(taskWrk.getCommandStep() + 1);//更新指令步序
                taskWrkService.updateById(taskWrk);
            }else{
                log.error("输送线写入失败"+staProtocol+"++++++++++++++++++++++++++++++++++++++");
                log.error(staProtocol+"++++++++++++++++++++++++++++++++++++++");
//                log.error("输送线写入失败"+staProtocol+"++++++++++++++++++++++++++++++++++++++");
            }
        }