| | |
| | | */ |
| | | public void exportDnc(Long[] approvedIdArray, OutputStream os) throws IOException { |
| | | //FileOutputStream fos = new FileOutputStream("d:/exportDnc.zip"); |
| | | try (ZipOutputStream zipOut = new ZipOutputStream(os);) {//os |
| | | try (ZipOutputStream zipOut = new ZipOutputStream(os);os) {//os |
| | | |
| | | for (Long approvedId : approvedIdArray) { |
| | | NcProgramApproved approved = approvedService.getById(approvedId); |
| | | addProgramPackageToZip(zipOut,approved); |
| | | |
| | | approved.setStatus(NcProgramApproved.STATUS_EXPORTED); |
| | | approvedService.updateById(approved); |
| | | } |
| | | |
| | | //状态修改为已导出 |
| | | /* |
| | | approvedService.lambdaUpdate().in(NcProgramApproved::getId, Arrays.asList(approvedIdArray)) |
| | | .set(NcProgramApproved::getStatus,NcProgramApproved.STATUS_EXPORTED).update(); |
| | | .set(NcProgramApproved::getStatus,NcProgramApproved.STATUS_EXPORTED).update();*/ |
| | | }catch(Exception e){ |
| | | Throwable [] err = e.getSuppressed(); |
| | | throw new ServiceException("导出工控网错误"+e.getMessage()); |
| | | } |
| | | |
| | | os.close(); |
| | | |
| | | } |
| | | |
| | |
| | | ZipEntry zipEntry = new ZipEntry(packageFolder);// "/"结尾表示文件夹 |
| | | 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(); |
| | | |
| | |
| | | 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); |
| | | this.addInputStreamToZip(zipOut, addedIns2, filePathInZip); |