diff --git a/am-backend/yudao-module-lab/src/main/java/cn/iocoder/yudao/module/lab/controller/admin/inspection/LabInspectionController.java b/am-backend/yudao-module-lab/src/main/java/cn/iocoder/yudao/module/lab/controller/admin/inspection/LabInspectionController.java index cfa45d1..ee3bd79 100644 --- a/am-backend/yudao-module-lab/src/main/java/cn/iocoder/yudao/module/lab/controller/admin/inspection/LabInspectionController.java +++ b/am-backend/yudao-module-lab/src/main/java/cn/iocoder/yudao/module/lab/controller/admin/inspection/LabInspectionController.java @@ -54,8 +54,10 @@ public class LabInspectionController { if(binary&&!security.hasPermission("lab:data:download"))throw new ResponseStatusException(HttpStatus.FORBIDDEN,"没有文件下载权限"); if(binary&&job!=null) { String name=path.substring(path.lastIndexOf('/')+1); - if(Set.of("report_signed_chromatogram.pdf","report.pdf","platform-result.stl").contains(name)) { - if(!"ARCHIVED".equals(job.get("status"))||job.get("delivery_id")==null||job.get("awaiting_revision")!=null) + boolean pdf=Set.of("report_signed_chromatogram.pdf","report.pdf").contains(name); + boolean archived="ARCHIVED".equals(job.get("status"))&&job.get("delivery_id")!=null&&job.get("awaiting_revision")==null; + if(name.equals("platform-result.stl")||pdf&&archived) { + if(!archived) throw new ResponseStatusException(HttpStatus.CONFLICT,"当前成果尚未完成归档,请等待归档完成或重试成果归档后下载"); long tenant=TenantContextHolder.getRequiredTenantId(); var delivery=jdbc.queryForMap("SELECT stl_id,pdf_id FROM lab_dimension_delivery WHERE id=? AND tenant_id=? AND deleted=0",job.get("delivery_id"),tenant); @@ -63,6 +65,13 @@ public class LabInspectionController { response.setContentType(name.endsWith(".pdf")?"application/pdf":"application/octet-stream");response.setHeader("Cache-Control","private, no-store");response.setHeader("X-Content-Type-Options","nosniff"); response.setHeader("Content-Disposition","attachment; filename*=UTF-8''"+URLEncoder.encode(file.get("name").toString(),StandardCharsets.UTF_8));Files.copy((Path)file.get("path"),response.getOutputStream());return null; } + if(pdf) { + String statePath="/api/tasks/"+engine; + Object value=gateway.json(statePath,"GET",gateway.forward(statePath,"GET",new byte[0])); + if(!(value instanceof Map state)||Boolean.FALSE.equals(state.get("report_ready")) + ||!Set.of("done","blocked").contains(Objects.toString(state.get("status"),""))) + throw new ResponseStatusException(HttpStatus.CONFLICT,"报告尚未生成完成,请等待报告生成后下载"); + } } byte[] body=new byte[0]; if(method.equals("POST")) { diff --git a/am-web/src/views/lab/inspection/InspectionFeatures.vue b/am-web/src/views/lab/inspection/InspectionFeatures.vue index c99804c..f6e8930 100644 --- a/am-web/src/views/lab/inspection/InspectionFeatures.vue +++ b/am-web/src/views/lab/inspection/InspectionFeatures.vue @@ -1833,7 +1833,7 @@ async function evaluateDocument(op: FeatureOperation) { async function report() { return runOperation(async (op) => { await op.post('feature-report', { revision: doc.value.revision }) - ElMessage.success('报告已生成,归档完成后可在成果页下载 PDF') + ElMessage.success('报告已生成,可在成果页直接下载 PDF') emit('reported') }) } diff --git a/am-web/src/views/lab/inspection/InspectionWorkbench.vue b/am-web/src/views/lab/inspection/InspectionWorkbench.vue index 381f773..c27ad50 100644 --- a/am-web/src/views/lab/inspection/InspectionWorkbench.vue +++ b/am-web/src/views/lab/inspection/InspectionWorkbench.vue @@ -458,17 +458,12 @@ 预览报告下载 PDF下载结果包处理日志 current.value.report_ready !== false && ['done', 'blocked'].includes(current.value.status) ), - archivedReportReady = computed(() => { - const job = current.value.platform_job - return ( - !!job?.delivery_id && - job.status === 'ARCHIVED' && - !job.awaiting_revision && - String(job.engine_revision) === - String(current.value.report_revision || current.value.revision || '') - ) - }), statusType = computed(() => ready.value ? pendingInspectionCount(current.value) || current.value.measurement_complete === false diff --git a/deploy/windows11/RELEASE-20261124-pdf-download.md b/deploy/windows11/RELEASE-20261124-pdf-download.md new file mode 100644 index 0000000..48d8048 --- /dev/null +++ b/deploy/windows11/RELEASE-20261124-pdf-download.md @@ -0,0 +1,26 @@ +# PDF 报告下载不再依赖成果归档 + +报告生成后,结果页与报告预览窗口可以直接下载 PDF,无需先生成处理后 STL 或完成成套归档。 + +未归档报告由平台检查当前报告已生成后,从计算服务读取 PDF;已归档报告继续读取保存的归档文件。任务访问、租户和文件下载权限校验保留,尚未生成完成的报告不允许下载。成果归档流程与 STL 归档规则保持原有行为。 + +## 验证 + +- 后端模块及依赖编译通过;8 项下载验证通过,涵盖未归档报告、归档待处理、报告未就绪、计算中、已归档报告及访问权限。 +- 前端 standalone 完整构建通过,两处 Vue 组件编译通过。 +- 发布更新脚本语法检查通过,已核对拉取、前后端构建、增量升级、空闲检查、停止/启动和健康检查路径。 +- 临时测试代码与验证产物已清理;未运行现场设备。 + +## 更新 + +没有新增依赖、私有配置、菜单、字典或表结构;无需专项迁移。通过原有 `update.ps1` 构建前后端并执行标准增量升级即可。保留现场设备地址、凭据、QUIC、证书及业务文件,不同步开发数据。 + +正式环境 AI 收到更新通知后,先核对仓库本地改动和已有未推送提交,不得强制重置或覆盖。确认现场空闲后按原有受控流程执行: + +```powershell +pwsh -NoProfile -File deploy/windows11/update.ps1 -CheckOnly +pwsh -NoProfile -File deploy/windows11/update.ps1 -ConfirmStopped +pwsh -NoProfile -File deploy/windows11/manage.ps1 -Action Status +``` + +更新后核对 `.local/standalone/deployment.json` 的提交号与 JAR 校验值,并检查前端 5180、后端 48090 和代理健康。打开已有报告已生成、尚未归档的检测记录,确认结果页和预览窗口均可下载有效 PDF;不需要重新扫描或运动设备。