| | |
| | | import java.util.concurrent.CompletableFuture; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.apache.commons.lang3.SystemUtils.getUserName; |
| | | |
| | | /** |
| | | * 设备产品过程参数采集Service业务层处理 |
| | | * |
| | |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | logger.info("OP100报工开始-工厂MES异步方法"); |
| | | String stationCode = "M2P100";//因为上层系统只支持6位,所有报工工位为M2P100 |
| | | String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), stationCode, format.format(new Date())); |
| | | //String reportResult = RestfulService.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), stationCode, format.format(new Date())); |
| | | String reportResult = OPCUaSubscription.getWorkReportResultFeedback(daParamCollection.getProductBarcode(), stationCode, format.format(new Date())); |
| | | JSONObject jsonObject = new JSONObject(reportResult); |
| | | String code = jsonObject.getStr("code"); |
| | | if("success".equals(code)){ |
| | |
| | | |
| | | //半自动工位,先将自动数据保存到数据库 |
| | | public void saveParameters(DaParamCollection daParamCollection) { |
| | | OmProductionOrdeInfo omProductionOrdeInfo = omProductionOrdeInfoService.selectOrderByProductNum(daParamCollection.getProductBarcode()); |
| | | //添加自动工位参数数据 |
| | | //查询参数配置表 |
| | | List<DaCollectionParamConf> list = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
| | | .eq(DaCollectionParamConf::getProcessesCode, daParamCollection.getLocationCode())//工位 |
| | | .eq(DaCollectionParamConf::getWhetherToCollect, Constants.ONE)//是否采集 |
| | | .eq(DaCollectionParamConf::getProductModel,omProductionOrdeInfo.getProductModel()) |
| | | );//类型 |
| | | |
| | | List<String> collectAddressList = list.stream() |
| | |
| | | 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{ |
| | |
| | | |
| | | @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"; |