yangys
2025-08-19 b7da34655eba68a1d837cffbbd43319d88971fac
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/NcProgramExportDNCService.java
@@ -110,6 +110,9 @@
      zipOut.putNextEntry(zipEntry);
      zipOut.closeEntry();
      NcNode packageNode = ncNodeService.getById(approved.getNcNodeId());
      Machine machine = machineService.getByCode(packageNode.getMachineCode());//程序包节点,获取注释用
      List<NcNode> programNodes = ncNodeService.lambdaQuery().eq(NcNode::getIsLastEdition,1).eq(NcNode::getParentId, approved.getNcNodeId()).list();
      FlowProgramFile programFile;
@@ -120,15 +123,16 @@
      }else if(programPackageNode.hasCured()){
         status = "GH";
      }
      List<Dict> annotationList = programAnnotationService.getAnnotionList();
      //List<Dict> annotationList = programAnnotationService.getAnnotionList();
      for (NcNode node : programNodes) {
         String filePathInZip = packageFolder + node.getName();
         programFile = this.flowProgramFileService.getById(node.getFlowProgramFileId());
         if(programFile.isProgram()) {//程序文件,才会加入压缩包
            InputStream inputStream = ossTemplate.statFileStream(programFile.getOssName());
            Machine machine = machineService.getByCode(node.getMachineCode());
            InputStream addedIns1 = addSendDirAnnotation(inputStream, machine, annotationList);
            InputStream addedIns2 = addProgramStatusAnnotation(addedIns1, status, machine, annotationList);
            //InputStream addedIns1 = addSendDirAnnotation(inputStream, machine, annotationList);
            //InputStream addedIns2 = addProgramStatusAnnotation(addedIns1, status, machine, annotationList);
            String sendDir = machine.getProgSendDir()==null? StringUtil.EMPTY:machine.getProgSendDir();
            InputStream addedIns2 = programAnnotationService.setSendDirAndStatusAnnotation(sendDir,status,inputStream,machine.getMachineGroupCode());
            this.addInputStreamToZip(zipOut, addedIns2, filePathInZip);
         }
      }
@@ -141,13 +145,14 @@
    * @param inputStream
    * @return
    */
   /*
   InputStream addSendDirAnnotation(InputStream inputStream,Machine machine,List<Dict> annotationList) throws IOException {
      //检测第二行是否是路径
      String annotationText = programAnnotationService.generateAnnotation(machine.getProgSendDir()==null? StringUtil.EMPTY:machine.getProgSendDir(),machine.getMachineGroupCode(),annotationList);
      //TODO 改判断行内容
      return FileContentUtil.insertLine(inputStream,1,annotationText);
   }
   }*/
   /**
    * 添加程序专改的注释
@@ -158,11 +163,12 @@
    * @return
    * @throws IOException
    */
   /*
   InputStream addProgramStatusAnnotation(InputStream inputStream,String status,Machine machine,List<Dict> annotationList) throws IOException {
      String annoText= programAnnotationService.generateAnnotation(status,machine.getMachineGroupCode(),annotationList);
      return FileContentUtil.insertLine(inputStream,2,annoText);
   }
   }*/
   /**
    * 判断一行文本是否是注释
@@ -170,11 +176,12 @@
    * @param annotationList
    * @return
    */
   /*
   boolean isAnnotation(String line,List<Dict> annotationList){
      boolean isAnno = false;
      return isAnno;
   }
   }*/