春风项目四线(合箱线、总装线)
wujian
2024-10-23 2c65c31aceb16c1d06c692266e3fb555ecafdfb5
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -3,6 +3,7 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.jcdm.common.core.domain.BaseEntity;
import com.jcdm.main.bs.domain.BsTechnologyRouteChildInfo;
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
@@ -13,6 +14,8 @@
import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
import com.jcdm.main.da.paramCollection.service.IDaParamCollectionService;
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection;
import com.jcdm.main.da.passingStationCollection.domain.ProductNewPassStation;
import com.jcdm.main.da.passingStationCollection.service.ProductNewPassStationService;
import com.jcdm.main.da.passingStationCollection.service.impl.DaPassingStationCollectionServiceImpl;
import com.jcdm.main.plcserver.conf.OPCElement;
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord;
@@ -21,6 +24,7 @@
import com.kangaroohy.milo.runner.subscription.SubscriptionCallback;
import com.kangaroohy.milo.service.MiloService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -55,6 +59,7 @@
    public IRmRepairRecordService rmRepairRecordService;
    public IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService;
    public ProductNewPassStationService productNewPassStationService;
    public HashMap<String,List<DaCollectionParamConf>> allCollectParamList = new HashMap<>();
@@ -65,7 +70,8 @@
                             IBsOrderSchedulingService bsOrderSchedulingService,
                             List<DaOpcuaConfig> lists,
                             IRmRepairRecordService rmRepairRecordService,
                             IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService) {
                             IBsTechnologyRouteChildInfoService bsTechnologyRouteChildInfoService,
                             ProductNewPassStationService productNewPassStationService) {
        OPCUaSubscription.miloService = miloService;
        this.collectionParamConfService = collectionParamConfService;
        this.daParamCollectionService = daParamCollectionService;
@@ -74,6 +80,7 @@
        this.lists = lists;
        this.rmRepairRecordService = rmRepairRecordService;
        this.bsTechnologyRouteChildInfoService = bsTechnologyRouteChildInfoService;
        this.productNewPassStationService = productNewPassStationService;
    }
@@ -81,7 +88,7 @@
    public void onSubscribe(String identifier, Object value) {
        String ecpStr = "";//异常记录标记
        try {
            if(null != value && "1".equals(value.toString())) {
                 if(null != value && "1".equals(value.toString())) {
                //1、检索SN号
                //2、过站参数采集
                //3、扫码枪数据回传
@@ -93,18 +100,131 @@
                    logger.info("-------监听到,{}的CODE_CHECK的信号",identifier);
                    //logger.info("-------time--------------,{}",LocalDateTime.now());
                    //sn
                    this.SNRetrieval(identifier,value.toString());
                    if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
                        //总装上线扫码传输数据
                        logger.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier);
                        scannerGunMessage();
                    if (OPCElement.OP010_CODE_CHECK.equals(identifier)){
                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP010.CodeCheckFeed", 1);
                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                    } else if (OPCElement.OP020_CODE_CHECK.equals(identifier)) {
                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.CodeCheckFeed", 1);
                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                    } else if (OPCElement.OP030_CODE_CHECK.equals(identifier)) {
                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP030.CodeCheckFeed", 1);
                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                        Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP030.Code").getValue();
                        if (ObjectUtil.isNotEmpty(SNCodeObject)){
                            String snCode = SNCodeObject.toString();
                            if (StrUtil.isNotBlank(snCode)){
                                String type = productNewFlag(snCode);
                                if ("280".equals(type) || "380".equals(type)){
                                    //获取箱体码
                                    ProductNewPassStation productNewPassStation = new ProductNewPassStation();
                                    productNewPassStation.setFinishFlag(OPCElement.UN_FINISH);
                                    productNewPassStation.setSfcCode(snCode);
                                    List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
                                    if (CollUtil.isNotEmpty(productPassStationList)){
                                        List<ProductNewPassStation> collect = productPassStationList.stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime).reversed()).collect(Collectors.toList());
                                        ProductNewPassStation productNewPassStation1 = collect.get(0);
                                        String boxCode = productNewPassStation1.getBoxCode();
                                        passingStationCollectionServiceImpl.sendMessage(type+"*"+boxCode,"OP030");
                                    }
                                }
                            }
                        }
                    } else if (OPCElement.OP040_CODE_CHECK.equals(identifier)) {
                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP040.CodeCheckFeed", 1);
                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                        //推送数据
                        log.info("进入OP040.CodeCheck");
                        tile2("CFL4HX.OP040.CodeCheck");
                    } else {
                        this.SNRetrieval(identifier,value.toString());
                        if (identifier.equals(OPCElement.OP120_ZZ_CODE_CHECK) && "1".equals(value.toString())){
                            //总装上线扫码传输数据
                            logger.info("-------监听到,{}的扫码枪扫码的CODE_CHECK的信号",identifier);
                            scannerGunMessage();
                        }
                    }
                }
                if (collect2.contains(identifier)){
                    if ("1".equals(value.toString())){
                        logger.info("-------监听到,{}的SAVE_REQUEST_LAST的信号",identifier);
                        //logger.info("-------time--------------,{}",LocalDateTime.now());
                        this.SaveData(identifier);
                        //HX线改装
                        if (OPCElement.OP010_REQUEST_PRODUCT_TYPE.equals(identifier)){
                           Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP010.Code").getValue();
                           if (ObjectUtil.isNotEmpty(SNCodeObject)){
                               String snCode = SNCodeObject.toString();
                               ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP010.ProductTypeSN",snCode);
                               OPCUaSubscription.miloService.writeToOpcUa(entity3);//写产品SN号反馈
                               ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SNDone", 1);
                               OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成
                           }
                        } else if (OPCElement.OP010_SAVE_REQUEST.equals(identifier)) {
                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP010.SaveFeed", 1);
                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成
                        } else if (OPCElement.OP020_PRINT_REQUEST.equals(identifier)) {
                            Object SNCodeObject = miloService.readFromOpcUa("CFL4HX.OP020.Code").getValue();
                            if (ObjectUtil.isNotEmpty(SNCodeObject)){
                                String snCode = SNCodeObject.toString();
                                DaPassingStationCollection passingStationCollectionCheck = new DaPassingStationCollection();
                                passingStationCollectionCheck.setLocationCode("OP020");
                                passingStationCollectionCheck.setSfcCode(snCode);
                                List<DaPassingStationCollection> checkList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passingStationCollectionCheck);
                                if (CollUtil.isNotEmpty(checkList)){
                                    if (snCode.startsWith("380")){
                                        log.info("enter-380");
                                        String[] split = snCode.split(StrUtil.SPACE);
                                        if (split.length>1){
                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//写完成
                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "☆"+split[1]+"☆");
                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//写完成
                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成
                                        }
                                    } else {
                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 2);
                                        OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成
                                    }
                                } else {
                                    if (snCode.startsWith("380")){
                                        log.info("enter-380");
                                        String[] split = snCode.split(StrUtil.SPACE);
                                        if (split.length>1){
                                            ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", split[0]);
                                            OPCUaSubscription.miloService.writeToOpcUa(entity);//写完成
                                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP020.PrintSN2", "☆"+split[1]+"☆");
                                            OPCUaSubscription.miloService.writeToOpcUa(entity2);//写完成
                                            ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
                                            OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成
                                        }
                                    } else {
                                        ReadWriteEntity entity = new ReadWriteEntity("CFL4HX.OP020.PrintSN1", snCode);
                                        OPCUaSubscription.miloService.writeToOpcByte(entity);//写完成
                                        ReadWriteEntity entity3 = new ReadWriteEntity("CFL4HX.OP020.SendSNDone", 1);
                                        OPCUaSubscription.miloService.writeToOpcByte(entity3);//写完成
                                    }
                                }
                            }
                        } else if (OPCElement.OP030_SAVE_REQUEST.equals(identifier)) {
                            cleanForm("CFL4HX.OP030.SaveFeed");
                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP030.SaveFeed", 1);
                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成
                        } else if (OPCElement.OP040_SAVE_REQUEST.equals(identifier)) {
                            cleanForm040(OPCElement.OP040_SAVE_REQUEST);
                            ReadWriteEntity entity2 = new ReadWriteEntity("CFL4HX.OP040.SaveFeed", 1);
                            OPCUaSubscription.miloService.writeToOpcByte(entity2);//写完成
                        } else {
                            this.SaveData(identifier);
                        }
                    }
                }
            }
@@ -125,7 +245,7 @@
        }
        if (null != SNCodeObject){
            String SNCode = SNCodeObject.toString();
            passingStationCollectionServiceImpl.sendMessage(SNCode);
            passingStationCollectionServiceImpl.sendMessage(SNCode,"OP120");
        }
    }
@@ -136,13 +256,34 @@
            Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
            if(null != SNCodeObject) {
                String SNCode=SNCodeObject.toString();
//                String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]);
//              String a=passingStationCollectionServiceImpl.SelectSN(SNCode,parts[1]);
                String a;
                BsOrderScheduling bsOrderSchedulingQuery = new BsOrderScheduling();
                bsOrderSchedulingQuery.setEngineNo(SNCode);
                List<BsOrderScheduling> queryOrderList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderSchedulingQuery);
                if (CollUtil.isNotEmpty(queryOrderList)){
                    a = "1";
                    //如果是老车型,判断是否重复扫码
                    if (OPCElement.OP050_CODE_CHECK.equals(Node)){
                        String type = productNewFlag(SNCode);
                        if (!"280".equals(type) && !"380".equals(type)){
                            DaPassingStationCollection passCheck = new DaPassingStationCollection();
                            passCheck.setSfcCode(SNCode);
                            passCheck.setLocationCode("OP060");
                            List<DaPassingStationCollection> passCheckList = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(passCheck);
                            if (CollUtil.isNotEmpty(passCheckList)){
                                //是否返修
                                a = "5";
//                                RmRepairRecord repairRecordCheck = new RmRepairRecord();
//                                repairRecordCheck.setBoxCode(SNCode);
//                                repairRecordCheck.setProcessesCode("OP050");
//                                List<RmRepairRecord> repairCheckList = rmRepairRecordService.selectRmRepairRecordList(repairRecordCheck);
//                                if (CollUtil.isEmpty(repairCheckList)){
//
//                                }
                            }
                        }
                    }
                }else {
                    a = "4";
                }
@@ -155,49 +296,101 @@
                    DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
                    PassingStationCollection.setSfcCode(SNCode);
                    daPassingStationCollections = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
                    if (CollUtil.isNotEmpty(daPassingStationCollections)){
                        DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
                        String outRsSign = lastOne.getOutRsSign();
                        if ("合格".equals(outRsSign)){
                            a = "1";
                        }else {
                            a = "2";
                        }
                    }
//                    if (CollUtil.isNotEmpty(daPassingStationCollections)){
//                        DaPassingStationCollection lastOne = daPassingStationCollections.get(daPassingStationCollections.size() - 1);
//                        String outRsSign = lastOne.getOutRsSign();
//                        if ("合格".equals(outRsSign)){
//                            a = "1";
//                        }else {
//                            a = "2";
//                        }
//                    }
                    RmRepairRecord rmRepairRecord = new RmRepairRecord();
                    rmRepairRecord.setBoxCode(SNCode);
                    rmRepairRecords = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord);
                    if (CollUtil.isNotEmpty(rmRepairRecords)){
                        a = "1";
                    }else {
                        a = "2";
                    }
                }
                logger.info("-----返回codeCheckFeed-----,{}",a);
//                String a="1";
                //zz上线工位查询hx线是否过站合格
                if (OPCElement.OP120_ZZ_CODE_CHECK.equals(Node)){
                    //过站记录
                    DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
                    PassingStationCollection.setSfcCode(SNCode);
                    PassingStationCollection.setLocationCode("OP160");
                    List<DaPassingStationCollection> ZZOP120PassCheck = passingStationCollectionServiceImpl.selectDaPassingStationCollectionList(PassingStationCollection);
                    if (CollUtil.isEmpty(ZZOP120PassCheck)){
                        a = "";
                    } else {
                        DaPassingStationCollection passingStationCollection = ZZOP120PassCheck.get(0);
                        String outRsSign = passingStationCollection.getOutRsSign();
                        if (!OPCElement.QUALIFIED.equals(outRsSign)){
                            a = "";
                        }
                    }
                }
                // 1:OK可生产 2:NG不可生产 3:NG可返工 4:PC检索失败(无记录)5:PC检索失败(软件)
                if (StrUtil.isNotBlank(a)){
                    int input = Integer.parseInt(a);
                    ReadWriteEntity entity = new ReadWriteEntity(parts[0]+"."+parts[1]+".CodeCheckFeed", input);
                    logger.info("-------监听到,{}的CodeCheck的信号",Node);
                    logger.info("发动机号:{},监听到{}的CodeCheck的信号",SNCode,Node);
                    miloService.writeToOpcByte(entity);
                    logger.info("监听到返回codecheckfeed信号,{}",entity);
                    //首站传输订单号
                    if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
                        //查询订单号
                        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
                        bsOrderScheduling.setEngineNo(SNCode);
                        List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
                        String orderNum = "";
                        if (CollUtil.isNotEmpty(tempList)){
                            BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
                            orderNum = bsOrderScheduling1.getOrderNo();
                        }
                        ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
                        miloService.writeToOpcUa(entity2);
                    }
//                    if (OPCElement.OP050_HX_CODE_CHECK.equals(Node)){
//                        //查询订单号
//                        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
//                        bsOrderScheduling.setEngineNo(SNCode);
//                        List<BsOrderScheduling> tempList = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
//                        String orderNum = "";
//                        if (CollUtil.isNotEmpty(tempList)){
//                            BsOrderScheduling bsOrderScheduling1 = tempList.get(0);
//                            orderNum = bsOrderScheduling1.getOrderNo();
//                        }
//                        ReadWriteEntity entity2 = new ReadWriteEntity(parts[0]+"."+parts[1]+".OrderNumber", orderNum);
//                        miloService.writeToOpcUa(entity2);
//                    }
                    //如果是返修工位需要传输返修工位号
                    if (OPCElement.OP465_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP355_ZZ_CODE_CHECK.equals(Node)
                    || OPCElement.OP695_ZZ_CODE_CHECK.equals(Node) || OPCElement.OP755_ZZ_CODE_CHECK.equals(Node)){
                        rework(SNCode,Node,daPassingStationCollections,rmRepairRecords);
                    }
                    if (OPCElement.OP050_CODE_CHECK.equals(Node)) {
                        //新机型050
                        String type = productNewFlag(SNCode);
                        if ("280".equals(type) || "380".equals(type)){
                            ProductNewPassStation productNewPassStation = new ProductNewPassStation();
                            productNewPassStation.setSfcCode(SNCode);
                            List<ProductNewPassStation> passStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
                            ProductNewPassStation productNewPassStation2 = new ProductNewPassStation();
                            productNewPassStation2.setFinishFlag("0");
                            List<ProductNewPassStation> collect = productNewPassStationService.getProductPassStationList(productNewPassStation2)
                                    .stream().sorted(Comparator.comparing(ProductNewPassStation::getCreateTime))
                                    .collect(Collectors.toList());
                            String partSfcCode = "";
                            if (CollUtil.isNotEmpty(collect)){
                                ProductNewPassStation passStation = collect.get(0);
                                partSfcCode = passStation.getSfcCode();
                            }
                            if (CollUtil.isNotEmpty(passStationList)){
                                ProductNewPassStation passStation = passStationList.get(0);
                                String productType = "";
                                if (ObjectUtils.isNotEmpty(passStation)){
                                    productType = passStation.getProductType();
                                }
                                passingStationCollectionServiceImpl.sendMessage(SNCode+"*sfcCode*"+productType+"*"+partSfcCode,"OP050");
                            }
                        }
                    }
                    if (OPCElement.OP060_CODE_CHECK.equals(Node)){
                        String type = productNewFlag(SNCode);
                        if ("280".equals(type) || "380".equals(type)){
                            checkBoxRod(Node);
                        }
                    }
                    System.out.println(entity);
@@ -289,7 +482,7 @@
                    Integer finalMaxCodeNum = maxCodeNum;
                    //勾选的返修工位中最大的工位之后的工位----1
                    List<BsTechnologyRouteChildInfo> collect3 = bsTechnologyRouteChildInfos.stream()
                            .filter(x -> x.getStepNoNum() >= finalMaxCodeNum).collect(Collectors.toList());
                            .filter(x -> x.getStepNoNum() > finalMaxCodeNum).collect(Collectors.toList());
                    if (CollUtil.isNotEmpty(collect3)){
                        //需要生产
                        productStation.addAll(collect3.stream().map(BsTechnologyRouteChildInfo::getProcessesCode).collect(Collectors.toList()));
@@ -375,7 +568,26 @@
                    allCollectParamList.put(gatherAddress,list);
                }
            }
            //60只采集老车型
            if (OPCElement.OP060_SAVE_REQUEST.equals(Node) || OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){
                String s = productNewFlag(SNCode);
                if ("280".equals(s) || "380".equals(s)){
                    list = new ArrayList<>();
                }
            }
            //80、100只采集新车型
            if (OPCElement.OP080_SAVE_REQUEST.equals(Node)
                    || OPCElement.OP080_SAVE_REQUEST_LAST.equals(Node)
                    || OPCElement.OP100_SAVE_REQUEST.equals(Node)
                    || OPCElement.OP100_SAVE_REQUEST_LAST.equals(Node)){
                String s = productNewFlag(SNCode);
                if (StrUtil.isNotEmpty(s)){
                    if (!"280".equals(s) && !"380".equals(s)){
                        list = new ArrayList<>();
                    }
                }
            }
            List<String> nodeIdList = list.stream().map(info -> {
                String nodeid = info.getGatherAddress();
                return nodeid;
@@ -391,9 +603,19 @@
                //返回plc保存成功
                if (parts.length==3){
                    if ("SaveRequest".equals(parts[2])){
                        if (OPCElement.OP050_SAVE_REQUEST.equals(Node)){
                            cleanForm050(Node);
                        } else if (OPCElement.OP060_SAVE_REQUEST.equals(Node)){
                            cleanForm060(Node);
                        }
                        ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeed", 1);
                                miloService.writeToOpcByte(entity);
                    }else if ("SaveRequestLast".equals(parts[2])){
                        if (OPCElement.OP050_SAVE_REQUEST_LAST.equals(Node)){
                            cleanForm050(Node);
                        } else if (OPCElement.OP060_SAVE_REQUEST_LAST.equals(Node)){
                            cleanForm060(Node);
                        }
                        ReadWriteEntity entity = new ReadWriteEntity(parts[0] + "." + parts[1] + ".SaveFeedLast", 1);
                                miloService.writeToOpcByte(entity);
                    }
@@ -416,7 +638,7 @@
                                ParamCollection.setParamValue(readWriteEntityList.get(i).getValue().toString());
                            }
                            ParamCollection.setSfcCode(SNCode);
                            ParamCollection.setParamName(list.get(i).getCollectParameterName());
                            ParamCollection.setParamName(list.get(i).getParameterSetName());
                            ParamCollection.setParamUpper(list.get(i).getParamUpper());
                            ParamCollection.setParamLower(list.get(i).getParamLower());
                            ParamCollection.setUnit(list.get(i).getCollectParameterUnit());
@@ -430,15 +652,11 @@
                    daParamCollectionService.saveBeachDaParamCollection(daParamCollectionlist);
                    logger.info("{}发动机({})采集数据保存完成",SNCode,Node);
                }
            Long beatTime = 0L;
            if (ObjectUtil.isNotEmpty(object)){
                String str = object.toString();
                beatTime = Float.valueOf(str).longValue();
            }
            Object ProductStatus = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".ProductStatus").getValue();
            logger.info("ProductStatus,{}",ProductStatus.toString());
            String str1="合格" ;
            if (ObjectUtil.isNotEmpty(ProductStatus)){
                logger.info("ProductStatus,{}",ProductStatus.toString());
                String productStatusString = ProductStatus.toString();
                if (productStatusString.contains("2") || productStatusString.contains("3")){
                    str1="不合格";
@@ -446,8 +664,14 @@
                    str1="合格";
                }
            }
            Long beatTime = 0L;
            if (ObjectUtil.isNotEmpty(object)){
                String str = object.toString();
                beatTime = Float.valueOf(str).longValue();
            }
            DaPassingStationCollection PassingStationCollection=new DaPassingStationCollection();
            PassingStationCollection.setSfcCode(SNCode);
            PassingStationCollection.setProductCode(bsOrderScheduling.getModel());
            PassingStationCollection.setLocationCode(parts[1]);
            PassingStationCollection.setOutboundTime(new Date());
            PassingStationCollection.setInboundTime(new Date(new Date().getTime()-beatTime*1000));
@@ -461,14 +685,15 @@
            //更新工单状态
            if ("OP790".equals(parts[1])) {
                bsOrderScheduling.setReport20("1");
                //bsOrderScheduling.setReport20("0");
                bsOrderScheduling.setProductionStatus("3");
                bsOrderScheduling.setFinalAssemblyOfflineTime(new Date());
            }else if("OP050".equals(parts[1])){
                bsOrderScheduling.setReport10("1");
                bsOrderScheduling.setReport10("0");
                bsOrderScheduling.setProductionStatus("2");
                bsOrderScheduling.setBoxClosingOnlineTime(new Date());
            }else if("OP120".equals(parts[1])){
                bsOrderScheduling.setReport20("0");
                bsOrderScheduling.setFinalAssemblyLaunchTime(new Date());
                bsOrderScheduling.setClosingBoxOfflineTime(new Date());
            }
@@ -477,4 +702,127 @@
            bsOrderSchedulingService.updateBsOrderScheduling(bsOrderScheduling);
        }
    }
    public String productNewFlag(String SNCode){
        String type;
        if (SNCode.startsWith("280")){
            type = "280";
        } else if (SNCode.startsWith("380")){
            type = "380";
        }else {
            type = "oldType";
        }
        return type;
    }
    public void tile2(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (null != SNCodeObject) {
            String SNCode = SNCodeObject.toString();
            String productNewFlag = productNewFlag(SNCode);
            if ("380".equals(productNewFlag)){
                ProductNewPassStation passStation = new ProductNewPassStation();
                passStation.setSfcCode(SNCode);
                List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation);
                if (CollUtil.isNotEmpty(productPassStationList)){
                    ProductNewPassStation productNewPassStation = productPassStationList.get(0);
                    String boxCode = productNewPassStation.getBoxCode();
                    String productType = productNewPassStation.getProductType();
                    log.info("发送到OP040的页面数据productType,{}",productType);
                    log.info("发送到OP040的页面数据boxCode,{}",boxCode);
                    passingStationCollectionServiceImpl.sendMessage(productType+"*"+boxCode, "OP040");
                }
            } else if ("280".equals(productNewFlag)){
            }
        }
    }
    public void cleanForm(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (ObjectUtils.isNotEmpty(SNCodeObject)){
            String snCode = SNCodeObject.toString();
            String s = productNewFlag(snCode);
            if ("280".equals(s) || "380".equals(s)){
                log.info("发送到OP030的清除");
                passingStationCollectionServiceImpl.sendMessage("clean","OP030");
            }
        }
    }
    public void cleanForm040(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (ObjectUtils.isNotEmpty(SNCodeObject)){
            String snCode = SNCodeObject.toString();
            String s = productNewFlag(snCode);
            if ("280".equals(s) || "380".equals(s)){
                log.info("发送到OP040的页面清除");
                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP040");
            }
        }
    }
    public void cleanForm050(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (ObjectUtils.isNotEmpty(SNCodeObject)){
            String snCode = SNCodeObject.toString();
            String s = productNewFlag(snCode);
            if ("280".equals(s) || "380".equals(s)){
                ProductNewPassStation passStation = new ProductNewPassStation();
                passStation.setSfcCode(snCode);
                List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(passStation);
                if (CollUtil.isNotEmpty(productPassStationList)){
                    productNewPassStationService.updatePassStationBySfcCode(snCode);
                }
                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP050");
            }
        }
    }
    public void cleanForm060(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (ObjectUtils.isNotEmpty(SNCodeObject)){
            String snCode = SNCodeObject.toString();
            String s = productNewFlag(snCode);
            if ("280".equals(s) || "380".equals(s)){
                passingStationCollectionServiceImpl.sendMessage("clean*clean","OP060");
            }
        }
    }
    public void checkBoxRod(String Node) throws Exception {
        String[] parts = Node.split("[.]");
        Object SNCodeObject = miloService.readFromOpcUa(parts[0] + "." + parts[1] + ".Code").getValue();
        if (null != SNCodeObject) {
            String SNCode = SNCodeObject.toString();
            String s = productNewFlag(SNCode);
            if ("280".equals(s) || "380".equals(s)){
                sendTo060(SNCode,parts);
            }
        }
    }
    private void sendTo060(String SNCode, String[] parts) throws Exception {
        String boxCode = "";
        String rodCode = "";
        ProductNewPassStation productNewPassStation = new ProductNewPassStation();
        productNewPassStation.setSfcCode(SNCode);
        List<ProductNewPassStation> productPassStationList = productNewPassStationService.getProductPassStationList(productNewPassStation);
        if (CollUtil.isNotEmpty(productPassStationList)){
            ProductNewPassStation passStation = productPassStationList.get(0);
            boxCode = passStation.getBoxCode();
            rodCode = passStation.getRodCode();
        }
        //配瓦校验
        passingStationCollectionServiceImpl.sendMessage(boxCode + "*" + rodCode + "*" + SNCode, parts[1]);
    }
}