1
5 天以前 a84e04a54fa499bcff8c9806df5c15e09ce3c504
src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -10,6 +10,8 @@
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.mapper.BasRgvMapMapper;
import com.zy.asrs.mapper.BasRgvMapper;
import com.zy.asrs.service.*;
import com.zy.common.utils.News;
import com.zy.core.DevpThread;
@@ -24,6 +26,7 @@
import com.zy.core.model.protocol.StaProtocol;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
@@ -37,7 +40,8 @@
@Data
@Slf4j
public class SiemensDevpThread implements Runnable, DevpThread {
    private BasRgvMapMapper basRgvMapMapper;
    private BasRgvMapper basRgvMapper;
    private DevpSlave slave;
    private SiemensS7Net siemensS7Net;
    private Map<Integer, StaProtocol> station = new ConcurrentHashMap<>();
@@ -47,6 +51,7 @@
//
//    }};
    public static final ArrayList<Integer> staNos1 = new ArrayList<Integer>() {{
        add(1);add(2);//小车站点
        add(1001);add(1002);add(1004);
        add(1005);add(1007);
        add(1008);add(1010);
@@ -67,6 +72,7 @@
    }};
    public static final ArrayList<Integer> staNos2 = new ArrayList<Integer>() {{
        add(3);add(4);
        add(2001);add(2003);
        add(2004);add(2006);
        add(2007);add(2009);
@@ -442,7 +448,7 @@
        OperateResultExOne<byte[]> result4 = null;//1054-1079
        OperateResultExOne<byte[]> result5 = null;//1080-1110
        OperateResultExOne<byte[]> resultErr = null;
        if(staNoSize == 100){
        if(staNoSize == 102){
            result1 = siemensS7Net.Read("DB100.0", (short) (2768));//1001-1028
            result2 = siemensS7Net.Read("DB101.0", (short) (1268));//1029-1037
            result3 = siemensS7Net.Read("DB104.0", (short) (1268));//1042-1053
@@ -470,7 +476,7 @@
                    station.put(siteId, staProtocol);
                }
                staProtocol.setSiteId(siteId);
                if (staNoSize == 100) {
                if (staNoSize == 102) {
                    if (siteId < 1029) {
                        result = result1;
                    } else if (siteId < 1042) {
@@ -491,6 +497,20 @@
                        result = result3;
                    }
                }
//                if(siteId < 5){
//                    int rgvNo = 2;
//                    if(siteId<3){
//                        rgvNo = 1;
//                    }
////                    BasRgv basRgv = basRgvMapper.selectByRgvNo(rgvNo);
//                    BasRgvMap basRgvMap = basRgvMapMapper.selectByRgvNo(rgvNo);
//                    if(siteId%2 != 0){
////                        staProtocol.setWorkNo(basRgv.getWrkNo1());
//                    }else{
////                        staProtocol.setWorkNo(basRgv.getWrkNo2());
//                    }
//
//                }else{
                // 获取该站点对应的偏移量
                Integer offset = siteOffsetMap.get(siteId);
                if (offset == null) {
@@ -637,6 +657,8 @@
                if (!staProtocol.isPakMk() && (!staProtocol.isLoading() || staProtocol.getWorkNo()==0)) {
                    staProtocol.setPakMk(true);
                }
//                }
            }
        }
        //条码扫描器
@@ -705,6 +727,8 @@
        }
        if (result1.IsSuccess && result2.IsSuccess) {
            OutputQueue.DEVP.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));