| .. | ||
| make-demo-zip.ps1 | ||
| manifest.json | ||
| plm-pdf-demo-fake.rar | ||
| plm-pdf-demo.zip | ||
| README.md | ||
PLM PDF 压缩包接口 Postman 测试
接口
| 项 | 值 |
|---|---|
| 方法 | POST |
| URL | http://localhost:8033/system/material/plm/pdf/zip |
| Content-Type | multipart/form-data |
| 鉴权 | 无(@SaIgnore) |
端口以本地
application.yml为准(默认8033);dev 配置可能是9101。
表单字段
| Key | 类型 | 说明 |
|---|---|---|
items |
Text | manifest.json 全文(JSON 字符串) |
files |
File | zip 包,内含 manifest 声明的 PDF |
注意: Postman 里 items 必须选 Text,不要选 File;字段名必须是 items 和 files。
manifest JSON 示例
见同目录 manifest.json:
{
"productionOrderNo": "CP-25-103-XCL",
"IsDrawingChanaged": true,
"items": [
{
"pdfPath": "drawings/part-a.pdf",
"materialCode": "MAT-001",
"materialName": "测试零件A",
"unitQty": 1,
"batchQty": 10
},
{
"pdfPath": "drawings/part-b.pdf",
"dwgPath": "drawings/part-b.dwg",
"materialCode": "MAT-002",
"materialName": "测试零件B",
"unitQty": 2,
"batchQty": 20
}
]
}
pdfPath:zip 内 PDF 的相对路径(用/,与 zip 里 entry 名一致)dwgPath:可选,zip 内 DWG 相对路径IsDrawingChanaged:根级是否变更图纸(布尔;会回填到各明细;明细也可单独覆盖;亦兼容isDrawingChanged)- zip 里不能多、不能少 PDF/DWG,必须与
items声明一致
生成测试 zip
cd script\postman\plm-pdf-zip
.\make-demo-zip.ps1
得到 plm-pdf-demo.zip。
Postman 操作步骤
- New Request →
POST→ URL 填上表地址 - Body → form-data
- 第一行:Key=
items,类型 Text,Value 粘贴manifest.json内容 - 第二行:Key=
files,类型 File,选择plm-pdf-demo.zip - Send
成功响应示例
{
"code": 200,
"msg": "操作成功",
"data": {
"productionOrderNo": "CP-25-103-XCL",
"savedDir": "D:/plm/pdf/CP-25-103-XCL",
"count": 2,
"items": [
{
"pdfPath": "drawings/part-a.pdf",
"materialCode": "MAT-001",
"materialName": "测试零件A",
"savedFileName": "MAT-001测试零件A.pdf",
"savedDir": "D:/plm/pdf/CP-25-103-XCL",
"savedPath": "D:/plm/pdf/CP-25-103-XCL/MAT-001测试零件A.pdf"
}
]
}
}
保存目录由配置 plm.pdf.base-dir 决定(默认 D:/plm/pdf)。
常见错误
| 返回 | 原因 |
|---|---|
| manifest不能为空 | 未传 items 或为空 |
| manifest不是合法JSON | items 不是合法 JSON |
| zip缺少以下PDF文件 | zip 里没有对应 pdfPath |
| zip包含未在manifest声明的PDF | zip 里多了未列出的 pdf |