cl
2024-02-23 73bc0656dc15cd9cc95c6f4f51949ef0437088ce
提交 | 用户 | 时间
d43481 1 package cn.stylefeng.guns.plcserver.init;
C 2
3 import cn.stylefeng.guns.modular.bs.collectionParamConf.service.CollectionParamConfService;
4 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam;
5 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult;
6 import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService;
7 import cn.stylefeng.guns.modular.bs.locationInfo.service.LocationInfoService;
8 import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService;
9 import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
10 import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService;
11 import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
12 import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
13 import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
14 import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
15 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService;
16 import cn.stylefeng.guns.modular.om.productionOrderRecords.service.ProductionOrderRecordsService;
17 import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService;
18 import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
19 import cn.stylefeng.guns.plcserver.callback.*;
20 import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
21 import cn.stylefeng.guns.plcserver.opc.OPCElement;
22 import com.kangaroohy.milo.service.MiloService;
23 import lombok.extern.slf4j.Slf4j;
24 import org.openscada.opc.lib.da.Item;
25 import org.springframework.beans.factory.annotation.Autowired;
26 import org.springframework.boot.ApplicationArguments;
27 import org.springframework.boot.ApplicationRunner;
28 import org.springframework.stereotype.Component;
29
30 import java.util.ArrayList;
31 import java.util.List;
32 import java.util.concurrent.ExecutorService;
33 import java.util.concurrent.Executors;
34
35 @Component
36 @Slf4j
37 public class CustomRunner implements ApplicationRunner {
38
39     @Autowired
40     public MiloService miloService;
41
42     @Autowired
43     public ProductionOrdeInfoService productionOrdeInfoService;
44     @Autowired
45     public PassingStationCollectionService passingStationCollectionService;
46     @Autowired
47     public ParamCollectionService paramCollectionService;
48     @Autowired
49     public CollectionParamConfService collectionParamConfService;
50     @Autowired
51     public SerialNumbersConfService serialNumbersConfService;
52     @Autowired
53     private EquipmentStatusService equipmentStatusService;
54
55     @Autowired
56     private EquipmentAlarmService equipmentAlarmService;
57     @Autowired
58     private MaterialTraceabilityService materialTraceabilityService;
59     @Autowired
60     private EquipmentInfoService equipmentInfoService;
61     @Autowired
62     private RepairManageInfoService repairManageInfoService;
63
64     @Autowired
65     private LocationInfoService locationInfoService;
66
67     @Autowired
68     private GreaseManageService greaseManageService;
69
70     @Autowired
71     private ProductionOrderRecordsService productionOrderRecordsService;
72
73     @Autowired
74     private ProductionOrderBatchInfoService productionOrderBatchInfoService;
75
76     private List stateLists = null;
77     @Override
78     public void run(ApplicationArguments args) throws Exception {
79
80         GlobalVariable.PRODUCT_TYPE_MAP.put("12980500000198","1");//C1 36V
81         GlobalVariable.PRODUCT_TYPE_MAP.put("12980500000174","2");//C1 48V
82         GlobalVariable.PRODUCT_TYPE_MAP.put("12980500000194","3");//T1 36V
83         GlobalVariable.PRODUCT_TYPE_MAP.put("12980500000201","4");//T1 48V
84
85         GlobalVariable.PRODUCT_CODE_MAP.put("1","12980500000198");
86         GlobalVariable.PRODUCT_CODE_MAP.put("2","12980500000174");
87         GlobalVariable.PRODUCT_CODE_MAP.put("3","12980500000194");
88         GlobalVariable.PRODUCT_CODE_MAP.put("4","12980500000201");
89
90         InitCallback InitCallback = new InitCallback(miloService,productionOrdeInfoService,
91                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
92                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
93                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
94                 productionOrderBatchInfoService);
95
314bc7 96         System.out.println("start run^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
d43481 97         List<String> lists = getList();
C 98         miloService.subscriptionFromOpcUa(lists,InitCallback);
99
100     }
101
102     public List<String> getList(){
103         List<String> lists = new ArrayList<>();
104
105         lists.add(OPCElement.COP010_F_HEART_BEAT);
106         lists.add(OPCElement.COP010_J_PLC_START);
107         lists.add(OPCElement.COP010_J_PLC_FINISH);
108
109         lists.add(OPCElement.COP020_F_HEART_BEAT);
110         lists.add(OPCElement.COP020_J_PLC_START);
111         lists.add(OPCElement.COP020_J_PLC_FINISH);
112
113         lists.add(OPCElement.COP030_F_HEART_BEAT);
114         lists.add(OPCElement.COP030_J_PLC_START);
115         lists.add(OPCElement.COP030_J_PLC_FINISH);
116
117         lists.add(OPCElement.BOP010_F_HEART_BEAT);
118         lists.add(OPCElement.BOP010_J_PLC_START);
119         lists.add(OPCElement.BOP010_J_PLC_FINISH);
120
121         lists.add(OPCElement.BOP020_F_HEART_BEAT);
122         lists.add(OPCElement.BOP020_J_PLC_START);
123         lists.add(OPCElement.BOP020_J_PLC_FINISH);
124
125         lists.add(OPCElement.BOP030_F_HEART_BEAT);
126         lists.add(OPCElement.BOP030_J_PLC_START);
127         lists.add(OPCElement.BOP030_J_PLC_FINISH);
128
129         lists.add(OPCElement.BOP030B_F_HEART_BEAT);
130         lists.add(OPCElement.BOP030B_J_PLC_START);
131         lists.add(OPCElement.BOP030B_J_PLC_FINISH);
132
133         lists.add(OPCElement.BOP040_F_HEART_BEAT);
134         lists.add(OPCElement.BOP040_J_PLC_START);
135         lists.add(OPCElement.BOP040_J_PLC_FINISH);
136
137         lists.add(OPCElement.BOP040B_F_HEART_BEAT);
138         lists.add(OPCElement.BOP040B_J_PLC_START);
139         lists.add(OPCElement.BOP040B_J_PLC_FINISH);
140
141         lists.add(OPCElement.DOP010_F_HEART_BEAT);
142         lists.add(OPCElement.DOP010_J_PLC_START);
143         lists.add(OPCElement.DOP010_J_PLC_FINISH);
144
145     /*    lists.add(OPCElement.DOP020_F_HEART_BEAT);
146         lists.add(OPCElement.DOP020_J_PLC_START);
147         lists.add(OPCElement.DOP020_J_PLC_FINISH);*/
148
149         lists.add(OPCElement.EOP010_F_HEART_BEAT);
150         lists.add(OPCElement.EOP010_J_PLC_START);
151         lists.add(OPCElement.EOP010_J_PLC_FINISH);
152
153         lists.add(OPCElement.EOP020_F_HEART_BEAT);
154         lists.add(OPCElement.EOP020_J_PLC_START);
155         lists.add(OPCElement.EOP020_J_PLC_FINISH);
156
157         lists.add(OPCElement.EOP030_F_HEART_BEAT);
158         lists.add(OPCElement.EOP030_J_PLC_START);
159         lists.add(OPCElement.EOP030_J_PLC_FINISH);
160
161         lists.add(OPCElement.EOP040_F_HEART_BEAT);
162         lists.add(OPCElement.EOP040_J_PLC_START);
163         lists.add(OPCElement.EOP040_J_PLC_FINISH);
164
165         lists.add(OPCElement.EOP050_F_HEART_BEAT);
166         lists.add(OPCElement.EOP050_J_PLC_START);
167         lists.add(OPCElement.EOP050_J_PLC_FINISH);
168
169         lists.add(OPCElement.EOP060_F_HEART_BEAT);
170         lists.add(OPCElement.EOP060_J_PLC_START);
171         lists.add(OPCElement.EOP060_J_PLC_FINISH);
172
173         lists.add(OPCElement.EOP070_F_HEART_BEAT);
174         lists.add(OPCElement.EOP070_J_PLC_START);
175         lists.add(OPCElement.EOP070_J_PLC_FINISH);
176
177         lists.add(OPCElement.EOP070_F_HEART_BEAT);
178         lists.add(OPCElement.EOP070_J_PLC_START);
179         lists.add(OPCElement.EOP070_J_PLC_FINISH);
180
181         lists.add(OPCElement.EOP090_F_HEART_BEAT);
182         lists.add(OPCElement.EOP090_J_PLC_START);
183         lists.add(OPCElement.EOP090_J_PLC_FINISH);
184
185         lists.add(OPCElement.EOP090B_F_HEART_BEAT);
186         lists.add(OPCElement.EOP090B_J_PLC_START);
187         lists.add(OPCElement.EOP090B_J_PLC_FINISH);
188
189         lists.add(OPCElement.OP010_F_HEART_BEAT);
190         lists.add(OPCElement.OP010_J_PLC_START);
191         lists.add(OPCElement.OP010_J_PLC_FINISH);
192
193         lists.add(OPCElement.OP020_F_HEART_BEAT);
194         lists.add(OPCElement.OP020_J_PLC_START);
195         lists.add(OPCElement.OP020_J_PLC_FINISH);
196
197         lists.add(OPCElement.OP030_F_HEART_BEAT);
198         lists.add(OPCElement.OP030_J_PLC_START);
199         lists.add(OPCElement.OP030_J_PLC_FINISH);
200
201         lists.add(OPCElement.OP040_F_HEART_BEAT);
202         lists.add(OPCElement.OP040_J_PLC_START);
203         lists.add(OPCElement.OP040_J_PLC_FINISH);
204
205         lists.add(OPCElement.OP050_F_HEART_BEAT);
206         lists.add(OPCElement.OP050_J_PLC_START);
207         lists.add(OPCElement.OP050_J_PLC_FINISH);
208
209         lists.add(OPCElement.OP070_F_HEART_BEAT);
210         lists.add(OPCElement.OP070_J_PLC_START);
211         lists.add(OPCElement.OP070_J_PLC_FINISH);
212
213         lists.add(OPCElement.OP080_F_HEART_BEAT);
214         lists.add(OPCElement.OP080_J_PLC_START);
215         lists.add(OPCElement.OP080_J_PLC_FINISH);
216
217         lists.add(OPCElement.OP090_F_HEART_BEAT);
218         lists.add(OPCElement.OP090_J_PLC_START);
219         lists.add(OPCElement.OP090_J_PLC_FINISH);
220
221         lists.add(OPCElement.OP100_F_HEART_BEAT);
222         lists.add(OPCElement.OP100_J_PLC_START);
223         lists.add(OPCElement.OP100_J_PLC_FINISH);
224
225         lists.add(OPCElement.OP110_F_HEART_BEAT);
226         lists.add(OPCElement.OP110_J_PLC_START);
227         lists.add(OPCElement.OP110_J_PLC_FINISH);
228
229         lists.add(OPCElement.OP120_F_HEART_BEAT);
230         lists.add(OPCElement.OP120_J_PLC_START);
231         lists.add(OPCElement.OP120_J_PLC_FINISH);
232
233         lists.add(OPCElement.OP120B_F_HEART_BEAT);
234         lists.add(OPCElement.OP120B_J_PLC_START);
235         lists.add(OPCElement.OP120B_J_PLC_FINISH);
236
237         lists.add(OPCElement.OP130_F_HEART_BEAT);
238         lists.add(OPCElement.OP130_J_PLC_START);
239         lists.add(OPCElement.OP130_J_PLC_FINISH);
240
241         lists.add(OPCElement.OP130B_F_HEART_BEAT);
242         lists.add(OPCElement.OP130B_J_PLC_START);
243         lists.add(OPCElement.OP130B_J_PLC_FINISH);
244
245         lists.add(OPCElement.OP140_F_HEART_BEAT);
246         lists.add(OPCElement.OP140_J_PLC_START);
247         lists.add(OPCElement.OP140_J_PLC_FINISH);
248
249      /*   lists.add(OPCElement.OP150_F_HEART_BEAT);
250         lists.add(OPCElement.OP150_J_PLC_START);
251         lists.add(OPCElement.OP150_J_PLC_FINISH);*/
252
253         lists.add(OPCElement.OP160_F_HEART_BEAT);
254         lists.add(OPCElement.OP160_J_PLC_START);
255         lists.add(OPCElement.OP160_J_PLC_FINISH);
256
257         lists.add(OPCElement.OP170_F_HEART_BEAT);
258         lists.add(OPCElement.OP170_J_PLC_START);
259         lists.add(OPCElement.OP170_J_PLC_FINISH);
260
73bc06 261         /*if(null == stateLists ){
d43481 262             EquipmentInfoParam equipmentInfoParam = new EquipmentInfoParam();
C 263             stateLists = equipmentInfoService.findListBySpec(equipmentInfoParam);
264         }
265
266         if(!stateLists.isEmpty()){
267             for(int i=0;i<stateLists.size();i++) {
268                 EquipmentInfoResult result = (EquipmentInfoResult) stateLists.get(i);
269                 if(null != result.getSpareField1()){
270                     lists.add(result.getSpareField1());
271                 }
272             }
73bc06 273         }*/
d43481 274         return lists;
C 275     }
276 }
277