| | |
| | | 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()); |
| | | |
| | |
| | | */ |
| | | 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); |
| | |
| | | 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 = 16;//挡位校验不合格 |
| | | log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为:{}",cellCode,cellGear,cellValue); |
| | | } |
| | | }/*else { |
| | | }else { |
| | | cellStatus = 2; |
| | | result = 17;//查不到要校验的挡位 |
| | | }*/ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".CellStatus_"+(i+1)).value(cellStatus).build()); |
| | | result = 16;//查不到要校验的挡位 |
| | | log.info("电芯挡位校验不合格:电芯码为{},PLC设置挡位为{},工厂MES下发挡位为空,查询不到该数据",cellCode,cellGear); |
| | | } |
| | | 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; |
| | | } |
| | | |