cl
2024-09-06 91b54fc007c9e82087738048d3b767c9645a6aec
提交 | 用户 | 时间
b78728 1 package com.jcdm.main.plcserver;
A 2
3
4 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 import com.jcdm.main.constant.Constants;
6 import com.jcdm.main.da.cellData.service.IDaCellDataService;
7 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
8 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
9 import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
10 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
11 import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService;
12 import com.jcdm.main.da.testDeviceInterfaceTemp.service.IDaTestDeviceInterfaceTempService;
13 import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
14 import com.jcdm.main.plcserver.sub.OPCUaSubscription;
15 import com.kangaroohy.milo.service.MiloService;
16 import org.springframework.beans.factory.annotation.Autowired;
17 import org.springframework.boot.ApplicationArguments;
18 import org.springframework.boot.ApplicationRunner;
19 import org.springframework.stereotype.Component;
20
21 import java.util.List;
22 import java.util.stream.Collectors;
23
24 @Component
25 public class CustomRunner implements ApplicationRunner {
26
27     @Autowired
28     private MiloService miloService;
29
30     @Autowired
31     private IDaPassingStationCollectionService daPassingStationCollectionService;
32
33     @Autowired
34     private IDaCollectionParamConfService collectionParamConfService;
35
36     @Autowired
37     private IDaParamCollectionService daParamCollectionService;
38
39
40     @Autowired
41     private IOmProductionOrdeInfoService omProductionOrdeInfoService;
42
43
44     @Autowired
45     private IDaOpcuaConfigService daOpcuaConfigService;
46
47     @Autowired
48     private IDaTestDeviceInterfaceTempService daTestDeviceInterfaceTempService;
49
50     @Autowired
51     private IDaCellDataService daCellDataService;
52
53     @Override
54     public void run(ApplicationArguments args) throws Exception {
55
f3862f 56         //PLC到MES物料转换
46b20f 57         Constants.materialMap.put("1","9900200461");//微卡电驱动系统总成(9999276636)//9900200461
C 58         Constants.materialMap.put("2","9900207783");//微面电驱动系统总成(9999276639)//9900207783
59
b82de6 60         Constants.facMaterialMap.put("9900200461","9999276636");//生产物料转工厂物料请求工单
C 61         Constants.facMaterialMap.put("9900207783","9999276639");//生产物料转工厂物料请求工单
2b9842 62
257bd3 63         //通道
ce7b04 64         Constants.thoroughfareMap.put(Constants.OP010,"JCDM035-1");
C 65
66         Constants.thoroughfareMap.put(Constants.OP020,"JCDM035-2");
67         Constants.thoroughfareMap.put(Constants.OP030,"JCDM035-2");
68         Constants.thoroughfareMap.put(Constants.OP120_2,"JCDM035-2");
69         Constants.thoroughfareMap.put(Constants.OP130,"JCDM035-2");
70         Constants.thoroughfareMap.put(Constants.OP140,"JCDM035-2");
71         Constants.thoroughfareMap.put(Constants.OP150,"JCDM035-2");
72         Constants.thoroughfareMap.put(Constants.OP160,"JCDM035-2");
73         Constants.thoroughfareMap.put(Constants.OP165,"JCDM035-2");
74
257bd3 75         Constants.thoroughfareMap.put(Constants.OP040,"JCDM035-3");
C 76         Constants.thoroughfareMap.put(Constants.OP050,"JCDM035-3");
77         Constants.thoroughfareMap.put(Constants.OP060,"JCDM035-3");
78         Constants.thoroughfareMap.put(Constants.OP070,"JCDM035-3");
79         Constants.thoroughfareMap.put(Constants.OP080,"JCDM035-3");
80         Constants.thoroughfareMap.put(Constants.OP090,"JCDM035-3");
81         Constants.thoroughfareMap.put(Constants.OP100,"JCDM035-3");
82         Constants.thoroughfareMap.put(Constants.OP110,"JCDM035-3");
83
ce7b04 84         Constants.thoroughfareMap.put(Constants.OP170,"JCDM035-4");
C 85         Constants.thoroughfareMap.put(Constants.OP180,"JCDM035-4");
86         Constants.thoroughfareMap.put(Constants.OP190,"JCDM035-4");
87         Constants.thoroughfareMap.put(Constants.OP200,"JCDM035-4");
88         Constants.thoroughfareMap.put(Constants.OP210,"JCDM035-4");
89         Constants.thoroughfareMap.put(Constants.OP220,"JCDM035-4");
90         Constants.thoroughfareMap.put(Constants.OP230,"JCDM035-4");
91
2b9842 92         //主线人工工位
C 93         Constants.OP040_OP160.add(Constants.OP040);
5d1c1c 94         Constants.OP040_OP160.add(Constants.OP080);
2b9842 95         Constants.OP040_OP160.add(Constants.OP070);
ce7b04 96         Constants.OP040_OP160.add(Constants.OP100);
C 97         Constants.OP040_OP160.add(Constants.OP120_2);
e4697f 98         Constants.OP040_OP160.add(Constants.OP165);
2b9842 99
6f1a28 100         //环线人工工位
8bab65 101         Constants.OP0170_OP220.add(Constants.OP170);
C 102         Constants.OP0170_OP220.add(Constants.OP180);
103         Constants.OP0170_OP220.add(Constants.OP190);
104         Constants.OP0170_OP220.add(Constants.OP200);
105         Constants.OP0170_OP220.add(Constants.OP210);
106         Constants.OP0170_OP220.add(Constants.OP220);
6f1a28 107
b78728 108         OPCUaSubscription opcUaSubscription = new OPCUaSubscription(
A 109                 miloService,
110                 daPassingStationCollectionService,
111                 collectionParamConfService,
112                 daParamCollectionService,
113                 omProductionOrdeInfoService,
114                 daTestDeviceInterfaceTempService,
115                 daCellDataService);
116
117         List<String> lists = getSubList();
118         System.out.println("订阅内容:"+lists);
119         miloService.subscriptionFromOpcUa(lists,50,opcUaSubscription);
120
121     }
122
123     /**
124      * 订阅内容
125      */
126     public List<String> getSubList(){
127         List<String> lists = daOpcuaConfigService.list(new LambdaQueryWrapper<DaOpcuaConfig>()
93dc3d 128                         .eq(DaOpcuaConfig::getState, Constants.USE_ING)
C 129                         .eq(DaOpcuaConfig::getSubscribe,Constants.YES))
b78728 130                 .stream().map(DaOpcuaConfig::getNode).collect(Collectors.toList());
A 131         return lists;
132     }
133 }
134