cl
2024-01-22 314bc7a1733856bd82c9d99bdfa27b34a4a762c3
提交 | 用户 | 时间
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             if(null != value) {
402                 //OP010
403                 //心跳
404                 if (identifier.equals(OPCElement.OP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
405                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP010_F_HEART_BEAT, true);
406                     miloService.writeToOpcUa(entity);
407                 }
408                 //PLC进站
409                 else if (identifier.equals(OPCElement.OP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
410                     String isRepair = miloService.readFromOpcUa(OPCElement.OP010_P_REPAIR).getValue().toString();//是否返修
411                     if (isRepair.equals("true")) {
412                         OP010Callback.handleRepair();
413                     } else {
414                         OP010Callback.handleOrder();
415                     }
416                 }
417                 //PLC出站
418                 else if (identifier.equals(OPCElement.OP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
419                     OP010Callback.handleFinsh();
420                     OP010Callback.handleMaterial();
421                 }
422
423                 //OP020
424                 //心跳
425                 else if (identifier.equals(OPCElement.OP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
426                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP020_F_HEART_BEAT, true);
427                     miloService.writeToOpcUa(entity);
428                 }
429                 //PLC进站
430                 else if (identifier.equals(OPCElement.OP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
431                     OP020Callback.handleOrder();
432                 }
433                 //PLC出站
434                 else if (identifier.equals(OPCElement.OP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
435                     OP020Callback.handleFinsh();
436                     OP020Callback.handleMaterial();
437                     OP020Callback.handleInfo();
438                 }
439
440                 //OP030
441                 //心跳
442                 else if (identifier.equals(OPCElement.OP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
443                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP030_F_HEART_BEAT, true);
444                     miloService.writeToOpcUa(entity);
445                 }
446                 //PLC进站
447                 else if (identifier.equals(OPCElement.OP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
448                     OP030Callback.handleOrder();
449                 }
450                 //PLC出站
451                 else if (identifier.equals(OPCElement.OP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
452                     OP030Callback.handleFinsh();
453                     OP030Callback.handleMaterial();
454                     OP030Callback.handleInfo();
455                 }
456
457                 //OP040
458                 //心跳
459                 else if (identifier.equals(OPCElement.OP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
460                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP040_F_HEART_BEAT, true);
461                     miloService.writeToOpcUa(entity);
462                 }
463                 //PLC进站
464                 else if (identifier.equals(OPCElement.OP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
465                     OP040Callback.handleOrder();
466                 }
467                 //PLC出站
468                 else if (identifier.equals(OPCElement.OP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
469                     OP040Callback.handleFinsh();
470                     OP040Callback.handleMaterial();
471                     OP040Callback.handleInfo();
472                 }
473
474                 //OP050
475                 //心跳
476                 else if (identifier.equals(OPCElement.OP050_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
477                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP050_F_HEART_BEAT, true);
478                     miloService.writeToOpcUa(entity);
479                 }
480                 //PLC进站
481                 else if (identifier.equals(OPCElement.OP050_J_PLC_START) && null != value && "true".equals(value.toString())) {
482                     OP050Callback.handleOrder();
483                 }
484                 //PLC出站
485                 else if (identifier.equals(OPCElement.OP050_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
486                     OP050Callback.handleMaterial();
487                     OP050Callback.handleInfo();
488                     OP050Callback.handleFinsh();
489                 }
490
491                 //OP070
492                 //心跳
493                 else if (identifier.equals(OPCElement.OP070_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
494                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP070_F_HEART_BEAT, true);
495                     miloService.writeToOpcUa(entity);
496                 }
497                 //PLC进站
498                 else if (identifier.equals(OPCElement.OP070_J_PLC_START) && null != value && "true".equals(value.toString())) {
499                     OP070Callback.handleOrder();
500                 }
501                 //PLC出站
502                 else if (identifier.equals(OPCElement.OP070_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
503                     OP070Callback.handleFinsh();
504                     OP070Callback.handleMaterial();
505                     OP070Callback.handleInfo();
506                 }
507
508                 //OP080
509                 //心跳
510                 else if (identifier.equals(OPCElement.OP080_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
511                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP080_F_HEART_BEAT, true);
512                     miloService.writeToOpcUa(entity);
513                 }
514                 //PLC进站
515                 else if (identifier.equals(OPCElement.OP080_J_PLC_START) && null != value && "true".equals(value.toString())) {
516                     String isRepair = miloService.readFromOpcUa(OPCElement.OP080_P_REPAIR).getValue().toString();//是否返修
517                     if (isRepair.equals("true")) {
518                         OP080Callback.handleRepair();
519                     } else {
520                         OP080Callback.handleOrder();
521                     }
522                 }
523                 //PLC出站
524                 else if (identifier.equals(OPCElement.OP080_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
525                     OP080Callback.handleFinsh();
526                     OP080Callback.handleMaterial();
527                     OP080Callback.handleInfo();
528                 }
529
530                 //OP090
531                 //心跳
532                 else if (identifier.equals(OPCElement.OP090_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
533                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP090_F_HEART_BEAT, true);
534                     miloService.writeToOpcUa(entity);
535                 }
536                 //PLC进站
537                 else if (identifier.equals(OPCElement.OP090_J_PLC_START) && null != value && "true".equals(value.toString())) {
538                     OP090Callback.handleOrder();
539                 }
540                 //PLC出站
541                 else if (identifier.equals(OPCElement.OP100_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
542                     OP100Callback.handleMaterial();
543                     OP100Callback.handleInfo();
544                     OP100Callback.handleFinsh();
545                 }
546
547                 //OP110
548                 //心跳
549                 else if (identifier.equals(OPCElement.OP110_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
550                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP110_F_HEART_BEAT, true);
551                     miloService.writeToOpcUa(entity);
552                 }
553                 //PLC进站
554                 else if (identifier.equals(OPCElement.OP110_J_PLC_START) && null != value && "true".equals(value.toString())) {
555                     OP110Callback.handleOrder();
556                 }
557                 //PLC出站
558                 else if (identifier.equals(OPCElement.OP110_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
559                     OP110Callback.handleFinsh();
560                     OP110Callback.handleMaterial();
561                     OP110Callback.handleInfo();
562                 }
563
564                 //OP120
565                 //心跳
566                 else if (identifier.equals(OPCElement.OP120_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
567                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120_F_HEART_BEAT, true);
568                     miloService.writeToOpcUa(entity);
569                 }
570                 //PLC进站
571                 else if (identifier.equals(OPCElement.OP120_J_PLC_START) && null != value && "true".equals(value.toString())) {
572                     OP120Callback.handleOrder();
573                 }
574                 //PLC出站
575                 else if (identifier.equals(OPCElement.OP120_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
576                     OP120Callback.handleFinsh();
577                     OP120Callback.handleMaterial();
578                     OP120Callback.handleInfo();
579                 }
580
581                 //OP120B
582                 //心跳
583                 else if (identifier.equals(OPCElement.OP120B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
584                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP120B_F_HEART_BEAT, true);
585                     miloService.writeToOpcUa(entity);
586                 }
587                 //PLC进站
588                 else if (identifier.equals(OPCElement.OP120B_J_PLC_START) && null != value && "true".equals(value.toString())) {
589                     OP120BCallback.handleOrder();
590                 }
591                 //PLC出站
592                 else if (identifier.equals(OPCElement.OP120B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
593                     OP120BCallback.handleFinsh();
594                     OP120BCallback.handleMaterial();
595                     OP120BCallback.handleInfo();
596                 }
597
598                 //OP130
599                 //心跳
600                 else if (identifier.equals(OPCElement.OP130_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
601                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP130_F_HEART_BEAT, true);
602                     miloService.writeToOpcUa(entity);
603                 }
604                 //PLC进站
605                 else if (identifier.equals(OPCElement.OP130_J_PLC_START) && null != value && "true".equals(value.toString())) {
606                     OP130Callback.handleOrder();
607                 }
608                 //PLC出站
609                 else if (identifier.equals(OPCElement.OP130_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
610                     OP130Callback.handleFinsh();
611                     OP130Callback.handleMaterial();
612                     OP130Callback.handleInfo();
613                 }
614
615                 //OP130B
616                 //心跳
617                 else if (identifier.equals(OPCElement.OP130B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
618                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP130B_F_HEART_BEAT, true);
619                     miloService.writeToOpcUa(entity);
620                 }
621                 //PLC进站
622                 else if (identifier.equals(OPCElement.OP130B_J_PLC_START) && null != value && "true".equals(value.toString())) {
623                     OP130BCallback.handleOrder();
624                 }
625                 //PLC出站
626                 else if (identifier.equals(OPCElement.OP130B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
627                     OP130BCallback.handleFinsh();
628                     OP130BCallback.handleMaterial();
629                     OP130BCallback.handleInfo();
630                 }
631
632                 //OP140
633                 //心跳
634                 else if (identifier.equals(OPCElement.OP140_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
635                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP140_F_HEART_BEAT, true);
636                     miloService.writeToOpcUa(entity);
637                 }
638                 //PLC进站
639                 else if (identifier.equals(OPCElement.OP140_J_PLC_START) && null != value && "true".equals(value.toString())) {
640                     OP140Callback.handleOrder();
641                 }
642                 //PLC出站
643                 else if (identifier.equals(OPCElement.OP140_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
644                     OP140Callback.handleFinsh();
645                     OP140Callback.handleMaterial();
646                     OP140Callback.handleInfo();
647                 }
648
649                 //OP150
650                 //心跳
651                 else if (identifier.equals(OPCElement.OP150_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
652                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP150_F_HEART_BEAT, true);
653                     miloService.writeToOpcUa(entity);
654                 }
655                 //PLC进站
656                 else if (identifier.equals(OPCElement.OP150_J_PLC_START) && null != value && "true".equals(value.toString())) {
657                     OP150Callback.handleOrder();
658                 }
659                 //PLC出站
660                 else if (identifier.equals(OPCElement.OP150_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
661                     OP150Callback.handleFinsh();
662                     OP150Callback.handleMaterial();
663                     OP150Callback.handleInfo();
664                 }
665
666                 //OP160
667                 //心跳
668                 else if (identifier.equals(OPCElement.OP160_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
669                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP160_F_HEART_BEAT, true);
670                     miloService.writeToOpcUa(entity);
671                 }
672                 //PLC进站
673                 else if (identifier.equals(OPCElement.OP160_J_PLC_START) && null != value && "true".equals(value.toString())) {
674                     OP160Callback.handleOrder();
675                 }
676                 //PLC出站
677                 else if (identifier.equals(OPCElement.OP160_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
678                     OP160Callback.handleFinsh();
679                     OP160Callback.handleMaterial();
680                     OP160Callback.handleInfo();
681                 }
682
683                 //OP170
684                 //心跳
685                 else if (identifier.equals(OPCElement.OP170_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
686                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.OP170_F_HEART_BEAT, true);
687                     miloService.writeToOpcUa(entity);
688                 }
689                 //PLC进站
690                 else if (identifier.equals(OPCElement.OP170_J_PLC_START) && null != value && "true".equals(value.toString())) {
691                     OP170Callback.handleOrder();
692                 }
693                 //PLC出站
694                 else if (identifier.equals(OPCElement.OP170_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
695                     OP170Callback.handleFinsh();
696                     OP170Callback.handleMaterial();
697                     //OP170Callback.handleInfo();
698                 }
699
700                 //BOP010
701                 //心跳
702                 else if (identifier.equals(OPCElement.BOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
703                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP010_F_HEART_BEAT, true);
704                     miloService.writeToOpcUa(entity);
705                 }
706                 //PLC进站
707                 else if (identifier.equals(OPCElement.BOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
708                     String isRepair = miloService.readFromOpcUa(OPCElement.BOP010_P_REPAIR).getValue().toString();//是否返修
709                     if (isRepair.equals("true")) {
710                         BOP010Callback.handleRepair();
711                     } else {
712                         BOP010Callback.handleOrder();
713                     }
714                 }
715                 //PLC出站
716                 else if (identifier.equals(OPCElement.BOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
717                     BOP010Callback.handleFinsh();
718                     BOP010Callback.handleMaterial();
719                     //BOP010Callback.handleInfo();
720                 }
721
722
723                 //BOP020
724                 //心跳
725                 else if (identifier.equals(OPCElement.BOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
726                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP020_F_HEART_BEAT, true);
727                     miloService.writeToOpcUa(entity);
728                 }
729                 //PLC进站
730                 else if (identifier.equals(OPCElement.BOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
731                     BOP020Callback.handleOrder();
732                 }
733                 //PLC出站
734                 else if (identifier.equals(OPCElement.BOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
735                     BOP020Callback.handleFinsh();
736                     BOP020Callback.handleMaterial();
737                     BOP020Callback.handleInfo();
738                 }
739
740
741                 //BOP030
742                 //心跳
743                 else if (identifier.equals(OPCElement.BOP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
744                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP030_F_HEART_BEAT, true);
745                     miloService.writeToOpcUa(entity);
746                 }
747                 //PLC进站
748                 else if (identifier.equals(OPCElement.BOP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
749                     BOP030Callback.handleOrder();
750                 }
751                 //PLC出站
752                 else if (identifier.equals(OPCElement.BOP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
753                     BOP030Callback.handleFinsh();
754                     BOP030Callback.handleMaterial();
755                     BOP030Callback.handleInfo();
756                 }
757
758                 //BOP030B
759                 //心跳
760                 else if (identifier.equals(OPCElement.BOP030B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
761                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP030B_F_HEART_BEAT, true);
762                     miloService.writeToOpcUa(entity);
763                 }
764                 //PLC进站
765                 else if (identifier.equals(OPCElement.BOP030B_J_PLC_START) && null != value && "true".equals(value.toString())) {
766                     BOP030BCallback.handleOrder();
767                 }
768                 //PLC出站
769                 else if (identifier.equals(OPCElement.BOP030B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
770                     BOP030BCallback.handleFinsh();
771                     //BOP030BCallback.handleMaterial();
772                     //BOP030BCallback.handleInfo();
773                 }
774
775                 //BOP040
776                 //心跳
777                 else if (identifier.equals(OPCElement.BOP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
778                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP040_F_HEART_BEAT, true);
779                     miloService.writeToOpcUa(entity);
780                 }
781                 //PLC进站
782                 else if (identifier.equals(OPCElement.BOP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
783                     BOP040Callback.handleOrder();
784                 }
785                 //PLC出站
786                 else if (identifier.equals(OPCElement.BOP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
787                     BOP040Callback.handleFinsh();
788                     BOP040Callback.handleMaterial();
789                     BOP040Callback.handleInfo();
790                 }
791
792                 //BOP040B
793                 //心跳
794                 else if (identifier.equals(OPCElement.BOP040B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
795                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.BOP040B_F_HEART_BEAT, true);
796                     miloService.writeToOpcUa(entity);
797                 }
798                 //PLC进站
799                 else if (identifier.equals(OPCElement.BOP040B_J_PLC_START) && null != value && "true".equals(value.toString())) {
800                     BOP040BCallback.handleOrder();
801                 }
802                 //PLC出站
803                 else if (identifier.equals(OPCElement.BOP040B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
804                     BOP040BCallback.handleFinsh();
805                    // BOP040BCallback.handleMaterial();
806                     //BOP040BCallback.handleInfo();
807                 }
808
809
810                 //COP010
811                 //心跳
812                 else if (identifier.equals(OPCElement.COP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
813                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP010_F_HEART_BEAT, true);
814                     miloService.writeToOpcUa(entity);
815                 }
816                 //PLC进站
817                 else if (identifier.equals(OPCElement.COP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
818                     String isRepair = miloService.readFromOpcUa(OPCElement.COP010_P_REPAIR).getValue().toString();//是否返修
819                     if (isRepair.equals("true")) {
820                         COP010Callback.handleRepair();
821                     } else {
822                         COP010Callback.handleOrder();
823                     }
824                 }
825                 //PLC出站
826                 else if (identifier.equals(OPCElement.COP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
827                     COP010Callback.handleFinsh();
828                     COP010Callback.handleMaterial();
829                     //COP010Callback.handleInfo();
830                 }
831
832
833                 //COP020
834                 //心跳
835                 else if (identifier.equals(OPCElement.COP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
836                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP020_F_HEART_BEAT, true);
837                     miloService.writeToOpcUa(entity);
838                 }
839                 //PLC进站
840                 else if (identifier.equals(OPCElement.COP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
841                     COP020Callback.handleOrder();
842                 }
843                 //PLC出站
844                 else if (identifier.equals(OPCElement.COP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
845                     COP020Callback.handleFinsh();
846                     COP020Callback.handleMaterial();
847                     COP020Callback.handleInfo();
848                 }
849
850
851                 //COP030
852                 //心跳
853                 else if (identifier.equals(OPCElement.COP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
854                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.COP030_F_HEART_BEAT, true);
855                     miloService.writeToOpcUa(entity);
856                 }
857                 //PLC进站
858                 else if (identifier.equals(OPCElement.COP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
859                     COP030Callback.handleOrder();
860                 }
861                 //PLC出站
862                 else if (identifier.equals(OPCElement.COP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
863                     COP030Callback.handleFinsh();
864                     COP030Callback.handleMaterial();
865                     COP030Callback.handleInfo();
866                 }
867
868
869                 //DOP010
870                 //心跳
871                 else if (identifier.equals(OPCElement.DOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
872                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.DOP010_F_HEART_BEAT, true);
873                     miloService.writeToOpcUa(entity);
874                 }
875                 //PLC进站
876                 else if (identifier.equals(OPCElement.DOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
877                     String isRepair = miloService.readFromOpcUa(OPCElement.DOP010_P_REPAIR).getValue().toString();//是否返修
878                     if (isRepair.equals("true")) {
879                         DOP010Callback.handleRepair();
880                     } else {
881                         DOP010Callback.handleOrder();
882                     }
883                 }
884                 //PLC出站
885                 else if (identifier.equals(OPCElement.DOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
886                     DOP010Callback.handleFinsh();
887                     DOP010Callback.handleMaterial();
888                     //DOP010Callback.handleInfo();
889                 }
890
891
892                 //DOP020
893                 //心跳
894                 else if (identifier.equals(OPCElement.DOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
895                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.DOP020_F_HEART_BEAT, true);
896                     miloService.writeToOpcUa(entity);
897                 }
898                 //PLC进站
899                 else if (identifier.equals(OPCElement.DOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
900                     DOP020Callback.handleOrder();
901                 }
902                 //PLC出站
903                 else if (identifier.equals(OPCElement.DOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
904                     DOP020Callback.handleFinsh();
905                     DOP020Callback.handleMaterial();
906                     DOP020Callback.handleInfo();
907                 }
908
909                 //EOP010
910                 //心跳
911                 else if (identifier.equals(OPCElement.EOP010_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
912                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP010_F_HEART_BEAT, true);
913                     miloService.writeToOpcUa(entity);
914                 }
915                 //PLC进站
916                 else if (identifier.equals(OPCElement.EOP010_J_PLC_START) && null != value && "true".equals(value.toString())) {
917                     EOP010Callback.handleOrder();
918                 }
919                 //PLC出站
920                 else if (identifier.equals(OPCElement.EOP010_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
921                     EOP010Callback.handleFinsh();
922                     EOP010Callback.handleMaterial();
923                     EOP010Callback.handleInfo();
924                 }
925                 //EOP020
926                 //心跳
927                 else if (identifier.equals(OPCElement.EOP020_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
928                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP020_F_HEART_BEAT, true);
929                     miloService.writeToOpcUa(entity);
930                 }
931                 //PLC进站
932                 else if (identifier.equals(OPCElement.EOP020_J_PLC_START) && null != value && "true".equals(value.toString())) {
933                     EOP020Callback.handleOrder();
934                 }
935                 //PLC出站
936                 else if (identifier.equals(OPCElement.EOP020_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
937                     EOP020Callback.handleFinsh();
938                     EOP020Callback.handleMaterial();
939                     EOP020Callback.handleInfo();
940                 }
941
942                 //EOP030
943                 //心跳
944                 else if (identifier.equals(OPCElement.EOP030_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
945                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP030_F_HEART_BEAT, true);
946                     miloService.writeToOpcUa(entity);
947                 }
948                 //PLC进站
949                 else if (identifier.equals(OPCElement.EOP030_J_PLC_START) && null != value && "true".equals(value.toString())) {
950                     EOP030Callback.handleOrder();
951                 }
952                 //PLC出站
953                 else if (identifier.equals(OPCElement.EOP030_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
954                     EOP030Callback.handleFinsh();
955                     EOP030Callback.handleMaterial();
956                     EOP030Callback.handleInfo();
957                 }
958
959                 //EOP040
960                 //心跳
961                 else if (identifier.equals(OPCElement.EOP040_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
962                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP040_F_HEART_BEAT, true);
963                     miloService.writeToOpcUa(entity);
964                 }
965                 //PLC进站
966                 else if (identifier.equals(OPCElement.EOP040_J_PLC_START) && null != value && "true".equals(value.toString())) {
967                     EOP040Callback.handleOrder();
968                 }
969                 //PLC出站
970                 else if (identifier.equals(OPCElement.EOP040_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
971                     EOP040Callback.handleFinsh();
972                     EOP040Callback.handleMaterial();
973                     EOP040Callback.handleInfo();
974                 }
975
976                 //EOP050
977                 //心跳
978                 else if (identifier.equals(OPCElement.EOP050_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
979                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP050_F_HEART_BEAT, true);
980                     miloService.writeToOpcUa(entity);
981                 }
982                 //PLC进站
983                 else if (identifier.equals(OPCElement.EOP050_J_PLC_START) && null != value && "true".equals(value.toString())) {
984                     EOP050Callback.handleOrder();
985                 }
986                 //PLC出站
987                 else if (identifier.equals(OPCElement.EOP050_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
988                     EOP050Callback.handleFinsh();
989                     EOP050Callback.handleMaterial();
990                     EOP050Callback.handleInfo();
991                 }
992
993                 //EOP060
994                 //心跳
995                 else if (identifier.equals(OPCElement.EOP060_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
996                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP060_F_HEART_BEAT, true);
997                     miloService.writeToOpcUa(entity);
998                 }
999                 //PLC进站
1000                 else if (identifier.equals(OPCElement.EOP060_J_PLC_START) && null != value && "true".equals(value.toString())) {
1001                     EOP060Callback.handleOrder();
1002                 }
1003                 //PLC出站
1004                 else if (identifier.equals(OPCElement.EOP060_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1005                     EOP060Callback.handleFinsh();
1006                     EOP060Callback.handleMaterial();
1007                     EOP060Callback.handleInfo();
1008                 }
1009
1010                 //EOP070
1011                 //心跳
1012                 else if (identifier.equals(OPCElement.EOP070_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1013                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP070_F_HEART_BEAT, true);
1014                     miloService.writeToOpcUa(entity);
1015                 }
1016                 //PLC进站
1017                 else if (identifier.equals(OPCElement.EOP070_J_PLC_START) && null != value && "true".equals(value.toString())) {
1018                     EOP070Callback.handleOrder();
1019                 }
1020                 //PLC出站
1021                 else if (identifier.equals(OPCElement.EOP070_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1022                     EOP070Callback.handleFinsh();
1023                     EOP070Callback.handleMaterial();
1024                     EOP070Callback.handleInfo();
1025                 }
1026
1027                 //EOP080
1028                 //心跳
1029                 else if (identifier.equals(OPCElement.EOP080_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1030                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP080_F_HEART_BEAT, true);
1031                     miloService.writeToOpcUa(entity);
1032                 }
1033                 //PLC进站
1034                 else if (identifier.equals(OPCElement.EOP080_J_PLC_START) && null != value && "true".equals(value.toString())) {
1035                     EOP080Callback.handleOrder();
1036                 }
1037                 //PLC出站
1038                 else if (identifier.equals(OPCElement.EOP080_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1039                     EOP080Callback.handleFinsh();
1040                     EOP080Callback.handleMaterial();
1041                     EOP080Callback.handleInfo();
1042                 }
1043
1044                 //EOP090
1045                 //心跳
1046                 else if (identifier.equals(OPCElement.EOP090_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1047                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP090_F_HEART_BEAT, true);
1048                     miloService.writeToOpcUa(entity);
1049                 }
1050                 //PLC进站
1051                 else if (identifier.equals(OPCElement.EOP090_J_PLC_START) && null != value && "true".equals(value.toString())) {
1052                     EOP090Callback.handleOrder();
1053                 }
1054                 //PLC出站
1055                 else if (identifier.equals(OPCElement.EOP090_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1056                     EOP090Callback.handleFinsh();
1057                     EOP090Callback.handleMaterial();
1058                     EOP090Callback.handleInfo();
1059                 }
1060
1061                 //EOP090B
1062                 //心跳
1063                 else if (identifier.equals(OPCElement.EOP090B_F_HEART_BEAT) && null != value && "false".equals(value.toString())) {
1064                     ReadWriteEntity entity = new ReadWriteEntity(OPCElement.EOP090B_F_HEART_BEAT, true);
1065                     miloService.writeToOpcUa(entity);
1066                 }
1067                 //PLC进站
1068                 else if (identifier.equals(OPCElement.EOP090B_J_PLC_START) && null != value && "true".equals(value.toString())) {
1069                     EOP090BCallback.handleOrder();
1070                 }
1071                 //PLC出站
1072                 else if (identifier.equals(OPCElement.EOP090B_J_PLC_FINISH) && null != value && "true".equals(value.toString())) {
1073                     EOP090BCallback.handleFinsh();
1074                     EOP090BCallback.handleMaterial();
1075                     EOP090BCallback.handleInfo();
1076                 }
1077
314bc7 1078                 else if (identifier.contains("STATE") && null != value) {
d43481 1079                     EquipmentInfoParam equipmentInfoParam = new EquipmentInfoParam();
C 1080                     equipmentInfoParam.setSpareField1(identifier);
1081                     List<EquipmentInfoResult> lists = equipmentInfoService.findListBySpec(equipmentInfoParam);
1082                     if(!lists.isEmpty()){
1083                         EquipmentInfoResult result = (EquipmentInfoResult) list.get(0);
1084                         String equipmentNo = result.getEquipmentNo();
1085                         EquipmentStatusParam equipmentStatusParam = new EquipmentStatusParam();
1086                         equipmentStatusParam.setEquipmentNo(equipmentNo);
1087                         List statuslist = equipmentStatusService.findListBySpec(equipmentStatusParam);
1088                         if(statuslist.size()>0){
1089                             EquipmentStatusResult equipmentStatusResult = (EquipmentStatusResult) statuslist.get(0);
1090                             if(!value.equals(equipmentStatusResult.getStatus())){
1091                                 equipmentStatusParam.setId(equipmentStatusResult.getId());
1092                                 equipmentStatusParam.setStatus(value.toString());
1093                                 equipmentStatusParam.setUpdateTime(DateTool.getLocalTimeForDate());
1094                                 equipmentStatusService.update(equipmentStatusParam);//更新设备状态
1095
1096                                 //添加设备报警
1097                                 if("3".equals(value)){
1098                                     EquipmentAlarmParam equipmentAlarmParam = new EquipmentAlarmParam();
1099                                     equipmentAlarmParam.setEquipmentNo(equipmentNo);
1100                                     equipmentAlarmParam.setEquipmentName(result.getEquipmentName());
1101                                     equipmentAlarmParam.setWorkshopCode(result.getWorkshopCode());
1102                                     equipmentAlarmParam.setProductionLineCode(result.getProductionLineCode());
1103                                     equipmentAlarmParam.setLocationCode(result.getLocationCode());
1104                                     equipmentAlarmParam.setErrorDesc(result.getEquipmentName()+"报警!");
1105                                     equipmentAlarmParam.setAlarmTime(DateTool.getLocalTimeForDate());
1106                                     equipmentAlarmService.add(equipmentAlarmParam);
1107                                 }
1108                             }
1109
1110                         }else{
1111                             equipmentStatusParam.setEquipmentName(result.getEquipmentName());
1112                             equipmentStatusParam.setWorkshopCode(result.getWorkshopCode());
1113                             equipmentStatusParam.setProductionLineCode(result.getProductionLineCode());
1114                             equipmentStatusParam.setLocationCode(result.getLocationCode());
1115                             equipmentStatusParam.setStatus(value.toString());
1116                             equipmentStatusParam.setUpdateTime(DateTool.getLocalTimeForDate());
1117                             equipmentStatusService.add(equipmentStatusParam);
1118
1119                             //添加设备报警
1120                             if("3".equals(value)){
1121                                 EquipmentAlarmParam equipmentAlarmParam = new EquipmentAlarmParam();
1122                                 equipmentAlarmParam.setEquipmentNo(equipmentNo);
1123                                 equipmentAlarmParam.setEquipmentName(result.getEquipmentName());
1124                                 equipmentAlarmParam.setWorkshopCode(result.getWorkshopCode());
1125                                 equipmentAlarmParam.setProductionLineCode(result.getProductionLineCode());
1126                                 equipmentAlarmParam.setLocationCode(result.getLocationCode());
1127                                 equipmentAlarmParam.setErrorDesc(result.getEquipmentName()+"报警!");
1128                                 equipmentAlarmParam.setAlarmTime(DateTool.getLocalTimeForDate());
1129                                 equipmentAlarmService.add(equipmentAlarmParam);
1130                             }
1131                         }
1132                     }
1133
314bc7 1134                     if(identifier.contains("OP050") && !identifier.contains("EOP050") ){
C 1135                         StateCallback.handleOilStateOP050("OP050");
1136                     }
1137                     if (identifier.contains("BOP030")){
1138                         StateCallback.handleOilStateBOP030("BOP030");
1139                     }
d43481 1140                 }
C 1141
1142                 else {
1143                     System.out.println("值没有变");
1144                 }
1145
1146
1147             }else {
1148                 System.out.println("值为空");
1149             }
1150
1151         } catch (Exception e) {
1152             ecpStr ="出现异常:" + logUtil.getTrace(e);
1153         }finally {
1154             if(!"".equals(ecpStr)){
1155                 System.out.println(ecpStr+"\r\n");
1156                 logger.info(ecpStr+"\r\n");
1157             }
1158         }
1159     }
1160
1161
1162
1163 }