春风项目四线(合箱线、总装线)
yyt
2024-05-22 696fd55ecc1243bce1d421d95cb9fba4b0a598b1
提交 | 用户 | 时间
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;
6 import com.jcdm.main.bs.domain.BsTechnologyRouteChildInfo;
7 import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
8 import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
9 import com.jcdm.main.bs.technologyRouteChild.service.IBsTechnologyRouteChildInfoService;
3e03af 10 import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
C 11 import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
059083 12 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
3e03af 13 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
C 14 import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
059083 15 import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
W 16 import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl;
3e03af 17 import com.jcdm.main.plcserver.conf.OPCElement;
9e6d86 18 import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
W 19 import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService;
3e03af 20 import com.kangaroohy.milo.model.ReadWriteEntity;
C 21 import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
22 import com.kangaroohy.milo.service.MiloService;
059083 23 import lombok.extern.slf4j.Slf4j;
1a444b 24 import org.slf4j.Logger;
Y 25 import org.slf4j.LoggerFactory;
3e03af 26 import org.springframework.stereotype.Component;
C 27
9f6314 28 import java.math.BigDecimal;
c76a3f 29 import java.sql.Time;
9e6d86 30 import java.time.LocalDateTime;
c76a3f 31 import java.util.*;
W 32 import java.util.concurrent.TimeUnit;
3e03af 33 import java.util.stream.Collectors;
C 34
35
059083 36 @Slf4j
3e03af 37 @Component
C 38 public class OPCUaSubscription implements SubscriptionCallback {
39
1a444b 40     private static final Logger logger = LoggerFactory.getLogger("sys-user");
3e03af 41     public static MiloService miloService;
C 42
43     public IDaCollectionParamConfService collectionParamConfService;
44
45     public IDaParamCollectionService daParamCollectionService;
46
059083 47     public DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl;
W 48
49     public List<DaOpcuaConfig> lists;
50
51     public static final HashMap<String,Integer> map = new HashMap<>();
52
9e6d86 53     public IBsOrderSchedulingService bsOrderSchedulingService;
W 54
55     public IRmRepairRecordService rmRepairRecordService;
56
57     public IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService;
58
c76a3f 59     public HashMap<String,List<DaCollectionParamConf>> allCollectParamList = new HashMap<>();
W 60
3e03af 61     public OPCUaSubscription(MiloService miloService,
C 62                              IDaCollectionParamConfService collectionParamConfService,
059083 63                              IDaParamCollectionService daParamCollectionService,
W 64                              DaPassingStationCollectionServiceImpl passingStationCollectionServiceImpl,
9e6d86 65                              IBsOrderSchedulingService bsOrderSchedulingService,
W 66                              List<DaOpcuaConfig> lists,
67                              IRmRepairRecordService rmRepairRecordService,
68                              IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService) {
3e03af 69         OPCUaSubscription.miloService = miloService;
C 70         this.collectionParamConfService = collectionParamConfService;
71         this.daParamCollectionService = daParamCollectionService;
059083 72         this.passingStationCollectionServiceImpl = passingStationCollectionServiceImpl;
9e6d86 73         this.bsOrderSchedulingService = bsOrderSchedulingService;
059083 74         this.lists = lists;
9e6d86 75         this.rmRepairRecordService = rmRepairRecordService;
W 76         this.bsTechnologyRouteChildInfoService = bsTechnologyRouteChildInfoService;
c76a3f 77
W 78
3e03af 79     }
C 80     @Override
81     public void onSubscribe(String identifier, Object value) {
82         String ecpStr = "";//异常记录标记
83         try {
9e6d86 84             if(null != value && "1".equals(value.toString())) {
059083 85                 //1、检索SN号
W 86                 //2、过站参数采集
87                 //3、扫码枪数据回传
88                 List<String> collect1 = lists.stream().filter(x -> OPCElement.SN_CHECK.equals(x.getrFunction()))
89                         .map(DaOpcuaConfig::getNode).collect(Collectors.toList());
90                 List<String> collect2 = lists.stream().filter(x -> OPCElement.SAVE_DATA.equals(x.getrFunction()))
91                         .map(DaOpcuaConfig::getNode).collect(Collectors.toList());
92                 if (collect1.contains(identifier)){
1a444b 93                     logger.info("-------监听到,{}的CODE_CHECK的信号",identifier);
Y 94                     //logger.info("-------time--------------,{}",LocalDateTime.now());
059083 95                     //sn
W 96                     this.SNRetrieval(identifier,value.toString());
97                     if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
98                         //总装上线扫码传输数据
1a444b 99                         logger.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier);
9e6d86 100                         scannerGunMessage();
W 101                     }
102                 }
103                 if (collect2.contains(identifier)){
104                     if ("1".equals(value.toString())){
1a444b 105                         logger.info("-------监听到,{}的SAVE_REQUEST_LAST的信号",identifier);
Y 106                         //logger.info("-------time--------------,{}",LocalDateTime.now());
9e6d86 107                         this.SaveData(identifier);
059083 108                     }
W 109                 }
3e03af 110             }
C 111         } catch (Exception e) {
9e6d86 112             System.out.println(e.getMessage());
3e03af 113         } finally {
C 114             if (!"".equals(ecpStr)) {
115                 System.out.println(ecpStr + "\r\n");
116             }
9e6d86 117         }
W 118     }
119
120     private void scannerGunMessage() throws Exception {
121         String[] parts = OPCElement.OP120_ZZ_CODE_CHECK.split("[.]");
122         Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue();
3946f8 123         if (null == SNCodeObject){
W 124             SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
125         }
9e6d86 126         if (null != SNCodeObject){
W 127             String SNCode = SNCodeObject.toString();
128             passingStationCollectionServiceImpl.sendMessage(SNCode);
3e03af 129         }
C 130     }
131
059083 132     public void SNRetrieval(String Node, String value) throws Exception {
W 133         String[] parts = Node.split("[.]");
134         if(value.equals("1")) {
135             //SN号检索
136             Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
137             if(null != SNCodeObject) {
138                 String SNCode=SNCodeObject.toString();
929bdc 139 //                String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]);
W 140                 String a;
141                 BsOrderScheduling bsOrderSchedulingQuery = new BsOrderScheduling();
142                 bsOrderSchedulingQuery.setEngineNo(SNCode);
143                 List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery);
144                 if (CollUtil.isNotEmpty(queryOrderList)){
145                     a = "1";
146                 }else {
0e3cac 147                     a = "4";
929bdc 148                 }
W 149                 //如果是返修工位需要传输返修工位号
0e3cac 150                 List<DaPassingStationCollection> daPassingStationCollections = new ArrayList<>();
W 151                 List<RmRepairRecord> rmRepairRecords = new ArrayList<>();
929bdc 152                 if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)
W 153                         || OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
154                     //过站记录
155                     DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
156                     PassingStationCollection.setSfcCode(SNCode);
0e3cac 157                     daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
929bdc 158                     if (CollUtil.isNotEmpty(daPassingStationCollections)){
W 159                         DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
160                         String outRsSign = lastOne.getOutRsSign();
161                         if ("合格".equals(outRsSign)){
162                             a = "1";
163                         }else {
164                             a = "2";
165                         }
166                     }
0e3cac 167                     RmRepairRecord rmRepairRecord = new RmRepairRecord();
W 168                     rmRepairRecord.setBoxCode(SNCode);
169                     rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord);
170                     if (CollUtil.isNotEmpty(rmRepairRecords)){
171                         a = "1";
172                     }
929bdc 173                 }
1a444b 174                 logger.info("-----返回codeCheckFeed-----,{}",a);
3946f8 175 //                String a="1";
059083 176                 // 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件)
9e6d86 177                 if (StrUtil.isNotBlank(a)){
W 178                     int input = Integer.parseInt(a);
179                     ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input);
1a444b 180                     logger.info("-------监听到,{}的CodeCheck的信号",Node);
cffac1 181                     miloService.writeToOpcByte(entity);
1a444b 182                     logger.info("监听到返回codecheckfeed信号,{}",entity);
9e6d86 183                     //首站传输订单号
W 184                     if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
185                         //查询订单号
186                         BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
187                         bsOrderScheduling.setEngineNo(SNCode);
188                         List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
189                         String orderNum = "";
190                         if (CollUtil.isNotEmpty(tempList)){
191                             BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
192                             orderNum = bsOrderScheduling1.getOrderNo();
193                         }
194                         ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
2b59de 195                         miloService.writeToOpcUa(entity2);
9e6d86 196                     }
W 197                     //如果是返修工位需要传输返修工位号
3946f8 198                     if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)
W 199                     || OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
0e3cac 200                         rework(SNCode,Node,daPassingStationCollections,rmRepairRecords);
9e6d86 201                     }
d4f437 202                     if (OPCElement.OP020_HX_CODE_CHECK.equals(Node)) {
Y 203                         //激光打码
204                         String[] printcode=SNCode.split("\\s+");
205                         ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.HOP020.PrintCode1", printcode[0]);
206                         OPCUaSubscription.miloService.writeToOpcUa(entity3);//写SN
207                         ReadWriteEntity entity5 = new ReadWriteEntity("CFL4HX.HOP020.PrintCode2", printcode[1]);
208                         OPCUaSubscription.miloService.writeToOpcUa(entity5);//写SN
696fd5 209                         ReadWriteEntity entity6 = new ReadWriteEntity("CFL4HX.HOP020.SNDoor", "1");
Y 210                         logger.info("发动机号{},请求打码内容写入成功,返回SNDoor信号信号1",SNCode);
211                         miloService.writeToOpcByte(entity6);
d4f437 212                     }
3946f8 213                     System.out.println(entity);
cffac1 214
9e6d86 215                 }
W 216
059083 217             }
9e6d86 218         }
W 219     }
220
0e3cac 221     private void rework(String SNCode,String Node,List<DaPassingStationCollection> daPassingStationCollections,List<RmRepairRecord> rmRepairRecords)  throws Exception{
9e6d86 222         BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
W 223         bsOrderScheduling.setEngineNo(SNCode);
224         List<String> allProcessCoed = new ArrayList<>();
929bdc 225         List<BsTechnologyRouteChildInfo> bsTechnologyRouteChildInfos = new ArrayList<>();
9e6d86 226         List<String> collect = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling).stream().map(BsOrderScheduling::getModel).collect(Collectors.toList());
W 227         if (CollUtil.isNotEmpty(collect)){
228             String s = collect.get(0);
229             //查找次机型的完整工序
929bdc 230             bsTechnologyRouteChildInfos = bsTechnologyRouteChildInfoService.selectAllTechnologyRouteByProductCode(s);
9e6d86 231             if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){
W 232                 allProcessCoed = bsTechnologyRouteChildInfos.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList());
233             }
234         }
0e3cac 235 //        RmRepairRecord rmRepairRecord = new RmRepairRecord();
W 236 //        rmRepairRecord.setBoxCode(SNCode);
9e6d86 237         List<ReadWriteEntity> writeList = new ArrayList<>();
0e3cac 238 //        List<RmRepairRecord> rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord);
3946f8 239         //过站记录
0e3cac 240 //        DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
W 241 //        PassingStationCollection.setSfcCode(SNCode);
3946f8 242         //过站记录
0e3cac 243 //        List<DaPassingStationCollection> daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
3946f8 244
1a444b 245         //所有返工工位
9e6d86 246         List<String> collect1 = rmRepairRecords.stream().map(RmRepairRecord::getProcessesCode).collect(Collectors.toList());
3946f8 247         if (CollUtil.isNotEmpty(collect1)){
929bdc 248             //查询出所有需要返修工位的最小op块
W 249             Integer minOP = 0;
250             if (CollUtil.isNotEmpty(collect1)){
3946f8 251
929bdc 252                 List<Integer> sortList = new ArrayList<>();
W 253                 collect1.stream().forEach(x ->{
254                     String op = x.replace("OP", "");
255                     if (StrUtil.isNotBlank(op)){
256                         int i = Integer.parseInt(op);
257                         sortList.add(i);
258                     }
259                 });
260                 if (CollUtil.isNotEmpty(sortList)){
261                     List<Integer> collect2 = sortList.stream().filter(Objects::nonNull).sorted().collect(Collectors.toList());
262                     minOP = collect2.get(0);
3946f8 263                 }
W 264             }
929bdc 265             //获取过站记录的最大工位
W 266             String maxCode = null;
267             if (CollUtil.isNotEmpty(daPassingStationCollections)){
9bc510 268                 List<DaPassingStationCollection> collect2 = daPassingStationCollections.stream().filter(x -> "不合格".equals(x.getOutRsSign())).collect(Collectors.toList());
W 269                 if (CollUtil.isNotEmpty(collect2)){
270                     DaPassingStationCollection lastOne = collect2.get(collect2.size() - 1);
271                     maxCode = lastOne.getLocationCode();
272                 }else {
273                     DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
274                     maxCode = lastOne.getLocationCode();
275                 }
276
28860f 277             }
929bdc 278             //所有放行工位
W 279             List<String> passStation = new ArrayList<>();
280             //所有生产工位
281             List<String> productStation = new ArrayList<>();
282             //最大工位编号
283             Integer maxCodeNum = 0;
284             if (StrUtil.isNotEmpty(maxCode)){
285                 String finalMaxCode = maxCode;
286                 //获取当前工位对应工步号
287                 List<String> collect2 = bsTechnologyRouteChildInfos.stream()
288                         .filter(x -> x.getProcessesCode().equals(finalMaxCode))
289                         .map(BsTechnologyRouteChildInfo::getStepNo).collect(Collectors.toList());
290                 if (CollUtil.isNotEmpty(collect2)){
291                     String s = collect2.get(0);
292                     if (StrUtil.isNotBlank(s)){
293                         maxCodeNum = Integer.parseInt(s);
294                     }
295                 }
296                 if (CollUtil.isNotEmpty(bsTechnologyRouteChildInfos)){
297                     bsTechnologyRouteChildInfos.forEach(x -> {
298                         x.setStepNoNum(Integer.parseInt(x.getStepNo()));
299                     });
300                     Integer finalMaxCodeNum = maxCodeNum;
301                     //勾选的返修工位中最大的工位之后的工位----1
302                     List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream()
303                             .filter(x -> x.getStepNoNum() >= finalMaxCodeNum).collect(Collectors.toList());
304                     if (CollUtil.isNotEmpty(collect3)){
305                         //需要生产
306                         productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()));
307                     }
308                     //从第一个工位到返修的最大工位之间,
309                     //勾选了返修标记的需要生产---1,未勾选的不生产---2
310                     productStation.addAll(collect1);
311                 }
312             }
313             if (CollUtil.isNotEmpty(productStation)){
314                 List<String> collect2 = allProcessCoed.stream().filter(x -> !productStation.contains(x)).collect(Collectors.toList());
315                 passStation.addAll(collect2);
316             }
317             String[] parts = Node.split("[.]");
318             String par = parts[0]+"."+parts[1];
319             if (CollUtil.isNotEmpty(passStation)){
320                 passStation.forEach(x -> {
321                     ReadWriteEntity readWriteEntity = new ReadWriteEntity();
322                     readWriteEntity.setIdentifier(par+"."+x);
323                     readWriteEntity.setValue(2);
324                     writeList.add(readWriteEntity);
325                 });
326             }
327             if (CollUtil.isNotEmpty(productStation)){
328                 productStation.forEach(x -> {
329                     ReadWriteEntity readWriteEntity = new ReadWriteEntity();
330                     readWriteEntity.setIdentifier(par+"."+x);
331                     readWriteEntity.setValue(1);
332                     writeList.add(readWriteEntity);
333                 });
334             }
e94b2b 335             //对OP755做特殊处理
W 336             List<ReadWriteEntity> OP755List = new ArrayList<>();
337             if (OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
338                 List<String> patchList = new ArrayList<>();
339                 patchList.add(par+".OP740");
340                 patchList.add(par+".OP760");
341                 patchList.add(par+".OP770");
342                 patchList.add(par+".OP780");
343                 for (String s : patchList) {
344                     ReadWriteEntity readWriteEntity = new ReadWriteEntity();
345                     readWriteEntity.setIdentifier(s);
346                     readWriteEntity.setValue(0);
347                     OP755List.add(readWriteEntity);
348                 }
349             }
929bdc 350             ReadWriteEntity readWriteEntity = new ReadWriteEntity();
W 351             readWriteEntity.setIdentifier(parts[0]+"."+parts[1]+".Repair_sign");
352             readWriteEntity.setValue(minOP);
353             miloService.writeToOpcShort(readWriteEntity);
354             miloService.writeToOpcByte(writeList);
1a444b 355             logger.info("{}返修写入:,{}",SNCode,writeList);
e94b2b 356             if (CollUtil.isNotEmpty(OP755List)){
W 357                 miloService.writeToOpcByte(OP755List);
358             }
929bdc 359         }
W 360
059083 361     }
W 362
363
3e03af 364     public void SaveData(String Node) throws Exception {
28860f 365
059083 366         String[] parts = Node.split("[.]");
3e03af 367         Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code1").getValue();
3946f8 368         if (null == SNCodeObject){
W 369             SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
370         }
3e03af 371         if(null != SNCodeObject)
C 372         {
373             String SNCode = SNCodeObject.toString();
c76a3f 374             Object object = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Runtime").getValue();
W 375             String gatherAddress = parts[0] + "." + parts[1];
376             List<DaCollectionParamConf> list = new ArrayList<>();
377             if (allCollectParamList.containsKey(gatherAddress)){
378                 list = allCollectParamList.get(gatherAddress);
379             }else {
380                 DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf();
381                 daCollectionParamConf.setGatherAddress(gatherAddress);
382                 daCollectionParamConf.setRemarks("1");
383                 list = collectionParamConfService.selectDaCollectionParamConfList(daCollectionParamConf);
384                 if (CollUtil.isNotEmpty(list)){
385                     //加入hashmap
386                     allCollectParamList.put(gatherAddress,list);
387                 }
388             }
3e03af 389
C 390             List<String> nodeIdList = list.stream().map(info -> {
391                 String nodeid = info.getGatherAddress();
392                 return nodeid;
393             }).collect(Collectors.toList());
394
f4cb4d 395             List<ReadWriteEntity> readWriteEntityList = new ArrayList<>();
W 396             if(CollUtil.isNotEmpty(nodeIdList)){
1a444b 397                 //long time1 = new Date().getTime();
f4cb4d 398                 readWriteEntityList = miloService.readFromOpcUa(nodeIdList);
1a444b 399                 //long time2 = new Date().getTime();
Y 400                 //logger.info("读取点位花费时间:{},",time2-time1);
f4cb4d 401             }
c76a3f 402                 //返回plc保存成功
W 403                 if (parts.length==3){
404                     if ("SaveRequest".equals(parts[2])){
405                         ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1);
406                                 miloService.writeToOpcByte(entity);
407                     }else if ("SaveRequestLast".equals(parts[2])){
408                         ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1);
409                                 miloService.writeToOpcByte(entity);
410                     }
1a444b 411                     logger.info("{}保存请求信号返回,MES->PLC的SaveFeedLast信号",Node);
Y 412                     //logger.info("-------请求返回-----,{}",LocalDateTime.now());
c76a3f 413                 }
1a444b 414
Y 415                 BsOrderScheduling bsOrderScheduling=bsOrderSchedulingService.selectBsOrderSchedulingSNCode(SNCode);
416
3e03af 417                 List<DaParamCollection> daParamCollectionlist = new ArrayList<>();
f4cb4d 418                 if (CollUtil.isNotEmpty(nodeIdList)){
W 419                     for(int i=0;i<nodeIdList.size();i++){
127f1b 420                         if(ObjectUtil.isNotEmpty(readWriteEntityList.get(i).getValue()) && !readWriteEntityList.get(i).getValue().toString().equals("0.0")){
f4cb4d 421                             DaParamCollection ParamCollection = new DaParamCollection();
W 422                             ParamCollection.setParamCode(readWriteEntityList.get(i).getIdentifier().toString().split("[.]")[2]);
423                             ParamCollection.setLocationCode(parts[1]);
424                             if (readWriteEntityList.get(i) == null){
425                                 ParamCollection.setParamValue("0");
426                             }else {
427                                 ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString());
428                             }
429                             ParamCollection.setSfcCode(SNCode);
430                             ParamCollection.setParamName(list.get(i).getCollectParameterName());
431                             ParamCollection.setParamUpper(list.get(i).getParamUpper());
432                             ParamCollection.setParamLower(list.get(i).getParamLower());
433                             ParamCollection.setUnit(list.get(i).getCollectParameterUnit());
434                             ParamCollection.setState("合格");
435                             ParamCollection.setType(list.get(i).getCollectParameterType());
436                             ParamCollection.setCollectionTime(new Date());
1a444b 437                             ParamCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo());
f4cb4d 438                             daParamCollectionlist.add(ParamCollection);
c6aaad 439                         }
3e03af 440                     }
f4cb4d 441                     daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
1a444b 442                     logger.info("{}发动机({})采集数据保存完成",SNCode,Node);
3e03af 443                 }
9e6d86 444             Long beatTime = 0L;
W 445             if (ObjectUtil.isNotEmpty(object)){
9f6314 446                 String str = object.toString();
W 447                 beatTime = Float.valueOf(str).longValue();
9e6d86 448             }
127f1b 449             Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue();
1a444b 450             logger.info("ProductStatus,{}",ProductStatus.toString());
127f1b 451             String str1="合格" ;
Y 452             if (ObjectUtil.isNotEmpty(ProductStatus)){
453                 String productStatusString = ProductStatus.toString();
454                 if (productStatusString.contains("2") || productStatusString.contains("3")){
455                     str1="不合格";
456                 }else {
457                     str1="合格";
458                 }
459             }
9e6d86 460             DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
W 461             PassingStationCollection.setSfcCode(SNCode);
462             PassingStationCollection.setLocationCode(parts[1]);
463             PassingStationCollection.setOutboundTime(new Date());
464             PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000));
465             PassingStationCollection.setCollectionTime(new Date());
466             PassingStationCollection.setCreateTime(new Date());
467             PassingStationCollection.setBeatTime(beatTime.toString());
127f1b 468             PassingStationCollection.setOutRsSign(str1);
1a444b 469             PassingStationCollection.setWorkOrderNo(bsOrderScheduling.getOrderNo());
9e6d86 470             passingStationCollectionServiceImpl.insertDaPassingStationCollection(PassingStationCollection);
1a444b 471             logger.info("{}发动机({})过站数据保存完成",SNCode,Node);
c76a3f 472
1a444b 473             //更新工单状态
Y 474             if ("OP790".equals(parts[1])) {
d4f437 475                 //bsOrderScheduling.setReport20("0");
1a444b 476                 bsOrderScheduling.setProductionStatus("3");
Y 477                 bsOrderScheduling.setFinalAssemblyOfflineTime(new Date());
478             }else if("OP050".equals(parts[1])){
bbc578 479                 bsOrderScheduling.setReport10("0");
1a444b 480                 bsOrderScheduling.setProductionStatus("2");
Y 481                 bsOrderScheduling.setBoxClosingOnlineTime(new Date());
482             }else if("OP120".equals(parts[1])){
d4f437 483                 bsOrderScheduling.setReport20("0");
1a444b 484                 bsOrderScheduling.setFinalAssemblyLaunchTime(new Date());
Y 485                 bsOrderScheduling.setClosingBoxOfflineTime(new Date());
486             }
487             bsOrderScheduling.setQualityStatus(str1);
488             bsOrderScheduling.setCurrentWorkstation(parts[1]);
489             bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling);
059083 490         }
3e03af 491     }
C 492 }