| | |
| | | if (ObjectUtil.isNotNull(value1)){ |
| | | String cellCode = value1.toString(); |
| | | //反馈电芯ocv检测结果 |
| | | boolean b = OCVResultFeedBack(thoroughfare, device,cellCode); |
| | | boolean b = OCVResultFeedBack(thoroughfare, device,cellCode);//对替换电芯校验 |
| | | //四个电芯的状态 |
| | | if (b){ |
| | | scanResult = 11; |
| | |
| | | //1:告知MES托盘已到站,请求下发进站状态 |
| | | if (Constants.OP030.equals(device)){ |
| | | //反馈电芯ocv检测结果 |
| | | boolean b = OCVResultFeedBack(thoroughfare, device); |
| | | boolean b = OCVResultFeedBack(thoroughfare, device);//进站对4个电芯校验 |
| | | //四个电芯的状态 |
| | | if (b){ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); |
| | |
| | | Integer result = 21; |
| | | //读取电芯码 |
| | | List<String> cellCodeList = readCellCodeList(thoroughfare, device); |
| | | if(ObjectUtil.isNull(cellCodeList) || cellCodeList.size() != 4){ |
| | | if(ObjectUtil.isNull(cellCodeList) || cellCodeList.size() != 4 ){ |
| | | result = 23; |
| | | }else{ |
| | | String cellCode1 = cellCodeList.get(0); |
| | | String cellCode2 = cellCodeList.get(1); |
| | | String cellCode3 = cellCodeList.get(2); |
| | | String cellCode4 = cellCodeList.get(3); |
| | | |
| | | if(cellCode1.isEmpty() || cellCode2.isEmpty()){ |
| | | result = 23; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | return; |
| | | } |
| | | if(!cellCode3.isEmpty() && cellCode4.isEmpty()){ |
| | | result = 23; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | return; |
| | | } |
| | | if(cellCode3.isEmpty() && !cellCode4.isEmpty()){ |
| | | result = 23; |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); |
| | | return; |
| | | } |
| | | |
| | | result = savePassingStation(thoroughfare, device,cellCodeList);//保存过站 |
| | | if(result == 21) { |
| | | result = saveParamCollection(device,cellCodeList);//保存参数,发送工厂MES |
| | |
| | | omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum")); |
| | | omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum")); |
| | | omProductionOrdeInfo.setStationCode(dataObject.getStr("stationCode")); |
| | | omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode")); |
| | | omProductionOrdeInfo.setProductCode(dataObject.getStr("materialCode")); |
| | | omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity"))); |
| | | omProductionOrdeInfo.setOnlineCompletionMark("0"); |
| | | omProductionOrdeInfo.setSfResult("0"); |
| | | omProductionOrdeInfo.setProductCode(dataObject.getStr("model")); |
| | | omProductionOrdeInfo.setProductModel(dataObject.getStr("model")); |
| | | omProductionOrdeInfo.setCreateTime(new Date()); |
| | | omProductionOrdeInfo.setCreateUser("工厂MES"); |
| | | omProductionOrdeInfoService.save(omProductionOrdeInfo); |
| | |
| | | try { |
| | | List<ReadWriteEntity> readWriteEntityList = miloService.readFromOpcUa(readList);//电芯码 |
| | | for (ReadWriteEntity readWriteEntity : readWriteEntityList) { |
| | | if (ObjectUtil.isNotNull(readWriteEntity.getValue()) && !"".equals(readWriteEntity.getValue().toString().trim())){ |
| | | if (ObjectUtil.isNotNull(readWriteEntity.getValue()) && !readWriteEntity.getValue().toString().trim().isEmpty()){ |
| | | cellCodeList.add(readWriteEntity.getValue().toString());//封装电芯码 |
| | | }/*else{ |
| | | }else{ |
| | | cellCodeList.add("");//封装电芯码 |
| | | }*/ |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | paramValue = readWriteEntityList.get(i).getValue().toString();//参数值 |
| | | if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ |
| | | paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString(); |
| | | }else if("MODEL".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ |
| | | paramValue = Constants.materialMap.get(paramValue); |
| | | } |
| | | } |
| | | daParamCollection.setParamValue(paramValue);//参数值 |
| | |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | //插入参数采集表 |
| | | daParamCollectionService.insertBatch(collectionList); |
| | | |
| | | //如果220工位,进行报工 |
| | | if("M1OP220".equals(device)) { |
| | | RestfulService.getWorkReportResultFeedback(moduleCode, "M1OP220", format.format(new Date())); |
| | | } |
| | | |
| | | //上传到工厂mes |
| | | ParentVO parentVO = new ParentVO(); |
| | | parentVO.setStationCode(device);//工位 |
| | | parentVO.setSiteCode("3983"); |
| | | |
| | | parentVO.setRecordId(UUID.randomUUID().toString()); |
| | | if("2".equals(stationStatus)){ |
| | | if("2".equals(stationStatus)){//工站状态 |
| | | parentVO.setTotalResult("0"); |
| | | }else { |
| | | parentVO.setTotalResult("1"); |
| | | } |
| | | parentVO.setProductNum(moduleCode); |
| | | |
| | | //添加基础数据 |
| | | List<ChildVO> basicList = getCollectParamBasicData(device); |
| | | mesList.addAll(basicList); |
| | | |
| | | parentVO.setCheckList(mesList); |
| | | |
| | | log.info("执行工厂MES方法start,工位号{} 传入数据:{}",device ,parentVO); |
| | |
| | | break; |
| | | |
| | | } |
| | | |
| | | //添加基础数据 |
| | | List<ChildVO> basicList = getCollectParamBasicData(device); |
| | | mesChildList.addAll(basicList); |
| | | |
| | | parentVO.setCheckList(mesChildList);//参数 |
| | | //CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | log.info("执行工厂MES方法start,传入数据:{}",parentVO); |
| | |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * AMES报工结果回传 |
| | | * @param productNum |
| | | * @param stationCode |
| | | * @param confirmTime |
| | | * @return |
| | | */ |
| | | //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"} |
| | | public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) |
| | | { |
| | | String result = ""; |
| | | 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); |
| | | result = response.body(); |
| | | }catch (Exception e){ |
| | | throw new RuntimeException(e); |
| | | }finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取采集参数基础数据 |
| | | * @param stationCode |
| | | * @return list |
| | | */ |
| | | public static List<ChildVO> getCollectParamBasicData(String stationCode) { |
| | | List<ChildVO> basicList = new ArrayList<>(); |
| | | try { |
| | | //查询参数配置表 |
| | | List<DaCollectionParamConf> list = collectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
| | | .eq(DaCollectionParamConf::getProcessesCode, stationCode)//工位 |
| | | .eq(DaCollectionParamConf::getCollectParameterType, "BASIC")//采集参数类型 |
| | | ); |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | for(DaCollectionParamConf conf:list){ |
| | | ChildVO childVO = new ChildVO(); |
| | | childVO.setItemCode(conf.getCollectParameterId());//参数 |
| | | childVO.setItemType(conf.getItemType()); |
| | | childVO.setItemValue(conf.getParamCentral());//参数值 |
| | | childVO.setItemText(conf.getCollectParameterName()); |
| | | childVO.setCheckResult("1"); |
| | | childVO.setCheckTime(format.format(new Date())); |
| | | basicList.add(childVO); |
| | | } |
| | | } |
| | | return basicList; |
| | | }catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |