cl
2024-09-06 e1a98fbab82268012f9adc38135d4bb0e7e1cc6b
jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java
@@ -164,8 +164,9 @@
                            result = 16;//电芯挡位为空
                        }else{
                            String cellGear = cellGearObjcet.toString();
                           /* List<String> cellCodeList = readCellCodeList(thoroughfare, device);
                            result = checkCellGear(thoroughfare, device,cellCodeList,cellGear);//校验电芯挡位和组别*/
                            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());
@@ -861,7 +862,7 @@
     */
    private Integer checkCellGear(String thoroughfare, String device,List<String> cellCodeList,String cellGear) throws Exception {
        Integer result = 11;
        String cellSerial = "";
        for(int i = 0; i < cellCodeList.size(); i ++){
            Integer cellStatus = 1;
            String cellCode = cellCodeList.get(i);
@@ -871,20 +872,31 @@
                if(CollUtil.isNotEmpty(list)){
                    DaCellData daCellData = list.get(0);
                    String cellValue = daCellData.getCellValue();//数据库中电芯挡位
                    String cellSerial = daCellData.getCellSerial();//数据库中电芯组别
                    cellSerial = daCellData.getCellSerial();//数据库中电芯组别
                    if(!cellValue.isEmpty() && cellValue.equals(cellGear)){
                        cellStatus = 1;
                    }else {
                        cellStatus = 2;
                        result = 17;//挡位校验不合格
                        result = 16;//挡位校验不合格
                        log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为:{}",cellCode,cellGear,cellValue);
                    }
                }else {
                    cellStatus = 2;
                    result = 17;//查不到要校验的挡位
                    result = 16;//查不到要校验的挡位
                    log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为空,查询不到该数据",cellCode,cellGear);
                }
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_"+(i+1)).value(cellStatus).build());
                miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".Cell_Status_"+(i+1)).value(cellStatus).build());
            }
        }
        //当电芯挡位发生变化时,并且老的挡位不为空,删除当前电芯批次
        if(!Constants.OLD_CELL_GEAR.isEmpty() && !cellGear.equals(Constants.OLD_CELL_GEAR)){
            if(!cellSerial.isEmpty()){
                daCellDataService.deleteDaCellDataByCellSerial(cellSerial);
            }
            log.info("电芯挡位发生改变,老的挡位为:{},新的挡位为:{},批次号为{}",Constants.OLD_CELL_GEAR,cellGear,cellSerial);
        }
        return result;
    }
@@ -1047,7 +1059,7 @@
        try {
            String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime;
            HttpResponse response = HttpRequest.get(url).execute();
            HttpRequest httpRequest = HttpRequest.get(url);
            //HttpRequest httpRequest = HttpRequest.get(url);
            result =  response.body();
        }catch (Exception e){
            throw new RuntimeException(e);
@@ -1075,7 +1087,7 @@
            if (CollUtil.isNotEmpty(list)){
                for(DaCollectionParamConf conf:list){
                    //1P1S生成
                    if(conf.getCollectParameterId().equals("1P1S")){
                    if("1P1S".equals(conf.getCollectParameterId())){
                        String result = get1P1S(sfcCode);
                        conf.setParamCentral(result);
                    }