From f4486e42360320b7c241066b8321baf07348e7ed Mon Sep 17 00:00:00 2001 From: Fancy <Fancy.fx@outlook.com> Date: 星期一, 01 七月 2024 15:18:38 +0800 Subject: [PATCH] node and product file and parameter --- pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java | 74 +++++++++++++++++++++++++++++++++++-- 1 files changed, 70 insertions(+), 4 deletions(-) diff --git a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java index e75269d..908012b 100644 --- a/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java +++ b/pms-parent/pms-web-station/src/main/java/com/dy/pmsStation/workOrder/WorkOrderSv.java @@ -3,14 +3,17 @@ import com.alibaba.excel.util.StringUtils; import com.dy.pmsGlobal.daoBa.BaUserMapper; import com.dy.pmsGlobal.daoOth.OthFileMapper; +import com.dy.pmsGlobal.daoPlt.PltProductMapper; import com.dy.pmsGlobal.daoPlt.PltStationMapper; import com.dy.pmsGlobal.daoPr.PrAssemblyPlanMapper; +import com.dy.pmsGlobal.daoPr.PrProductionNodeMapper; import com.dy.pmsGlobal.daoSta.StaAssemblyWorkHistoryMapper; import com.dy.pmsGlobal.daoSta.StaAssemblyWorkLastMapper; import com.dy.pmsGlobal.dyFile.FileOperate; import com.dy.pmsGlobal.dyFile.FileRestVo; import com.dy.pmsGlobal.pojoBa.BaUser; import com.dy.pmsGlobal.pojoOth.OthFile; +import com.dy.pmsGlobal.pojoPlt.PltProduct; import com.dy.pmsGlobal.pojoPlt.PltStation; import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan; import com.dy.pmsGlobal.pojoPr.PrProductionNode; @@ -44,6 +47,8 @@ private PltStationMapper pltStationDao; private StaAssemblyWorkLastMapper assemblyWorkLastDao; private StaAssemblyWorkHistoryMapper assemblyWorkHistoryDao; + private PrProductionNodeMapper nodeDao; + private PltProductMapper productDao; private FileOperate fileOperate; private OthFileMapper othFileMapper; @Value("${dy.webFile.fmUrl}") @@ -72,6 +77,16 @@ @Autowired private void setStaAssemblyWorkLastDao(StaAssemblyWorkLastMapper assemblyWorkLastDao) { this.assemblyWorkLastDao = assemblyWorkLastDao; + } + + @Autowired + public void setNodeDao(PrProductionNodeMapper nodeDao) { + this.nodeDao = nodeDao; + } + + @Autowired + public void setPltProductDao(PltProductMapper productDao) { + this.productDao = productDao; } @Autowired @@ -202,7 +217,7 @@ StaAssemblyWorkLast checkResult = checkUserAndStationUsed(vo); //鏍¢獙planId processId nodeId PrAssemblyPlan assyPlan = assemblyDao.selectByPrimaryKey(vo.getPlanId()); - if(assyPlan == null){ + if (assyPlan == null) { throw new RuntimeException("缁勮浠诲姟宸茬粡鍦ㄧ郴缁熶腑鍒犻櫎璇锋鏌�,鍒锋柊骞堕噸鏂伴�夋嫨浠诲姟"); } boolean hasNodeId = assyPlan.getProcess().getNodes().stream() @@ -238,7 +253,7 @@ throw new RuntimeException("鏁版嵁搴撳瓨鍌ㄥけ璐�"); } StaAssemblyWorkLast result = assemblyWorkLastDao.selectByPrimaryKey(staLast.getId()); - List<PrProductionNode> nodeInfo =assyPlan.getProcess().getNodes().stream() + List<PrProductionNode> nodeInfo = assyPlan.getProcess().getNodes().stream() .filter(node -> node.id.equals(vo.getNodeId())).collect(Collectors.toList()); assyPlan.getProcess().setNodes(nodeInfo); result.setPlan(assyPlan); @@ -375,7 +390,58 @@ List<BaUser> assistantList = baUserDao.selectByAssistants(workLast.getAssistants()); return assistantList; } - //鏍规嵁鑺傜偣鐨勬煡鍑鸿妭鐐逛綔涓氭寚瀵间功 - // 鏍规嵁浜у搧鏌ュ嚭浜у搧鏂囦欢 涓昏鎶�鏈弬鏁� + //鏍规嵁鑺傜偣鏌ュ嚭鑺傜偣浣滀笟鎸囧涔� + public PrProductionNode getSopByNodeId(String nodeId) { + if(StringUtils.isBlank(nodeId)){ + throw new RuntimeException("鑺傜偣ID涓嶈兘涓虹┖"); + } + PrProductionNode node = nodeDao.selectByPrimaryKey(Long.parseLong(nodeId)); + if(node == null){ + throw new RuntimeException("鑺傜偣ID涓嶅瓨鍦�,璇锋鏌�"); + } + if(node.instruction != null){ + addUrl(node.instruction); + } + return node; + } + + // 鏍规嵁浜у搧鏌ュ嚭浜у搧鏂囦欢 涓昏鎶�鏈弬鏁� 鍚� platform-->product-->productSv + public PltProduct getFileByProId(String proId) { + if(StringUtils.isBlank(proId)){ + throw new RuntimeException("浜у搧ID涓嶈兘涓虹┖"); + } + PltProduct product = productDao.selectByPrimaryKey(Long.parseLong(proId)); + if(product == null){ + throw new RuntimeException("浜у搧ID涓嶅瓨鍦�,璇锋鏌�"); + } + product = addWebUrl(product); + return product; + } + private PltProduct addWebUrl(PltProduct pro) { + if (pro != null) { + if (pro.image != null) { + String filePathWithWebUrl = getFilePathWithWebUrl(pro.image); + pro.imageWebPath = filePathWithWebUrl; + pro.imageWebPathZip = fileOperate.getImgFileZipPath(filePathWithWebUrl); + } + + pro.proFiles.stream().forEach(doc -> { + OthFile file = othFileMapper.selectByPrimaryKey(doc.fileId); + if (file == null) { + return; + } + FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); + doc.webUrl = fileRestVo.fileSysRestUrl + fileRestVo.fileWebDownloadPath + doc.fileId; + doc.orgName = file.orgName; + doc.extName = file.extName; + }); + } + return pro; + } + private String getFilePathWithWebUrl(Long fileId) { + OthFile file = othFileMapper.selectByPrimaryKey(fileId); + FileRestVo fileRestVo = fileOperate.parseHashcode(fmUrl, file.hash); + return fileRestVo.fileWebUrl + file.filePath; + } } \ No newline at end of file -- Gitblit v1.8.0