提交 | 用户 | 时间
|
3e03af
|
1 |
package com.jcdm.main.plcserver.sub; |
C |
2 |
|
9e6d86
|
3 |
import cn.hutool.core.collection.CollUtil; |
W |
4 |
import cn.hutool.core.util.ObjectUtil; |
|
5 |
import cn.hutool.core.util.StrUtil; |
59e228
|
6 |
import com.jcdm.common.core.domain.BaseEntity; |
9e6d86
|
7 |
import com.jcdm.main.bs.domain.BsTechnologyRouteChildInfo; |
W |
8 |
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
|
9 |
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService; |
|
10 |
import com.jcdm.main.bs.technologyRouteChild.service.IBsTechnologyRouteChildInfoService; |
3e03af
|
11 |
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf; |
C |
12 |
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService; |
059083
|
13 |
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig; |
3e03af
|
14 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
C |
15 |
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService; |
059083
|
16 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
59e228
|
17 |
import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation; |
W |
18 |
import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService; |
059083
|
19 |
import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl; |
3e03af
|
20 |
import com.jcdm.main.plcserver.conf.OPCElement; |
9e6d86
|
21 |
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; |
W |
22 |
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService; |
3e03af
|
23 |
import com.kangaroohy.milo.model.ReadWriteEntity; |
C |
24 |
import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; |
|
25 |
import com.kangaroohy.milo.service.MiloService; |
059083
|
26 |
import lombok.extern.slf4j.Slf4j; |
59e228
|
27 |
import org.apache.commons.lang3.ObjectUtils; |
1a444b
|
28 |
import org.slf4j.Logger; |
Y |
29 |
import org.slf4j.LoggerFactory; |
3e03af
|
30 |
import org.springframework.stereotype.Component; |
C |
31 |
|
9f6314
|
32 |
import java.math.BigDecimal; |
c76a3f
|
33 |
import java.sql.Time; |
9e6d86
|
34 |
import java.time.LocalDateTime; |
c76a3f
|
35 |
import java.util.*; |
W |
36 |
import java.util.concurrent.TimeUnit; |
3e03af
|
37 |
import java.util.stream.Collectors; |
C |
38 |
|
|
39 |
|
059083
|
40 |
@Slf4j |
3e03af
|
41 |
@Component |
C |
42 |
public class OPCUaSubscription implements SubscriptionCallback { |
|
43 |
|
1a444b
|
44 |
private static final Logger logger = LoggerFactory.getLogger("sys-user"); |
3e03af
|
45 |
public static MiloService miloService; |
C |
46 |
|
|
47 |
public IDaCollectionParamConfService collectionParamConfService; |
|
48 |
|
|
49 |
public IDaParamCollectionService daParamCollectionService; |
|
50 |
|
059083
|
51 |
public DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl; |
W |
52 |
|
|
53 |
public List<DaOpcuaConfig> lists; |
|
54 |
|
|
55 |
public static final HashMap<String,Integer> map = new HashMap<>(); |
|
56 |
|
9e6d86
|
57 |
public IBsOrderSchedulingService bsOrderSchedulingService; |
W |
58 |
|
|
59 |
public IRmRepairRecordService rmRepairRecordService; |
|
60 |
|
|
61 |
public IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService; |
59e228
|
62 |
public ProductNewPassStationService productNewPassStationService; |
9e6d86
|
63 |
|
c76a3f
|
64 |
public HashMap<String,List<DaCollectionParamConf>> allCollectParamList = new HashMap<>(); |
W |
65 |
|
3e03af
|
66 |
public OPCUaSubscription(MiloService miloService, |
C |
67 |
IDaCollectionParamConfService collectionParamConfService, |
059083
|
68 |
IDaParamCollectionService daParamCollectionService, |
W |
69 |
DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl, |
9e6d86
|
70 |
IBsOrderSchedulingService bsOrderSchedulingService, |
W |
71 |
List<DaOpcuaConfig> lists, |
|
72 |
IRmRepairRecordService rmRepairRecordService, |
59e228
|
73 |
IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService, |
W |
74 |
ProductNewPassStationService productNewPassStationService) { |
3e03af
|
75 |
OPCUaSubscription.miloService = miloService; |
C |
76 |
this.collectionParamConfService = collectionParamConfService; |
|
77 |
this.daParamCollectionService = daParamCollectionService; |
059083
|
78 |
this.passingStationCollectionServiceImpl = passingStationCollectionServiceImpl; |
9e6d86
|
79 |
this.bsOrderSchedulingService = bsOrderSchedulingService; |
059083
|
80 |
this.lists = lists; |
9e6d86
|
81 |
this.rmRepairRecordService = rmRepairRecordService; |
W |
82 |
this.bsTechnologyRouteChildInfoService = bsTechnologyRouteChildInfoService; |
59e228
|
83 |
this.productNewPassStationService = productNewPassStationService; |
c76a3f
|
84 |
|
W |
85 |
|
3e03af
|
86 |
} |
C |
87 |
@Override |
|
88 |
public void onSubscribe(String identifier, Object value) { |
|
89 |
String ecpStr = "";//异常记录标记 |
|
90 |
try { |
8876c2
|
91 |
if(null != value && "1".equals(value.toString())) { |
059083
|
92 |
//1、检索SN号 |
W |
93 |
//2、过站参数采集 |
|
94 |
//3、扫码枪数据回传 |
|
95 |
List<String> collect1 = lists.stream().filter(x -> OPCElement.SN_CHECK.equals(x.getrFunction())) |
|
96 |
.map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
|
97 |
List<String> collect2 = lists.stream().filter(x -> OPCElement.SAVE_DATA.equals(x.getrFunction())) |
|
98 |
.map(DaOpcuaConfig::getNode).collect(Collectors.toList()); |
|
99 |
if (collect1.contains(identifier)){ |
1a444b
|
100 |
logger.info("-------监听到,{}的CODE_CHECK的信号",identifier); |
Y |
101 |
//logger.info("-------time--------------,{}",LocalDateTime.now()); |
059083
|
102 |
//sn |
59e228
|
103 |
if (OPCElement.OP010_CODE_CHECK.equals(identifier)){ |
W |
104 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.CodeCheckFeed", 1); |
|
105 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
106 |
} else if (OPCElement.OP020_CODE_CHECK.equals(identifier)) { |
|
107 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.CodeCheckFeed", 1); |
|
108 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
109 |
} else if (OPCElement.OP030_CODE_CHECK.equals(identifier)) { |
|
110 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP030.CodeCheckFeed", 1); |
|
111 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
112 |
Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP030.Code").getValue(); |
|
113 |
if (ObjectUtil.isNotEmpty(SNCodeObject)){ |
|
114 |
String snCode = SNCodeObject.toString(); |
|
115 |
if (StrUtil.isNotBlank(snCode)){ |
|
116 |
String type = productNewFlag(snCode); |
|
117 |
if ("280".equals(type) || "380".equals(type)){ |
|
118 |
//获取箱体码 |
|
119 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
120 |
productNewPassStation.setFinishFlag(OPCElement.UN_FINISH); |
|
121 |
productNewPassStation.setSfcCode(snCode); |
|
122 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
123 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
124 |
List<ProductNewPassStation> collect = productPassStationList.stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime).reversed()).collect(Collectors.toList()); |
|
125 |
ProductNewPassStation productNewPassStation1 = collect.get(0); |
|
126 |
String boxCode = productNewPassStation1.getBoxCode(); |
|
127 |
passingStationCollectionServiceImpl.sendMessage(type+"*"+boxCode,"OP030"); |
|
128 |
} |
|
129 |
|
|
130 |
} |
|
131 |
} |
|
132 |
|
dd4482
|
133 |
} |
59e228
|
134 |
} else if (OPCElement.OP040_CODE_CHECK.equals(identifier)) { |
W |
135 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP040.CodeCheckFeed", 1); |
|
136 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
137 |
//推送数据 |
|
138 |
log.info("进入OP040.CodeCheck"); |
|
139 |
tile2("CFL4HX.OP040.CodeCheck"); |
|
140 |
} else { |
|
141 |
this.SNRetrieval(identifier,value.toString()); |
|
142 |
if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){ |
|
143 |
//总装上线扫码传输数据 |
|
144 |
logger.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier); |
|
145 |
scannerGunMessage(); |
dd4482
|
146 |
} |
Y |
147 |
} |
59e228
|
148 |
|
9e6d86
|
149 |
} |
W |
150 |
if (collect2.contains(identifier)){ |
|
151 |
if ("1".equals(value.toString())){ |
1a444b
|
152 |
logger.info("-------监听到,{}的SAVE_REQUEST_LAST的信号",identifier); |
Y |
153 |
//logger.info("-------time--------------,{}",LocalDateTime.now()); |
59e228
|
154 |
//HX线改装 |
W |
155 |
if (OPCElement.OP010_REQUEST_PRODUCT_TYPE.equals(identifier)){ |
|
156 |
Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP010.Code").getValue(); |
|
157 |
if (ObjectUtil.isNotEmpty(SNCodeObject)){ |
|
158 |
String snCode = SNCodeObject.toString(); |
|
159 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP010.ProductTypeSN",snCode); |
|
160 |
OPCUaSubscription.miloService.writeToOpcUa(entity3);//写产品SN号反馈 |
|
161 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SNDone", 1); |
|
162 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
163 |
|
|
164 |
} |
|
165 |
} else if (OPCElement.OP010_SAVE_REQUEST.equals(identifier)) { |
|
166 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SaveFeed", 1); |
|
167 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
168 |
} else if (OPCElement.OP020_PRINT_REQUEST.equals(identifier)) { |
|
169 |
Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP020.Code").getValue(); |
|
170 |
if (ObjectUtil.isNotEmpty(SNCodeObject)){ |
|
171 |
String snCode = SNCodeObject.toString(); |
778d3d
|
172 |
DaPassingStationCollection passingStationCollectionCheck = new DaPassingStationCollection(); |
W |
173 |
passingStationCollectionCheck.setLocationCode("OP020"); |
|
174 |
passingStationCollectionCheck.setSfcCode(snCode); |
|
175 |
List<DaPassingStationCollection> checkList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passingStationCollectionCheck); |
|
176 |
if (CollUtil.isNotEmpty(checkList)){ |
|
177 |
if (snCode.startsWith("380")){ |
|
178 |
log.info("enter-380"); |
|
179 |
String[] split = snCode.split(StrUtil.SPACE); |
|
180 |
if (split.length>1){ |
|
181 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]); |
|
182 |
OPCUaSubscription.miloService.writeToOpcUa(entity);//写完成 |
|
183 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "☆"+split[1]+"☆"); |
|
184 |
OPCUaSubscription.miloService.writeToOpcUa(entity2);//写完成 |
|
185 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2); |
|
186 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
|
187 |
} |
|
188 |
} else { |
|
189 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode); |
|
190 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
191 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2); |
59e228
|
192 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
W |
193 |
} |
|
194 |
} else { |
778d3d
|
195 |
if (snCode.startsWith("380")){ |
W |
196 |
log.info("enter-380"); |
|
197 |
String[] split = snCode.split(StrUtil.SPACE); |
|
198 |
if (split.length>1){ |
|
199 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]); |
|
200 |
OPCUaSubscription.miloService.writeToOpcUa(entity);//写完成 |
|
201 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "☆"+split[1]+"☆"); |
|
202 |
OPCUaSubscription.miloService.writeToOpcUa(entity2);//写完成 |
|
203 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1); |
|
204 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
|
205 |
} |
|
206 |
} else { |
|
207 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode); |
|
208 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
209 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1); |
|
210 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
|
211 |
} |
59e228
|
212 |
} |
778d3d
|
213 |
|
59e228
|
214 |
} |
W |
215 |
} else if (OPCElement.OP030_SAVE_REQUEST.equals(identifier)) { |
d2daac
|
216 |
cleanForm("CFL4HX.OP030.SaveFeed"); |
59e228
|
217 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP030.SaveFeed", 1); |
W |
218 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
d2daac
|
219 |
|
59e228
|
220 |
} else if (OPCElement.OP040_SAVE_REQUEST.equals(identifier)) { |
W |
221 |
cleanForm040(OPCElement.OP040_SAVE_REQUEST); |
|
222 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP040.SaveFeed", 1); |
|
223 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
224 |
} else { |
|
225 |
this.SaveData(identifier); |
|
226 |
} |
|
227 |
|
059083
|
228 |
} |
W |
229 |
} |
3e03af
|
230 |
} |
C |
231 |
} catch (Exception e) { |
9e6d86
|
232 |
System.out.println(e.getMessage()); |
3e03af
|
233 |
} finally { |
C |
234 |
if (!"".equals(ecpStr)) { |
|
235 |
System.out.println(ecpStr + "\r\n"); |
|
236 |
} |
9e6d86
|
237 |
} |
W |
238 |
} |
|
239 |
|
|
240 |
private void scannerGunMessage() throws Exception { |
|
241 |
String[] parts = OPCElement.OP120_ZZ_CODE_CHECK.split("[.]"); |
|
242 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
3946f8
|
243 |
if (null == SNCodeObject){ |
W |
244 |
SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
245 |
} |
9e6d86
|
246 |
if (null != SNCodeObject){ |
W |
247 |
String SNCode = SNCodeObject.toString(); |
1c7036
|
248 |
passingStationCollectionServiceImpl.sendMessage(SNCode,"OP120"); |
3e03af
|
249 |
} |
C |
250 |
} |
|
251 |
|
059083
|
252 |
public void SNRetrieval(String Node, String value) throws Exception { |
W |
253 |
String[] parts = Node.split("[.]"); |
|
254 |
if(value.equals("1")) { |
|
255 |
//SN号检索 |
|
256 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
257 |
if(null != SNCodeObject) { |
|
258 |
String SNCode=SNCodeObject.toString(); |
1c7036
|
259 |
// String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]); |
929bdc
|
260 |
String a; |
W |
261 |
BsOrderScheduling bsOrderSchedulingQuery = new BsOrderScheduling(); |
|
262 |
bsOrderSchedulingQuery.setEngineNo(SNCode); |
|
263 |
List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery); |
|
264 |
if (CollUtil.isNotEmpty(queryOrderList)){ |
|
265 |
a = "1"; |
131e8c
|
266 |
//如果是老车型,判断是否重复扫码 |
W |
267 |
if (OPCElement.OP050_CODE_CHECK.equals(Node)){ |
|
268 |
String type = productNewFlag(SNCode); |
|
269 |
if (!"280".equals(type) && !"380".equals(type)){ |
|
270 |
DaPassingStationCollection passCheck = new DaPassingStationCollection(); |
|
271 |
passCheck.setSfcCode(SNCode); |
8876c2
|
272 |
passCheck.setLocationCode("OP060"); |
131e8c
|
273 |
List<DaPassingStationCollection> passCheckList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passCheck); |
W |
274 |
if (CollUtil.isNotEmpty(passCheckList)){ |
|
275 |
//是否返修 |
|
276 |
a = "5"; |
|
277 |
// RmRepairRecord repairRecordCheck = new RmRepairRecord(); |
|
278 |
// repairRecordCheck.setBoxCode(SNCode); |
|
279 |
// repairRecordCheck.setProcessesCode("OP050"); |
|
280 |
// List<RmRepairRecord> repairCheckList = rmRepairRecordService.selectRmRepairRecordList(repairRecordCheck); |
|
281 |
// if (CollUtil.isEmpty(repairCheckList)){ |
|
282 |
// |
|
283 |
// } |
|
284 |
} |
|
285 |
} |
|
286 |
} |
929bdc
|
287 |
}else { |
0e3cac
|
288 |
a = "4"; |
929bdc
|
289 |
} |
W |
290 |
//如果是返修工位需要传输返修工位号 |
0e3cac
|
291 |
List<DaPassingStationCollection> daPassingStationCollections = new ArrayList<>(); |
W |
292 |
List<RmRepairRecord> rmRepairRecords = new ArrayList<>(); |
929bdc
|
293 |
if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node) |
W |
294 |
|| OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){ |
|
295 |
//过站记录 |
|
296 |
DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
|
297 |
PassingStationCollection.setSfcCode(SNCode); |
0e3cac
|
298 |
daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection); |
45f460
|
299 |
// if (CollUtil.isNotEmpty(daPassingStationCollections)){ |
Y |
300 |
// DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1); |
|
301 |
// String outRsSign = lastOne.getOutRsSign(); |
|
302 |
// if ("合格".equals(outRsSign)){ |
|
303 |
// a = "1"; |
|
304 |
// }else { |
|
305 |
// a = "2"; |
|
306 |
// } |
|
307 |
// } |
0e3cac
|
308 |
RmRepairRecord rmRepairRecord = new RmRepairRecord(); |
W |
309 |
rmRepairRecord.setBoxCode(SNCode); |
|
310 |
rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
|
311 |
if (CollUtil.isNotEmpty(rmRepairRecords)){ |
|
312 |
a = "1"; |
45f460
|
313 |
}else { |
Y |
314 |
a = "2"; |
0e3cac
|
315 |
} |
929bdc
|
316 |
} |
1a444b
|
317 |
logger.info("-----返回codeCheckFeed-----,{}",a); |
3946f8
|
318 |
// String a="1"; |
059083
|
319 |
// 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件) |
9e6d86
|
320 |
if (StrUtil.isNotBlank(a)){ |
W |
321 |
int input = Integer.parseInt(a); |
|
322 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input); |
5030f3
|
323 |
logger.info("发动机号:{},监听到{}的CodeCheck的信号",SNCode,Node); |
cffac1
|
324 |
miloService.writeToOpcByte(entity); |
1a444b
|
325 |
logger.info("监听到返回codecheckfeed信号,{}",entity); |
9e6d86
|
326 |
//首站传输订单号 |
59e228
|
327 |
// if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){ |
W |
328 |
// //查询订单号 |
|
329 |
// BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
330 |
// bsOrderScheduling.setEngineNo(SNCode); |
|
331 |
// List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
|
332 |
// String orderNum = ""; |
|
333 |
// if (CollUtil.isNotEmpty(tempList)){ |
|
334 |
// BsOrderScheduling bsOrderScheduling1 = tempList.get(0); |
|
335 |
// orderNum = bsOrderScheduling1.getOrderNo(); |
|
336 |
// } |
|
337 |
// ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum); |
|
338 |
// miloService.writeToOpcUa(entity2); |
|
339 |
// } |
9e6d86
|
340 |
//如果是返修工位需要传输返修工位号 |
3946f8
|
341 |
if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node) |
W |
342 |
|| OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){ |
0e3cac
|
343 |
rework(SNCode,Node,daPassingStationCollections,rmRepairRecords); |
9e6d86
|
344 |
} |
59e228
|
345 |
if (OPCElement.OP050_CODE_CHECK.equals(Node)) { |
W |
346 |
//新机型050 |
|
347 |
String type = productNewFlag(SNCode); |
|
348 |
if ("280".equals(type) || "380".equals(type)){ |
|
349 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
350 |
productNewPassStation.setSfcCode(SNCode); |
|
351 |
List<ProductNewPassStation> passStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
352 |
ProductNewPassStation productNewPassStation2 = new ProductNewPassStation(); |
|
353 |
productNewPassStation2.setFinishFlag("0"); |
|
354 |
List<ProductNewPassStation> collect = productNewPassStationService.getProductPassStationList(productNewPassStation2) |
|
355 |
.stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime)) |
|
356 |
.collect(Collectors.toList()); |
|
357 |
String partSfcCode = ""; |
|
358 |
if (CollUtil.isNotEmpty(collect)){ |
|
359 |
ProductNewPassStation passStation = collect.get(0); |
|
360 |
partSfcCode = passStation.getSfcCode(); |
|
361 |
} |
|
362 |
if (CollUtil.isNotEmpty(passStationList)){ |
|
363 |
ProductNewPassStation passStation = passStationList.get(0); |
|
364 |
String productType = ""; |
|
365 |
if (ObjectUtils.isNotEmpty(passStation)){ |
|
366 |
productType = passStation.getProductType(); |
|
367 |
} |
|
368 |
passingStationCollectionServiceImpl.sendMessage(SNCode+"*sfcCode*"+productType+"*"+partSfcCode,"OP050"); |
|
369 |
} |
|
370 |
} |
|
371 |
} |
|
372 |
if (OPCElement.OP060_CODE_CHECK.equals(Node)){ |
|
373 |
String type = productNewFlag(SNCode); |
|
374 |
if ("280".equals(type) || "380".equals(type)){ |
|
375 |
checkBoxRod(Node); |
|
376 |
} |
d4f437
|
377 |
} |
3946f8
|
378 |
System.out.println(entity); |
cffac1
|
379 |
|
9e6d86
|
380 |
} |
W |
381 |
|
059083
|
382 |
} |
9e6d86
|
383 |
} |
W |
384 |
} |
|
385 |
|
0e3cac
|
386 |
private void rework(String SNCode,String Node,List<DaPassingStationCollection> daPassingStationCollections,List<RmRepairRecord> rmRepairRecords) throws Exception{ |
9e6d86
|
387 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
W |
388 |
bsOrderScheduling.setEngineNo(SNCode); |
|
389 |
List<String> allProcessCoed = new ArrayList<>(); |
929bdc
|
390 |
List<BsTechnologyRouteChildInfo> bsTechnologyRouteChildInfos = new ArrayList<>(); |
9e6d86
|
391 |
List<String> collect = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling).stream().map(BsOrderScheduling::getModel).collect(Collectors.toList()); |
W |
392 |
if (CollUtil.isNotEmpty(collect)){ |
|
393 |
String s = collect.get(0); |
|
394 |
//查找次机型的完整工序 |
929bdc
|
395 |
bsTechnologyRouteChildInfos = bsTechnologyRouteChildInfoService.selectAllTechnologyRouteByProductCode(s); |
9e6d86
|
396 |
if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){ |
W |
397 |
allProcessCoed = bsTechnologyRouteChildInfos.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()); |
|
398 |
} |
|
399 |
} |
0e3cac
|
400 |
// RmRepairRecord rmRepairRecord = new RmRepairRecord(); |
W |
401 |
// rmRepairRecord.setBoxCode(SNCode); |
9e6d86
|
402 |
List<ReadWriteEntity> writeList = new ArrayList<>(); |
0e3cac
|
403 |
// List<RmRepairRecord> rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
3946f8
|
404 |
//过站记录 |
0e3cac
|
405 |
// DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
W |
406 |
// PassingStationCollection.setSfcCode(SNCode); |
3946f8
|
407 |
//过站记录 |
0e3cac
|
408 |
// List<DaPassingStationCollection> daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection); |
3946f8
|
409 |
|
1a444b
|
410 |
//所有返工工位 |
9e6d86
|
411 |
List<String> collect1 = rmRepairRecords.stream().map(RmRepairRecord::getProcessesCode).collect(Collectors.toList()); |
3946f8
|
412 |
if (CollUtil.isNotEmpty(collect1)){ |
929bdc
|
413 |
//查询出所有需要返修工位的最小op块 |
W |
414 |
Integer minOP = 0; |
|
415 |
if (CollUtil.isNotEmpty(collect1)){ |
3946f8
|
416 |
|
929bdc
|
417 |
List<Integer> sortList = new ArrayList<>(); |
W |
418 |
collect1.stream().forEach(x ->{ |
|
419 |
String op = x.replace("OP", ""); |
|
420 |
if (StrUtil.isNotBlank(op)){ |
|
421 |
int i = Integer.parseInt(op); |
|
422 |
sortList.add(i); |
|
423 |
} |
|
424 |
}); |
|
425 |
if (CollUtil.isNotEmpty(sortList)){ |
|
426 |
List<Integer> collect2 = sortList.stream().filter(Objects::nonNull).sorted().collect(Collectors.toList()); |
|
427 |
minOP = collect2.get(0); |
3946f8
|
428 |
} |
W |
429 |
} |
929bdc
|
430 |
//获取过站记录的最大工位 |
W |
431 |
String maxCode = null; |
|
432 |
if (CollUtil.isNotEmpty(daPassingStationCollections)){ |
9bc510
|
433 |
List<DaPassingStationCollection> collect2 = daPassingStationCollections.stream().filter(x -> "不合格".equals(x.getOutRsSign())).collect(Collectors.toList()); |
W |
434 |
if (CollUtil.isNotEmpty(collect2)){ |
|
435 |
DaPassingStationCollection lastOne = collect2.get(collect2.size() - 1); |
|
436 |
maxCode = lastOne.getLocationCode(); |
|
437 |
}else { |
|
438 |
DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1); |
|
439 |
maxCode = lastOne.getLocationCode(); |
|
440 |
} |
|
441 |
|
28860f
|
442 |
} |
929bdc
|
443 |
//所有放行工位 |
W |
444 |
List<String> passStation = new ArrayList<>(); |
|
445 |
//所有生产工位 |
|
446 |
List<String> productStation = new ArrayList<>(); |
|
447 |
//最大工位编号 |
|
448 |
Integer maxCodeNum = 0; |
|
449 |
if (StrUtil.isNotEmpty(maxCode)){ |
|
450 |
String finalMaxCode = maxCode; |
|
451 |
//获取当前工位对应工步号 |
|
452 |
List<String> collect2 = bsTechnologyRouteChildInfos.stream() |
|
453 |
.filter(x -> x.getProcessesCode().equals(finalMaxCode)) |
|
454 |
.map(BsTechnologyRouteChildInfo::getStepNo).collect(Collectors.toList()); |
|
455 |
if (CollUtil.isNotEmpty(collect2)){ |
|
456 |
String s = collect2.get(0); |
|
457 |
if (StrUtil.isNotBlank(s)){ |
|
458 |
maxCodeNum = Integer.parseInt(s); |
|
459 |
} |
|
460 |
} |
|
461 |
if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){ |
|
462 |
bsTechnologyRouteChildInfos.forEach(x -> { |
|
463 |
x.setStepNoNum(Integer.parseInt(x.getStepNo())); |
|
464 |
}); |
|
465 |
Integer finalMaxCodeNum = maxCodeNum; |
|
466 |
//勾选的返修工位中最大的工位之后的工位----1 |
|
467 |
List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream() |
a4c4c1
|
468 |
.filter(x -> x.getStepNoNum() > finalMaxCodeNum).collect(Collectors.toList()); |
929bdc
|
469 |
if (CollUtil.isNotEmpty(collect3)){ |
W |
470 |
//需要生产 |
|
471 |
productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList())); |
|
472 |
} |
|
473 |
//从第一个工位到返修的最大工位之间, |
|
474 |
//勾选了返修标记的需要生产---1,未勾选的不生产---2 |
|
475 |
productStation.addAll(collect1); |
|
476 |
} |
|
477 |
} |
|
478 |
if (CollUtil.isNotEmpty(productStation)){ |
|
479 |
List<String> collect2 = allProcessCoed.stream().filter(x -> !productStation.contains(x)).collect(Collectors.toList()); |
|
480 |
passStation.addAll(collect2); |
|
481 |
} |
|
482 |
String[] parts = Node.split("[.]"); |
|
483 |
String par = parts[0]+"."+parts[1]; |
|
484 |
if (CollUtil.isNotEmpty(passStation)){ |
|
485 |
passStation.forEach(x -> { |
|
486 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
487 |
readWriteEntity.setIdentifier(par+"."+x); |
|
488 |
readWriteEntity.setValue(2); |
|
489 |
writeList.add(readWriteEntity); |
|
490 |
}); |
|
491 |
} |
|
492 |
if (CollUtil.isNotEmpty(productStation)){ |
|
493 |
productStation.forEach(x -> { |
|
494 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
495 |
readWriteEntity.setIdentifier(par+"."+x); |
|
496 |
readWriteEntity.setValue(1); |
|
497 |
writeList.add(readWriteEntity); |
|
498 |
}); |
|
499 |
} |
e94b2b
|
500 |
//对OP755做特殊处理 |
W |
501 |
List<ReadWriteEntity> OP755List = new ArrayList<>(); |
|
502 |
if (OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){ |
|
503 |
List<String> patchList = new ArrayList<>(); |
|
504 |
patchList.add(par+".OP740"); |
|
505 |
patchList.add(par+".OP760"); |
|
506 |
patchList.add(par+".OP770"); |
|
507 |
patchList.add(par+".OP780"); |
|
508 |
for (String s : patchList) { |
|
509 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
510 |
readWriteEntity.setIdentifier(s); |
|
511 |
readWriteEntity.setValue(0); |
|
512 |
OP755List.add(readWriteEntity); |
|
513 |
} |
|
514 |
} |
929bdc
|
515 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
W |
516 |
readWriteEntity.setIdentifier(parts[0]+"."+parts[1]+".Repair_sign"); |
|
517 |
readWriteEntity.setValue(minOP); |
|
518 |
miloService.writeToOpcShort(readWriteEntity); |
|
519 |
miloService.writeToOpcByte(writeList); |
1a444b
|
520 |
logger.info("{}返修写入:,{}",SNCode,writeList); |
e94b2b
|
521 |
if (CollUtil.isNotEmpty(OP755List)){ |
W |
522 |
miloService.writeToOpcByte(OP755List); |
|
523 |
} |
929bdc
|
524 |
} |
W |
525 |
|
059083
|
526 |
} |
W |
527 |
|
|
528 |
|
3e03af
|
529 |
public void SaveData(String Node) throws Exception { |
28860f
|
530 |
|
059083
|
531 |
String[] parts = Node.split("[.]"); |
3e03af
|
532 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
3946f8
|
533 |
if (null == SNCodeObject){ |
W |
534 |
SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
535 |
} |
3e03af
|
536 |
if(null != SNCodeObject) |
C |
537 |
{ |
|
538 |
String SNCode = SNCodeObject.toString(); |
c76a3f
|
539 |
Object object = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Runtime").getValue(); |
W |
540 |
String gatherAddress = parts[0] + "." + parts[1]; |
|
541 |
List<DaCollectionParamConf> list = new ArrayList<>(); |
|
542 |
if (allCollectParamList.containsKey(gatherAddress)){ |
|
543 |
list = allCollectParamList.get(gatherAddress); |
|
544 |
}else { |
|
545 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
546 |
daCollectionParamConf.setGatherAddress(gatherAddress); |
|
547 |
daCollectionParamConf.setRemarks("1"); |
|
548 |
list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf); |
|
549 |
if (CollUtil.isNotEmpty(list)){ |
|
550 |
//加入hashmap |
|
551 |
allCollectParamList.put(gatherAddress,list); |
|
552 |
} |
|
553 |
} |
59e228
|
554 |
//60只采集老车型 |
W |
555 |
if (OPCElement.OP060_SAVE_REQUEST.equals(Node) || OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){ |
|
556 |
String s = productNewFlag(SNCode); |
|
557 |
if ("280".equals(s) || "380".equals(s)){ |
|
558 |
list = new ArrayList<>(); |
|
559 |
} |
|
560 |
} |
|
561 |
//80、100只采集新车型 |
|
562 |
if (OPCElement.OP080_SAVE_REQUEST.equals(Node) |
|
563 |
|| OPCElement.OP080_SAVE_REQUEST_LAST.equals(Node) |
|
564 |
|| OPCElement.OP100_SAVE_REQUEST.equals(Node) |
|
565 |
|| OPCElement.OP100_SAVE_REQUEST_LAST.equals(Node)){ |
|
566 |
String s = productNewFlag(SNCode); |
|
567 |
if (StrUtil.isNotEmpty(s)){ |
|
568 |
if (!"280".equals(s) && !"380".equals(s)){ |
|
569 |
list = new ArrayList<>(); |
|
570 |
} |
|
571 |
} |
3e03af
|
572 |
|
59e228
|
573 |
} |
3e03af
|
574 |
List<String> nodeIdList = list.stream().map(info -> { |
C |
575 |
String nodeid = info.getGatherAddress(); |
|
576 |
return nodeid; |
|
577 |
}).collect(Collectors.toList()); |
|
578 |
|
f4cb4d
|
579 |
List<ReadWriteEntity> readWriteEntityList = new ArrayList<>(); |
W |
580 |
if(CollUtil.isNotEmpty(nodeIdList)){ |
1a444b
|
581 |
//long time1 = new Date().getTime(); |
f4cb4d
|
582 |
readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
1a444b
|
583 |
//long time2 = new Date().getTime(); |
Y |
584 |
//logger.info("读取点位花费时间:{},",time2-time1); |
f4cb4d
|
585 |
} |
c76a3f
|
586 |
//返回plc保存成功 |
W |
587 |
if (parts.length==3){ |
|
588 |
if ("SaveRequest".equals(parts[2])){ |
59e228
|
589 |
if (OPCElement.OP050_SAVE_REQUEST.equals(Node)){ |
W |
590 |
cleanForm050(Node); |
|
591 |
} else if (OPCElement.OP060_SAVE_REQUEST.equals(Node)){ |
|
592 |
cleanForm060(Node); |
|
593 |
} |
c76a3f
|
594 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1); |
W |
595 |
miloService.writeToOpcByte(entity); |
|
596 |
}else if ("SaveRequestLast".equals(parts[2])){ |
59e228
|
597 |
if (OPCElement.OP050_SAVE_REQUEST_LAST.equals(Node)){ |
W |
598 |
cleanForm050(Node); |
|
599 |
} else if (OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){ |
|
600 |
cleanForm060(Node); |
|
601 |
} |
c76a3f
|
602 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1); |
W |
603 |
miloService.writeToOpcByte(entity); |
|
604 |
} |
1a444b
|
605 |
logger.info("{}保存请求信号返回,MES->PLC的SaveFeedLast信号",Node); |
Y |
606 |
//logger.info("-------请求返回-----,{}",LocalDateTime.now()); |
c76a3f
|
607 |
} |
1a444b
|
608 |
|
Y |
609 |
BsOrderScheduling bsOrderScheduling=bsOrderSchedulingService.selectBsOrderSchedulingSNCode(SNCode); |
|
610 |
|
3e03af
|
611 |
List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
f4cb4d
|
612 |
if (CollUtil.isNotEmpty(nodeIdList)){ |
W |
613 |
for(int i=0;i<nodeIdList.size();i++){ |
127f1b
|
614 |
if(ObjectUtil.isNotEmpty(readWriteEntityList.get(i).getValue()) && !readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
f4cb4d
|
615 |
DaParamCollection ParamCollection = new DaParamCollection(); |
W |
616 |
ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
|
617 |
ParamCollection.setLocationCode(parts[1]); |
|
618 |
if (readWriteEntityList.get(i) == null){ |
|
619 |
ParamCollection.setParamValue("0"); |
|
620 |
}else { |
|
621 |
ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
|
622 |
} |
|
623 |
ParamCollection.setSfcCode(SNCode); |
|
624 |
ParamCollection.setParamName(list.get(i).getCollectParameterName()); |
|
625 |
ParamCollection.setParamUpper(list.get(i).getParamUpper()); |
|
626 |
ParamCollection.setParamLower(list.get(i).getParamLower()); |
|
627 |
ParamCollection.setUnit(list.get(i).getCollectParameterUnit()); |
|
628 |
ParamCollection.setState("合格"); |
|
629 |
ParamCollection.setType(list.get(i).getCollectParameterType()); |
|
630 |
ParamCollection.setCollectionTime(new Date()); |
1a444b
|
631 |
ParamCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo()); |
f4cb4d
|
632 |
daParamCollectionlist.add(ParamCollection); |
c6aaad
|
633 |
} |
3e03af
|
634 |
} |
f4cb4d
|
635 |
daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
1a444b
|
636 |
logger.info("{}发动机({})采集数据保存完成",SNCode,Node); |
3e03af
|
637 |
} |
59e228
|
638 |
|
127f1b
|
639 |
Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue(); |
Y |
640 |
String str1="合格" ; |
|
641 |
if (ObjectUtil.isNotEmpty(ProductStatus)){ |
59e228
|
642 |
logger.info("ProductStatus,{}",ProductStatus.toString()); |
127f1b
|
643 |
String productStatusString = ProductStatus.toString(); |
Y |
644 |
if (productStatusString.contains("2") || productStatusString.contains("3")){ |
|
645 |
str1="不合格"; |
|
646 |
}else { |
|
647 |
str1="合格"; |
|
648 |
} |
59e228
|
649 |
} |
W |
650 |
Long beatTime = 0L; |
|
651 |
if (ObjectUtil.isNotEmpty(object)){ |
|
652 |
String str = object.toString(); |
|
653 |
beatTime = Float.valueOf(str).longValue(); |
127f1b
|
654 |
} |
9e6d86
|
655 |
DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
W |
656 |
PassingStationCollection.setSfcCode(SNCode); |
|
657 |
PassingStationCollection.setLocationCode(parts[1]); |
|
658 |
PassingStationCollection.setOutboundTime(new Date()); |
|
659 |
PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000)); |
|
660 |
PassingStationCollection.setCollectionTime(new Date()); |
|
661 |
PassingStationCollection.setCreateTime(new Date()); |
|
662 |
PassingStationCollection.setBeatTime(beatTime.toString()); |
127f1b
|
663 |
PassingStationCollection.setOutRsSign(str1); |
1a444b
|
664 |
PassingStationCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo()); |
9e6d86
|
665 |
passingStationCollectionServiceImpl.insertDaPassingStationCollection(PassingStationCollection); |
1a444b
|
666 |
logger.info("{}发动机({})过站数据保存完成",SNCode,Node); |
c76a3f
|
667 |
|
1a444b
|
668 |
//更新工单状态 |
Y |
669 |
if ("OP790".equals(parts[1])) { |
d4f437
|
670 |
//bsOrderScheduling.setReport20("0"); |
1a444b
|
671 |
bsOrderScheduling.setProductionStatus("3"); |
Y |
672 |
bsOrderScheduling.setFinalAssemblyOfflineTime(new Date()); |
|
673 |
}else if("OP050".equals(parts[1])){ |
bbc578
|
674 |
bsOrderScheduling.setReport10("0"); |
1a444b
|
675 |
bsOrderScheduling.setProductionStatus("2"); |
Y |
676 |
bsOrderScheduling.setBoxClosingOnlineTime(new Date()); |
|
677 |
}else if("OP120".equals(parts[1])){ |
d4f437
|
678 |
bsOrderScheduling.setReport20("0"); |
1a444b
|
679 |
bsOrderScheduling.setFinalAssemblyLaunchTime(new Date()); |
Y |
680 |
bsOrderScheduling.setClosingBoxOfflineTime(new Date()); |
|
681 |
} |
|
682 |
bsOrderScheduling.setQualityStatus(str1); |
|
683 |
bsOrderScheduling.setCurrentWorkstation(parts[1]); |
|
684 |
bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling); |
059083
|
685 |
} |
3e03af
|
686 |
} |
59e228
|
687 |
|
W |
688 |
|
|
689 |
public String productNewFlag(String SNCode){ |
|
690 |
String type; |
|
691 |
if (SNCode.startsWith("280")){ |
|
692 |
type = "280"; |
|
693 |
} else if (SNCode.startsWith("380")){ |
|
694 |
type = "380"; |
|
695 |
}else { |
|
696 |
type = "oldType"; |
|
697 |
} |
|
698 |
return type; |
|
699 |
} |
|
700 |
|
|
701 |
public void tile2(String Node) throws Exception { |
|
702 |
String[] parts = Node.split("[.]"); |
|
703 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
704 |
if (null != SNCodeObject) { |
|
705 |
String SNCode = SNCodeObject.toString(); |
|
706 |
String productNewFlag = productNewFlag(SNCode); |
|
707 |
if ("380".equals(productNewFlag)){ |
|
708 |
ProductNewPassStation passStation = new ProductNewPassStation(); |
|
709 |
passStation.setSfcCode(SNCode); |
|
710 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation); |
|
711 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
712 |
ProductNewPassStation productNewPassStation = productPassStationList.get(0); |
|
713 |
String boxCode = productNewPassStation.getBoxCode(); |
|
714 |
String productType = productNewPassStation.getProductType(); |
d2daac
|
715 |
log.info("发送到OP040的页面数据productType,{}",productType); |
W |
716 |
log.info("发送到OP040的页面数据boxCode,{}",boxCode); |
59e228
|
717 |
passingStationCollectionServiceImpl.sendMessage(productType+"*"+boxCode, "OP040"); |
W |
718 |
} |
|
719 |
} else if ("280".equals(productNewFlag)){ |
|
720 |
|
|
721 |
} |
|
722 |
} |
|
723 |
} |
|
724 |
|
|
725 |
|
|
726 |
public void cleanForm(String Node) throws Exception { |
|
727 |
String[] parts = Node.split("[.]"); |
|
728 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
729 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
730 |
String snCode = SNCodeObject.toString(); |
|
731 |
String s = productNewFlag(snCode); |
|
732 |
if ("280".equals(s) || "380".equals(s)){ |
d2daac
|
733 |
log.info("发送到OP030的清除"); |
59e228
|
734 |
passingStationCollectionServiceImpl.sendMessage("clean","OP030"); |
W |
735 |
} |
|
736 |
} |
|
737 |
|
|
738 |
} |
|
739 |
|
|
740 |
public void cleanForm040(String Node) throws Exception { |
|
741 |
String[] parts = Node.split("[.]"); |
|
742 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
743 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
744 |
String snCode = SNCodeObject.toString(); |
|
745 |
String s = productNewFlag(snCode); |
|
746 |
if ("280".equals(s) || "380".equals(s)){ |
d2daac
|
747 |
log.info("发送到OP040的页面清除"); |
59e228
|
748 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP040"); |
W |
749 |
} |
|
750 |
} |
|
751 |
} |
|
752 |
|
|
753 |
public void cleanForm050(String Node) throws Exception { |
|
754 |
String[] parts = Node.split("[.]"); |
|
755 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
756 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
757 |
String snCode = SNCodeObject.toString(); |
|
758 |
String s = productNewFlag(snCode); |
|
759 |
if ("280".equals(s) || "380".equals(s)){ |
|
760 |
ProductNewPassStation passStation = new ProductNewPassStation(); |
|
761 |
passStation.setSfcCode(snCode); |
|
762 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation); |
|
763 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
764 |
productNewPassStationService.updatePassStationBySfcCode(snCode); |
|
765 |
} |
|
766 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP050"); |
|
767 |
} |
|
768 |
} |
|
769 |
} |
|
770 |
|
|
771 |
public void cleanForm060(String Node) throws Exception { |
|
772 |
String[] parts = Node.split("[.]"); |
|
773 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
774 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
775 |
String snCode = SNCodeObject.toString(); |
|
776 |
String s = productNewFlag(snCode); |
|
777 |
if ("280".equals(s) || "380".equals(s)){ |
|
778 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP060"); |
|
779 |
} |
|
780 |
} |
|
781 |
} |
|
782 |
|
|
783 |
|
|
784 |
public void checkBoxRod(String Node) throws Exception { |
|
785 |
String[] parts = Node.split("[.]"); |
|
786 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
787 |
if (null != SNCodeObject) { |
|
788 |
String SNCode = SNCodeObject.toString(); |
|
789 |
String s = productNewFlag(SNCode); |
|
790 |
if ("280".equals(s) || "380".equals(s)){ |
|
791 |
sendTo060(SNCode,parts); |
|
792 |
} |
|
793 |
} |
|
794 |
} |
|
795 |
|
|
796 |
private void sendTo060(String SNCode, String[] parts) throws Exception { |
|
797 |
String boxCode = ""; |
|
798 |
String rodCode = ""; |
|
799 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
800 |
productNewPassStation.setSfcCode(SNCode); |
|
801 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
802 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
803 |
ProductNewPassStation passStation = productPassStationList.get(0); |
|
804 |
boxCode = passStation.getBoxCode(); |
|
805 |
rodCode = passStation.getRodCode(); |
|
806 |
} |
|
807 |
//配瓦校验 |
|
808 |
passingStationCollectionServiceImpl.sendMessage(boxCode + "*" + rodCode + "*" + SNCode, parts[1]); |
|
809 |
} |
3e03af
|
810 |
} |