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