cl
2024-04-24 e7a9d55133fc1ce4b7651767e6b4c4d41bbe32a0
提交 | 用户 | 时间
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
e7a9d5 105         //lists.add(OPCElement.COP010_F_HEART_BEAT);
d43481 106         lists.add(OPCElement.COP010_J_PLC_START);
C 107         lists.add(OPCElement.COP010_J_PLC_FINISH);
108
e7a9d5 109         //lists.add(OPCElement.COP020_F_HEART_BEAT);
d43481 110         lists.add(OPCElement.COP020_J_PLC_START);
C 111         lists.add(OPCElement.COP020_J_PLC_FINISH);
112
e7a9d5 113         //lists.add(OPCElement.COP030_F_HEART_BEAT);
d43481 114         lists.add(OPCElement.COP030_J_PLC_START);
C 115         lists.add(OPCElement.COP030_J_PLC_FINISH);
116
e7a9d5 117         //lists.add(OPCElement.BOP010_F_HEART_BEAT);
d43481 118         lists.add(OPCElement.BOP010_J_PLC_START);
C 119         lists.add(OPCElement.BOP010_J_PLC_FINISH);
120
e7a9d5 121         //lists.add(OPCElement.BOP020_F_HEART_BEAT);
d43481 122         lists.add(OPCElement.BOP020_J_PLC_START);
C 123         lists.add(OPCElement.BOP020_J_PLC_FINISH);
124
e7a9d5 125         //lists.add(OPCElement.BOP030_F_HEART_BEAT);
d43481 126         lists.add(OPCElement.BOP030_J_PLC_START);
C 127         lists.add(OPCElement.BOP030_J_PLC_FINISH);
128
e7a9d5 129         //lists.add(OPCElement.BOP030B_F_HEART_BEAT);
d43481 130         lists.add(OPCElement.BOP030B_J_PLC_START);
C 131         lists.add(OPCElement.BOP030B_J_PLC_FINISH);
132
e7a9d5 133         //lists.add(OPCElement.BOP040_F_HEART_BEAT);
d43481 134         lists.add(OPCElement.BOP040_J_PLC_START);
C 135         lists.add(OPCElement.BOP040_J_PLC_FINISH);
136
e7a9d5 137         //lists.add(OPCElement.BOP040B_F_HEART_BEAT);
d43481 138         lists.add(OPCElement.BOP040B_J_PLC_START);
C 139         lists.add(OPCElement.BOP040B_J_PLC_FINISH);
140
e7a9d5 141         //lists.add(OPCElement.DOP010_F_HEART_BEAT);
d43481 142         lists.add(OPCElement.DOP010_J_PLC_START);
C 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
e7a9d5 149         //lists.add(OPCElement.EOP010_F_HEART_BEAT);
d43481 150         lists.add(OPCElement.EOP010_J_PLC_START);
C 151         lists.add(OPCElement.EOP010_J_PLC_FINISH);
152
e7a9d5 153         //lists.add(OPCElement.EOP020_F_HEART_BEAT);
d43481 154         lists.add(OPCElement.EOP020_J_PLC_START);
C 155         lists.add(OPCElement.EOP020_J_PLC_FINISH);
156
e7a9d5 157         //lists.add(OPCElement.EOP030_F_HEART_BEAT);
d43481 158         lists.add(OPCElement.EOP030_J_PLC_START);
C 159         lists.add(OPCElement.EOP030_J_PLC_FINISH);
160
e7a9d5 161         //lists.add(OPCElement.EOP040_F_HEART_BEAT);
d43481 162         lists.add(OPCElement.EOP040_J_PLC_START);
C 163         lists.add(OPCElement.EOP040_J_PLC_FINISH);
164
e7a9d5 165         //lists.add(OPCElement.EOP050_F_HEART_BEAT);
d43481 166         lists.add(OPCElement.EOP050_J_PLC_START);
C 167         lists.add(OPCElement.EOP050_J_PLC_FINISH);
168
e7a9d5 169         //lists.add(OPCElement.EOP060_F_HEART_BEAT);
d43481 170         lists.add(OPCElement.EOP060_J_PLC_START);
C 171         lists.add(OPCElement.EOP060_J_PLC_FINISH);
172
e7a9d5 173         //lists.add(OPCElement.EOP070_F_HEART_BEAT);
d43481 174         lists.add(OPCElement.EOP070_J_PLC_START);
C 175         lists.add(OPCElement.EOP070_J_PLC_FINISH);
176
e7a9d5 177         //lists.add(OPCElement.EOP070_F_HEART_BEAT);
d43481 178         lists.add(OPCElement.EOP070_J_PLC_START);
C 179         lists.add(OPCElement.EOP070_J_PLC_FINISH);
180
e7a9d5 181         //lists.add(OPCElement.EOP090_F_HEART_BEAT);
d43481 182         lists.add(OPCElement.EOP090_J_PLC_START);
C 183         lists.add(OPCElement.EOP090_J_PLC_FINISH);
184
e7a9d5 185         //lists.add(OPCElement.EOP090B_F_HEART_BEAT);
d43481 186         lists.add(OPCElement.EOP090B_J_PLC_START);
C 187         lists.add(OPCElement.EOP090B_J_PLC_FINISH);
188
e7a9d5 189         //lists.add(OPCElement.OP010_F_HEART_BEAT);
d43481 190         lists.add(OPCElement.OP010_J_PLC_START);
C 191         lists.add(OPCElement.OP010_J_PLC_FINISH);
192
e7a9d5 193         //lists.add(OPCElement.OP020_F_HEART_BEAT);
d43481 194         lists.add(OPCElement.OP020_J_PLC_START);
C 195         lists.add(OPCElement.OP020_J_PLC_FINISH);
196
e7a9d5 197         //lists.add(OPCElement.OP030_F_HEART_BEAT);
d43481 198         lists.add(OPCElement.OP030_J_PLC_START);
C 199         lists.add(OPCElement.OP030_J_PLC_FINISH);
200
e7a9d5 201         //lists.add(OPCElement.OP040_F_HEART_BEAT);
d43481 202         lists.add(OPCElement.OP040_J_PLC_START);
C 203         lists.add(OPCElement.OP040_J_PLC_FINISH);
204
e7a9d5 205         //lists.add(OPCElement.OP050_F_HEART_BEAT);
d43481 206         lists.add(OPCElement.OP050_J_PLC_START);
C 207         lists.add(OPCElement.OP050_J_PLC_FINISH);
208
e7a9d5 209         //lists.add(OPCElement.OP070_F_HEART_BEAT);
d43481 210         lists.add(OPCElement.OP070_J_PLC_START);
C 211         lists.add(OPCElement.OP070_J_PLC_FINISH);
212
e7a9d5 213         //lists.add(OPCElement.OP080_F_HEART_BEAT);
d43481 214         lists.add(OPCElement.OP080_J_PLC_START);
C 215         lists.add(OPCElement.OP080_J_PLC_FINISH);
216
e7a9d5 217         //lists.add(OPCElement.OP090_F_HEART_BEAT);
d43481 218         lists.add(OPCElement.OP090_J_PLC_START);
C 219         lists.add(OPCElement.OP090_J_PLC_FINISH);
220
e7a9d5 221         //lists.add(OPCElement.OP100_F_HEART_BEAT);
d43481 222         lists.add(OPCElement.OP100_J_PLC_START);
C 223         lists.add(OPCElement.OP100_J_PLC_FINISH);
224
e7a9d5 225         //lists.add(OPCElement.OP110_F_HEART_BEAT);
d43481 226         lists.add(OPCElement.OP110_J_PLC_START);
C 227         lists.add(OPCElement.OP110_J_PLC_FINISH);
228
e7a9d5 229         //lists.add(OPCElement.OP120_F_HEART_BEAT);
d43481 230         lists.add(OPCElement.OP120_J_PLC_START);
C 231         lists.add(OPCElement.OP120_J_PLC_FINISH);
232
e7a9d5 233         //lists.add(OPCElement.OP120B_F_HEART_BEAT);
d43481 234         lists.add(OPCElement.OP120B_J_PLC_START);
C 235         lists.add(OPCElement.OP120B_J_PLC_FINISH);
236
e7a9d5 237         //lists.add(OPCElement.OP130_F_HEART_BEAT);
d43481 238         lists.add(OPCElement.OP130_J_PLC_START);
C 239         lists.add(OPCElement.OP130_J_PLC_FINISH);
240
e7a9d5 241         //lists.add(OPCElement.OP130B_F_HEART_BEAT);
d43481 242         lists.add(OPCElement.OP130B_J_PLC_START);
C 243         lists.add(OPCElement.OP130B_J_PLC_FINISH);
244
e7a9d5 245         //lists.add(OPCElement.OP140_F_HEART_BEAT);
d43481 246         lists.add(OPCElement.OP140_J_PLC_START);
C 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
e7a9d5 253         //lists.add(OPCElement.OP160_F_HEART_BEAT);
d43481 254         lists.add(OPCElement.OP160_J_PLC_START);
C 255         lists.add(OPCElement.OP160_J_PLC_FINISH);
256
e7a9d5 257         //lists.add(OPCElement.OP170_F_HEART_BEAT);
d43481 258         lists.add(OPCElement.OP170_J_PLC_START);
C 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