package com.jcdm.main.plcserver;
|
|
|
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
|
import com.jcdm.main.bs.technologyRouteChild.service.IBsTechnologyRouteChildInfoService;
|
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
|
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
|
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
|
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
|
import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService;
|
import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl;
|
import com.jcdm.main.plcserver.sub.OPCUaSubscription;
|
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService;
|
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 javax.annotation.Resource;
|
import java.util.List;
|
import java.util.stream.Collectors;
|
|
@Component
|
public class CustomRunner implements ApplicationRunner {
|
|
@Autowired
|
public MiloService miloService;
|
|
@Autowired
|
public IDaCollectionParamConfService collectionParamConfService;
|
|
@Autowired
|
public IDaParamCollectionService daParamCollectionService;
|
|
@Resource
|
private DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl;
|
|
@Resource
|
private IDaOpcuaConfigService iDaOpcuaConfigService;
|
|
@Resource
|
private IBsOrderSchedulingService bsOrderSchedulingService;
|
|
@Resource
|
private IRmRepairRecordService rmRepairRecordService;
|
|
@Resource
|
private IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService;
|
|
@Resource
|
private ProductNewPassStationService productNewPassStationService;
|
|
@Override
|
public void run(ApplicationArguments args) throws Exception {
|
|
List<DaOpcuaConfig> lists = getSubList();
|
List<String> collect = lists.stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
|
OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
|
miloService,
|
collectionParamConfService,
|
daParamCollectionService,
|
passingStationCollectionServiceImpl,
|
bsOrderSchedulingService,
|
lists,
|
rmRepairRecordService,
|
bsTechnologyRouteChildInfoService,
|
productNewPassStationService);
|
miloService.subscriptionFromOpcUa(collect,100,opcUaSubscription);
|
}
|
|
/**
|
* 订阅内容
|
*/
|
public List<DaOpcuaConfig> getSubList(){
|
DaOpcuaConfig config = new DaOpcuaConfig();
|
config.setState(0);
|
List<DaOpcuaConfig> list = iDaOpcuaConfigService.selectDaOpcuaConfigList(config);
|
return list;
|
}
|
}
|