# ObjectPRX_WX **Repository Path**: uesoft/objectprx_wx ## Basic Information - **Project Name**: ObjectPRX_WX - **Description**: 这是AutoPDMS(ObjectPRX)的跨平台版本(VC++2005改写为wxWidgets-3.2.4) - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: http://www.uesoft.com - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-21 - **Last Updated**: 2026-08-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # ObjectPRX_W_X - Cross-Platform Object Persistence Framework ObjectPRX_W_X 是将原 VC++2005/MFC 项目 **ObjectPRX** 移植到 **wxWidgets 3.2.4** 的跨平台版本。 --- ## ✅ Phase 0 — 核心框架(已完成) | 原MFC模块 | 跨平台版本 | 说明 | |-----------|------------|------| | `afx.h` / `afxtempl.h` | `ShareHeader.h` | 基础类型,CString→wxString | | `Object_.h` | `Object_.h` + `Object_.cpp` | 自研RTTI,UE_DECLARE_DYNAMIC | | `UeObjectId.h` | `UeObjectId.h` + `UeObjectId.cpp` | 对象ID(env/obj格式) | | `Persistent.h` | `Persistent.h` + `Persistent.cpp` | 持久化基类,SQLite框架 | | `PersistentRegister.h` | `PersistentRegister.h` | 类注册系统(单例) | | `libCommon.h` | `libCommon.h` | 公共函数库 | | `UEList.h` | `UEList.h` | CList→std::list,UEArray→std::vector | | `UEADO.h` (import msado15.dll) | `wxSQLiteWrapper.h` + `.cpp` | ADO→SQLite3 C API | --- ## ✅ Phase 1 — 数据库与域对象(已完成) | 模块 | 文件 | 说明 | |------|------|------| | 数据库对象层 | `DB.h` + `DB.cpp` | 替换CDatabase,单例模式+事务支持 | | 内存数据库 | `DB.h` (MDB class) | 对象缓存层,按ID/类查询 | | 节点对象基类 | `UeNodeObject.h` + `.cpp` | 树形结构(parent/children) | | 管理叶对象 | `AdminLeafObject.h` + `.cpp` | 管理节点(Code/Category/Enabled) | | 管理容器 | `AdminLeafObject.h` | 容器节点(内含Leaf集合) | | 属性注册系统 | `PersistentAttribute.h` + `.cpp` | REGISTER_ATT_DECLARE SQLite序列化 | | 属性类型枚举 | `PersistentAttribute.h` | Int/Long/String/Double/Bool/ObjectId | --- ## ✅ Phase 2 — 域对象扩展(已完成) | 域对象 | 文件 | 说明 | |--------|------|------| | User | `User.h` + `User.cpp` | 用户对象(用户名/密码Hash/Email/角色) | | Role | `Role.h` + `Role.cpp` | 角色对象(角色名/描述/权限集合) | | Permission | `Permission.h` + `Permission.cpp` | 权限对象(资源+操作,如"user:create") | ### 属性注册示例 ```cpp class User : public PersistentWithAttributes { UE_DECLARE_DYNAMIC(User) // ... void RegisterAttributes() override { RegisterString(wxT("username"), offsetof(User, m_strUserName)); RegisterString(wxT("password_hash"), offsetof(User, m_strPasswordHash)); RegisterString(wxT("email"), offsetof(User, m_strEmail)); RegisterBool(wxT("active"), offsetof(User, m_bActive)); RegisterInt(wxT("login_count"), offsetof(User, m_nLoginCount)); } }; ``` ### SQLite序列化实现 - `LoadFromDB()`: 从SQLite读取属性值,通过`attr.fromString()`自动填充对象 - `SaveToDB()`: 将属性值通过`attr.toString()`转为字符串,执行INSERT/REPLACE - `GenerateCreateTableSQL()`: 根据注册属性自动生成CREATE TABLE语句 --- ## ✅ Phase 3 — 业务域对象(已完成) | 域对象 | 文件 | 说明 | |--------|------|------| | Document | `Document.h` + `Document.cpp` | 文档对象(DocName/DocType/Status/Owner/Folder/BLOB内容) | | Folder | `Folder.h` + `Folder.cpp` | 文件夹对象(继承UeNodeObject树形结构+属性持久化) | | Workflow | `Workflow.h` + `Workflow.cpp` | 工作流对象(工作流定义JSON/状态/版本管理) | ### Document 特点 - 继承 `PersistentWithAttributes` - 支持 **BLOB 内容存储**(`LoadContent`/`SaveContent` 使用 `sqlite3_bind_blob`) - 文档状态枚举:DRAFT / PENDING / APPROVED / REJECTED / ARCHIVED - 文档类型枚举:TEXT / RICH_TEXT / PDF / SPREADSHEET / IMAGE ### Folder 特点 - 继承 `UeNodeObject`(树形结构:parent/children) - 结合 `PersistentWithAttributes` 实现属性持久化 - 文件夹类型:USER / SHARED / SYSTEM / INBOX / TRASH ### Workflow 特点 - 继承 `PersistentWithAttributes` - 工作流定义存储为 JSON 字符串 - 自动版本管理(每次 SaveToDB 自动递增版本号) - 状态管理:DISABLED / ACTIVE / TESTING / DEPRECATED / ARCHIVED --- ## ✅ Phase 4 — 报表与仪表盘(已完成) | 域对象 | 文件 | 说明 | |--------|------|------| | Report | `Report.h` + `Report.cpp` | 报表对象(SQL查询/参数/输出格式/布局JSON) | | Dashboard | `Dashboard.h` + `Dashboard.cpp` | 仪表盘对象(布局JSON/Widget配置/主题/刷新间隔) | ### Report 特点 - 继承 `PersistentWithAttributes` - 支持多种输出格式:TABLE / CHART / CROSS_TAB / SUMMARY / PDF / EXCEL - 查询参数存储为 JSON(支持运行时绑定) - 系统报表标志(不可删除) ### Dashboard 特点 - 继承 `PersistentWithAttributes` - 布局和 Widget 配置均存储为 JSON - 支持类型:USER / SHARED / SYSTEM / DEPARTMENT - 支持自动刷新(cron 表达式或秒数) - 可设置默认仪表盘 --- ## ✅ Phase 5 — 审批与通知(已完成) | 域对象 | 文件 | 说明 | |--------|------|------| | Approval | `Approval.h` + `Approval.cpp` | 审批对象(多步骤审批/状态/优先级/记录JSON) | | Notification | `Notification.h` + `Notification.cpp` | 通知对象(多接收者/类型/优先级/过期时间) | ### Approval 特点 - 继承 `PersistentWithAttributes` - 支持多步骤审批(ApproverIds JSON 数组 + CurrentStep) - 审批状态:DRAFT / PENDING / APPROVED / REJECTED / CANCELLED / RETURNED - 优先级:LOW / NORMAL / HIGH / URGENT - 审批记录存储为 JSON(RecordsJSON) ### Notification 特点 - 继承 `PersistentWithAttributes` - 支持多个接收者(RecipientIds JSON 数组) - 通知类型:SYSTEM / APPROVAL / WORKFLOW / DOCUMENT / MESSAGE / ALERT - 优先级:LOW / NORMAL / HIGH / URGENT - 支持过期时间(ExpiresAt ISO 8601) 和操作链接(ActionURL) --- ## 编译依赖 - **wxWidgets 3.2.4** (或 3.2.x) - **SQLite3** (系统库或 bundled) - **CMake 3.16+** - **C++17** 编译器 ## 构建步骤 (WSL2 Ubuntu / Linux) ```bash cd ~/ObjectPRX_W_X sudo apt install cmake build-essential libsqlite3-dev wx3.2-dev mkdir -p build && cd build cmake .. make -j4 ``` ## 运行测试 ```bash ./build/test_persistent ``` --- ## 下一步 (Phase 6) - [ ] 移植更多业务模块(如 Schedule、Task、Calendar 等) - [ ] **WSL2 Ubuntu 完整编译验证**(完成上述构建步骤) - [ ] 编写更多单元测试(覆盖 Approval/Notification 逻辑) - [ ] 完善角色-权限-用户关联表的 SQLite 实现 - [ ] 实现对象间关联延迟加载(如 Folder→Documents) - [ ] 添加数据库迁移/升级脚本 - [ ] 实现审批工作流引擎(状态机) --- ## 架构说明 - **完全保留原项目自研RTTI系统**,只替换MFC依赖 - **持久化层改用SQLite**(参考AIBuddy项目的裸SQLite3 C API) - **wxWidgets仅用于基础类型和字符串**,不依赖wx专用持久化 - **属性注册系统**自动生成CREATE TABLE SQL,运行时序列化/反序列化 - **域对象继承体系**: ``` Persistent → PersistentWithAttributes → User/Role/Permission/Document/Workflow/Report/Dashboard/Approval/Notification Persistent → UeNodeObject → AdminLeafObject/AdminContainerObject/Folder ``` --- *Created: 2026-05-20* *Phase 0: 2026-05-20* *Phase 1: 2026-05-21* *Phase 2: 2026-05-21* *Phase 3: 2026-05-20* *Phase 4: 2026-05-21* *Phase 5: 2026-05-21* *Status: ✅ Phase 0 + 1 + 2 + 3 + 4 + 5 Complete*