hdy
2025-02-27 bf5dcc46de28c2ca664be4c6c3566e0a82c1ecd6
提交 | 用户 | 时间
1e2ff5 1 package com.billion.main.plcServer;
H 2
a2cd0f 3 import com.billion.main.bs.service.IBsBomChildInfoService;
H 4 import com.billion.main.constant.Constants;
bf5dcc 5 import com.billion.main.da.service.IDaCollectionParamConfService;
H 6 import com.billion.main.da.service.IDaMaterialCollectionService;
1e2ff5 7 import com.billion.main.da.service.IDaParamCollectionService;
a2cd0f 8 import com.billion.main.da.service.IDaStationCollectionService;
H 9 import com.billion.main.om.service.IOmOrderSchedulingService;
10 import com.billion.main.om.service.IOmProductionOrderInfoService;
1e2ff5 11 import com.billion.main.plcServer.sub.OPCUaSubscription;
H 12 import com.kangaroohy.milo.service.MiloService;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.boot.ApplicationArguments;
15 import org.springframework.boot.ApplicationRunner;
a2cd0f 16 import org.springframework.stereotype.Component;
1e2ff5 17
H 18 import java.util.ArrayList;
19 import java.util.List;
a2cd0f 20 @Component
1e2ff5 21 public class CustomRunner implements ApplicationRunner {
H 22     @Autowired
23     private MiloService miloService;
24
25     @Autowired
26     public IDaParamCollectionService daParamCollectionService;
a2cd0f 27
H 28     @Autowired
29     public IDaStationCollectionService daStationCollectionService;
30
31     @Autowired
32     public IOmProductionOrderInfoService omProductionOrderInfoService;
33     @Autowired
34     public IOmOrderSchedulingService omOrderSchedulingService;
35     @Autowired
bf5dcc 36     public IBsBomChildInfoService bsBomChildInfoService;
H 37     @Autowired
38     public IDaCollectionParamConfService daCollectionParamConfService;
39     @Autowired
40     public IDaMaterialCollectionService daMaterialCollectionService;
a2cd0f 41
H 42
1e2ff5 43     @Override
H 44     public void run(ApplicationArguments args) throws Exception {
a2cd0f 45         //第三方设备
H 46         Constants.PLC.add(Constants.C040);
47         Constants.PLC.add(Constants.OP030);
48         Constants.PLC.add(Constants.OP050);
49         Constants.PLC.add(Constants.OP070);
50         Constants.PLC.add(Constants.OP110);
51         Constants.PLC.add(Constants.OP140);
52         //PLC1设备
53         Constants.PLC.add(Constants.C010);
54         Constants.PLC.add(Constants.C020);
55         Constants.PLC.add(Constants.C030);
56         Constants.PLC.add(Constants.C060);
57         Constants.PLC.add(Constants.C070);
58         //PLC2设备
59         Constants.PLC.add(Constants.P010);
60         Constants.PLC.add(Constants.P020);
61         Constants.PLC.add(Constants.P030);
62         Constants.PLC.add(Constants.OP005);
63         Constants.PLC.add(Constants.OP010);
64         Constants.PLC.add(Constants.OP020);
65         Constants.PLC.add(Constants.OP040);
66         Constants.PLC.add(Constants.OP045);
67         Constants.PLC.add(Constants.OP060);
68         Constants.PLC.add(Constants.OP075);
69         Constants.PLC.add(Constants.OP080);
70         Constants.PLC.add(Constants.OP090);
71         Constants.PLC.add(Constants.OP095);
72         Constants.PLC.add(Constants.OP100);
73         Constants.PLC.add(Constants.OP120);
74         //PLC3设备
75         Constants.PLC.add(Constants.OP130);
76         Constants.PLC.add(Constants.OP145);
77         Constants.PLC.add(Constants.OP150);
78         Constants.PLC.add(Constants.OP160);
79         Constants.PLC.add(Constants.OP165);
80         Constants.PLC.add(Constants.OP170);
81         Constants.PLC.add(Constants.OP180);
82         Constants.PLC.add(Constants.OP190);
83         Constants.PLC.add(Constants.OP200);
84         Constants.PLC.add(Constants.OP210);
85         Constants.PLC.add(Constants.OP220);
86         Constants.PLC.add(Constants.OP230);
87         Constants.PLC.add(Constants.OP240);
88         Constants.PLC.add(Constants.OP250);
89         Constants.PLC.add(Constants.OP260);
90         Constants.PLC.add(Constants.OP270);
91         Constants.PLC.add(Constants.OP275);
92         Constants.PLC.add(Constants.OP280);
93         Constants.PLC.add(Constants.OP290);
94         Constants.PLC.add(Constants.OP295);
95         Constants.PLC.add(Constants.OP300);
96         //
1e2ff5 97
H 98         OPCUaSubscription OPCUaSubscription = new OPCUaSubscription(miloService,
a2cd0f 99                 daParamCollectionService,
H 100                 daStationCollectionService,
101                 omProductionOrderInfoService,
102                 omOrderSchedulingService,
bf5dcc 103                 bsBomChildInfoService,
H 104                 daCollectionParamConfService,
105                 daMaterialCollectionService);
1e2ff5 106
H 107         List<String> lists = getList();
108         System.out.println("订阅内容:"+lists);
109         miloService.subscriptionFromOpcUa(lists,OPCUaSubscription);
110
111     }
112
113     public List<String> getList(){
114         List<String> lists = new ArrayList<>();
a2cd0f 115         lists.add("PLC1.C005.RecordData");//请求保存
H 116         lists.add("PLC1.C005.WorkOrderRequest");//请求保存
117         lists.add("PLC1.OP010.RecordData");//请求保存
118         lists.add("PLC1.A1.RecordData");//请求保存
119
1e2ff5 120         return lists;
H 121     }
122 }