lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/dto/TransferPackage.java
@@ -12,7 +12,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class TransferPackage { public enum DataType { PROCESS, WORKSTEP } public enum DataType {PRODUCT,COMPONENT,PARTS,OPERATION,PROCESS,WORKSTEP} private final DataType dataType; private final DocRelative docRelative; lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/listener/FileListener.java
@@ -26,7 +26,7 @@ @Override public void onStart(FileAlterationObserver observer) { // log.info("å¼å§çå¬ç®å½: {}", observer.getDirectory().getAbsolutePath()); log.info("å¼å§çå¬ç®å½: {}", observer.getDirectory().getAbsolutePath()); } @Override lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentPackageStrategy.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package org.jeecg.modules.dnc.service.impl; import org.jeecg.modules.dnc.dto.TransferPackage; import org.jeecg.modules.dnc.entity.ComponentInfo; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; import org.jeecg.modules.dnc.mapper.DocRelativeMapper; import org.jeecg.modules.dnc.service.DataPackageStrategy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ComponentPackageStrategy implements DataPackageStrategy { @Autowired private ComponentInfoMapper componentInfoMapper; @Autowired private DeviceTypeMapper deviceTypeMapper; @Autowired private FullHierarchyTraceService traceService; @Autowired private DocRelativeMapper docRelativeMapper; @Override public TransferPackage packageData(String relativeId) { DocRelative docRelative=docRelativeMapper.selectById(relativeId); ComponentInfo componentInfo=componentInfoMapper.selectById(docRelative.getAttributionId()); if (componentInfo == null) { throw new IllegalArgumentException("对åºçé¨ä»¶ä¸åå¨: " + docRelative.getAttributionId()); } return TransferPackage.builder() .dataType(TransferPackage.DataType.COMPONENT) .docRelative(docRelative) .traceChain(traceService.traceFromComponent(docRelative)) .build(); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
@@ -322,7 +322,6 @@ } break; case "2": if (StrUtil.isNotEmpty(item.getUserId())){ ComponentPermission componentPermission = new ComponentPermission(); componentPermission.setComponentId(item.getBusinessId()); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataPackageService.java
@@ -18,7 +18,15 @@ public DataPackageService(List<DataPackageStrategy> strategyList) { strategies = new EnumMap<>(TransferPackage.DataType.class); strategyList.forEach(strategy -> { if (strategy instanceof ProcessPackageStrategy) { if (strategy instanceof ProductPackageStrategy) { strategies.put(TransferPackage.DataType.PRODUCT, strategy); } else if (strategy instanceof ComponentPackageStrategy) { strategies.put(TransferPackage.DataType.COMPONENT, strategy); } else if (strategy instanceof PartsPackageStrategy) { strategies.put(TransferPackage.DataType.PARTS, strategy); } else if (strategy instanceof ProcessSpecVersionPackageStrategy) { strategies.put(TransferPackage.DataType.OPERATION, strategy); } else if (strategy instanceof ProcessPackageStrategy) { strategies.put(TransferPackage.DataType.PROCESS, strategy); } else if (strategy instanceof WorkStepPackageStrategy) { strategies.put(TransferPackage.DataType.WORKSTEP, strategy); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FileFerryService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import liquibase.pro.packaged.S; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.dto.ComponentHierarchy; import org.jeecg.modules.dnc.dto.TransferPackage; import org.jeecg.modules.dnc.entity.*; @@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -36,6 +38,7 @@ import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Objects; @Service public class FileFerryService { @@ -51,7 +54,7 @@ @Value("${jeecg.path.upload}") private String upLoadPath; @Autowired @Resource private MdcEquipmentMapper mdcEquipmentMapper; @Autowired @@ -94,8 +97,6 @@ throw new RuntimeException("æä»¶åå ¥å¤±è´¥", e); } } public TransferPackage importData(String filePath) { try { @@ -142,18 +143,28 @@ long number = Long.parseLong(numericPart); number--; // è·ååä¸ä¸ªåºåå· // ä¿æç¸å使°æ ¼å¼ String newNumeric = String.format("%0" + numericPart.length() + "d", number); String ncFileName = prefix + newNumeric + "_" + equipmentId+".NC"; String ncFilePath = path.getParent().resolve(ncFileName).toString(); // 6. è·åæä»¶å¤å¶ç®æ è·¯å¾ DocRelative docRelative=pkg.getDocRelative(); DocFile docFile = pkg.getTraceChain().getDocFile(); DocInfo docInfo = pkg.getTraceChain().getDocInfo(); if (docFile == null) { throw new IllegalStateException("ä¼ è¾å ä¸ç¼ºå°ææ¡£æä»¶ä¿¡æ¯"); } // ä¿æç¸å使°æ ¼å¼ String newNumeric = String.format("%0" + numericPart.length() + "d", number); String ncFileName = ""; if (Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { //NCæä»¶çæ·è´ ncFileName = prefix + newNumeric + "_" + equipmentId+".NC"; }else { //å ¶ä»ææ¡£çæ·è´ ncFileName = prefix + newNumeric + "_" + equipmentId+"."+docFile.getFileSuffix(); docInfo.setDocDispatchStatus(3); pkg.getTraceChain().setDocInfo(docInfo); } String ncFilePath = path.getParent().resolve(ncFileName).toString(); // æå»ºç®æ è·¯å¾ String targetDirectory = fileHomePath + docFile.getFilePath(); String targetPath = Paths.get(targetDirectory, docFile.getFileEncodeName()).toString(); @@ -183,12 +194,12 @@ DocClassification classification = classificationService.getByCode("send"); if(classification == null) ExceptionCast.cast(DocumentCode.DOC_CLASS_ERROR); DocRelative docRelative = new DocRelative(); docRelative.setDocId(docInfo.getDocId()); docRelative.setClassificationId(classification.getClassificationId()); docRelative.setAttributionType(7); docRelative.setAttributionId(mdcEquipment.getId()); docRelativeService.save(docRelative); DocRelative newDocRelative = new DocRelative(); newDocRelative.setDocId(docInfo.getDocId()); newDocRelative.setClassificationId(classification.getClassificationId()); newDocRelative.setAttributionType(7); newDocRelative.setAttributionId(mdcEquipment.getId()); docRelativeService.save(newDocRelative); } String sendPath = StringUtils.join(strings.toArray(), "/"); boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(), sendPath + "/" + mdcEquipment.getEquipmentId(), @@ -203,37 +214,35 @@ } else { throw new RuntimeException("æä»¶ä¼ è¾è·¯å¾è·å失败"); } // 计ç®åä¸ä¸ªæä»¶å long nextNumber = Long.parseLong(numericPart); nextNumber++; //è·ååºååçç¨åºç¡®è®¤è¡¨æ°æ® GuideCardBatch guideCardBatch=pkg.getTraceChain().getGuideCardBatch(); if (guideCardBatch!=null){ // 计ç®åä¸ä¸ªæä»¶å long nextNumber = Long.parseLong(numericPart); nextNumber++; //è·åæä»¶è·¯å¾ String pictureUrl=guideCardBatch.getPicture(); //è·åæä»¶è·¯å¾ String pictureUrl=guideCardBatch.getPicture(); // ä¿æç¸å使°æ ¼å¼ String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber); String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1]; String nextFilePath = path.getParent().resolve(nextFileName).toString(); // ä¿æç¸å使°æ ¼å¼ String nextNumeric = String.format("%0" + numericPart.length() + "d", nextNumber); String nextFileName = prefix + nextNumeric + "_" + equipmentId+"."+pictureUrl.split("\\.")[1]; String nextFilePath = path.getParent().resolve(nextFileName).toString(); //æ¼æ¥ç°æè·¯å¾ String picturePtah=upLoadPath+"/"+pictureUrl; //æ¼æ¥ç°æè·¯å¾ String picturePtah=upLoadPath+"/"+pictureUrl; // 9. å¤å¶æä»¶å¹¶éå½å logger.info("å¤å¶æä»¶: {} â {}", nextFilePath,picturePtah); Path PicSource= Paths.get(nextFilePath); Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING); // 9. å¤å¶æä»¶å¹¶éå½å logger.info("å¤å¶æä»¶: {} â {}", nextFilePath,picturePtah); Path PicSource= Paths.get(nextFilePath); Files.copy(PicSource, Paths.get(picturePtah), StandardCopyOption.REPLACE_EXISTING); Files.delete(PicSource); } // å 餿件 logger.info("å é¤ä¸´æ¶æä»¶: {}", ncFilePath); Files.delete(source); Files.delete(path); Files.delete(PicSource); return JsonUtils.fromJson(json, TransferPackage.class); return pkg; } catch (NumberFormatException e) { throw new RuntimeException("æä»¶åä¸çæ°åæ ¼å¼æ æ: " + e.getMessage(), e); @@ -251,7 +260,6 @@ pkg.getTraceChain().getComponentHierarchy().getComponents().size() < 4) { return; } ComponentHierarchy hierarchy = pkg.getTraceChain().getComponentHierarchy(); List<ComponentInfo> compressed = new ArrayList<>(); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/FullHierarchyTraceService.java
@@ -6,6 +6,7 @@ import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.mapper.*; import org.jeecg.modules.dnc.service.IPermissionStreamNewService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -46,7 +47,74 @@ private CutterMapper cutterMapper; @Autowired private GuideCardBatchMapper guideCardBatchMapper; @Autowired private IPermissionStreamNewService permissionStreamNewService; @Autowired private ISysUserService sysUserService; @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()); @@ -60,9 +128,15 @@ completeChainWithProductInfo(chain); List<ProductMix> productMixList=buildFullTreePath(chain); chain.setTreePath(productMixList); chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); return chain; } /** * å·¥æ¥å°è£ * @param docRelative * @return */ public ProcessTraceChain traceFromWorkStep(DocRelative docRelative) { ProcessTraceChain chain = initChainWithDocInfo(docRelative); DeviceType deviceType = deviceTypeMapper.selectById(docRelative.getAttributionId()); @@ -76,6 +150,7 @@ completeChainWithProductInfo(chain); List<ProductMix> productMixList=buildFullTreePath(chain); chain.setTreePath(productMixList); chain.setPermissionStreamNewList(buildFullTreePathPermission(productMixList)); return chain; } @@ -85,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; } @@ -111,6 +188,48 @@ private boolean isWorkSiteType(DeviceType deviceType) { return deviceType != null && 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) { @@ -210,4 +329,22 @@ return path; } private List<PermissionStreamNew> buildFullTreePathPermission(List<ProductMix> productMixList) { List<Long> ids=productMixList.stream().map(ProductMix::getId).collect(Collectors.toList()); List<PermissionStreamNew> path = permissionStreamNewService .list(new QueryWrapper<PermissionStreamNew>().in("business_id",ids) .eq("delete_flag",0)); path.forEach(item->{ if (item.getDepartId()!=null){ MdcProduction mdcProduction=mdcProductionService.getById(item.getDepartId()); if(mdcProduction!=null){ item.setDepartId(item.getDepartId()); } } if (item.getUserId()!=null){ item.setUserId(sysUserService.getById(item.getUserId()).getUsername()); } }); return path; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsPackageStrategy.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package org.jeecg.modules.dnc.service.impl; import org.jeecg.modules.dnc.dto.TransferPackage; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.entity.PartsInfo; import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; import org.jeecg.modules.dnc.mapper.DocRelativeMapper; import org.jeecg.modules.dnc.mapper.PartsInfoMapper; import org.jeecg.modules.dnc.service.DataPackageStrategy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class PartsPackageStrategy implements DataPackageStrategy { @Autowired private PartsInfoMapper partsInfoMapper; @Autowired private DeviceTypeMapper deviceTypeMapper; @Autowired private FullHierarchyTraceService traceService; @Autowired private DocRelativeMapper docRelativeMapper; @Override public TransferPackage packageData(String relativeId) { DocRelative docRelative=docRelativeMapper.selectById(relativeId); PartsInfo partsInfo=partsInfoMapper.selectById(docRelative.getAttributionId()); if (partsInfo == null) { throw new IllegalArgumentException("对åºçé¶ä»¶ä¸åå¨: " + docRelative.getAttributionId()); } return TransferPackage.builder() .dataType(TransferPackage.DataType.PARTS) .docRelative(docRelative) .traceChain(traceService.traceFromParts(docRelative)) .build(); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPackageStrategy.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package org.jeecg.modules.dnc.service.impl; import org.jeecg.modules.dnc.dto.TransferPackage; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.entity.ProcessSpecVersion; import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; import org.jeecg.modules.dnc.mapper.DocRelativeMapper; import org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper; import org.jeecg.modules.dnc.service.DataPackageStrategy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ProcessSpecVersionPackageStrategy implements DataPackageStrategy { @Autowired private ProcessSpecVersionMapper processSpecVersionMapper; @Autowired private DeviceTypeMapper deviceTypeMapper; @Autowired private FullHierarchyTraceService traceService; @Autowired private DocRelativeMapper docRelativeMapper; @Override public TransferPackage packageData(String relativeId) { DocRelative docRelative=docRelativeMapper.selectById(relativeId); ProcessSpecVersion processSpecVersion=processSpecVersionMapper.selectById(docRelative.getAttributionId()); if (processSpecVersion == null) { throw new IllegalArgumentException("对åºçå·¥èºè§ç¨çæ¬ä¸åå¨: " + docRelative.getAttributionId()); } return TransferPackage.builder() .dataType(TransferPackage.DataType.PROCESS) .docRelative(docRelative) .traceChain(traceService.traceFromPsv(docRelative)) .build(); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPackageStrategy.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package org.jeecg.modules.dnc.service.impl; import org.jeecg.modules.dnc.dto.TransferPackage; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.entity.ProductInfo; import org.jeecg.modules.dnc.mapper.DeviceTypeMapper; import org.jeecg.modules.dnc.mapper.DocRelativeMapper; import org.jeecg.modules.dnc.mapper.ProductInfoMapper; import org.jeecg.modules.dnc.service.DataPackageStrategy; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ProductPackageStrategy implements DataPackageStrategy { @Autowired private ProductInfoMapper productInfoMapper; @Autowired private DeviceTypeMapper deviceTypeMapper; @Autowired private FullHierarchyTraceService traceService; @Autowired private DocRelativeMapper docRelativeMapper; @Override public TransferPackage packageData(String relativeId) { DocRelative docRelative=docRelativeMapper.selectById(relativeId); ProductInfo productInfo=productInfoMapper.selectById(docRelative.getAttributionId()); if (productInfo == null) { throw new IllegalArgumentException("对åºç产åä¸åå¨: " + docRelative.getAttributionId()); } return TransferPackage.builder() .dataType(TransferPackage.DataType.PRODUCT) .docRelative(docRelative) .traceChain(traceService.traceFromProduct(docRelative)) .build(); } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java
@@ -82,6 +82,18 @@ } /** * å ¶ä»ææ¡£æå¨åèµ·æµç¨ * @param dispatchFile * @return */ @AutoLog(value = "ncç¨åºä¸çµåå¾çç¾æ´¾-å ¶ä»ææ¡£æå¨åèµ·æµç¨") @ApiOperation(value="ncç¨åºä¸çµåå¾çç¾æ´¾-å ¶ä»ææ¡£æå¨åèµ·æµç¨", notes="ncç¨åºä¸çµåå¾çç¾æ´¾-å ¶ä»ææ¡£æå¨åèµ·æµç¨") @PostMapping(value = "/startDispatchFile") public Result<?> startDispatchFile(@RequestBody DispatchFile dispatchFile){ return dispatchFileService.saveDispatchFile(dispatchFile); } /** * éæ°å¯å¨ * @param dispatchFileFlowTaskVo * @return lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java
@@ -346,8 +346,11 @@ DocFile docFile = docFileService.getById(en.getFileId()); if(docFile == null) ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); //ä¿®æ¹åæç¶æ docInfo.setDocDispatchStatus(4); //ä¿®æ¹NCç¶æ if (Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode().toString()) || Objects.equals(en.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode().toString())) { docInfo.setDocDispatchStatus(4); } docInfoService.updateById(docInfo); DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(en.getDocId(),7, en.getDeviceId()); if(deviceDoc != null) { @@ -378,19 +381,17 @@ } if(!b) ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); if (mdcEquipment != null) { List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); if (strings != null && !strings.isEmpty()) { String path = StringUtils.join(strings.toArray(), "/"); boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileEncodeName(), List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); if (strings != null && !strings.isEmpty()) { String path = StringUtils.join(strings.toArray(), "/"); boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileEncodeName(), docFile.getFileName(),docFile.getFileSuffix()); if (!copyFileNc) { ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); } else { FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(),docFile.getFileSuffix()); if (!copyFileNc) { ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); } else { FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(),docFile.getFileSuffix()); } } } List<DocRelative> docRelativeList=docRelativeService. @@ -401,13 +402,15 @@ if (docRelativeList.isEmpty()){ ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); } //æ¶å¯ç½è¿è¡NCæä»¶çæ·è´ handleFileTransfer(mdcEquipment, docFile); //NCæä»¶çæ·è´ // handleFileProcessing(docFile, mdcEquipment, secretFolder); //对åºäº§åç»ææ æ·è´ // handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); return synchronizedFlagService.updateFlag(1); DocRelative docRelative=docRelativeList.get(0); if (!Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode()) || !Objects.equals(docRelative.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())) { //å ¶ä»æä»¶çæ·è´ handleFileOtherProcessing(docFile, mdcEquipment, secretFolder); //对åºäº§åç»ææ æ·è´ handleProductTree(docInfo,docRelativeList.get(0),mdcEquipment.getEquipmentId()); } return true; }else if(up.getStatus() == 3) { //æç»æä½ ä»ä¹ä¹ä¸å return true; @@ -687,16 +690,86 @@ passInfoTxt.setPassType(DncPassLogPassType.PRODUCTSTRUCTURE.getCode()); dncPassLogService.save(passInfoTxt); String fileName="10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY); if (Objects.equals(docInfo.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ //å·¥åºå¯¹åºè®¾å¤ç±» String filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("å·¥åºæ°æ®å·²å¯¼åº: " + filePath); }else { //å·¥æ¥å¯¹åºè®¾å¤ç±» String filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("å·¥æ¥æ°æ®å·²å¯¼åº: " + filePath); String filePath=""; switch (docInfo.getAttributionType()){ case 1: //产å对åºå ¶ä»ææ¡£ filePath = ferryService.exportData(TransferPackage.DataType.PRODUCT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("äº§åæ°æ®å·²å¯¼åº: " + filePath); break; case 2: //é¨ä»¶å¯¹åºå ¶ä»ææ¡£ filePath = ferryService.exportData(TransferPackage.DataType.COMPONENT, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("é¨ä»¶æ°æ®å·²å¯¼åº: " + filePath); break; case 3: //é¶ä»¶å¯¹åºå ¶ä»ææ¡£ filePath = ferryService.exportData(TransferPackage.DataType.PARTS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("é¶ä»¶æ°æ®å·²å¯¼åº: " + filePath); break; case 4: //å·¥èºçæ¬å¯¹åºå ¶ä»ææ¡£ filePath = ferryService.exportData(TransferPackage.DataType.OPERATION, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("å·¥èºçæ¬æ°æ®å·²å¯¼åº: " + filePath); break; case 5: //å·¥åºå¯¹åºè®¾å¤ç±» filePath = ferryService.exportData(TransferPackage.DataType.PROCESS, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("å·¥åºæ°æ®å·²å¯¼åº: " + filePath); break; case 6: //å·¥æ¥å¯¹åºè®¾å¤ç±» filePath = ferryService.exportData(TransferPackage.DataType.WORKSTEP, docRelative.getId(),fileName+sequence+"_"+equipmentId+".ferry"); System.out.println("å·¥æ¥æ°æ®å·²å¯¼åº: " + filePath); break; default: break; } } //å°è£ å¤çå ¶ä»æä»¶ private void handleFileOtherProcessing(DocFile docFile, MdcEquipment mdcEquipment, String secretFolder) { if (!docFile.getFileSuffix().equals("zip") && !docFile.getFileSuffix().equals("rar")) { List<String> strings = iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); if (strings != null && !strings.isEmpty()) { DncPassLog passInfoTxt = new DncPassLog(); String path = StringUtils.join(strings.toArray(), "/"); Date dateFirst = DateUtil.getNow(); passInfoTxt.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); /*æ¥è¯¢æå䏿¡è®°å½*/ //ä¼ç 500æ¯«ç§ DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); int fileNc =0; if (dncPassLog !=null) { fileNc = dncPassLog.getSequenceNumber() + 1; } else { fileNc = 1; } //å¤çæä»¶åç§° æä»¶è·¯å¾ String sequenceNc = String.format("%06d",fileNc); DncPassLog passInfoNc = new DncPassLog(); passInfoNc.setSequenceNumber(fileNc); passInfoNc.setSequenceOrder(sequenceNc); passInfoNc.setDayTime(DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)); passInfoNc.setPassType("02"); passInfoNc.setPassName(docFile.getFileName()); try { Thread.sleep(1000); Date date = new Date(); passInfoNc.setCreateTime(date); System.out.println(DateUtil.format(date,DateUtil.STR_DATE_TIME)); } catch (InterruptedException e) { e.printStackTrace(); } dncPassLogService.save(passInfoNc); FileUtilS.copyFileUpName(path + "/" + mdcEquipment.getEquipmentId() + "/send/" + docFile.getFileName(), secretFolder +"/"+"10A"+DateUtil.format(dateFirst,DateUtil.STR_YEARMONTHDAY)+sequenceNc+"_"+mdcEquipment.getEquipmentId(), docFile.getFileSuffix(), docFile.getFileSuffix()); } } } @Override public void afterFlowHandle(FlowMyBusiness business) { business.getTaskNameId();//æ¥ä¸æ¥å®¡æ¹çèç¹