cl
2024-01-19 e0fac38b26845f25de479783e0c76cf12a5311e0
guns-vip-main/src/main/java/cn/stylefeng/guns/plcserver/opc/OPCComm.java
@@ -10,6 +10,8 @@
import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService;
import cn.stylefeng.guns.modular.om.productionOrderRecords.service.ProductionOrderRecordsService;
import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService;
import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
import cn.stylefeng.guns.plcserver.server.BOP010.callback.*;
@@ -106,6 +108,12 @@
    public LocationInfoService locationInfoService;
    @Autowired
    public GreaseManageService greaseManageService;
    @Autowired
    public ProductionOrderRecordsService productionOrderRecordsService;
    @Autowired
    public ProductionOrderBatchInfoService productionOrderBatchInfoService;
    //OP010
    private Item OP010_F_HEART_BEAT;//心跳
@@ -727,7 +735,9 @@
                     EquipmentInfoService equipmentInfoService,
                     RepairManageInfoService repairManageInfoService,
                     LocationInfoService locationInfoService,
                     GreaseManageService greaseManageService
                     GreaseManageService greaseManageService,
                     ProductionOrderRecordsService productionOrderRecordsService,
                     ProductionOrderBatchInfoService productionOrderBatchInfoService
                    ) throws Exception {
        this.productionOrdeInfoService = productionOrdeInfoService;
        this.passingStationCollectionService = passingStationCollectionService;
@@ -741,6 +751,8 @@
        this.repairManageInfoService = repairManageInfoService;
        this.locationInfoService = locationInfoService;
        this.greaseManageService = greaseManageService;
        this.productionOrderRecordsService = productionOrderRecordsService;
        this.productionOrderBatchInfoService = productionOrderBatchInfoService;
        // 加载配置文件
        final ConnectionInformation ci = getCLSIDConnectionInfomation();
@@ -753,13 +765,11 @@
            logger.info("This is {} message.", "OPCserver connect success");
            this.server = server;
            // 同步读取,500ms一次
            final AccessBase access = new SyncAccess(server, 1000);
            //final AccessBase access = new Async20Access(server, 1000,false);
            final AccessBase access = new SyncAccess(server, 500);
            //OP010回调
            access.addItem(OPCElement.OP010_F_HEART_BEAT, new DataCallBack_OP010_F_HEART_BEAT());//心跳
           /* access.addItem(OPCElement.OP010_E_STATE, new DataCallBack_OP010_E_STATE());//设备状态*/
            /* access.addItem(OPCElement.OP010_E_STATE, new DataCallBack_OP010_E_STATE());//设备状态*/
            //OP020回调
            access.addItem(OPCElement.OP020_F_HEART_BEAT, new DataCallBack_OP020_F_HEART_BEAT());//心跳
@@ -791,13 +801,11 @@
            access.addItem(OPCElement.OP110_F_HEART_BEAT, new DataCallBack_OP110_F_HEART_BEAT());//心跳
/*
            //OP120回调
            access.addItem(OPCElement.OP120_F_HEART_BEAT, new DataCallBack_OP120_F_HEART_BEAT());//心跳
            //OP120B回调
            access.addItem(OPCElement.OP120B_F_HEART_BEAT, new DataCallBack_OP120B_F_HEART_BEAT());//心跳
      */
            //OP130回调
@@ -810,7 +818,9 @@
            access.addItem(OPCElement.OP140_F_HEART_BEAT, new DataCallBack_OP140_F_HEART_BEAT());//心跳
            //OP150回调
/*
            access.addItem(OPCElement.OP150_F_HEART_BEAT, new DataCallBack_OP150_F_HEART_BEAT());//心跳
*/
            //OP160回调
            access.addItem(OPCElement.OP160_F_HEART_BEAT, new DataCallBack_OP160_F_HEART_BEAT());//心跳
@@ -850,7 +860,7 @@
            access.addItem(OPCElement.DOP010_F_HEART_BEAT, new DataCallBack_DOP010_F_HEART_BEAT());//心跳
            //DOP020回调
            access.addItem(OPCElement.DOP020_F_HEART_BEAT, new DataCallBack_DOP020_F_HEART_BEAT());//心跳
            /* access.addItem(OPCElement.DOP020_F_HEART_BEAT, new DataCallBack_DOP020_F_HEART_BEAT());//心跳*/
            //EOP010回调
            access.addItem(OPCElement.EOP010_F_HEART_BEAT, new DataCallBack_EOP010_F_HEART_BEAT());//心跳
@@ -861,7 +871,7 @@
            //EOP030回调
            access.addItem(OPCElement.EOP030_F_HEART_BEAT, new DataCallBack_EOP030_F_HEART_BEAT());//心跳
             //EOP040回调
            //EOP040回调
            access.addItem(OPCElement.EOP040_F_HEART_BEAT, new DataCallBack_EOP040_F_HEART_BEAT());//心跳
            //EOP050回调
@@ -1045,7 +1055,7 @@
            OP110_S_PRODUCT_STATE_CODE = OP110_GROUP.addItem((OPCElement.OP110_S_PRODUCT_STATE_CODE));//产品状态编码
            //OP120组
         /*   final Group OP120_GROUP = server.addGroup("OP120");
            final Group OP120_GROUP = server.addGroup("OP120");
            OP120_F_HEART_BEAT = OP120_GROUP.addItem((OPCElement.OP120_F_HEART_BEAT));//心跳
            OP120_J_PLC_START = OP120_GROUP.addItem((OPCElement.OP120_J_PLC_START));//PLC开始
            OP120_J_PC_WRITE_ORDER = OP120_GROUP.addItem((OPCElement.OP120_J_PC_WRITE_ORDER));//PC读数据完成
@@ -1070,7 +1080,7 @@
            OP120B_S_PRODUCT_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_CODE));//产品编号
            OP120B_S_SFC_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_SFC_CODE));//总成编码
            OP120B_S_PRODUCT_STATE_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_STATE_CODE));//产品状态编码*/
            OP120B_S_PRODUCT_STATE_CODE = OP120B_GROUP.addItem((OPCElement.OP120B_S_PRODUCT_STATE_CODE));//产品状态编码
            //OP130组
            final Group OP130_GROUP = server.addGroup("OP130");
@@ -1116,7 +1126,7 @@
            OP140_S_PRODUCT_STATE_CODE = OP140_GROUP.addItem((OPCElement.OP140_S_PRODUCT_STATE_CODE));//产品状态编码
            //OP150组
            final Group OP150_GROUP = server.addGroup("OP150");
         /*   final Group OP150_GROUP = server.addGroup("OP150");
            OP150_F_HEART_BEAT = OP150_GROUP.addItem((OPCElement.OP150_F_HEART_BEAT));//心跳
            OP150_J_PLC_START = OP150_GROUP.addItem((OPCElement.OP150_J_PLC_START));//PLC开始
            OP150_J_PC_WRITE_ORDER = OP150_GROUP.addItem((OPCElement.OP150_J_PC_WRITE_ORDER));//PC下发工单
@@ -1127,7 +1137,7 @@
            OP150_S_PRODUCT_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_CODE));//产品编号
            OP150_S_SFC_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_SFC_CODE));//总成编码
            OP150_S_PRODUCT_STATE_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_STATE_CODE));//产品状态编码
            OP150_S_PRODUCT_STATE_CODE = OP150_GROUP.addItem((OPCElement.OP150_S_PRODUCT_STATE_CODE));//产品状态编码*/
            //OP160组
            final Group OP160_GROUP = server.addGroup("OP160");
@@ -1476,7 +1486,7 @@
            DOP010_P_REPAIR_LOCATION = DOP010_GROUP.addItem((OPCElement.DOP010_P_REPAIR_LOCATION));//返修工位
            //DOP020组
            final Group DOP020_GROUP = server.addGroup("DOP020");
            /*final Group DOP020_GROUP = server.addGroup("DOP020");
            DOP020_F_HEART_BEAT = DOP020_GROUP.addItem((OPCElement.DOP020_F_HEART_BEAT));//心跳
            DOP020_J_PLC_START = DOP020_GROUP.addItem((OPCElement.DOP020_J_PLC_START));//PLC开始
            DOP020_J_PC_WRITE_ORDER = DOP020_GROUP.addItem((OPCElement.DOP020_J_PC_WRITE_ORDER));//PC下发工单
@@ -1489,7 +1499,7 @@
            DOP020_S_PRODUCT_STATE_CODE = DOP020_GROUP.addItem((OPCElement.DOP020_S_PRODUCT_STATE_CODE));//产品状态编码
            DOP020_OIL_STATE = DOP020_GROUP.addItem((OPCElement.DOP020_OIL_STATE));//油脂状态
            DOP020_OIL_STATE = DOP020_GROUP.addItem((OPCElement.DOP020_OIL_STATE));//油脂状态*/
            // start reading