TellmePdmsPluging/日志排查指南.md

120 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 日志排查指南PDMS 插件)
本文给后续开发使用,目标是快速定位导出/接口问题。
## 1. 先看哪些日志
### 1.1 PDMS Alert Summary最关键
- 典型内容:
- `Message: (...) CP: Syntax error`
- `Message: (...) Security error ... feature has not been checked out`
- `Command: EXPORT ...`
- 这是最直接的命令执行结果,优先级最高。
### 1.2 接口返回 JSON
- 本插件接口统一返回:
- `code`
- `message`
- `data`
- 导出失败时重点看 `message`,例如:
- `RVM导出失败未生成文件`
- `RVM导出异常: ...`
### 1.3 插件源码中的错误包装点
- 导出主逻辑:`Core/PdmsManager.cs`
- HTTP 包装:`Network/HttpServer.cs`
---
## 2. 日志/文档常见位置
### 2.1 PDMS 安装目录
- `C:\AVEVA\Plant\PDMS12.1.SP4\`
### 2.2 文档目录(命令语法依据)
- `C:\AVEVA\Plant\PDMS12.1.SP4\Documentation\`
- 常用已解包文档(若存在):
- `...\_decompiled\DRMPU\`EXPORT 命令完整语法)
- `...\_decompiled\EXPLA\`ExPLANT-A 示例)
### 2.3 项目目录
- 当前仓库根目录(本文件所在目录)
---
## 3. 常用检索命令Windows
先执行:
```powershell
chcp 65001
```
### 3.1 在项目里搜导出相关代码
```powershell
rg -n "export|EXPORT|RVM|IFC|ExportSystem|Selections|EXPORT FINISH" -S Core Network Models
```
### 3.2 在文档里搜命令语法
```powershell
rg -n -i "export command - full syntax|copying model data from pdms to review|export system|export file|export finish" "C:\AVEVA\Plant\PDMS12.1.SP4\Documentation" -S --glob "*.htm" --glob "*.html"
```
### 3.3 搜许可证/安全错误关键词
```powershell
rg -n -i "security error|feature has not been checked out|license|licen[cs]e" -S .
```
> Alert Summary 通常是人工“Save Alert Summary to File”保存的文本路径不固定。拿到文件后可直接用 `rg` 搜 `Message:` / `Command:`。
---
## 4. 一次标准排查流程
1. 看接口返回 `message`(先判断是语法错误、许可证错误,还是文件未生成)。
2. 打开 PDMS Alert Summary记录两行
- `Message: ...`
- `Command: ...`
3.`Message` 包含:
- `CP: Syntax error`:命令格式问题,去查 `DRMPU` 语法页。
- `feature has not been checked out`:许可证问题,找管理员处理 feature。
4. 对照 `Core/PdmsManager.cs` 的导出命令构建逻辑,确认实际发送命令序列。
5. 最后再看落盘路径:
- `ExportPath`
- `FileName`
- `FullPath`
- 文件是否真实存在。
---
## 5. 典型问题与判断
### 5.1 `CP: Syntax error`
- 说明 PDMS 不接受该命令写法。
- 优先根据文档语法修正,不要靠猜。
### 5.2 `Security error ... feature has not been checked out`
- 许可证未授权对应导出驱动(例如 `/EXPLANTA`)。
- 这是环境/授权问题,不是代码语法问题。
### 5.3 `导出失败,未生成文件`
- 命令可能执行但未产出文件,常见原因:
- 选择对象为空或不匹配;
- 导出驱动/许可问题;
- 输出目录权限或路径异常。
---
## 6. 开发约定建议
1. 提交 issue 时必须附:
- 接口请求体
- 接口响应 JSON
- Alert Summary 里的 `Message` + `Command`
2. 优先用文档佐证命令,不要直接改命令字符串“试错”。
3. 涉及导出驱动(`EXPORT SYSTEM ...`)时,先确认许可证 feature。