yangys
2025-09-22 0bdfd76339bb58be09927b8c2fe268175c3a7cc8
blade-service/blade-mdm/src/main/java/org/springblade/mdm/machinefile/service/NcProgramExportInnerService.java
@@ -43,7 +43,7 @@
   private final OssTemplate ossTemplate;
   private final MachineFileService machineFileService;
   private final MachineService machineService;
   private final MachineAnnotationConfig annoConfig;
   private final AnnotationProcessorHelper annotationProcessorHelper;
   private final ProgramAnnotationService programAnnotationService;
   /**
    * 导出到涉密网
@@ -80,7 +80,15 @@
      os.close();
   }
   /**
    * j将输入流加入zip
    * @param zipOut zip文件输出里路
    * @param inputStream 文件的输入流
    * @param entryName entryName
    * @param filename 原始文件名
    * @param machineCode 机床代码
    * @throws IOException 异常
    */
   public void addInputStreamToZip(ZipOutputStream zipOut, InputStream inputStream, String entryName,String filename,String machineCode)
      throws IOException {
      // 创建新的 ZIP 条目
@@ -108,7 +116,7 @@
    */
   InputStream setAnnotations(InputStream inputStream,String filename,String machineCode) throws IOException {
      Machine machine = this.machineService.getByCode(machineCode);
      AnnotationProcessor annoProcessor = ProcessorHelper.getProcessor(machine.getControlSystem(),annoConfig);
      AnnotationProcessor annoProcessor = annotationProcessorHelper.getProcessor(machine.getControlSystem());
      AnnotationData annoData = new AnnotationData();
      annoData.setFilename(filename);
@@ -116,8 +124,8 @@
      AnnotationProperties annoProps = annoProcessor.getAnnotationProperties();
      ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(inputStream));
      String statusLine = FileContentUtil.readLineAt(bais,annoProps.getStatusLineIndex());
      ByteArrayInputStream byteInsStream = new ByteArrayInputStream(IOUtils.toByteArray(inputStream));
      String statusLine = FileContentUtil.readLineAt(byteInsStream,annoProps.getStatusLineIndex());
      String text = programAnnotationService.removeAnnotation(machine.getControlSystem(),statusLine);
      if(AnnotationUtil.isStatusContent(text)){
@@ -127,9 +135,9 @@
         //没有按试切处理
         annoData.setProgramStatus(AnnotationUtil.SQ);
      }
      bais.reset();
      byteInsStream.reset();
      //
      return annoProcessor.putAnnotation(annoData,bais);
      return annoProcessor.putAnnotation(annoData,byteInsStream);
   }
}