Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_query
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linyangyang
smart_query
Commits
8c497c1f
Commit
8c497c1f
authored
May 27, 2025
by
linyangyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parents
Pipeline
#311
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
README.md
README.md
+107
-0
No files found.
README.md
0 → 100644
View file @
8c497c1f
# 电力运营日报数据处理系统
这是一个用于处理电力运营日报Word文档数据的系统。系统可以自动读取Word文档中的发电量指标和故障记录数据,并将其保存到PostgreSQL数据库中。
## 功能特点
-
自动读取并解析Word文档中的表格数据
-
支持从文件名中提取日期信息
-
智能处理发电量指标表数据
-
自动分类处理故障停机记录
-
数据直接保存到PostgreSQL数据库
## 系统要求
-
Python 3.11
-
PostgreSQL数据库
-
必要的Python包(见requirements.txt)
## 安装步骤
1.
确保已安装Python 3.11
2.
克隆或下载项目代码
3.
创建并激活虚拟环境(推荐):
```
bash
python
-m
venv venv
# Windows
venv
\S
cripts
\a
ctivate
# Linux/Mac
source
venv/bin/activate
```
4.
安装所需的Python包:
```
bash
pip
install
-r
requirements.txt
```
如果安装过程中遇到问题,可以尝试以下方法:
-
如果安装python-docx失败,可以尝试:
```
bash
pip
install
--upgrade
pip
pip
install
python-docx
--no-cache-dir
```
-
如果仍然有问题,可以尝试使用清华源:
```
bash
pip
install
-r
requirements.txt
-i
https://pypi.tuna.tsinghua.edu.cn/simple
```
## 使用方法
1.
将需要处理的Word文档(.docx格式)放在程序所在目录
2.
确保文档名称包含日期信息,格式如:
`XXX(23.5.1).docx`
3.
运行程序:
```
bash
python process_and_save.py
```
## 数据库配置
数据库连接信息在代码中配置:
-
主机:81.70.183.25
-
端口:15432
-
数据库:postgres
-
用户名:postgres
## 数据表结构
### 发电量指标表 (power_generation_indicators)
-
company_name: 公司名称
-
subsidiary_name: 子公司名称
-
daily_generation: 日发电量
-
monthly_generation: 月发电量
-
monthly_plan: 月计划
-
monthly_completion_rate: 月完成率
-
ytd_generation: 年累计发电量
-
yearly_plan: 年计划
-
yearly_completion_rate: 年完成率
-
last_year_generation: 去年同期
-
resource_indicator: 资源指标
-
monthly_utilization_hours: 月利用小时
-
auxiliary_power_rate: 厂用电率
-
power_limit: 限电量
-
fault_count: 故障次数
-
fault_power_loss: 故障损失电量
-
record_date: 记录日期
### 故障记录表 (fault_record)
-
type: 停机类型(1-计划性停机,2-7天内非计划停机,3-7天以上非计划停机)
-
sequence_number: 序号
-
plant_name: 电厂名称
-
equipment_code: 设备编号
-
shutdown_reason: 停机原因
-
fault_description: 故障描述
-
shutdown_start_time: 停机开始时间
-
total_shutdown_hours: 总停机时长
-
power_loss: 损失电量
-
processing_result: 处理结果
-
spare: 备注
-
record_date: 记录日期
## 注意事项
1.
确保Word文档格式规范,表格结构完整
2.
文件名中的日期信息格式必须正确
3.
数据库连接信息需要正确配置
4.
程序运行时会自动处理目录下所有.docx文件
5.
建议在虚拟环境中运行程序,以避免包版本冲突
6.
如果遇到包安装问题,请参考安装步骤中的解决方案
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment