admin
3 天以前 22ae1296592d87627d05233786c4aab0e854239b
-换型
已修改3个文件
109 ■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -58,6 +58,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.SystemUtils.getUserName;
/**
 * 设备产品过程参数采集Service业务层处理
 * 
@@ -397,12 +399,47 @@
                saveParamListTemp.add(collectionTemp);//封装参数采集list
            }
            //添加基础参数(登陆人信息)
//            try {
//                addCollectParamBasicData(daParamCollection.getLocationCode(),daParamCollection.getProductBarcode());
//            }catch (Exception e){
//                throw new RuntimeException(e);
//            }
            //插入参数采集表
            daParamCollectionService.insertBatch(saveParamList);
            //插入参数采集表
            daParamCollectionTempService.insertBatch(saveParamListTemp);
        }
    }
    public void addCollectParamBasicData(String stationCode,String modelCode){
        List<DaCollectionParamConf> confList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
                .like(DaCollectionParamConf::getCollectParameterId, "YGBH")
                .eq(DaCollectionParamConf::getProcessesCode, stationCode)
        );
        if(!confList.isEmpty()){
            DaCollectionParamConf daCollectionParamConf = confList.get(0);
            DaParamCollection collection = new DaParamCollection();
            collection.setSfcCode(modelCode);//模组码
            collection.setParamCode(daCollectionParamConf.getCollectParameterId());//参数编码
            collection.setParamName(daCollectionParamConf.getCollectParameterName());//参数名称
            collection.setParamValue(getUserName());//参数值
            collection.setLocationCode(stationCode);//工位
            collection.setCollectionTime(new Date());//采集时间
            daParamCollectionService.save(collection);
            DaParamCollectionTemp collectionTemp = new DaParamCollectionTemp();
            collectionTemp.setSfcCode(modelCode);//模组码
            collectionTemp.setParamCode(daCollectionParamConf.getCollectParameterId());//参数编码
            collectionTemp.setParamName(daCollectionParamConf.getCollectParameterName());//参数名称
            collectionTemp.setParamValue(getUserName());//参数值
            collectionTemp.setLocationCode(stationCode);//工位
            collectionTemp.setCollectionTime(new Date());//采集时间
            daParamCollectionTempService.save(collectionTemp);
        }
    }
    @Override
    public void insertBatch(List<DaParamCollection> confList){
        try{
@@ -543,6 +580,12 @@
    @Override
    public void pushGeelycvMesFeedback(String packID, String stationCode) {
        //添加基础参数(登陆人信息)
        try {
            addCollectParamBasicData(stationCode,packID);
        }catch (Exception e){
            throw new RuntimeException(e);
        }
        logger.info("进入人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String totalResult = "0";
jcdm-main/src/main/java/com/jcdm/main/plcserver/CustomRunner.java
@@ -58,6 +58,10 @@
        //PLC到MES物料转换
        Constants.materialMap.put("1","9900199052A");
        Constants.materialMap.put("2","9900199053B");
//        Constants.materialMap.put("3","9900236569");
//        Constants.materialMap.put("4","9900236570");
//        Constants.materialMap.put("1","9900236569");
//        Constants.materialMap.put("2","9900236570");
        //分段010-090段 电芯工位
        Constants.OP020_OP090.add(Constants.OP020);
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -121,16 +121,22 @@
                    Integer scanResult = 11;
                    if (Constants.OP010.equals(device)){
                        //OP010工位电芯条码校验||OP030工位电芯条码校验
                        Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Scaner").getValue();
                        if (ObjectUtil.isNotNull(value1)){
                            String keyCode = value1.toString();
                            log.info("读取到工位{}的Scaner数据:{}",device,keyCode);
                            //仅校验长度是否合格
//                                List<KeyCodeCheck> collect = keyCodeCheckService.list().stream().filter(x -> x.getKeyCode().contains(keyCode)).collect(Collectors.toList());
//                                if (CollUtil.isNotEmpty(collect)){
//                                    scanResult = 11;
//                                }
                        }
                        //电芯批次校验
//                        Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Scaner").getValue();
//                        Object value2 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Batch").getValue();
//                        if (ObjectUtil.isNotNull(value1)&&ObjectUtil.isNotNull(value2)){
//                            String keyCode = value1.toString();
//                            String batch = value2.toString();
//                            log.info("读取到工位{}的Scaner数据:{} 校验批次为:{}",device,keyCode,batch);
//                            //仅校验长度是否合格
////                                List<KeyCodeCheck> collect = keyCodeCheckService.list().stream().filter(x -> x.getKeyCode().contains(keyCode)).collect(Collectors.toList());
////                                if (CollUtil.isNotEmpty(collect)){
////                                    scanResult = 11;
////                                }
//                            scanResult = batchVerification(keyCode,batch);
//                        }else {
//                            scanResult = 12;
//                        }
                    }else if(Constants.OP030.equals(device)){
                        Object value1 = miloService.readFromOpcUa(thoroughfare + "." + device + ".Scaner").getValue();//电芯码
                        if (ObjectUtil.isNotNull(value1)){
@@ -161,15 +167,15 @@
                    //OP020 电芯挡位校验
                    if (Constants.OP020.equals(device)){
                        Integer result = 11;
                        /*Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue();
                        if (ObjectUtil.isNull(cellGearObjcet)){
                            result = 11;//如果电芯挡位为空,不进行挡位校验
                        }else{
                            String cellGear = cellGearObjcet.toString();
                            List<String> cellCodeList = readCellCodeList(thoroughfare, device);
                            result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别
                            Constants.OLD_CELL_GEAR = cellGear;//挡位赋值
                        }*/
//                        Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue();
//                        if (ObjectUtil.isNull(cellGearObjcet)){
//                            result = 11;//如果电芯挡位为空,不进行挡位校验
//                        }else{
//                            String cellGear = cellGearObjcet.toString();
//                            List<String> cellCodeList = readCellCodeList(thoroughfare, device);
//                            result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别
//                            Constants.OLD_CELL_GEAR = cellGear;//挡位赋值
//                        }
                        miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build());
                    }else if (Constants.OP030.equals(device)){
@@ -1179,5 +1185,23 @@
        }
    }
    /**
     * 批次校验
     * @param keyCode,batch
     * @return list
     */
    public Integer batchVerification(String keyCode,String batch){
        Integer result = 11;
        List<DaCellData> cellDataList = daCellDataService.list(new LambdaQueryWrapper<DaCellData>()
                .eq(DaCellData::getGbCellCode, keyCode)
                .eq(DaCellData::getCellSerial, batch)
        );
        if(cellDataList.isEmpty()){
            result = 13;
            log.info("电芯码{} 工位010校验批次失败:批次为{}",keyCode,batch);
        }
        return result;
    }
}