| | |
| | | package cn.stylefeng.guns.plcserver.init; |
| | | |
| | | import cn.stylefeng.guns.modular.bs.collectionParamConf.service.CollectionParamConfService; |
| | | import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam; |
| | | import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult; |
| | | import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService; |
| | | import cn.stylefeng.guns.modular.bs.locationInfo.service.LocationInfoService; |
| | | import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService; |
| | |
| | | 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.callback.*; |
| | | import cn.stylefeng.guns.plcserver.opc.GlobalVariable; |
| | | import cn.stylefeng.guns.plcserver.opc.OPCElement; |
| | | import cn.stylefeng.guns.plcserver.server.HEARTBEAT.HeartBeatServerInterface; |
| | | import cn.stylefeng.guns.plcserver.server.HEARTBEAT.impl.HeartBeatServerInterfaceImpl; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.openscada.opc.lib.da.Item; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | |
| | | GlobalVariable.PRODUCT_CODE_MAP.put("2","12980500000174"); |
| | | GlobalVariable.PRODUCT_CODE_MAP.put("3","12980500000194"); |
| | | GlobalVariable.PRODUCT_CODE_MAP.put("4","12980500000201"); |
| | | |
| | | InitCallback InitCallback = new InitCallback(miloService,productionOrdeInfoService, |
| | | SubscriptionManage InitCallback = new SubscriptionManage(miloService,productionOrdeInfoService, |
| | | passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService, |
| | | equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService, |
| | | repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService, |
| | | productionOrderBatchInfoService); |
| | | |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | String Months = StringUtils.leftPad(String.valueOf(calendar.get(Calendar.MONTH) + 1),2, "0"); |
| | | if(Months.equals("04") |
| | | ||Months.equals("07") ||Months.equals("08") || Months.equals("09") |
| | | || Months.equals("10") || Months.equals("11") || Months.equals("12") || |
| | | Months.equals("01") || Months.equals("02") || Months.equals("03") ){ |
| | | GlobalVariable.IS_CLOCK = false; |
| | | } |
| | | /* ExecutorService cachedThreadPool = Executors.newCachedThreadPool(); |
| | | cachedThreadPool.execute(new HeartBeatTaskThreadPool());*/ |
| | | |
| | | System.out.println("start run^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"); |
| | | List<String> lists = getList(); |
| | | miloService.subscriptionFromOpcUa(lists,InitCallback); |
| | | miloService.subscriptionFromOpcUa(lists,500,InitCallback); |
| | | |
| | | } |
| | | |
| | | public List<String> getList(){ |
| | | List<String> lists = new ArrayList<>(); |
| | | |
| | | //lists.add(OPCElement.COP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.COP010_J_PLC_START); |
| | | lists.add(OPCElement.COP010_J_PLC_FINISH); |
| | | lists.add(OPCElement.COP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.COP010_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.COP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.COP020_J_PLC_START); |
| | | lists.add(OPCElement.COP020_J_PLC_FINISH); |
| | | lists.add(OPCElement.COP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.COP020_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.COP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.COP030_J_PLC_START); |
| | | lists.add(OPCElement.COP030_J_PLC_FINISH); |
| | | lists.add(OPCElement.COP030_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP010_J_PLC_START); |
| | | lists.add(OPCElement.BOP010_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP010_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP020_J_PLC_START); |
| | | lists.add(OPCElement.BOP020_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP020_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP030_J_PLC_START); |
| | | lists.add(OPCElement.BOP030_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP030_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP030B_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP030B_J_PLC_START); |
| | | lists.add(OPCElement.BOP030B_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP030B_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP040_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP040_J_PLC_START); |
| | | lists.add(OPCElement.BOP040_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP040_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.BOP040B_F_HEART_BEAT); |
| | | lists.add(OPCElement.BOP040B_J_PLC_START); |
| | | lists.add(OPCElement.BOP040B_J_PLC_FINISH); |
| | | lists.add(OPCElement.BOP040B_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.DOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.DOP010_J_PLC_START); |
| | | lists.add(OPCElement.DOP010_J_PLC_FINISH); |
| | | lists.add(OPCElement.DOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.DOP010_PLC_REQUST); |
| | | |
| | | /* lists.add(OPCElement.DOP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.DOP020_J_PLC_START); |
| | | lists.add(OPCElement.DOP020_J_PLC_FINISH);*/ |
| | | |
| | | //lists.add(OPCElement.EOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP010_J_PLC_START); |
| | | lists.add(OPCElement.EOP010_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP010_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP020_J_PLC_START); |
| | | lists.add(OPCElement.EOP020_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP020_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP030_J_PLC_START); |
| | | lists.add(OPCElement.EOP030_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP030_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP040_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP040_J_PLC_START); |
| | | lists.add(OPCElement.EOP040_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP040_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP050_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP050_J_PLC_START); |
| | | lists.add(OPCElement.EOP050_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP050_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP050_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP060_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP060_J_PLC_START); |
| | | lists.add(OPCElement.EOP060_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP060_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP060_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP070_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP070_J_PLC_START); |
| | | lists.add(OPCElement.EOP070_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP070_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP070_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP070_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP070_J_PLC_START); |
| | | lists.add(OPCElement.EOP070_J_PLC_FINISH); |
| | | lists.add(OPCElement.EOP080_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP080_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.EOP090_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP090_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP090_J_PLC_START); |
| | | lists.add(OPCElement.EOP090_J_PLC_FINISH); |
| | | |
| | | //lists.add(OPCElement.EOP090B_F_HEART_BEAT); |
| | | lists.add(OPCElement.EOP090B_J_PLC_START); |
| | | lists.add(OPCElement.EOP090B_J_PLC_FINISH); |
| | | |
| | | //lists.add(OPCElement.OP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP010_J_PLC_START); |
| | | lists.add(OPCElement.OP010_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP010_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP010_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP020_J_PLC_START); |
| | | lists.add(OPCElement.OP020_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP020_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP020_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP030_J_PLC_START); |
| | | lists.add(OPCElement.OP030_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP030_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP030_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP040_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP040_J_PLC_START); |
| | | lists.add(OPCElement.OP040_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP040_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP040_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP050_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP050_J_PLC_START); |
| | | lists.add(OPCElement.OP050_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP050_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP050_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP070_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP070_J_PLC_START); |
| | | lists.add(OPCElement.OP070_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP070_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP070_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP080_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP080_J_PLC_START); |
| | | lists.add(OPCElement.OP080_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP080_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP090_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP090_J_PLC_START); |
| | | lists.add(OPCElement.OP090_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP090_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP090_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP100_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP100_J_PLC_START); |
| | | lists.add(OPCElement.OP100_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP100_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP100_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP110_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP110_J_PLC_START); |
| | | lists.add(OPCElement.OP110_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP110_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP110_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP120_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP120_J_PLC_START); |
| | | lists.add(OPCElement.OP120_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP120_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP120_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP120B_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP120B_J_PLC_START); |
| | | lists.add(OPCElement.OP120B_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP120B_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP130_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP130_J_PLC_START); |
| | | lists.add(OPCElement.OP130_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP130_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP130_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP130B_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP130B_J_PLC_START); |
| | | lists.add(OPCElement.OP130B_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP130B_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP140_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP140_J_PLC_START); |
| | | lists.add(OPCElement.OP140_J_PLC_FINISH); |
| | | lists.add(OPCElement.OP140_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP140_PLC_REQUST); |
| | | |
| | | /* lists.add(OPCElement.OP150_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP150_J_PLC_START); |
| | | lists.add(OPCElement.OP150_J_PLC_FINISH);*/ |
| | | lists.add(OPCElement.OP150_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP150_PLC_REQUST); |
| | | |
| | | //lists.add(OPCElement.OP160_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP160_F_HEART_BEAT); |
| | | // lists.add(OPCElement.OP160_PLC_REQUST); |
| | | lists.add(OPCElement.OP160_J_PLC_START); |
| | | lists.add(OPCElement.OP160_J_PLC_FINISH); |
| | | |
| | | //lists.add(OPCElement.OP170_F_HEART_BEAT); |
| | | lists.add(OPCElement.OP170_J_PLC_START); |
| | | lists.add(OPCElement.OP170_J_PLC_FINISH); |
| | | /* lists.add(OPCElement.OP170_F_HEART_BEAT);*/ |
| | | lists.add(OPCElement.OP170_PLC_REQUST); |
| | | |
| | | /*if(null == stateLists ){ |
| | | EquipmentInfoParam equipmentInfoParam = new EquipmentInfoParam(); |
| | |
| | | } |
| | | } |
| | | |
| | | /*class HeartBeatTaskThreadPool implements Runnable { |
| | | |
| | | private HeartBeatServerInterface server; |
| | | |
| | | public void run() { |
| | | try { |
| | | while (GlobalVariable.TERMINATED) { |
| | | server = new HeartBeatServerInterfaceImpl(); |
| | | server.monitor(); |
| | | Thread.sleep(GlobalVariable.SLEEP_TIME); |
| | | } |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }*/ |
| | | |