cl
2024-01-20 d434812c124e2dab22487f8d40d8ad6c3b8ad19c
提交 | 用户 | 时间
d43481 1 package cn.stylefeng.guns.plcserver.callback;
C 2
3
4 import cn.stylefeng.guns.modular.bs.collectionParamConf.model.params.CollectionParamConfParam;
5 import cn.stylefeng.guns.modular.bs.collectionParamConf.model.result.CollectionParamConfResult;
6 import cn.stylefeng.guns.modular.bs.collectionParamConf.service.CollectionParamConfService;
7 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.params.EquipmentInfoParam;
8 import cn.stylefeng.guns.modular.bs.equipmentInfo.model.result.EquipmentInfoResult;
9 import cn.stylefeng.guns.modular.bs.equipmentInfo.service.EquipmentInfoService;
10 import cn.stylefeng.guns.modular.bs.locationInfo.model.params.LocationInfoParam;
11 import cn.stylefeng.guns.modular.bs.locationInfo.model.result.LocationInfoResult;
12 import cn.stylefeng.guns.modular.bs.locationInfo.service.LocationInfoService;
13 import cn.stylefeng.guns.modular.cm.paramCollection.model.params.ParamCollectionParam;
14 import cn.stylefeng.guns.modular.cm.paramCollection.service.ParamCollectionService;
15 import cn.stylefeng.guns.modular.cm.passingStationCollection.model.params.PassingStationCollectionParam;
16 import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
17 import cn.stylefeng.guns.modular.dq.materialTraceability.model.params.MaterialTraceabilityParam;
18 import cn.stylefeng.guns.modular.dq.materialTraceability.service.MaterialTraceabilityService;
19 import cn.stylefeng.guns.modular.em.equipmentAlarm.model.params.EquipmentAlarmParam;
20 import cn.stylefeng.guns.modular.em.equipmentAlarm.service.EquipmentAlarmService;
21 import cn.stylefeng.guns.modular.em.equipmentStatus.model.params.EquipmentStatusParam;
22 import cn.stylefeng.guns.modular.em.equipmentStatus.model.result.EquipmentStatusResult;
23 import cn.stylefeng.guns.modular.em.equipmentStatus.service.EquipmentStatusService;
24 import cn.stylefeng.guns.modular.gm.greaseManage.service.GreaseManageService;
25 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam;
26 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.result.ProductionOrdeInfoResult;
27 import cn.stylefeng.guns.modular.om.productionOrdeInfo.service.ProductionOrdeInfoService;
28 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.params.ProductionOrderBatchInfoParam;
29 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.model.result.ProductionOrderBatchInfoResult;
30 import cn.stylefeng.guns.modular.om.productionOrderBatchInfo.service.ProductionOrderBatchInfoService;
31 import cn.stylefeng.guns.modular.om.productionOrderRecords.model.params.ProductionOrderRecordsParam;
32 import cn.stylefeng.guns.modular.om.productionOrderRecords.model.result.ProductionOrderRecordsResult;
33 import cn.stylefeng.guns.modular.om.productionOrderRecords.service.ProductionOrderRecordsService;
34 import cn.stylefeng.guns.modular.sc.repairManageInfo.model.params.RepairManageInfoParam;
35 import cn.stylefeng.guns.modular.sc.repairManageInfo.model.result.RepairManageInfoResult;
36 import cn.stylefeng.guns.modular.sc.repairManageInfo.service.RepairManageInfoService;
37 import cn.stylefeng.guns.modular.sc.serialNumbersConf.model.params.SerialNumbersConfParam;
38 import cn.stylefeng.guns.modular.sc.serialNumbersConf.model.result.SerialNumbersConfResult;
39 import cn.stylefeng.guns.modular.sc.serialNumbersConf.service.SerialNumbersConfService;
40 import cn.stylefeng.guns.plcserver.opc.GlobalVariable;
41 import cn.stylefeng.guns.plcserver.opc.OPCElement;
42 import cn.stylefeng.guns.plcserver.opc.unit.SFCCodeTool;
43 import cn.stylefeng.guns.plcserver.tool.DateTool;
44 import cn.stylefeng.guns.plcserver.tool.LogUtil;
45 import com.kangaroohy.milo.model.ReadWriteEntity;
46 import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
47 import com.kangaroohy.milo.service.MiloService;
48 import org.apache.commons.lang3.StringUtils;
49 import org.apache.log4j.Logger;
50 import org.springframework.beans.factory.annotation.Autowired;
51 import org.springframework.stereotype.Component;
52
53 import java.util.ArrayList;
54 import java.util.Calendar;
55 import java.util.Date;
56 import java.util.List;
57
58 @Component
59 public class InitCallback implements SubscriptionCallback {
60
61     public MiloService miloService;
62
63     @Autowired
64     public ProductionOrdeInfoService productionOrdeInfoService;
65     @Autowired
66     public PassingStationCollectionService passingStationCollectionService;
67     @Autowired
68     public ParamCollectionService paramCollectionService;
69     @Autowired
70     public CollectionParamConfService collectionParamConfService;
71     @Autowired
72     public SerialNumbersConfService serialNumbersConfService;
73     @Autowired
74     private EquipmentStatusService equipmentStatusService;
75
76     @Autowired
77     private EquipmentAlarmService equipmentAlarmService;
78     @Autowired
79     private MaterialTraceabilityService materialTraceabilityService;
80     @Autowired
81     private EquipmentInfoService equipmentInfoService;
82     @Autowired
83     private RepairManageInfoService repairManageInfoService;
84
85     @Autowired
86     private LocationInfoService locationInfoService;
87
88     @Autowired
89     private GreaseManageService greaseManageService;
90
91     @Autowired
92     private ProductionOrderRecordsService productionOrderRecordsService;
93
94     @Autowired
95     private ProductionOrderBatchInfoService productionOrderBatchInfoService;
96
97     private static Logger logger;
98     LogUtil logUtil = new LogUtil();
99     static {
100         logger = Logger.getLogger(InitCallback.class);
101     }
102     private static Date IN_TIME = null;
103     private static String S_ORDER_CODE = "";//工单编号
104     private static String S_PRODUCT_CODE = "";//产品编号
105     private static String S_PRODUCT_TYPE= "";//产品类型
106     private static String S_SFC_CODE = "";//总成编码
107     private static String PRODUCTION_LINE  = "OP";//产线号
108     private static String LOCATION_CODE  = "OP010";//工位号
109     private static List list = null;
110
111     private static Integer ACTUAL_ONLINE_QTY  = 0 ;//上线数量
112
113     OP010Callback OP010Callback;
114     OP020Callback OP020Callback;
115     OP030Callback OP030Callback;
116     OP040Callback OP040Callback;
117     OP050Callback OP050Callback;
118     OP070Callback OP070Callback;
119     OP080Callback OP080Callback;
120     OP090Callback OP090Callback;
121     OP100Callback OP100Callback;
122     OP110Callback OP110Callback;
123     OP120Callback OP120Callback;
124     OP120BCallback OP120BCallback;
125     OP130Callback OP130Callback;
126     OP130BCallback OP130BCallback;
127     OP140Callback OP140Callback;
128     OP150Callback OP150Callback;
129     OP160Callback OP160Callback;
130     OP170Callback OP170Callback;
131     BOP010Callback BOP010Callback;
132     BOP020Callback BOP020Callback;
133     BOP030Callback BOP030Callback;
134     BOP030BCallback BOP030BCallback;
135     BOP040Callback BOP040Callback;
136     BOP040BCallback BOP040BCallback;
137     COP010Callback COP010Callback;
138     COP020Callback COP020Callback;
139     COP030Callback COP030Callback;
140     DOP010Callback DOP010Callback;
141     DOP020Callback DOP020Callback;
142     EOP010Callback EOP010Callback;
143     EOP020Callback EOP020Callback;
144     EOP030Callback EOP030Callback;
145     EOP040Callback EOP040Callback;
146     EOP050Callback EOP050Callback;
147     EOP060Callback EOP060Callback;
148     EOP070Callback EOP070Callback;
149     EOP080Callback EOP080Callback;
150     EOP090Callback EOP090Callback;
151     EOP090BCallback EOP090BCallback;
152
153     StateCallback StateCallback;
154
155
156     public InitCallback(MiloService miloService,
157                         ProductionOrdeInfoService productionOrdeInfoService,
158                         PassingStationCollectionService passingStationCollectionService,
159                         ParamCollectionService paramCollectionService,
160                         CollectionParamConfService collectionParamConfService,
161                         SerialNumbersConfService serialNumbersConfService,
162                         EquipmentStatusService equipmentStatusService,
163                         EquipmentAlarmService equipmentAlarmService,
164                         MaterialTraceabilityService materialTraceabilityService,
165                         EquipmentInfoService equipmentInfoService,
166                         RepairManageInfoService repairManageInfoService,
167                         LocationInfoService locationInfoService,
168                         GreaseManageService greaseManageService,
169                         ProductionOrderRecordsService productionOrderRecordsService,
170                         ProductionOrderBatchInfoService productionOrderBatchInfoService) {
171         this.miloService = miloService;
172         this.productionOrdeInfoService = productionOrdeInfoService;
173         this.passingStationCollectionService = passingStationCollectionService;
174         this.paramCollectionService = paramCollectionService;
175         this.collectionParamConfService = collectionParamConfService;
176         this.serialNumbersConfService = serialNumbersConfService;
177         this.equipmentStatusService = equipmentStatusService;
178         this.equipmentAlarmService = equipmentAlarmService;
179         this.materialTraceabilityService = materialTraceabilityService;
180         this.equipmentInfoService = equipmentInfoService;
181         this.repairManageInfoService = repairManageInfoService;
182         this.locationInfoService = locationInfoService;
183         this.greaseManageService = greaseManageService;
184         this.productionOrderRecordsService = productionOrderRecordsService;
185         this.productionOrderBatchInfoService = productionOrderBatchInfoService;
186
187         OP010Callback = new OP010Callback(miloService,productionOrdeInfoService,
188                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
189                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
190                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
191                 productionOrderBatchInfoService);
192         OP020Callback = new OP020Callback(miloService,productionOrdeInfoService,
193                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
194                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
195                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
196                 productionOrderBatchInfoService);
197         OP030Callback = new OP030Callback(miloService,productionOrdeInfoService,
198                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
199                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
200                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
201                 productionOrderBatchInfoService);
202         OP040Callback = new OP040Callback(miloService,productionOrdeInfoService,
203                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
204                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
205                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
206                 productionOrderBatchInfoService);
207         OP050Callback = new OP050Callback(miloService,productionOrdeInfoService,
208                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
209                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
210                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
211                 productionOrderBatchInfoService);
212    /*     OP060Callback = new OP060Callback(miloService,productionOrdeInfoService,
213                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
214                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
215                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
216                 productionOrderBatchInfoService);*/
217         OP070Callback = new OP070Callback(miloService,productionOrdeInfoService,
218                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
219                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
220                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
221                 productionOrderBatchInfoService);
222         OP080Callback = new OP080Callback(miloService,productionOrdeInfoService,
223                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
224                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
225                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
226                 productionOrderBatchInfoService);
227         OP090Callback = new OP090Callback(miloService,productionOrdeInfoService,
228                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
229                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
230                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
231                 productionOrderBatchInfoService);
232         OP100Callback = new OP100Callback(miloService,productionOrdeInfoService,
233                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
234                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
235                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
236                 productionOrderBatchInfoService);
237         OP110Callback = new OP110Callback(miloService,productionOrdeInfoService,
238                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
239                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
240                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
241                 productionOrderBatchInfoService);
242         OP120Callback = new OP120Callback(miloService,productionOrdeInfoService,
243                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
244                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
245                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
246                 productionOrderBatchInfoService);
247         OP120BCallback = new OP120BCallback(miloService,productionOrdeInfoService,
248                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
249                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
250                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
251                 productionOrderBatchInfoService);
252         OP130Callback = new OP130Callback(miloService,productionOrdeInfoService,
253                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
254                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
255                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
256                 productionOrderBatchInfoService);
257         OP130BCallback = new OP130BCallback(miloService,productionOrdeInfoService,
258                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
259                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
260                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
261                 productionOrderBatchInfoService);
262         OP140Callback = new OP140Callback(miloService,productionOrdeInfoService,
263                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
264                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
265                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
266                 productionOrderBatchInfoService);
267         OP150Callback = new OP150Callback(miloService,productionOrdeInfoService,
268                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
269                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
270                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
271                 productionOrderBatchInfoService);
272         OP160Callback = new OP160Callback(miloService,productionOrdeInfoService,
273                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
274                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
275                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
276                 productionOrderBatchInfoService);
277         OP170Callback = new OP170Callback(miloService,productionOrdeInfoService,
278                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
279                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
280                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
281                 productionOrderBatchInfoService);
282         COP010Callback = new COP010Callback(miloService,productionOrdeInfoService,
283                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
284                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
285                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
286                 productionOrderBatchInfoService);
287         COP020Callback = new COP020Callback(miloService,productionOrdeInfoService,
288                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
289                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
290                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
291                 productionOrderBatchInfoService);
292         COP030Callback = new COP030Callback(miloService,productionOrdeInfoService,
293                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
294                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
295                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
296                 productionOrderBatchInfoService);
297         BOP010Callback = new BOP010Callback(miloService,productionOrdeInfoService,
298                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
299                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
300                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
301                 productionOrderBatchInfoService);
302         BOP020Callback = new BOP020Callback(miloService,productionOrdeInfoService,
303                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
304                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
305                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
306                 productionOrderBatchInfoService);
307         BOP030Callback = new BOP030Callback(miloService,productionOrdeInfoService,
308                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
309                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
310                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
311                 productionOrderBatchInfoService);
312         BOP030BCallback = new BOP030BCallback(miloService,productionOrdeInfoService,
313                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
314                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
315                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
316                 productionOrderBatchInfoService);
317         BOP040Callback = new BOP040Callback(miloService,productionOrdeInfoService,
318                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
319                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
320                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
321                 productionOrderBatchInfoService);
322         BOP040BCallback = new BOP040BCallback(miloService,productionOrdeInfoService,
323                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
324                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
325                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
326                 productionOrderBatchInfoService);
327         DOP010Callback = new DOP010Callback(miloService,productionOrdeInfoService,
328                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
329                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
330                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
331                 productionOrderBatchInfoService);
332         DOP020Callback = new DOP020Callback(miloService,productionOrdeInfoService,
333                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
334                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
335                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
336                 productionOrderBatchInfoService);
337         EOP010Callback = new EOP010Callback(miloService,productionOrdeInfoService,
338                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
339                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
340                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
341                 productionOrderBatchInfoService);
342         EOP020Callback = new EOP020Callback(miloService,productionOrdeInfoService,
343                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
344                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
345                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
346                 productionOrderBatchInfoService);
347         EOP030Callback = new EOP030Callback(miloService,productionOrdeInfoService,
348                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
349                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
350                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
351                 productionOrderBatchInfoService);
352         EOP040Callback = new EOP040Callback(miloService,productionOrdeInfoService,
353                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
354                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
355                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
356                 productionOrderBatchInfoService);
357         EOP050Callback = new EOP050Callback(miloService,productionOrdeInfoService,
358                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
359                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
360                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
361                 productionOrderBatchInfoService);
362         EOP060Callback = new EOP060Callback(miloService,productionOrdeInfoService,
363                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
364                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
365                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
366                 productionOrderBatchInfoService);
367         EOP070Callback = new EOP070Callback(miloService,productionOrdeInfoService,
368                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
369                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
370                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
371                 productionOrderBatchInfoService);
372         EOP080Callback = new EOP080Callback(miloService,productionOrdeInfoService,
373                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
374                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
375                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
376                 productionOrderBatchInfoService);
377         EOP090Callback = new EOP090Callback(miloService,productionOrdeInfoService,
378                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
379                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
380                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
381                 productionOrderBatchInfoService);
382         EOP090BCallback = new EOP090BCallback(miloService,productionOrdeInfoService,
383                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
384                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
385                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
386                 productionOrderBatchInfoService);
387
388         StateCallback = new StateCallback(miloService,productionOrdeInfoService,
389                 passingStationCollectionService,paramCollectionService,collectionParamConfService,serialNumbersConfService,
390                 equipmentStatusService,equipmentAlarmService,materialTraceabilityService,equipmentInfoService,
391                 repairManageInfoService,locationInfoService,greaseManageService,productionOrderRecordsService,
392                 productionOrderBatchInfoService);
393     }
394
395
396
397     @Override
398     public void onSubscribe(String identifier, Object value) {
399         String ecpStr = "";//异常记录标记
400         try {
401
402             if(null != value) {
403                 //OP010
404                 //心跳
405                 if (identifier.equals(OPCElement.OP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
406                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP010_F_HEART_BEAT, true);
407                     miloService.writeToOpcUa(entity);
408                 }
409                 //PLC进站
410                 else if (identifier.equals(OPCElement.OP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
411                     String isRepair = miloService.readFromOpcUa(OPCElement.OP010_P_REPAIR).getValue().toString();//是否返修
412                     if (isRepair.equals("true")) {
413                         OP010Callback.handleRepair();
414                     } else {
415                         OP010Callback.handleOrder();
416                     }
417                 }
418                 //PLC出站
419                 else if (identifier.equals(OPCElement.OP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
420                     OP010Callback.handleFinsh();
421                     OP010Callback.handleMaterial();
422                 }
423
424                 //OP020
425                 //心跳
426                 else if (identifier.equals(OPCElement.OP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
427                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP020_F_HEART_BEAT, true);
428                     miloService.writeToOpcUa(entity);
429                 }
430                 //PLC进站
431                 else if (identifier.equals(OPCElement.OP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
432                     OP020Callback.handleOrder();
433                 }
434                 //PLC出站
435                 else if (identifier.equals(OPCElement.OP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
436                     OP020Callback.handleFinsh();
437                     OP020Callback.handleMaterial();
438                     OP020Callback.handleInfo();
439                 }
440
441                 //OP030
442                 //心跳
443                 else if (identifier.equals(OPCElement.OP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
444                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP030_F_HEART_BEAT, true);
445                     miloService.writeToOpcUa(entity);
446                 }
447                 //PLC进站
448                 else if (identifier.equals(OPCElement.OP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
449                     OP030Callback.handleOrder();
450                 }
451                 //PLC出站
452                 else if (identifier.equals(OPCElement.OP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
453                     OP030Callback.handleFinsh();
454                     OP030Callback.handleMaterial();
455                     OP030Callback.handleInfo();
456                 }
457
458                 //OP040
459                 //心跳
460                 else if (identifier.equals(OPCElement.OP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
461                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP040_F_HEART_BEAT, true);
462                     miloService.writeToOpcUa(entity);
463                 }
464                 //PLC进站
465                 else if (identifier.equals(OPCElement.OP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
466                     OP040Callback.handleOrder();
467                 }
468                 //PLC出站
469                 else if (identifier.equals(OPCElement.OP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
470                     OP040Callback.handleFinsh();
471                     OP040Callback.handleMaterial();
472                     OP040Callback.handleInfo();
473                 }
474
475                 //OP050
476                 //心跳
477                 else if (identifier.equals(OPCElement.OP050_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
478                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP050_F_HEART_BEAT, true);
479                     miloService.writeToOpcUa(entity);
480                 }
481                 //PLC进站
482                 else if (identifier.equals(OPCElement.OP050_J_PLC_START) && null != value && "true".equals(value.toString())) {
483                     OP050Callback.handleOrder();
484                 }
485                 //PLC出站
486                 else if (identifier.equals(OPCElement.OP050_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
487                     OP050Callback.handleMaterial();
488                     OP050Callback.handleInfo();
489                     OP050Callback.handleFinsh();
490                 }
491
492                 //OP070
493                 //心跳
494                 else if (identifier.equals(OPCElement.OP070_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
495                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP070_F_HEART_BEAT, true);
496                     miloService.writeToOpcUa(entity);
497                 }
498                 //PLC进站
499                 else if (identifier.equals(OPCElement.OP070_J_PLC_START) && null != value && "true".equals(value.toString())) {
500                     OP070Callback.handleOrder();
501                 }
502                 //PLC出站
503                 else if (identifier.equals(OPCElement.OP070_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
504                     OP070Callback.handleFinsh();
505                     OP070Callback.handleMaterial();
506                     OP070Callback.handleInfo();
507                 }
508
509                 //OP080
510                 //心跳
511                 else if (identifier.equals(OPCElement.OP080_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
512                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP080_F_HEART_BEAT, true);
513                     miloService.writeToOpcUa(entity);
514                 }
515                 //PLC进站
516                 else if (identifier.equals(OPCElement.OP080_J_PLC_START) && null != value && "true".equals(value.toString())) {
517                     String isRepair = miloService.readFromOpcUa(OPCElement.OP080_P_REPAIR).getValue().toString();//是否返修
518                     if (isRepair.equals("true")) {
519                         OP080Callback.handleRepair();
520                     } else {
521                         OP080Callback.handleOrder();
522                     }
523                 }
524                 //PLC出站
525                 else if (identifier.equals(OPCElement.OP080_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
526                     OP080Callback.handleFinsh();
527                     OP080Callback.handleMaterial();
528                     OP080Callback.handleInfo();
529                 }
530
531                 //OP090
532                 //心跳
533                 else if (identifier.equals(OPCElement.OP090_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
534                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP090_F_HEART_BEAT, true);
535                     miloService.writeToOpcUa(entity);
536                 }
537                 //PLC进站
538                 else if (identifier.equals(OPCElement.OP090_J_PLC_START) && null != value && "true".equals(value.toString())) {
539                     OP090Callback.handleOrder();
540                 }
541                 //PLC出站
542                 else if (identifier.equals(OPCElement.OP100_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
543                     OP100Callback.handleMaterial();
544                     OP100Callback.handleInfo();
545                     OP100Callback.handleFinsh();
546                 }
547
548                 //OP110
549                 //心跳
550                 else if (identifier.equals(OPCElement.OP110_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
551                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP110_F_HEART_BEAT, true);
552                     miloService.writeToOpcUa(entity);
553                 }
554                 //PLC进站
555                 else if (identifier.equals(OPCElement.OP110_J_PLC_START) && null != value && "true".equals(value.toString())) {
556                     OP110Callback.handleOrder();
557                 }
558                 //PLC出站
559                 else if (identifier.equals(OPCElement.OP110_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
560                     OP110Callback.handleFinsh();
561                     OP110Callback.handleMaterial();
562                     OP110Callback.handleInfo();
563                 }
564
565                 //OP120
566                 //心跳
567                 else if (identifier.equals(OPCElement.OP120_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
568                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120_F_HEART_BEAT, true);
569                     miloService.writeToOpcUa(entity);
570                 }
571                 //PLC进站
572                 else if (identifier.equals(OPCElement.OP120_J_PLC_START) && null != value && "true".equals(value.toString())) {
573                     OP120Callback.handleOrder();
574                 }
575                 //PLC出站
576                 else if (identifier.equals(OPCElement.OP120_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
577                     OP120Callback.handleFinsh();
578                     OP120Callback.handleMaterial();
579                     OP120Callback.handleInfo();
580                 }
581
582                 //OP120B
583                 //心跳
584                 else if (identifier.equals(OPCElement.OP120B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
585                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120B_F_HEART_BEAT, true);
586                     miloService.writeToOpcUa(entity);
587                 }
588                 //PLC进站
589                 else if (identifier.equals(OPCElement.OP120B_J_PLC_START) && null != value && "true".equals(value.toString())) {
590                     OP120BCallback.handleOrder();
591                 }
592                 //PLC出站
593                 else if (identifier.equals(OPCElement.OP120B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
594                     OP120BCallback.handleFinsh();
595                     OP120BCallback.handleMaterial();
596                     OP120BCallback.handleInfo();
597                 }
598
599                 //OP130
600                 //心跳
601                 else if (identifier.equals(OPCElement.OP130_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
602                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP130_F_HEART_BEAT, true);
603                     miloService.writeToOpcUa(entity);
604                 }
605                 //PLC进站
606                 else if (identifier.equals(OPCElement.OP130_J_PLC_START) && null != value && "true".equals(value.toString())) {
607                     OP130Callback.handleOrder();
608                 }
609                 //PLC出站
610                 else if (identifier.equals(OPCElement.OP130_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
611                     OP130Callback.handleFinsh();
612                     OP130Callback.handleMaterial();
613                     OP130Callback.handleInfo();
614                 }
615
616                 //OP130B
617                 //心跳
618                 else if (identifier.equals(OPCElement.OP130B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
619                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP130B_F_HEART_BEAT, true);
620                     miloService.writeToOpcUa(entity);
621                 }
622                 //PLC进站
623                 else if (identifier.equals(OPCElement.OP130B_J_PLC_START) && null != value && "true".equals(value.toString())) {
624                     OP130BCallback.handleOrder();
625                 }
626                 //PLC出站
627                 else if (identifier.equals(OPCElement.OP130B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
628                     OP130BCallback.handleFinsh();
629                     OP130BCallback.handleMaterial();
630                     OP130BCallback.handleInfo();
631                 }
632
633                 //OP140
634                 //心跳
635                 else if (identifier.equals(OPCElement.OP140_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
636                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP140_F_HEART_BEAT, true);
637                     miloService.writeToOpcUa(entity);
638                 }
639                 //PLC进站
640                 else if (identifier.equals(OPCElement.OP140_J_PLC_START) && null != value && "true".equals(value.toString())) {
641                     OP140Callback.handleOrder();
642                 }
643                 //PLC出站
644                 else if (identifier.equals(OPCElement.OP140_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
645                     OP140Callback.handleFinsh();
646                     OP140Callback.handleMaterial();
647                     OP140Callback.handleInfo();
648                 }
649
650                 //OP150
651                 //心跳
652                 else if (identifier.equals(OPCElement.OP150_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
653                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP150_F_HEART_BEAT, true);
654                     miloService.writeToOpcUa(entity);
655                 }
656                 //PLC进站
657                 else if (identifier.equals(OPCElement.OP150_J_PLC_START) && null != value && "true".equals(value.toString())) {
658                     OP150Callback.handleOrder();
659                 }
660                 //PLC出站
661                 else if (identifier.equals(OPCElement.OP150_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
662                     OP150Callback.handleFinsh();
663                     OP150Callback.handleMaterial();
664                     OP150Callback.handleInfo();
665                 }
666
667                 //OP160
668                 //心跳
669                 else if (identifier.equals(OPCElement.OP160_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
670                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP160_F_HEART_BEAT, true);
671                     miloService.writeToOpcUa(entity);
672                 }
673                 //PLC进站
674                 else if (identifier.equals(OPCElement.OP160_J_PLC_START) && null != value && "true".equals(value.toString())) {
675                     OP160Callback.handleOrder();
676                 }
677                 //PLC出站
678                 else if (identifier.equals(OPCElement.OP160_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
679                     OP160Callback.handleFinsh();
680                     OP160Callback.handleMaterial();
681                     OP160Callback.handleInfo();
682                 }
683
684                 //OP170
685                 //心跳
686                 else if (identifier.equals(OPCElement.OP170_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
687                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP170_F_HEART_BEAT, true);
688                     miloService.writeToOpcUa(entity);
689                 }
690                 //PLC进站
691                 else if (identifier.equals(OPCElement.OP170_J_PLC_START) && null != value && "true".equals(value.toString())) {
692                     OP170Callback.handleOrder();
693                 }
694                 //PLC出站
695                 else if (identifier.equals(OPCElement.OP170_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
696                     OP170Callback.handleFinsh();
697                     OP170Callback.handleMaterial();
698                     //OP170Callback.handleInfo();
699                 }
700
701                 //BOP010
702                 //心跳
703                 else if (identifier.equals(OPCElement.BOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
704                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP010_F_HEART_BEAT, true);
705                     miloService.writeToOpcUa(entity);
706                 }
707                 //PLC进站
708                 else if (identifier.equals(OPCElement.BOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
709                     String isRepair = miloService.readFromOpcUa(OPCElement.BOP010_P_REPAIR).getValue().toString();//是否返修
710                     if (isRepair.equals("true")) {
711                         BOP010Callback.handleRepair();
712                     } else {
713                         BOP010Callback.handleOrder();
714                     }
715                 }
716                 //PLC出站
717                 else if (identifier.equals(OPCElement.BOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
718                     BOP010Callback.handleFinsh();
719                     BOP010Callback.handleMaterial();
720                     //BOP010Callback.handleInfo();
721                 }
722
723
724                 //BOP020
725                 //心跳
726                 else if (identifier.equals(OPCElement.BOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
727                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP020_F_HEART_BEAT, true);
728                     miloService.writeToOpcUa(entity);
729                 }
730                 //PLC进站
731                 else if (identifier.equals(OPCElement.BOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
732                     BOP020Callback.handleOrder();
733                 }
734                 //PLC出站
735                 else if (identifier.equals(OPCElement.BOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
736                     BOP020Callback.handleFinsh();
737                     BOP020Callback.handleMaterial();
738                     BOP020Callback.handleInfo();
739                 }
740
741
742                 //BOP030
743                 //心跳
744                 else if (identifier.equals(OPCElement.BOP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
745                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP030_F_HEART_BEAT, true);
746                     miloService.writeToOpcUa(entity);
747                 }
748                 //PLC进站
749                 else if (identifier.equals(OPCElement.BOP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
750                     BOP030Callback.handleOrder();
751                 }
752                 //PLC出站
753                 else if (identifier.equals(OPCElement.BOP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
754                     BOP030Callback.handleFinsh();
755                     BOP030Callback.handleMaterial();
756                     BOP030Callback.handleInfo();
757                 }
758
759                 //BOP030B
760                 //心跳
761                 else if (identifier.equals(OPCElement.BOP030B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
762                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP030B_F_HEART_BEAT, true);
763                     miloService.writeToOpcUa(entity);
764                 }
765                 //PLC进站
766                 else if (identifier.equals(OPCElement.BOP030B_J_PLC_START) && null != value && "true".equals(value.toString())) {
767                     BOP030BCallback.handleOrder();
768                 }
769                 //PLC出站
770                 else if (identifier.equals(OPCElement.BOP030B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
771                     BOP030BCallback.handleFinsh();
772                     //BOP030BCallback.handleMaterial();
773                     //BOP030BCallback.handleInfo();
774                 }
775
776                 //BOP040
777                 //心跳
778                 else if (identifier.equals(OPCElement.BOP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
779                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP040_F_HEART_BEAT, true);
780                     miloService.writeToOpcUa(entity);
781                 }
782                 //PLC进站
783                 else if (identifier.equals(OPCElement.BOP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
784                     BOP040Callback.handleOrder();
785                 }
786                 //PLC出站
787                 else if (identifier.equals(OPCElement.BOP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
788                     BOP040Callback.handleFinsh();
789                     BOP040Callback.handleMaterial();
790                     BOP040Callback.handleInfo();
791                 }
792
793                 //BOP040B
794                 //心跳
795                 else if (identifier.equals(OPCElement.BOP040B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
796                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP040B_F_HEART_BEAT, true);
797                     miloService.writeToOpcUa(entity);
798                 }
799                 //PLC进站
800                 else if (identifier.equals(OPCElement.BOP040B_J_PLC_START) && null != value && "true".equals(value.toString())) {
801                     BOP040BCallback.handleOrder();
802                 }
803                 //PLC出站
804                 else if (identifier.equals(OPCElement.BOP040B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
805                     BOP040BCallback.handleFinsh();
806                    // BOP040BCallback.handleMaterial();
807                     //BOP040BCallback.handleInfo();
808                 }
809
810
811                 //COP010
812                 //心跳
813                 else if (identifier.equals(OPCElement.COP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
814                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP010_F_HEART_BEAT, true);
815                     miloService.writeToOpcUa(entity);
816                 }
817                 //PLC进站
818                 else if (identifier.equals(OPCElement.COP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
819                     String isRepair = miloService.readFromOpcUa(OPCElement.COP010_P_REPAIR).getValue().toString();//是否返修
820                     if (isRepair.equals("true")) {
821                         COP010Callback.handleRepair();
822                     } else {
823                         COP010Callback.handleOrder();
824                     }
825                 }
826                 //PLC出站
827                 else if (identifier.equals(OPCElement.COP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
828                     COP010Callback.handleFinsh();
829                     COP010Callback.handleMaterial();
830                     //COP010Callback.handleInfo();
831                 }
832
833
834                 //COP020
835                 //心跳
836                 else if (identifier.equals(OPCElement.COP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
837                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP020_F_HEART_BEAT, true);
838                     miloService.writeToOpcUa(entity);
839                 }
840                 //PLC进站
841                 else if (identifier.equals(OPCElement.COP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
842                     COP020Callback.handleOrder();
843                 }
844                 //PLC出站
845                 else if (identifier.equals(OPCElement.COP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
846                     COP020Callback.handleFinsh();
847                     COP020Callback.handleMaterial();
848                     COP020Callback.handleInfo();
849                 }
850
851
852                 //COP030
853                 //心跳
854                 else if (identifier.equals(OPCElement.COP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
855                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP030_F_HEART_BEAT, true);
856                     miloService.writeToOpcUa(entity);
857                 }
858                 //PLC进站
859                 else if (identifier.equals(OPCElement.COP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
860                     COP030Callback.handleOrder();
861                 }
862                 //PLC出站
863                 else if (identifier.equals(OPCElement.COP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
864                     COP030Callback.handleFinsh();
865                     COP030Callback.handleMaterial();
866                     COP030Callback.handleInfo();
867                 }
868
869
870                 //DOP010
871                 //心跳
872                 else if (identifier.equals(OPCElement.DOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
873                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.DOP010_F_HEART_BEAT, true);
874                     miloService.writeToOpcUa(entity);
875                 }
876                 //PLC进站
877                 else if (identifier.equals(OPCElement.DOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
878                     String isRepair = miloService.readFromOpcUa(OPCElement.DOP010_P_REPAIR).getValue().toString();//是否返修
879                     if (isRepair.equals("true")) {
880                         DOP010Callback.handleRepair();
881                     } else {
882                         DOP010Callback.handleOrder();
883                     }
884                 }
885                 //PLC出站
886                 else if (identifier.equals(OPCElement.DOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
887                     DOP010Callback.handleFinsh();
888                     DOP010Callback.handleMaterial();
889                     //DOP010Callback.handleInfo();
890                 }
891
892
893                 //DOP020
894                 //心跳
895                 else if (identifier.equals(OPCElement.DOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
896                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.DOP020_F_HEART_BEAT, true);
897                     miloService.writeToOpcUa(entity);
898                 }
899                 //PLC进站
900                 else if (identifier.equals(OPCElement.DOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
901                     DOP020Callback.handleOrder();
902                 }
903                 //PLC出站
904                 else if (identifier.equals(OPCElement.DOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
905                     DOP020Callback.handleFinsh();
906                     DOP020Callback.handleMaterial();
907                     DOP020Callback.handleInfo();
908                 }
909
910                 //EOP010
911                 //心跳
912                 else if (identifier.equals(OPCElement.EOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
913                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP010_F_HEART_BEAT, true);
914                     miloService.writeToOpcUa(entity);
915                 }
916                 //PLC进站
917                 else if (identifier.equals(OPCElement.EOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
918                     EOP010Callback.handleOrder();
919                 }
920                 //PLC出站
921                 else if (identifier.equals(OPCElement.EOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
922                     EOP010Callback.handleFinsh();
923                     EOP010Callback.handleMaterial();
924                     EOP010Callback.handleInfo();
925                 }
926                 //EOP020
927                 //心跳
928                 else if (identifier.equals(OPCElement.EOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
929                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP020_F_HEART_BEAT, true);
930                     miloService.writeToOpcUa(entity);
931                 }
932                 //PLC进站
933                 else if (identifier.equals(OPCElement.EOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
934                     EOP020Callback.handleOrder();
935                 }
936                 //PLC出站
937                 else if (identifier.equals(OPCElement.EOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
938                     EOP020Callback.handleFinsh();
939                     EOP020Callback.handleMaterial();
940                     EOP020Callback.handleInfo();
941                 }
942
943                 //EOP030
944                 //心跳
945                 else if (identifier.equals(OPCElement.EOP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
946                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP030_F_HEART_BEAT, true);
947                     miloService.writeToOpcUa(entity);
948                 }
949                 //PLC进站
950                 else if (identifier.equals(OPCElement.EOP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
951                     EOP030Callback.handleOrder();
952                 }
953                 //PLC出站
954                 else if (identifier.equals(OPCElement.EOP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
955                     EOP030Callback.handleFinsh();
956                     EOP030Callback.handleMaterial();
957                     EOP030Callback.handleInfo();
958                 }
959
960                 //EOP040
961                 //心跳
962                 else if (identifier.equals(OPCElement.EOP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
963                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP040_F_HEART_BEAT, true);
964                     miloService.writeToOpcUa(entity);
965                 }
966                 //PLC进站
967                 else if (identifier.equals(OPCElement.EOP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
968                     EOP040Callback.handleOrder();
969                 }
970                 //PLC出站
971                 else if (identifier.equals(OPCElement.EOP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
972                     EOP040Callback.handleFinsh();
973                     EOP040Callback.handleMaterial();
974                     EOP040Callback.handleInfo();
975                 }
976
977                 //EOP050
978                 //心跳
979                 else if (identifier.equals(OPCElement.EOP050_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
980                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP050_F_HEART_BEAT, true);
981                     miloService.writeToOpcUa(entity);
982                 }
983                 //PLC进站
984                 else if (identifier.equals(OPCElement.EOP050_J_PLC_START) && null != value && "true".equals(value.toString())) {
985                     EOP050Callback.handleOrder();
986                 }
987                 //PLC出站
988                 else if (identifier.equals(OPCElement.EOP050_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
989                     EOP050Callback.handleFinsh();
990                     EOP050Callback.handleMaterial();
991                     EOP050Callback.handleInfo();
992                 }
993
994                 //EOP060
995                 //心跳
996                 else if (identifier.equals(OPCElement.EOP060_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
997                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP060_F_HEART_BEAT, true);
998                     miloService.writeToOpcUa(entity);
999                 }
1000                 //PLC进站
1001                 else if (identifier.equals(OPCElement.EOP060_J_PLC_START) && null != value && "true".equals(value.toString())) {
1002                     EOP060Callback.handleOrder();
1003                 }
1004                 //PLC出站
1005                 else if (identifier.equals(OPCElement.EOP060_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1006                     EOP060Callback.handleFinsh();
1007                     EOP060Callback.handleMaterial();
1008                     EOP060Callback.handleInfo();
1009                 }
1010
1011                 //EOP070
1012                 //心跳
1013                 else if (identifier.equals(OPCElement.EOP070_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1014                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP070_F_HEART_BEAT, true);
1015                     miloService.writeToOpcUa(entity);
1016                 }
1017                 //PLC进站
1018                 else if (identifier.equals(OPCElement.EOP070_J_PLC_START) && null != value && "true".equals(value.toString())) {
1019                     EOP070Callback.handleOrder();
1020                 }
1021                 //PLC出站
1022                 else if (identifier.equals(OPCElement.EOP070_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1023                     EOP070Callback.handleFinsh();
1024                     EOP070Callback.handleMaterial();
1025                     EOP070Callback.handleInfo();
1026                 }
1027
1028                 //EOP080
1029                 //心跳
1030                 else if (identifier.equals(OPCElement.EOP080_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1031                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP080_F_HEART_BEAT, true);
1032                     miloService.writeToOpcUa(entity);
1033                 }
1034                 //PLC进站
1035                 else if (identifier.equals(OPCElement.EOP080_J_PLC_START) && null != value && "true".equals(value.toString())) {
1036                     EOP080Callback.handleOrder();
1037                 }
1038                 //PLC出站
1039                 else if (identifier.equals(OPCElement.EOP080_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1040                     EOP080Callback.handleFinsh();
1041                     EOP080Callback.handleMaterial();
1042                     EOP080Callback.handleInfo();
1043                 }
1044
1045                 //EOP090
1046                 //心跳
1047                 else if (identifier.equals(OPCElement.EOP090_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1048                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP090_F_HEART_BEAT, true);
1049                     miloService.writeToOpcUa(entity);
1050                 }
1051                 //PLC进站
1052                 else if (identifier.equals(OPCElement.EOP090_J_PLC_START) && null != value && "true".equals(value.toString())) {
1053                     EOP090Callback.handleOrder();
1054                 }
1055                 //PLC出站
1056                 else if (identifier.equals(OPCElement.EOP090_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1057                     EOP090Callback.handleFinsh();
1058                     EOP090Callback.handleMaterial();
1059                     EOP090Callback.handleInfo();
1060                 }
1061
1062                 //EOP090B
1063                 //心跳
1064                 else if (identifier.equals(OPCElement.EOP090B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1065                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP090B_F_HEART_BEAT, true);
1066                     miloService.writeToOpcUa(entity);
1067                 }
1068                 //PLC进站
1069                 else if (identifier.equals(OPCElement.EOP090B_J_PLC_START) && null != value && "true".equals(value.toString())) {
1070                     EOP090BCallback.handleOrder();
1071                 }
1072                 //PLC出站
1073                 else if (identifier.equals(OPCElement.EOP090B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1074                     EOP090BCallback.handleFinsh();
1075                     EOP090BCallback.handleMaterial();
1076                     EOP090BCallback.handleInfo();
1077                 }
1078
1079                 else if (identifier.contains("STATE") && null != value && "true".equals(value.toString())) {
1080                     EquipmentInfoParam equipmentInfoParam = new EquipmentInfoParam();
1081                     equipmentInfoParam.setSpareField1(identifier);
1082                     List<EquipmentInfoResult> lists = equipmentInfoService.findListBySpec(equipmentInfoParam);
1083                     if(!lists.isEmpty()){
1084                         EquipmentInfoResult result = (EquipmentInfoResult) list.get(0);
1085                         String equipmentNo = result.getEquipmentNo();
1086                         EquipmentStatusParam equipmentStatusParam = new EquipmentStatusParam();
1087                         equipmentStatusParam.setEquipmentNo(equipmentNo);
1088                         List statuslist = equipmentStatusService.findListBySpec(equipmentStatusParam);
1089                         if(statuslist.size()>0){
1090                             EquipmentStatusResult equipmentStatusResult = (EquipmentStatusResult) statuslist.get(0);
1091                             if(!value.equals(equipmentStatusResult.getStatus())){
1092                                 equipmentStatusParam.setId(equipmentStatusResult.getId());
1093                                 equipmentStatusParam.setStatus(value.toString());
1094                                 equipmentStatusParam.setUpdateTime(DateTool.getLocalTimeForDate());
1095                                 equipmentStatusService.update(equipmentStatusParam);//更新设备状态
1096
1097                                 //添加设备报警
1098                                 if("3".equals(value)){
1099                                     EquipmentAlarmParam equipmentAlarmParam = new EquipmentAlarmParam();
1100                                     equipmentAlarmParam.setEquipmentNo(equipmentNo);
1101                                     equipmentAlarmParam.setEquipmentName(result.getEquipmentName());
1102                                     equipmentAlarmParam.setWorkshopCode(result.getWorkshopCode());
1103                                     equipmentAlarmParam.setProductionLineCode(result.getProductionLineCode());
1104                                     equipmentAlarmParam.setLocationCode(result.getLocationCode());
1105                                     equipmentAlarmParam.setErrorDesc(result.getEquipmentName()+"报警!");
1106                                     equipmentAlarmParam.setAlarmTime(DateTool.getLocalTimeForDate());
1107                                     equipmentAlarmService.add(equipmentAlarmParam);
1108                                 }
1109                             }
1110
1111                         }else{
1112                             equipmentStatusParam.setEquipmentName(result.getEquipmentName());
1113                             equipmentStatusParam.setWorkshopCode(result.getWorkshopCode());
1114                             equipmentStatusParam.setProductionLineCode(result.getProductionLineCode());
1115                             equipmentStatusParam.setLocationCode(result.getLocationCode());
1116                             equipmentStatusParam.setStatus(value.toString());
1117                             equipmentStatusParam.setUpdateTime(DateTool.getLocalTimeForDate());
1118                             equipmentStatusService.add(equipmentStatusParam);
1119
1120                             //添加设备报警
1121                             if("3".equals(value)){
1122                                 EquipmentAlarmParam equipmentAlarmParam = new EquipmentAlarmParam();
1123                                 equipmentAlarmParam.setEquipmentNo(equipmentNo);
1124                                 equipmentAlarmParam.setEquipmentName(result.getEquipmentName());
1125                                 equipmentAlarmParam.setWorkshopCode(result.getWorkshopCode());
1126                                 equipmentAlarmParam.setProductionLineCode(result.getProductionLineCode());
1127                                 equipmentAlarmParam.setLocationCode(result.getLocationCode());
1128                                 equipmentAlarmParam.setErrorDesc(result.getEquipmentName()+"报警!");
1129                                 equipmentAlarmParam.setAlarmTime(DateTool.getLocalTimeForDate());
1130                                 equipmentAlarmService.add(equipmentAlarmParam);
1131                             }
1132                         }
1133                     }
1134
1135
1136                     // handleOilState("DOP020");
1137                     StateCallback.handleOilStateOP050("OP050");
1138                     StateCallback.handleOilStateBOP030("BOP030");
1139                 }
1140
1141                 else {
1142                     System.out.println("值没有变");
1143                 }
1144
1145
1146             }else {
1147                 System.out.println("值为空");
1148             }
1149
1150         } catch (Exception e) {
1151             ecpStr ="出现异常:" + logUtil.getTrace(e);
1152         }finally {
1153             if(!"".equals(ecpStr)){
1154                 System.out.println(ecpStr+"\r\n");
1155                 logger.info(ecpStr+"\r\n");
1156             }
1157         }
1158     }
1159
1160
1161
1162 }