feat: 日志管理 + 质保书生产过程数据图表

- 新增 PlanLog 模型与 /logs API;计划新增/移动/投入生产/生产完成/删除均记录
  (时间/计划号/卷号/操作/状态变化/位置/操作人/说明)
- 新增「日志管理」页面 + 路由 + 导航
- 质保书:把生产完成持久化的实时数据(process_data)按单位分组生成多组柱状图

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-29 16:31:41 +08:00
parent 1073379b09
commit 18d78d986c
12 changed files with 310 additions and 8 deletions

View File

@@ -11,6 +11,7 @@ from app.models.energy import EnergyRecord
from app.models.inspection import EqpChecklist, EqpChecklistItem, EqpInspectionRecord, EqpInspectionDetail
from app.models.line_state import LineState
from app.models.cost import CostRecord
from app.models.plan_log import PlanLog
__all__ = [
"User",
@@ -24,5 +25,5 @@ __all__ = [
"QcTask", "QcTaskItem", "QcDefect",
"EnergyRecord",
"EqpChecklist", "EqpChecklistItem", "EqpInspectionRecord", "EqpInspectionDetail",
"LineState", "CostRecord",
"LineState", "CostRecord", "PlanLog",
]

View File

@@ -0,0 +1,19 @@
from sqlalchemy import Column, Integer, String, DateTime, Text, func
from app.database import Base
class PlanLog(Base):
"""计划操作/状态变更日志"""
__tablename__ = "plan_logs"
id = Column(Integer, primary_key=True, index=True)
plan_id = Column(Integer, index=True, comment="计划id")
plan_no = Column(String(30), index=True, comment="计划号")
coil_no = Column(String(30), comment="冷卷号")
action = Column(String(20), comment="操作: 新增/移动/投入生产/生产完成/删除")
from_status = Column(String(20), comment="原状态")
to_status = Column(String(20), comment="新状态")
position = Column(String(40), comment="变化位置")
operator = Column(String(50), comment="操作人")
detail = Column(Text, comment="说明")
created_at = Column(DateTime, server_default=func.now(), index=True)