hdy
2025-02-26 a2cd0f560c226d7830c79fa3c0a6cb3db72927b4
billion-main/src/main/java/com/billion/main/plcServer/CustomRunner.java
@@ -1,27 +1,100 @@
package com.billion.main.plcServer;
import com.billion.main.bs.service.IBsBomChildInfoService;
import com.billion.main.constant.Constants;
import com.billion.main.da.service.IDaParamCollectionService;
import com.billion.main.da.service.IDaStationCollectionService;
import com.billion.main.om.service.IOmOrderSchedulingService;
import com.billion.main.om.service.IOmProductionOrderInfoService;
import com.billion.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
    public IDaParamCollectionService daParamCollectionService;
    @Autowired
    public IDaStationCollectionService daStationCollectionService;
    @Autowired
    public IOmProductionOrderInfoService omProductionOrderInfoService;
    @Autowired
    public IOmOrderSchedulingService omOrderSchedulingService;
    @Autowired
    public IBsBomChildInfoService bomChildInfoService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //第三方设备
        Constants.PLC.add(Constants.C040);
        Constants.PLC.add(Constants.OP030);
        Constants.PLC.add(Constants.OP050);
        Constants.PLC.add(Constants.OP070);
        Constants.PLC.add(Constants.OP110);
        Constants.PLC.add(Constants.OP140);
        //PLC1设备
        Constants.PLC.add(Constants.C010);
        Constants.PLC.add(Constants.C020);
        Constants.PLC.add(Constants.C030);
        Constants.PLC.add(Constants.C060);
        Constants.PLC.add(Constants.C070);
        //PLC2设备
        Constants.PLC.add(Constants.P010);
        Constants.PLC.add(Constants.P020);
        Constants.PLC.add(Constants.P030);
        Constants.PLC.add(Constants.OP005);
        Constants.PLC.add(Constants.OP010);
        Constants.PLC.add(Constants.OP020);
        Constants.PLC.add(Constants.OP040);
        Constants.PLC.add(Constants.OP045);
        Constants.PLC.add(Constants.OP060);
        Constants.PLC.add(Constants.OP075);
        Constants.PLC.add(Constants.OP080);
        Constants.PLC.add(Constants.OP090);
        Constants.PLC.add(Constants.OP095);
        Constants.PLC.add(Constants.OP100);
        Constants.PLC.add(Constants.OP120);
        //PLC3设备
        Constants.PLC.add(Constants.OP130);
        Constants.PLC.add(Constants.OP145);
        Constants.PLC.add(Constants.OP150);
        Constants.PLC.add(Constants.OP160);
        Constants.PLC.add(Constants.OP165);
        Constants.PLC.add(Constants.OP170);
        Constants.PLC.add(Constants.OP180);
        Constants.PLC.add(Constants.OP190);
        Constants.PLC.add(Constants.OP200);
        Constants.PLC.add(Constants.OP210);
        Constants.PLC.add(Constants.OP220);
        Constants.PLC.add(Constants.OP230);
        Constants.PLC.add(Constants.OP240);
        Constants.PLC.add(Constants.OP250);
        Constants.PLC.add(Constants.OP260);
        Constants.PLC.add(Constants.OP270);
        Constants.PLC.add(Constants.OP275);
        Constants.PLC.add(Constants.OP280);
        Constants.PLC.add(Constants.OP290);
        Constants.PLC.add(Constants.OP295);
        Constants.PLC.add(Constants.OP300);
        //
        OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
                daParamCollectionService);
                daParamCollectionService,
                daStationCollectionService,
                omProductionOrderInfoService,
                omOrderSchedulingService,
                bomChildInfoService);
        List<String> lists = getList();
        System.out.println("订阅内容:"+lists);
@@ -31,18 +104,11 @@
    public List<String> getList(){
        List<String> lists = new ArrayList<>();
        lists.add("CFL4CVT.BCOP010.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP040.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP060.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP100.RecordData");//请求保存
        lists.add("CFL4CVT.BP020.RecordData");//请求保存
        lists.add("CFL4CVT.OP220.RecordData");//请求保存
        lists.add("CFL4CVT.BCOP010.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP040.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP060.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BCOP100.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.BP020.MesRecordDataDone");//请求保存
        lists.add("CFL4CVT.OP220.MesRecordDataDone");//请求保存
        lists.add("PLC1.C005.RecordData");//请求保存
        lists.add("PLC1.C005.WorkOrderRequest");//请求保存
        lists.add("PLC1.OP010.RecordData");//请求保存
        lists.add("PLC1.A1.RecordData");//请求保存
        return lists;
    }
}