From 537bfb7e43c78d5b3b98ba8a135b638f0461ea60 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期日, 20 十月 2024 15:50:30 +0800 Subject: [PATCH] 优化 --- jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java | 92 +++++++-------------------------------------- 1 files changed, 15 insertions(+), 77 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java index 5ab1ba3..43593d8 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java +++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java @@ -220,30 +220,11 @@ public AjaxResult yzUpdateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) { Boolean b = true; String result = "1"; -// BsFormulaChildInfo getMaterTwo = new BsFormulaChildInfo(); -// getMaterTwo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); -// getMaterTwo.setOperationType("2"); -// List<BsFormulaChildInfo> operationType = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(getMaterTwo); -// List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); -// for (String s : collect) { -// if(s.equals("")){ -//// return AjaxResult.success("鎵弿鏈畬鎴愶紝绂佹鎷х揣鎿嶄綔锛�"); -// } -// } -// BsFormulaChildInfo listQuery = new BsFormulaChildInfo(); -// listQuery.setParamCode(bsFormulaChildInfo.getParamCode()); -// listQuery.setProcessesCode(bsFormulaChildInfo.getLocationCode()); String paramData = bsFormulaChildInfo.getTightenTheArray(); if(paramData.contains("N")){ result = "3"; -// List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); -// bsFormulaChildInfos.get(0).setResults("NG"); -// bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); -// bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); this.updateTighteningData(bsFormulaChildInfo,"NG",paramData); -// return AjaxResult.success("鎵弿缁撴灉NG,璇烽噸鏂版壂鎻忥紒"); }else { -// List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); if(bsFormulaChildInfo.getSpareField2()!=null&&bsFormulaChildInfo.getSpareField3()!=null){ String tightenArray = bsFormulaChildInfo.getTightenTheArray().replace("[", "").replace("]", "").replace(" ", ""); String[] tightenDataParts = tightenArray.split(","); @@ -251,15 +232,11 @@ } if(b){ result = "3"; -// bsFormulaChildInfos.get(0).setResults("OK"); -// bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray()); -// bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0)); this.updateTighteningData(bsFormulaChildInfo,"OK",paramData); -// logger.info("yzUpdateTighteningFormula--鏌ヨ鏉′欢鍙傛暟锛�"+listQuery); -// logger.info("yzUpdateTighteningFormula--鏌ヨ缁撴灉锛�"+bsFormulaChildInfos.get(0)); Integer stepNumber = Integer.valueOf(bsFormulaChildInfo.getStepSort()); try { - miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".MStepNumber").value(stepNumber+1).build()); + String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getLocationCode());//鑾峰彇閫氶亾 + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+bsFormulaChildInfo.getLocationCode()+".MESScrew").value(stepNumber+1).build()); } catch (Exception e) { throw new RuntimeException(e); } @@ -269,7 +246,6 @@ // 鎵ц鎿嶄綔 if(bsFormulaChildInfo.getSpareField4().equals("1")){ try { -// WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); result = "2"; } catch (Exception e) { throw new RuntimeException(e); @@ -278,14 +254,8 @@ } }else { result = "3"; -// List<BsFormulaChildInfo> bsFormulaChildInfos1 = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery); -// bsFormulaChildInfos1.get(0).setResults("NG"); -// String originalString = bsFormulaChildInfo.getTightenTheArray(); String modifiedString = paramData.replaceFirst("OK", "NG"); -// bsFormulaChildInfos1.get(0).setCollectData(modifiedString); -// bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos1.get(0)); this.updateTighteningData(bsFormulaChildInfo,"NG",modifiedString); -// return AjaxResult.success("鎵弿缁撴灉NG,璇烽噸鏂版壂鎻忥紒"); } } return AjaxResult.success(result); @@ -354,13 +324,6 @@ @Override public AjaxResult jrmWorkpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) { this.clearCollectDataAndResultsByProcessesCode(bsFormulaChildInfo); -// List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() -// .eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) -// .eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode())); -// for (BsFormulaChildInfo info : list) { -// info.setCollectData(""); -// info.setResults(""); -// bsFormulaChildInfoService.saveOrUpdate(info); // } String[] split = bsFormulaChildInfo.getProductBarcode().split(","); try { @@ -555,35 +518,8 @@ @Override public AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo) { this.clearCollectDataAndResultsByProcessesCode(bsFormulaChildInfo); -// List<BsFormulaChildInfo> list = bsFormulaChildInfoService.list(new LambdaQueryWrapper<BsFormulaChildInfo>() -// .eq(BsFormulaChildInfo::getProcessesCode, bsFormulaChildInfo.getLocationCode()) -// .eq(BsFormulaChildInfo::getProductCode, bsFormulaChildInfo.getProductCode())); -// for (BsFormulaChildInfo info : list) { -// info.setCollectData(""); -// info.setResults(""); -// bsFormulaChildInfoService.saveOrUpdate(info); -// } try { daParamCollectionService.pushGeelycvMesFeedback(bsFormulaChildInfo.getProductBarcode(), bsFormulaChildInfo.getLocationCode()); -// String barCode = bsFormulaChildInfo.getProductBarcode(); -// String locationCode = bsFormulaChildInfo.getLocationCode(); -// -// if(StringUtils.isNotBlank(locationCode)&&StringUtils.isNotBlank(barCode)){ -// DaPassingStationCollection daPassingStationCollection = new DaPassingStationCollection(); -// daPassingStationCollection.setOutRsSign("1"); -// daPassingStationCollection.setOutboundTime(new Date()); -// daPassingStationCollection.setSfcCode(barCode); -// daPassingStationCollection.setLocationCode(locationCode); -// int updateDaPassingStation = daPassingStationCollectionService.updateDaPassingStationCollectionBySfcCodeAndLocationCode(daPassingStationCollection); -// logger.info("鏅�氫汉宸ュ伐浣嶆洿鏂拌繃绔欒褰晆pdateDaPassingStationCollectionBySfcCodeAndLocationCode:鏇存柊浜唟}鏉℃暟鎹�-鏇存柊鏉′欢pack鐮亄}-宸ヤ綅{}",updateDaPassingStation,barCode,locationCode); -// } - -// DaPassingStationCollection passingStationCollectionOne = daPassingStationCollectionService.getOne(new LambdaQueryWrapper<DaPassingStationCollection>().eq(DaPassingStationCollection::getSfcCode, barCode).eq(DaPassingStationCollection::getLocationCode, locationCode)); -// if (passingStationCollectionOne != null) { -// passingStationCollectionOne.setOutRsSign("1"); -// passingStationCollectionOne.setOutboundTime(new Date()); -// daPassingStationCollectionService.saveOrUpdate(passingStationCollectionOne); -// } }catch (Exception e){ } return AjaxResult.success(); @@ -592,17 +528,19 @@ @Override public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) { Boolean b = true; - BsFormulaChildInfo getMaterTwo = new BsFormulaChildInfo(); - getMaterTwo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); - getMaterTwo.setOperationType("2"); - List<BsFormulaChildInfo> operationType = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(getMaterTwo); - List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); - for (String s : collect) { - if(s.equals("")){ - return AjaxResult.error("鎵爜鏈畬鎴愶紝绂佹鎷х揣鎿嶄綔锛�"); + if(!"OP100".equals(bsFormulaChildInfo.getLocationCode())){ + BsFormulaChildInfo getMaterTwo = new BsFormulaChildInfo(); + getMaterTwo.setProductCode(bsFormulaChildInfo.getProductCode()); + getMaterTwo.setProcessesCode(bsFormulaChildInfo.getLocationCode()); + getMaterTwo.setOperationType("2"); + List<BsFormulaChildInfo> operationType = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(getMaterTwo); + List<String> collect = operationType.stream().map(BsFormulaChildInfo::getResults).collect(Collectors.toList()); + for (String s : collect) { + if(s.equals("")){ + return AjaxResult.error("鎵爜鏈畬鎴愶紝绂佹鎷х揣鎿嶄綔锛�"); + } } } - //娣诲姞鎷х揣鍙傛暟-鍙傛暟閲囬泦琛� DaParamCollection daParamCollection = new DaParamCollection(); daParamCollection.setParamCode(bsFormulaChildInfo.getParamCode()); @@ -636,8 +574,8 @@ bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfo); Integer stepNumber = Integer.valueOf(bsFormulaChildInfo.getStepSort()); + String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getLocationCode());//鑾峰彇閫氶亾 try { - String thoroughfare = Constants.thoroughfareMap.get(bsFormulaChildInfo.getLocationCode());//鑾峰彇閫氶亾 miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare+"."+bsFormulaChildInfo.getLocationCode()+".MESScrew").value(stepNumber+1).build()); } catch (Exception e) { throw new RuntimeException(e); @@ -654,7 +592,7 @@ // List<DaPassingStationCollection> daPassingStationCollections = daPassingStationCollectionMapper.selectDaPassingStationCollectionList(daPassingStationCollection); // daPassingStationCollections.get(0).setOutboundTime(new Date()); // daPassingStationCollectionMapper.updateDaPassingStationCollection(daPassingStationCollections.get(0)); -// miloService.writeToOpcShort(ReadWriteEntity.builder().identifier("PACK."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(21).build()); + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare +"."+bsFormulaChildInfo.getLocationCode()+".RecordDataDone").value(11).build()); WebSocketUsers.sendMessageToUserByText(map.get(bsFormulaChildInfo.getLocationCode()), "OUT"); } catch (Exception e) { throw new RuntimeException(e); -- Gitblit v1.9.3