unis_manager/.workbuddy/memory/2026-09-16.md

49 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# 2026-09-16
## 拉取代码仓
- 从 `https://git.unissense.tech/mula/unis_manager` 克隆代码到本地工作目录 `C:\Users\Administrator\WorkBuddy\unis_manager`。
- 当前分支 `main`,最新提交 `e9854eb v 0.0.1`。直接克隆进空的工作目录(`git clone <url> .`)。
- 项目结构:FastAPI 后端(`app/`:main/config/models/schemas/routers/ai_parser/export 等)+ 原生 JS 前端(`web/`)+ SQLite 数据(`data/board.db`)+ 运维脚本(`scripts/`)。
- 快速启动:`./run.sh`。依赖见 `requirements.txt`(fastapi / uvicorn / sqlalchemy / pydantic / httpx / openpyxl / python-multipart)。
## 本地启动(Windows)
- `run.sh` 是为 macOS 写的(用了 `open`、`/Users/jiliu/...` 路径),Windows 上不能直接跑,需手动执行:
1. 装依赖:`C:/Users/Administrator/.workbuddy/binaries/python/envs/default/Scripts/python.exe -m pip install -r requirements.txt`(已安装成功)
2. 启动:`.../python.exe -m uvicorn app.main:app --host 127.0.0.1 --port 8770`
- `data/board.db` 已有数据,无需 init/import。
- 验证通过:`/health` 返回 `{"ok":true,"db":"sqlite"}`,首页 200,`/api/weekly` 正常返回周期与项目数据(当前周期「2026年9月第3周」)。
- 服务运行中:http://127.0.0.1:8770
## 切换分支到 develop-chezhiqi
- `git fetch --all` 拉到远端新分支 `origin/develop-chezhiqi`。
- `git checkout -b develop-chezhiqi origin/develop-chezhiqi` → 已建本地跟踪分支并切换。
- 该分支目前与 `main` 指向同一提交 `e9854eb v 0.0.1`(无代码差异),是后续开发的落脚分支。
- 注:`.workbuddy/memory/` 下新增的每日日志与 MEMORY.md 属未跟踪文件,切分支时会保留。
## 在 develop-chezhiqi 分支上重启服务
- 停掉旧进程(占用 8770 的 PID 8732;git bash 下 `taskkill //PID` 参数会被改写,改用 PowerShell `Stop-Process` 更稳)。
- 重新启动:`uvicorn app.main:app --host 127.0.0.1 --port 8770`,新 boot id `dfafea7f...`,`/health` ok、首页 200。
- 当前运行分支:`develop-chezhiqi`。
## 术语改名:定制交付 → 定开项目
用户要求把模块③的称呼「定制交付」统一改成「定开项目」(公司内部正式叫法就是“定开”,见 `import_excel.py` 里 `/Users/jiliu/WorkSpace/定开管理/` 路径)。范围确认为**全量统一** + **项目分类一起改**。
替换规则(顺序敏感,带排除):
1. `定制交付项目` → `定开项目`(先做,否则会出现“定开项目项目”)
2. `定制交付` → `定开项目`
3. `定制项目` → `定开项目`
4. `定制(?!开发|产品组)` → `定开`
共改 21 个文件、137 行,涉及 `web/{index.html,app.js,styles.css,icons.js}`、`app/**`、`scripts/**`、`run.sh`、`README.md`。界面用词已统一:定开项目 / 定开项目明细 / 定开合同额 / 定开记录 / 定开动态 / 定开待计收。
**数据库**:`categories` 表 id=4 的 `name` 由「定制交付」改为「定开项目」(关联 3 个项目)。改前备份 `data/board.db.bak-before-rename-*`。
**刻意保留不动的字面量**(改了会破坏数据/逻辑):
- `"定制开发"` —— 历史 Excel 里的项目容器名,出现在 `import_excel.py:KEY_PROJECTS`、`migrate_custom.py:CONTAINER`、`fix_period_split.py`、`add_entry_date.py` 的匹配条件里。
- `import_excel.py:47` 的元组键 `("定制","交付","项目支撑")` —— 匹配 Excel 原始分组名,只改了映射目标值。
- `constants.py:STAFF_GROUPS` 里的 `"定制产品组"` —— 团队名,`staff.group` 里有 7 人是这个值。
- 业务数据(`projects.name` / `tasks.name` / `updates.content` / `staff.note` / `custom_projects.name`)一律未动。
- 代码标识符(`custom` / `custom_projects` / API 路由 / CSS 类名)未动。
验证:`/api/categories` 返回 id=4 名称「定开项目」;首页 200;import 自检通过;服务已重启(boot `274bba9d...`)。