提交 | 用户 | 时间
|
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 { |
9e6d86
|
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(); |
|
172 |
if (snCode.startsWith("380")){ |
|
173 |
String[] split = snCode.split(StrUtil.SPACE); |
|
174 |
if (split.length>1){ |
|
175 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]); |
|
176 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
177 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", split[1]); |
|
178 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
179 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1); |
|
180 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
|
181 |
} |
|
182 |
} else { |
|
183 |
ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode); |
|
184 |
OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成 |
|
185 |
ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1); |
|
186 |
OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成 |
|
187 |
} |
|
188 |
} |
|
189 |
} else if (OPCElement.OP030_SAVE_REQUEST.equals(identifier)) { |
|
190 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP030.SaveFeed", 1); |
|
191 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
192 |
cleanForm("CFL4HX.OP030.SaveFeed"); |
|
193 |
} else if (OPCElement.OP040_SAVE_REQUEST.equals(identifier)) { |
|
194 |
cleanForm040(OPCElement.OP040_SAVE_REQUEST); |
|
195 |
ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP040.SaveFeed", 1); |
|
196 |
OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成 |
|
197 |
} else { |
|
198 |
this.SaveData(identifier); |
|
199 |
} |
|
200 |
|
059083
|
201 |
} |
W |
202 |
} |
3e03af
|
203 |
} |
C |
204 |
} catch (Exception e) { |
9e6d86
|
205 |
System.out.println(e.getMessage()); |
3e03af
|
206 |
} finally { |
C |
207 |
if (!"".equals(ecpStr)) { |
|
208 |
System.out.println(ecpStr + "\r\n"); |
|
209 |
} |
9e6d86
|
210 |
} |
W |
211 |
} |
|
212 |
|
|
213 |
private void scannerGunMessage() throws Exception { |
|
214 |
String[] parts = OPCElement.OP120_ZZ_CODE_CHECK.split("[.]"); |
|
215 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
3946f8
|
216 |
if (null == SNCodeObject){ |
W |
217 |
SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
218 |
} |
9e6d86
|
219 |
if (null != SNCodeObject){ |
W |
220 |
String SNCode = SNCodeObject.toString(); |
1c7036
|
221 |
passingStationCollectionServiceImpl.sendMessage(SNCode,"OP120"); |
3e03af
|
222 |
} |
C |
223 |
} |
|
224 |
|
059083
|
225 |
public void SNRetrieval(String Node, String value) throws Exception { |
W |
226 |
String[] parts = Node.split("[.]"); |
|
227 |
if(value.equals("1")) { |
|
228 |
//SN号检索 |
|
229 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
230 |
if(null != SNCodeObject) { |
|
231 |
String SNCode=SNCodeObject.toString(); |
1c7036
|
232 |
// String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]); |
929bdc
|
233 |
String a; |
W |
234 |
BsOrderScheduling bsOrderSchedulingQuery = new BsOrderScheduling(); |
|
235 |
bsOrderSchedulingQuery.setEngineNo(SNCode); |
|
236 |
List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery); |
|
237 |
if (CollUtil.isNotEmpty(queryOrderList)){ |
|
238 |
a = "1"; |
|
239 |
}else { |
0e3cac
|
240 |
a = "4"; |
929bdc
|
241 |
} |
W |
242 |
//如果是返修工位需要传输返修工位号 |
0e3cac
|
243 |
List<DaPassingStationCollection> daPassingStationCollections = new ArrayList<>(); |
W |
244 |
List<RmRepairRecord> rmRepairRecords = new ArrayList<>(); |
929bdc
|
245 |
if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node) |
W |
246 |
|| OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){ |
|
247 |
//过站记录 |
|
248 |
DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
|
249 |
PassingStationCollection.setSfcCode(SNCode); |
0e3cac
|
250 |
daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection); |
45f460
|
251 |
// if (CollUtil.isNotEmpty(daPassingStationCollections)){ |
Y |
252 |
// DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1); |
|
253 |
// String outRsSign = lastOne.getOutRsSign(); |
|
254 |
// if ("合格".equals(outRsSign)){ |
|
255 |
// a = "1"; |
|
256 |
// }else { |
|
257 |
// a = "2"; |
|
258 |
// } |
|
259 |
// } |
0e3cac
|
260 |
RmRepairRecord rmRepairRecord = new RmRepairRecord(); |
W |
261 |
rmRepairRecord.setBoxCode(SNCode); |
|
262 |
rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
|
263 |
if (CollUtil.isNotEmpty(rmRepairRecords)){ |
|
264 |
a = "1"; |
45f460
|
265 |
}else { |
Y |
266 |
a = "2"; |
0e3cac
|
267 |
} |
929bdc
|
268 |
} |
1a444b
|
269 |
logger.info("-----返回codeCheckFeed-----,{}",a); |
3946f8
|
270 |
// String a="1"; |
059083
|
271 |
// 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件) |
9e6d86
|
272 |
if (StrUtil.isNotBlank(a)){ |
W |
273 |
int input = Integer.parseInt(a); |
|
274 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input); |
5030f3
|
275 |
logger.info("发动机号:{},监听到{}的CodeCheck的信号",SNCode,Node); |
cffac1
|
276 |
miloService.writeToOpcByte(entity); |
1a444b
|
277 |
logger.info("监听到返回codecheckfeed信号,{}",entity); |
9e6d86
|
278 |
//首站传输订单号 |
59e228
|
279 |
// if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){ |
W |
280 |
// //查询订单号 |
|
281 |
// BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
|
282 |
// bsOrderScheduling.setEngineNo(SNCode); |
|
283 |
// List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling); |
|
284 |
// String orderNum = ""; |
|
285 |
// if (CollUtil.isNotEmpty(tempList)){ |
|
286 |
// BsOrderScheduling bsOrderScheduling1 = tempList.get(0); |
|
287 |
// orderNum = bsOrderScheduling1.getOrderNo(); |
|
288 |
// } |
|
289 |
// ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum); |
|
290 |
// miloService.writeToOpcUa(entity2); |
|
291 |
// } |
9e6d86
|
292 |
//如果是返修工位需要传输返修工位号 |
3946f8
|
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)){ |
0e3cac
|
295 |
rework(SNCode,Node,daPassingStationCollections,rmRepairRecords); |
9e6d86
|
296 |
} |
59e228
|
297 |
if (OPCElement.OP050_CODE_CHECK.equals(Node)) { |
W |
298 |
//新机型050 |
|
299 |
String type = productNewFlag(SNCode); |
|
300 |
if ("280".equals(type) || "380".equals(type)){ |
|
301 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
302 |
productNewPassStation.setSfcCode(SNCode); |
|
303 |
List<ProductNewPassStation> passStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
304 |
ProductNewPassStation productNewPassStation2 = new ProductNewPassStation(); |
|
305 |
productNewPassStation2.setFinishFlag("0"); |
|
306 |
List<ProductNewPassStation> collect = productNewPassStationService.getProductPassStationList(productNewPassStation2) |
|
307 |
.stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime)) |
|
308 |
.collect(Collectors.toList()); |
|
309 |
String partSfcCode = ""; |
|
310 |
if (CollUtil.isNotEmpty(collect)){ |
|
311 |
ProductNewPassStation passStation = collect.get(0); |
|
312 |
partSfcCode = passStation.getSfcCode(); |
|
313 |
} |
|
314 |
if (CollUtil.isNotEmpty(passStationList)){ |
|
315 |
ProductNewPassStation passStation = passStationList.get(0); |
|
316 |
String productType = ""; |
|
317 |
if (ObjectUtils.isNotEmpty(passStation)){ |
|
318 |
productType = passStation.getProductType(); |
|
319 |
} |
|
320 |
passingStationCollectionServiceImpl.sendMessage(SNCode+"*sfcCode*"+productType+"*"+partSfcCode,"OP050"); |
|
321 |
} |
|
322 |
} |
|
323 |
} |
|
324 |
if (OPCElement.OP060_CODE_CHECK.equals(Node)){ |
|
325 |
String type = productNewFlag(SNCode); |
|
326 |
if ("280".equals(type) || "380".equals(type)){ |
|
327 |
checkBoxRod(Node); |
|
328 |
} |
d4f437
|
329 |
} |
3946f8
|
330 |
System.out.println(entity); |
cffac1
|
331 |
|
9e6d86
|
332 |
} |
W |
333 |
|
059083
|
334 |
} |
9e6d86
|
335 |
} |
W |
336 |
} |
|
337 |
|
0e3cac
|
338 |
private void rework(String SNCode,String Node,List<DaPassingStationCollection> daPassingStationCollections,List<RmRepairRecord> rmRepairRecords) throws Exception{ |
9e6d86
|
339 |
BsOrderScheduling bsOrderScheduling = new BsOrderScheduling(); |
W |
340 |
bsOrderScheduling.setEngineNo(SNCode); |
|
341 |
List<String> allProcessCoed = new ArrayList<>(); |
929bdc
|
342 |
List<BsTechnologyRouteChildInfo> bsTechnologyRouteChildInfos = new ArrayList<>(); |
9e6d86
|
343 |
List<String> collect = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling).stream().map(BsOrderScheduling::getModel).collect(Collectors.toList()); |
W |
344 |
if (CollUtil.isNotEmpty(collect)){ |
|
345 |
String s = collect.get(0); |
|
346 |
//查找次机型的完整工序 |
929bdc
|
347 |
bsTechnologyRouteChildInfos = bsTechnologyRouteChildInfoService.selectAllTechnologyRouteByProductCode(s); |
9e6d86
|
348 |
if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){ |
W |
349 |
allProcessCoed = bsTechnologyRouteChildInfos.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()); |
|
350 |
} |
|
351 |
} |
0e3cac
|
352 |
// RmRepairRecord rmRepairRecord = new RmRepairRecord(); |
W |
353 |
// rmRepairRecord.setBoxCode(SNCode); |
9e6d86
|
354 |
List<ReadWriteEntity> writeList = new ArrayList<>(); |
0e3cac
|
355 |
// List<RmRepairRecord> rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
3946f8
|
356 |
//过站记录 |
0e3cac
|
357 |
// DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
W |
358 |
// PassingStationCollection.setSfcCode(SNCode); |
3946f8
|
359 |
//过站记录 |
0e3cac
|
360 |
// List<DaPassingStationCollection> daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection); |
3946f8
|
361 |
|
1a444b
|
362 |
//所有返工工位 |
9e6d86
|
363 |
List<String> collect1 = rmRepairRecords.stream().map(RmRepairRecord::getProcessesCode).collect(Collectors.toList()); |
3946f8
|
364 |
if (CollUtil.isNotEmpty(collect1)){ |
929bdc
|
365 |
//查询出所有需要返修工位的最小op块 |
W |
366 |
Integer minOP = 0; |
|
367 |
if (CollUtil.isNotEmpty(collect1)){ |
3946f8
|
368 |
|
929bdc
|
369 |
List<Integer> sortList = new ArrayList<>(); |
W |
370 |
collect1.stream().forEach(x ->{ |
|
371 |
String op = x.replace("OP", ""); |
|
372 |
if (StrUtil.isNotBlank(op)){ |
|
373 |
int i = Integer.parseInt(op); |
|
374 |
sortList.add(i); |
|
375 |
} |
|
376 |
}); |
|
377 |
if (CollUtil.isNotEmpty(sortList)){ |
|
378 |
List<Integer> collect2 = sortList.stream().filter(Objects::nonNull).sorted().collect(Collectors.toList()); |
|
379 |
minOP = collect2.get(0); |
3946f8
|
380 |
} |
W |
381 |
} |
929bdc
|
382 |
//获取过站记录的最大工位 |
W |
383 |
String maxCode = null; |
|
384 |
if (CollUtil.isNotEmpty(daPassingStationCollections)){ |
9bc510
|
385 |
List<DaPassingStationCollection> collect2 = daPassingStationCollections.stream().filter(x -> "不合格".equals(x.getOutRsSign())).collect(Collectors.toList()); |
W |
386 |
if (CollUtil.isNotEmpty(collect2)){ |
|
387 |
DaPassingStationCollection lastOne = collect2.get(collect2.size() - 1); |
|
388 |
maxCode = lastOne.getLocationCode(); |
|
389 |
}else { |
|
390 |
DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1); |
|
391 |
maxCode = lastOne.getLocationCode(); |
|
392 |
} |
|
393 |
|
28860f
|
394 |
} |
929bdc
|
395 |
//所有放行工位 |
W |
396 |
List<String> passStation = new ArrayList<>(); |
|
397 |
//所有生产工位 |
|
398 |
List<String> productStation = new ArrayList<>(); |
|
399 |
//最大工位编号 |
|
400 |
Integer maxCodeNum = 0; |
|
401 |
if (StrUtil.isNotEmpty(maxCode)){ |
|
402 |
String finalMaxCode = maxCode; |
|
403 |
//获取当前工位对应工步号 |
|
404 |
List<String> collect2 = bsTechnologyRouteChildInfos.stream() |
|
405 |
.filter(x -> x.getProcessesCode().equals(finalMaxCode)) |
|
406 |
.map(BsTechnologyRouteChildInfo::getStepNo).collect(Collectors.toList()); |
|
407 |
if (CollUtil.isNotEmpty(collect2)){ |
|
408 |
String s = collect2.get(0); |
|
409 |
if (StrUtil.isNotBlank(s)){ |
|
410 |
maxCodeNum = Integer.parseInt(s); |
|
411 |
} |
|
412 |
} |
|
413 |
if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){ |
|
414 |
bsTechnologyRouteChildInfos.forEach(x -> { |
|
415 |
x.setStepNoNum(Integer.parseInt(x.getStepNo())); |
|
416 |
}); |
|
417 |
Integer finalMaxCodeNum = maxCodeNum; |
|
418 |
//勾选的返修工位中最大的工位之后的工位----1 |
|
419 |
List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream() |
|
420 |
.filter(x -> x.getStepNoNum() >= finalMaxCodeNum).collect(Collectors.toList()); |
|
421 |
if (CollUtil.isNotEmpty(collect3)){ |
|
422 |
//需要生产 |
|
423 |
productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList())); |
|
424 |
} |
|
425 |
//从第一个工位到返修的最大工位之间, |
|
426 |
//勾选了返修标记的需要生产---1,未勾选的不生产---2 |
|
427 |
productStation.addAll(collect1); |
|
428 |
} |
|
429 |
} |
|
430 |
if (CollUtil.isNotEmpty(productStation)){ |
|
431 |
List<String> collect2 = allProcessCoed.stream().filter(x -> !productStation.contains(x)).collect(Collectors.toList()); |
|
432 |
passStation.addAll(collect2); |
|
433 |
} |
|
434 |
String[] parts = Node.split("[.]"); |
|
435 |
String par = parts[0]+"."+parts[1]; |
|
436 |
if (CollUtil.isNotEmpty(passStation)){ |
|
437 |
passStation.forEach(x -> { |
|
438 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
439 |
readWriteEntity.setIdentifier(par+"."+x); |
|
440 |
readWriteEntity.setValue(2); |
|
441 |
writeList.add(readWriteEntity); |
|
442 |
}); |
|
443 |
} |
|
444 |
if (CollUtil.isNotEmpty(productStation)){ |
|
445 |
productStation.forEach(x -> { |
|
446 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
447 |
readWriteEntity.setIdentifier(par+"."+x); |
|
448 |
readWriteEntity.setValue(1); |
|
449 |
writeList.add(readWriteEntity); |
|
450 |
}); |
|
451 |
} |
e94b2b
|
452 |
//对OP755做特殊处理 |
W |
453 |
List<ReadWriteEntity> OP755List = new ArrayList<>(); |
|
454 |
if (OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){ |
|
455 |
List<String> patchList = new ArrayList<>(); |
|
456 |
patchList.add(par+".OP740"); |
|
457 |
patchList.add(par+".OP760"); |
|
458 |
patchList.add(par+".OP770"); |
|
459 |
patchList.add(par+".OP780"); |
|
460 |
for (String s : patchList) { |
|
461 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
|
462 |
readWriteEntity.setIdentifier(s); |
|
463 |
readWriteEntity.setValue(0); |
|
464 |
OP755List.add(readWriteEntity); |
|
465 |
} |
|
466 |
} |
929bdc
|
467 |
ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
W |
468 |
readWriteEntity.setIdentifier(parts[0]+"."+parts[1]+".Repair_sign"); |
|
469 |
readWriteEntity.setValue(minOP); |
|
470 |
miloService.writeToOpcShort(readWriteEntity); |
|
471 |
miloService.writeToOpcByte(writeList); |
1a444b
|
472 |
logger.info("{}返修写入:,{}",SNCode,writeList); |
e94b2b
|
473 |
if (CollUtil.isNotEmpty(OP755List)){ |
W |
474 |
miloService.writeToOpcByte(OP755List); |
|
475 |
} |
929bdc
|
476 |
} |
W |
477 |
|
059083
|
478 |
} |
W |
479 |
|
|
480 |
|
3e03af
|
481 |
public void SaveData(String Node) throws Exception { |
28860f
|
482 |
|
059083
|
483 |
String[] parts = Node.split("[.]"); |
3e03af
|
484 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue(); |
3946f8
|
485 |
if (null == SNCodeObject){ |
W |
486 |
SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
487 |
} |
3e03af
|
488 |
if(null != SNCodeObject) |
C |
489 |
{ |
|
490 |
String SNCode = SNCodeObject.toString(); |
c76a3f
|
491 |
Object object = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Runtime").getValue(); |
W |
492 |
String gatherAddress = parts[0] + "." + parts[1]; |
|
493 |
List<DaCollectionParamConf> list = new ArrayList<>(); |
|
494 |
if (allCollectParamList.containsKey(gatherAddress)){ |
|
495 |
list = allCollectParamList.get(gatherAddress); |
|
496 |
}else { |
|
497 |
DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
|
498 |
daCollectionParamConf.setGatherAddress(gatherAddress); |
|
499 |
daCollectionParamConf.setRemarks("1"); |
|
500 |
list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf); |
|
501 |
if (CollUtil.isNotEmpty(list)){ |
|
502 |
//加入hashmap |
|
503 |
allCollectParamList.put(gatherAddress,list); |
|
504 |
} |
|
505 |
} |
59e228
|
506 |
//60只采集老车型 |
W |
507 |
if (OPCElement.OP060_SAVE_REQUEST.equals(Node) || OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){ |
|
508 |
String s = productNewFlag(SNCode); |
|
509 |
if ("280".equals(s) || "380".equals(s)){ |
|
510 |
list = new ArrayList<>(); |
|
511 |
} |
|
512 |
} |
|
513 |
//80、100只采集新车型 |
|
514 |
if (OPCElement.OP080_SAVE_REQUEST.equals(Node) |
|
515 |
|| OPCElement.OP080_SAVE_REQUEST_LAST.equals(Node) |
|
516 |
|| OPCElement.OP100_SAVE_REQUEST.equals(Node) |
|
517 |
|| OPCElement.OP100_SAVE_REQUEST_LAST.equals(Node)){ |
|
518 |
String s = productNewFlag(SNCode); |
|
519 |
if (StrUtil.isNotEmpty(s)){ |
|
520 |
if (!"280".equals(s) && !"380".equals(s)){ |
|
521 |
list = new ArrayList<>(); |
|
522 |
} |
|
523 |
} |
3e03af
|
524 |
|
59e228
|
525 |
} |
3e03af
|
526 |
List<String> nodeIdList = list.stream().map(info -> { |
C |
527 |
String nodeid = info.getGatherAddress(); |
|
528 |
return nodeid; |
|
529 |
}).collect(Collectors.toList()); |
|
530 |
|
f4cb4d
|
531 |
List<ReadWriteEntity> readWriteEntityList = new ArrayList<>(); |
W |
532 |
if(CollUtil.isNotEmpty(nodeIdList)){ |
1a444b
|
533 |
//long time1 = new Date().getTime(); |
f4cb4d
|
534 |
readWriteEntityList = miloService.readFromOpcUa(nodeIdList); |
1a444b
|
535 |
//long time2 = new Date().getTime(); |
Y |
536 |
//logger.info("读取点位花费时间:{},",time2-time1); |
f4cb4d
|
537 |
} |
c76a3f
|
538 |
//返回plc保存成功 |
W |
539 |
if (parts.length==3){ |
|
540 |
if ("SaveRequest".equals(parts[2])){ |
59e228
|
541 |
if (OPCElement.OP050_SAVE_REQUEST.equals(Node)){ |
W |
542 |
cleanForm050(Node); |
|
543 |
} else if (OPCElement.OP060_SAVE_REQUEST.equals(Node)){ |
|
544 |
cleanForm060(Node); |
|
545 |
} |
c76a3f
|
546 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1); |
W |
547 |
miloService.writeToOpcByte(entity); |
|
548 |
}else if ("SaveRequestLast".equals(parts[2])){ |
59e228
|
549 |
if (OPCElement.OP050_SAVE_REQUEST_LAST.equals(Node)){ |
W |
550 |
cleanForm050(Node); |
|
551 |
} else if (OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){ |
|
552 |
cleanForm060(Node); |
|
553 |
} |
c76a3f
|
554 |
ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1); |
W |
555 |
miloService.writeToOpcByte(entity); |
|
556 |
} |
1a444b
|
557 |
logger.info("{}保存请求信号返回,MES->PLC的SaveFeedLast信号",Node); |
Y |
558 |
//logger.info("-------请求返回-----,{}",LocalDateTime.now()); |
c76a3f
|
559 |
} |
1a444b
|
560 |
|
Y |
561 |
BsOrderScheduling bsOrderScheduling=bsOrderSchedulingService.selectBsOrderSchedulingSNCode(SNCode); |
|
562 |
|
3e03af
|
563 |
List<DaParamCollection> daParamCollectionlist = new ArrayList<>(); |
f4cb4d
|
564 |
if (CollUtil.isNotEmpty(nodeIdList)){ |
W |
565 |
for(int i=0;i<nodeIdList.size();i++){ |
127f1b
|
566 |
if(ObjectUtil.isNotEmpty(readWriteEntityList.get(i).getValue()) && !readWriteEntityList.get(i).getValue().toString().equals("0.0")){ |
f4cb4d
|
567 |
DaParamCollection ParamCollection = new DaParamCollection(); |
W |
568 |
ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]); |
|
569 |
ParamCollection.setLocationCode(parts[1]); |
|
570 |
if (readWriteEntityList.get(i) == null){ |
|
571 |
ParamCollection.setParamValue("0"); |
|
572 |
}else { |
|
573 |
ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString()); |
|
574 |
} |
|
575 |
ParamCollection.setSfcCode(SNCode); |
|
576 |
ParamCollection.setParamName(list.get(i).getCollectParameterName()); |
|
577 |
ParamCollection.setParamUpper(list.get(i).getParamUpper()); |
|
578 |
ParamCollection.setParamLower(list.get(i).getParamLower()); |
|
579 |
ParamCollection.setUnit(list.get(i).getCollectParameterUnit()); |
|
580 |
ParamCollection.setState("合格"); |
|
581 |
ParamCollection.setType(list.get(i).getCollectParameterType()); |
|
582 |
ParamCollection.setCollectionTime(new Date()); |
1a444b
|
583 |
ParamCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo()); |
f4cb4d
|
584 |
daParamCollectionlist.add(ParamCollection); |
c6aaad
|
585 |
} |
3e03af
|
586 |
} |
f4cb4d
|
587 |
daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist); |
1a444b
|
588 |
logger.info("{}发动机({})采集数据保存完成",SNCode,Node); |
3e03af
|
589 |
} |
59e228
|
590 |
|
127f1b
|
591 |
Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue(); |
Y |
592 |
String str1="合格" ; |
|
593 |
if (ObjectUtil.isNotEmpty(ProductStatus)){ |
59e228
|
594 |
logger.info("ProductStatus,{}",ProductStatus.toString()); |
127f1b
|
595 |
String productStatusString = ProductStatus.toString(); |
Y |
596 |
if (productStatusString.contains("2") || productStatusString.contains("3")){ |
|
597 |
str1="不合格"; |
|
598 |
}else { |
|
599 |
str1="合格"; |
|
600 |
} |
59e228
|
601 |
} |
W |
602 |
Long beatTime = 0L; |
|
603 |
if (ObjectUtil.isNotEmpty(object)){ |
|
604 |
String str = object.toString(); |
|
605 |
beatTime = Float.valueOf(str).longValue(); |
127f1b
|
606 |
} |
9e6d86
|
607 |
DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection(); |
W |
608 |
PassingStationCollection.setSfcCode(SNCode); |
|
609 |
PassingStationCollection.setLocationCode(parts[1]); |
|
610 |
PassingStationCollection.setOutboundTime(new Date()); |
|
611 |
PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000)); |
|
612 |
PassingStationCollection.setCollectionTime(new Date()); |
|
613 |
PassingStationCollection.setCreateTime(new Date()); |
|
614 |
PassingStationCollection.setBeatTime(beatTime.toString()); |
127f1b
|
615 |
PassingStationCollection.setOutRsSign(str1); |
1a444b
|
616 |
PassingStationCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo()); |
9e6d86
|
617 |
passingStationCollectionServiceImpl.insertDaPassingStationCollection(PassingStationCollection); |
1a444b
|
618 |
logger.info("{}发动机({})过站数据保存完成",SNCode,Node); |
c76a3f
|
619 |
|
1a444b
|
620 |
//更新工单状态 |
Y |
621 |
if ("OP790".equals(parts[1])) { |
d4f437
|
622 |
//bsOrderScheduling.setReport20("0"); |
1a444b
|
623 |
bsOrderScheduling.setProductionStatus("3"); |
Y |
624 |
bsOrderScheduling.setFinalAssemblyOfflineTime(new Date()); |
|
625 |
}else if("OP050".equals(parts[1])){ |
bbc578
|
626 |
bsOrderScheduling.setReport10("0"); |
1a444b
|
627 |
bsOrderScheduling.setProductionStatus("2"); |
Y |
628 |
bsOrderScheduling.setBoxClosingOnlineTime(new Date()); |
|
629 |
}else if("OP120".equals(parts[1])){ |
d4f437
|
630 |
bsOrderScheduling.setReport20("0"); |
1a444b
|
631 |
bsOrderScheduling.setFinalAssemblyLaunchTime(new Date()); |
Y |
632 |
bsOrderScheduling.setClosingBoxOfflineTime(new Date()); |
|
633 |
} |
|
634 |
bsOrderScheduling.setQualityStatus(str1); |
|
635 |
bsOrderScheduling.setCurrentWorkstation(parts[1]); |
|
636 |
bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling); |
059083
|
637 |
} |
3e03af
|
638 |
} |
59e228
|
639 |
|
W |
640 |
|
|
641 |
public String productNewFlag(String SNCode){ |
|
642 |
String type; |
|
643 |
if (SNCode.startsWith("280")){ |
|
644 |
type = "280"; |
|
645 |
} else if (SNCode.startsWith("380")){ |
|
646 |
type = "380"; |
|
647 |
}else { |
|
648 |
type = "oldType"; |
|
649 |
} |
|
650 |
return type; |
|
651 |
} |
|
652 |
|
|
653 |
public void tile2(String Node) throws Exception { |
|
654 |
String[] parts = Node.split("[.]"); |
|
655 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
656 |
if (null != SNCodeObject) { |
|
657 |
String SNCode = SNCodeObject.toString(); |
|
658 |
String productNewFlag = productNewFlag(SNCode); |
|
659 |
if ("380".equals(productNewFlag)){ |
|
660 |
ProductNewPassStation passStation = new ProductNewPassStation(); |
|
661 |
passStation.setSfcCode(SNCode); |
|
662 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation); |
|
663 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
664 |
ProductNewPassStation productNewPassStation = productPassStationList.get(0); |
|
665 |
String boxCode = productNewPassStation.getBoxCode(); |
|
666 |
String productType = productNewPassStation.getProductType(); |
|
667 |
passingStationCollectionServiceImpl.sendMessage(productType+"*"+boxCode, "OP040"); |
|
668 |
} |
|
669 |
} else if ("280".equals(productNewFlag)){ |
|
670 |
|
|
671 |
} |
|
672 |
} |
|
673 |
} |
|
674 |
|
|
675 |
|
|
676 |
public void cleanForm(String Node) throws Exception { |
|
677 |
String[] parts = Node.split("[.]"); |
|
678 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
679 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
680 |
String snCode = SNCodeObject.toString(); |
|
681 |
String s = productNewFlag(snCode); |
|
682 |
if ("280".equals(s) || "380".equals(s)){ |
|
683 |
passingStationCollectionServiceImpl.sendMessage("clean","OP030"); |
|
684 |
} |
|
685 |
} |
|
686 |
|
|
687 |
} |
|
688 |
|
|
689 |
public void cleanForm040(String Node) throws Exception { |
|
690 |
String[] parts = Node.split("[.]"); |
|
691 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
692 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
693 |
String snCode = SNCodeObject.toString(); |
|
694 |
String s = productNewFlag(snCode); |
|
695 |
if ("280".equals(s) || "380".equals(s)){ |
|
696 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP040"); |
|
697 |
} |
|
698 |
} |
|
699 |
} |
|
700 |
|
|
701 |
public void cleanForm050(String Node) throws Exception { |
|
702 |
String[] parts = Node.split("[.]"); |
|
703 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
704 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
705 |
String snCode = SNCodeObject.toString(); |
|
706 |
String s = productNewFlag(snCode); |
|
707 |
if ("280".equals(s) || "380".equals(s)){ |
|
708 |
ProductNewPassStation passStation = new ProductNewPassStation(); |
|
709 |
passStation.setSfcCode(snCode); |
|
710 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation); |
|
711 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
712 |
productNewPassStationService.updatePassStationBySfcCode(snCode); |
|
713 |
} |
|
714 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP050"); |
|
715 |
} |
|
716 |
} |
|
717 |
} |
|
718 |
|
|
719 |
public void cleanForm060(String Node) throws Exception { |
|
720 |
String[] parts = Node.split("[.]"); |
|
721 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
722 |
if (ObjectUtils.isNotEmpty(SNCodeObject)){ |
|
723 |
String snCode = SNCodeObject.toString(); |
|
724 |
String s = productNewFlag(snCode); |
|
725 |
if ("280".equals(s) || "380".equals(s)){ |
|
726 |
passingStationCollectionServiceImpl.sendMessage("clean*clean","OP060"); |
|
727 |
} |
|
728 |
} |
|
729 |
} |
|
730 |
|
|
731 |
|
|
732 |
public void checkBoxRod(String Node) throws Exception { |
|
733 |
String[] parts = Node.split("[.]"); |
|
734 |
Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue(); |
|
735 |
if (null != SNCodeObject) { |
|
736 |
String SNCode = SNCodeObject.toString(); |
|
737 |
String s = productNewFlag(SNCode); |
|
738 |
if ("280".equals(s) || "380".equals(s)){ |
|
739 |
sendTo060(SNCode,parts); |
|
740 |
} |
|
741 |
} |
|
742 |
} |
|
743 |
|
|
744 |
private void sendTo060(String SNCode, String[] parts) throws Exception { |
|
745 |
String boxCode = ""; |
|
746 |
String rodCode = ""; |
|
747 |
ProductNewPassStation productNewPassStation = new ProductNewPassStation(); |
|
748 |
productNewPassStation.setSfcCode(SNCode); |
|
749 |
List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation); |
|
750 |
if (CollUtil.isNotEmpty(productPassStationList)){ |
|
751 |
ProductNewPassStation passStation = productPassStationList.get(0); |
|
752 |
boxCode = passStation.getBoxCode(); |
|
753 |
rodCode = passStation.getRodCode(); |
|
754 |
} |
|
755 |
//配瓦校验 |
|
756 |
passingStationCollectionServiceImpl.sendMessage(boxCode + "*" + rodCode + "*" + SNCode, parts[1]); |
|
757 |
} |
3e03af
|
758 |
} |