package com.jcdm.main.plcserver;
|
|
|
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
|
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
|
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
|
import com.jcdm.main.plcserver.conf.OPCElement;
|
import com.jcdm.main.plcserver.sub.OPCUaSubscription;
|
import com.kangaroohy.milo.service.MiloService;
|
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.List;
|
|
@Component
|
public class CustomRunner implements ApplicationRunner {
|
|
@Autowired
|
private MiloService miloService;
|
|
@Autowired
|
private IDaPassingStationCollectionService daPassingStationCollectionService;
|
|
@Autowired
|
private IDaCollectionParamConfService collectionParamConfService;
|
|
@Autowired
|
private IDaParamCollectionService daParamCollectionService;
|
|
@Override
|
public void run(ApplicationArguments args) throws Exception {
|
|
OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
|
miloService,
|
daPassingStationCollectionService,
|
collectionParamConfService,
|
daParamCollectionService);
|
|
List<String> lists = getSubList();
|
miloService.subscriptionFromOpcUa(lists,opcUaSubscription);
|
|
}
|
|
/**
|
* 订阅内容
|
*/
|
public List<String> getSubList(){
|
List<String> lists = new ArrayList<>();
|
lists.add(OPCElement.OP_OP010_RecordSN);//请求下发SN号
|
lists.add(OPCElement.OP_OP230_RecordData);//请求记录数据
|
lists.add(OPCElement.OP_OP240_RecordData);//请求记录数据
|
lists.add(OPCElement.OP_OP240_AngleResult);//请求记录数据
|
lists.add(OPCElement.OP_OP250_RecordData);//请求记录数据
|
lists.add(OPCElement.OP_OP250_AngleResult);//请求记录数据
|
return lists;
|
}
|
}
|