admin
3 天以前 48c7ffb6e7137b4b62bfdc63be8aa72d085ba40e
jcdm-main/src/main/java/com/jcdm/main/da/paramCollection/service/impl/DaParamCollectionServiceImpl.java
@@ -527,12 +527,16 @@
            parentVO.setTotalResult("1");
            List<ChildVO> listChildVo = new ArrayList<>();
            String productModel = "PE01B";
            OmProductionOrdeInfo orderOne = omProductionOrdeInfoService.getOne(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum, packID));
            productModel = orderOne.getProductCode();
            for (DaParamCollectionTemp daParamCollection : paramList) {
                ChildVO childVO = new ChildVO();
                childVO.setItemCode(daParamCollection.getParamCode());
                List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
                        .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())
                        .eq(DaCollectionParamConf::getProductModel, "PE01B")
                        .eq(DaCollectionParamConf::getProductModel, productModel)
                );
                DaCollectionParamConf paramConfOne = paramConfOneList.get(0);
                if(paramConfOne!=null){
@@ -597,6 +601,10 @@
            parentVO.setTotalResult("1");
            List<ChildVO> listChildVo = new ArrayList<>();
            String productModel = "PE01B";
            OmProductionOrdeInfo orderOne = omProductionOrdeInfoService.getOne(new LambdaQueryWrapper<OmProductionOrdeInfo>().eq(OmProductionOrdeInfo::getProductNum, packID));
            productModel = orderOne.getProductCode();
            for (DaParamCollection daParamCollection : paramList) {
                ChildVO childVO = new ChildVO();
                childVO.setItemCode(daParamCollection.getParamCode());
@@ -604,7 +612,7 @@
//                DaCollectionParamConf paramConfOne = daCollectionParamConfService.getOne(new LambdaQueryWrapper<DaCollectionParamConf>().eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode()));
                List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
                        .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())
                        .eq(DaCollectionParamConf::getProductModel, "PE01B")
                        .eq(DaCollectionParamConf::getProductModel, productModel)
                );
                DaCollectionParamConf paramConfOne = paramConfOneList.get(0);
                if(paramConfOne!=null){
@@ -892,6 +900,75 @@
        }
    }
    @Override
    public void jrmPushGeelycvMesFeedback(String packID, String stationCode, String productCode) {
        logger.info("进入人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        String url = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
        String url = "https://imes-group.geelycv.com/api/mom-open/restful/aMesSysIntegration/deviceResultFeedback";
        String totalResult = "0";
        List<DaParamCollectionTemp> paramList = daParamCollectionTempService.list(new LambdaQueryWrapper<DaParamCollectionTemp>().eq(DaParamCollectionTemp::getSfcCode, packID).eq(DaParamCollectionTemp::getLocationCode, stationCode));
        if(paramList.size() > 0){
            ParentVO parentVO = new ParentVO();
            parentVO.setSiteCode("3983");
            parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli()));
            parentVO.setStationCode(stationCode);
            parentVO.setProductNum(packID);
            parentVO.setTotalResult("1");
            List<ChildVO> listChildVo = new ArrayList<>();
            for (DaParamCollectionTemp daParamCollection : paramList) {
                ChildVO childVO = new ChildVO();
                childVO.setItemCode(daParamCollection.getParamCode());
                List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>()
                        .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode())
                        .eq(DaCollectionParamConf::getProductModel, productCode)
                );
                DaCollectionParamConf paramConfOne = paramConfOneList.get(0);
                if(paramConfOne!=null){
                    childVO.setItemType(paramConfOne.getSpareField1());
                    childVO.setItemText(paramConfOne.getCollectParameterName());
                }else {
                    childVO.setItemType("3");
                    childVO.setItemText("");
                }
                childVO.setItemValue(daParamCollection.getParamValue());
                if(daParamCollection.getParamValue().equals("1")){
                    childVO.setCheckResult("1");
                }else if(daParamCollection.getParamValue().equals("2")){
                    childVO.setCheckResult("0");
                    parentVO.setTotalResult("0");
                    totalResult = "1";
                }else {
                    childVO.setCheckResult("1");
                }
                childVO.setCheckTime(format.format(daParamCollection.getCollectionTime()));
                listChildVo.add(childVO);
            }
            parentVO.setCheckList(listChildVo);
            try{
                CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> {
                    logger.info("工位{}---开始执行异步方法---pack码是{}"+stationCode,packID);
                    HttpResponse execute = HttpRequest.post(url).body(JSONUtil.toJsonStr(parentVO)).execute();
                    logger.info("工位{}---异步方法执行结束---pack码是{}"+stationCode,packID);
                    logger.info("手动工位{}传工厂入参VO{}---pack码是{}" + stationCode,new Gson().toJson(parentVO),packID);
                    logger.info("手动工位{}传工厂MES异步方法{}---pack码是{}"+stationCode,execute.body(),packID);
                    DaParamCollectionTemp daParamCollectionTemp = new DaParamCollectionTemp();
                    daParamCollectionTemp.setSfcCode(packID);
                    daParamCollectionTemp.setLocationCode(stationCode);
                    int i = daParamCollectionTempService.deleteDaParamCollectionTempBySfcCodeAndLocationCode(daParamCollectionTemp);
                    logger.info("删除临时表数据条数{}-工位{}-pack码{}",i,stationCode,packID);
                });
            }catch (Exception e){
                System.out.println(e.getMessage());
            }
            logger.info("结束人工工位推送工厂MES数据方法-pushGeelycvMesFeedback-工位{}-pack码{}",stationCode,packID);
        }
    }
    public static String getRandomNumberBetween(double min, double max) {
        return String.format("%.1f",min + (Math.random() * (max - min)));
    }