| | |
| | | |
| | | @Override |
| | | public void saveCampaignTimeParameters(DaParamCollection daParamCollection) { |
| | | String locationCode = daParamCollection.getLocationCode(); |
| | | String thoroughfare = Constants.thoroughfareMap.get(locationCode); |
| | | |
| | | BsFormulaChildInfo childInfo = daParamCollection.getFormulaChildEntity(); |
| | | if(StringUtils.isNotBlank(childInfo.getResults())){ |
| | | if(!childInfo.getResults().equals("OK")){ |
| | | try { |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("MOZU1."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build()); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | } |
| | | }else { |
| | | try { |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("MOZU1."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build()); |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+daParamCollection.getLocationCode()+".RecordDataDone").value(22).build()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | this.saveParameters(daParamCollection); |
| | | |
| | | //给opc发21 |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("MOZU1."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); |
| | | if(daParamCollection.getLocationCode().equals("M1OP100-1") || daParamCollection.getLocationCode().equals("M1OP100-2") ){ |
| | | miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+daParamCollection.getLocationCode()+".RecordDataDone").value(21).build()); |
| | | /* if(daParamCollection.getLocationCode().equals("M1OP100-1") || daParamCollection.getLocationCode().equals("M1OP100-2") ){ |
| | | try{ |
| | | //更新工单状态为已执行 |
| | | LambdaUpdateWrapper<OmProductionOrdeInfo> updateWrapper = new LambdaUpdateWrapper<>(); |
| | |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | } catch (Exception e) { |
| | |
| | | for (int i = 0; i < paramCollectionList.size(); i++) { |
| | | DaParamCollection collection = new DaParamCollection(); |
| | | collection.setSfcCode(daParamCollection.getProductBarcode());//模组码 |
| | | collection.setWorkOrderNo(daParamCollection.getWorkOrderNo());//工单号 |
| | | collection.setParamCode(list.get(i).getCollectParameterId());//参数编码 |
| | | collection.setParamName(list.get(i).getCollectParameterName());//参数名称 |
| | | String paramValue = ""; |
| | |
| | | daParamCollectionTempService.insertBatch(saveParamListTemp); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void pushStartStopTime(String paramCode, String paramName, String productNum) { |
| | | ParentVO parentVO = new ParentVO(); |
| | | parentVO.setSiteCode("3983"); |
| | | parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli())); |
| | | parentVO.setStationCode("OP165"); |
| | | parentVO.setProductNum(productNum); |
| | | parentVO.setTotalResult("1"); |
| | | List<ChildVO> listChildVo = new ArrayList<>(); |
| | | ChildVO childVO = new ChildVO(); |
| | | childVO.setItemCode(paramCode); |
| | | childVO.setItemType("3"); |
| | | childVO.setItemText(paramName); |
| | | childVO.setItemValue(format.format(new Date())); |
| | | childVO.setCheckResult("1"); |
| | | childVO.setCheckTime(format.format(new Date())); |
| | | listChildVo.add(childVO); |
| | | parentVO.setCheckList(listChildVo); |
| | | try{ |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | System.out.println(execute.body()); |
| | | }); |
| | | }catch (Exception e){ |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void insertBatch(List<DaParamCollection> confList){ |
| | | try{ |
| | |
| | | for (DaParamCollectionTemp daParamCollection : paramList) { |
| | | ChildVO childVO = new ChildVO(); |
| | | childVO.setItemCode(daParamCollection.getParamCode()); |
| | | // BsFormulaChildInfo childOne = bsFormulaChildInfoService.getOne(new LambdaQueryWrapper<BsFormulaChildInfo>().eq(BsFormulaChildInfo::getParamCode, daParamCollection.getParamCode())); |
| | | // 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())); |
| | | List<DaCollectionParamConf> paramConfOneList = daCollectionParamConfService.list(new LambdaQueryWrapper<DaCollectionParamConf>() |
| | | .eq(DaCollectionParamConf::getCollectParameterId, daParamCollection.getParamCode()) |
| | | .eq(DaCollectionParamConf::getProcessesCode,stationCode)); |
| | | DaCollectionParamConf paramConfOne = paramConfOneList.get(0); |
| | | // if(childOne!=null){ |
| | | // String operationType = childOne.getOperationType(); |
| | | // if(operationType.equals("1")){ |
| | | // childVO.setItemType("2"); |
| | | // }else if(operationType.equals("2")){ |
| | | // childVO.setItemType("1"); |
| | | // } |
| | | // }else { |
| | | // childVO.setItemType("3"); |
| | | // } |
| | | if(paramConfOne!=null){ |
| | | childVO.setItemType(paramConfOne.getItemType()); |
| | | childVO.setItemText(paramConfOne.getCollectParameterName()); |
| | | }else { |
| | | childVO.setItemType("3"); |
| | | childVO.setItemText(""); |
| | | } |
| | | childVO.setItemValue(daParamCollection.getParamValue()); |
| | | if(!paramConfOneList.isEmpty()){ |
| | | if(paramConfOne!=null){ |
| | | childVO.setItemType(paramConfOne.getItemType()); |
| | | 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"); |
| | | 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); |
| | | } |
| | | childVO.setCheckTime(format.format(daParamCollection.getCollectionTime())); |
| | | listChildVo.add(childVO); |
| | | |
| | | } |
| | | parentVO.setCheckList(listChildVo); |
| | | try{ |
| | |
| | | @Override |
| | | public void manualWorkstationsAddBasicParameters(DaParamCollection daParamCollection) { |
| | | // 假设这是从数据库或其他地方获取的参数数据 |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("GC", "南浔工厂"); |
| | | map.put("CXBH", "Pack线"); |
| | | map.put("SBBH", "设备001"); |
| | | map.put("YGBH", SecurityUtils.getUsername()); |
| | | map.put("GDBH", daParamCollection.getWorkOrderNo()); |
| | | map.put("CPXH", daParamCollection.getProductCode()); |
| | | map.put("INT", format.format(daParamCollection.getInboundTime())); |
| | | map.put("OUTT",format.format(new Date())); |
| | | |
| | | map.forEach((key, value) -> { |
| | | DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
| | | daCollectionParamConf.setCollectParameterId(key); |
| | | List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | DaParamCollection saveData = new DaParamCollection(); |
| | | saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
| | | saveData.setProductCode(daParamCollection.getProductCode()); |
| | | saveData.setLocationCode(daParamCollection.getLocationCode()); |
| | | saveData.setSfcCode(daParamCollection.getProductBarcode()); |
| | | saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
| | | saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
| | | saveData.setCollectionTime(new Date()); |
| | | saveData.setParamValue(value); |
| | | daParamCollectionMapper.insertDaParamCollection(saveData); |
| | | }); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("GC", "南浔工厂"); |
| | | // map.put("CXBH", "Pack线"); |
| | | // map.put("SBBH", "设备001"); |
| | | // map.put("YGBH", SecurityUtils.getUsername()); |
| | | // map.put("GDBH", daParamCollection.getWorkOrderNo()); |
| | | // map.put("CPXH", daParamCollection.getProductCode()); |
| | | // map.put("INT", format.format(daParamCollection.getInboundTime())); |
| | | // map.put("OUTT",format.format(new Date())); |
| | | // |
| | | // map.forEach((key, value) -> { |
| | | // DaCollectionParamConf daCollectionParamConf = new DaCollectionParamConf(); |
| | | // daCollectionParamConf.setProcessesCode(daParamCollection.getLocationCode()); |
| | | // daCollectionParamConf.setCollectParameterId(key); |
| | | // List<DaCollectionParamConf> daCollectionParamConfs = daCollectionParamConfMapper.selectDaCollectionParamConfList(daCollectionParamConf); |
| | | // DaParamCollection saveData = new DaParamCollection(); |
| | | // saveData.setWorkOrderNo(daParamCollection.getWorkOrderNo()); |
| | | // saveData.setProductCode(daParamCollection.getProductCode()); |
| | | // saveData.setLocationCode(daParamCollection.getLocationCode()); |
| | | // saveData.setSfcCode(daParamCollection.getProductBarcode()); |
| | | // if(daCollectionParamConfs.isEmpty()){ |
| | | // saveData.setParamCode(daCollectionParamConfs.get(0).getCollectParameterId()); |
| | | // saveData.setParamName(daCollectionParamConfs.get(0).getCollectParameterName()); |
| | | // } |
| | | // saveData.setCollectionTime(new Date()); |
| | | // saveData.setParamValue(value); |
| | | // daParamCollectionMapper.insertDaParamCollection(saveData); |
| | | // }); |
| | | } |
| | | |
| | | @Override |