From bc8cd378fd72f43e66120c540f57f630580aa093 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 11 九月 2025 10:57:13 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 113 insertions(+), 3 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java index 43d8920..7304fdc 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java @@ -54,6 +54,67 @@ @Autowired private IMdcProductionService mdcProductionService; + /** + * 浜у搧灏佽 + * @param docRelative + * @return + */ + public ProcessTraceChain traceFromProduct(DocRelative docRelative) { + ProcessTraceChain chain = initChainWithDocInfo(docRelative); + traceProductChain(chain, docRelative.getAttributionId()); + List<ProductMix> productMixList=buildFullTreePath(chain); + chain.setTreePath(productMixList); + chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); + return chain; + } + + /** + * 閮ㄤ欢灏佽 + * @param docRelative + * @return + */ + public ProcessTraceChain traceFromComponent(DocRelative docRelative) { + ProcessTraceChain chain = initChainWithDocInfo(docRelative); + traceComponentChain(chain, docRelative.getAttributionId()); + List<ProductMix> productMixList=buildFullTreePath(chain); + chain.setTreePath(productMixList); + chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); + return chain; + } + + /** + * 闆朵欢灏佽 + * @param docRelative + * @return + */ + public ProcessTraceChain traceFromParts(DocRelative docRelative) { + ProcessTraceChain chain = initChainWithDocInfo(docRelative); + tracePartsChain(chain, docRelative.getAttributionId()); + List<ProductMix> productMixList=buildFullTreePath(chain); + chain.setTreePath(productMixList); + chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); + return chain; + } + + /** + * 宸ヨ壓瑙勭▼鐗堟湰灏佽 + * @param docRelative + * @return + */ + public ProcessTraceChain traceFromPsv(DocRelative docRelative) { + ProcessTraceChain chain = initChainWithDocInfo(docRelative); + traceProcessSpecVersionChain(chain, docRelative.getAttributionId()); + List<ProductMix> productMixList=buildFullTreePath(chain); + chain.setTreePath(productMixList); + chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); + return chain; + } + + /** + * 宸ュ簭灏佽 + * @param docRelative + * @return + */ public ProcessTraceChain traceFromProcess(DocRelative docRelative) { ProcessTraceChain chain = initChainWithDocInfo(docRelative); DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId()); @@ -71,6 +132,11 @@ return chain; } + /** + * 宸ユ灏佽 + * @param docRelative + * @return + */ public ProcessTraceChain traceFromWorkStep(DocRelative docRelative) { ProcessTraceChain chain = initChainWithDocInfo(docRelative); DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId()); @@ -94,9 +160,11 @@ .ifPresent(doc -> { chain.setDocInfo(doc); chain.setDocFile(docFileMapper.selectById(doc.getPublishFileId())); - chain.setCutterList(getCuttersByDocId(doc.getDocId())); - getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch); - }); + if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || + Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { + chain.setCutterList(getCuttersByDocId(doc.getDocId())); + getLatestGuideCardBatch(doc.getDocId()).ifPresent(chain::setGuideCardBatch); + }}); return chain; } @@ -122,6 +190,48 @@ Objects.equals(deviceType.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode()); } + private void traceProductChain(ProcessTraceChain chain, String productId) { + ProductInfo product = productMapper.selectById(productId); + chain.setProduct(product); + } + + private void traceComponentChain(ProcessTraceChain chain, String componentId) { + chain.setComponentHierarchy(traceComponentHierarchy(componentId)); + Optional.ofNullable(chain.getComponentHierarchy()) + .map(ComponentHierarchy::getRootProduct) + .ifPresent(chain::setProduct); + } + + private void tracePartsChain(ProcessTraceChain chain, String partsId) { + PartsInfo parts = partsMapper.selectById(partsId); + chain.setParts(parts); + if (parts != null) { + if (parts.getComponentId() != null) { + chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId())); + Optional.ofNullable(chain.getComponentHierarchy()) + .map(ComponentHierarchy::getRootProduct) + .ifPresent(chain::setProduct); + } + } + } + + private void traceProcessSpecVersionChain(ProcessTraceChain chain, String psvId) { + ProcessSpecVersion psv = psvMapper.selectById(psvId); + chain.setProcessSpec(psv); + if (psv != null) { + if (psv.getPartsId() != null) { + PartsInfo parts = partsMapper.selectById(psv.getPartsId()); + chain.setParts(parts); + if (parts != null && parts.getComponentId() != null) { + chain.setComponentHierarchy(traceComponentHierarchy(parts.getComponentId())); + Optional.ofNullable(chain.getComponentHierarchy()) + .map(ComponentHierarchy::getRootProduct) + .ifPresent(chain::setProduct); + } + } + } + } + private void traceProcessChain(ProcessTraceChain chain, String processId) { ProcessStream process = processMapper.selectById(processId); if (process == null) return; -- Gitblit v1.9.3