| | |
| | | addInputStreamToZip(zipOut,ins , programName + "/" + acceptedFile.getName(),acceptedFile.getName(),machineFile.getMachineCode()); |
| | | } |
| | | acceptedFile.setExportTime(DateUtil.now()); |
| | | acceptedFile.setStatus(MachineAcceptedFile.STATUS_EXPORTED); |
| | | } |
| | | |
| | | } |
| | |
| | | zipOut.closeEntry(); |
| | | } |
| | | |
| | | /** |
| | | * 给导出文件增加注释,涉密网要用 |
| | | * @param inputStream 输入流 |
| | | * @param filename 文件名 |
| | | * @param machineCode 机床代码 |
| | | * @return 完成后的stream |
| | | * @throws IOException 操作异常 |
| | | */ |
| | | InputStream setAnnotations(InputStream inputStream,String filename,String machineCode) throws IOException { |
| | | Machine machine = this.machineService.getByCode(machineCode); |
| | | AnnotationProcessor annoProcessor = ProcessorHelper.getProcessor(machine.getControlSystem(),annoConfig); |
| | |
| | | |
| | | ByteArrayInputStream bais = new ByteArrayInputStream(IOUtils.toByteArray(inputStream)); |
| | | String statusLine = FileContentUtil.readLineAt(bais,annoProps.getStatusLineIndex()); |
| | | String status = programAnnotationService.removeAnnotation(machine.getControlSystem(),statusLine); |
| | | if(StringUtils.equalsAny(status,"SQ","GH","PL")){ |
| | | String text = programAnnotationService.removeAnnotation(machine.getControlSystem(),statusLine); |
| | | |
| | | if(AnnotationUtil.isStatusContent(text)){ |
| | | //是3种状态之一 |
| | | annoData.setProgramStatus(text); |
| | | }else{ |
| | | //没有按试切处理 |
| | | annoData.setProgramStatus(AnnotationUtil.SQ); |
| | | } |
| | | bais.reset(); |
| | | annoData.setProgramStatus("3"); |
| | | // |
| | | return annoProcessor.putAnnotation(annoData,bais); |
| | | } |
| | | } |