| | |
| | | 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)){ |
| | |
| | | //OP020 电芯挡位校验 |
| | | if (Constants.OP020.equals(device)){ |
| | | Integer result = 11; |
| | | Object cellGearObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".CellGear").getValue(); |
| | | if (ObjectUtil.isNull(cellGearObjcet)){ |
| | | result = 16;//电芯挡位为空 |
| | | }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)){ |
| | |
| | | return; |
| | | } |
| | | |
| | | result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | //result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | if(result == 21) { |
| | | if(Constants.OP020.contains(device)){ |
| | | if(!cellCode1.isEmpty()){ |
| | |
| | | Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//站状态地址 |
| | | if (ObjectUtil.isNotNull(stationStatusObjcet)){ |
| | | String stationStatus = stationStatusObjcet.toString(); |
| | | result = savePassingStation(thoroughfare, device,moduleCode,stationStatus);//保存过站 |
| | | //result = savePassingStation(thoroughfare, device,moduleCode,stationStatus);//保存过站 |
| | | if(result == 21) { |
| | | result = saveParamCollection(device,moduleCode,stationStatus);//保存参数,发送工厂MES |
| | | } |
| | |
| | | public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) |
| | | { |
| | | String result = ""; |
| | | String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
| | | try { |
| | | String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
| | | log.info("执行工厂MES报工方法start,序列号{}工位号{}url{}",productNum,stationCode ,url); |
| | | HttpResponse response = HttpRequest.get(url).execute(); |
| | | /* HttpRequest httpRequest = HttpRequest.get(url);*/ |
| | | //HttpRequest httpRequest = HttpRequest.get(url); |
| | | result = response.body(); |
| | | log.info("执行工厂MES报工方法第一次end,序列号{}工位号{}返回数据{}",productNum,stationCode ,result); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException(e); |
| | | }finally { |
| | | if(result.isEmpty()){ |
| | | HttpResponse response = HttpRequest.get(url).execute(); |
| | | result = response.body(); |
| | | log.info("执行工厂MES报工方法第二次end,序列号{}工位号{}返回数据{}",productNum,stationCode ,result); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 批次校验 |
| | | * @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; |
| | | } |
| | | |
| | | |
| | | } |