feat: 移除PDI和订单号字段,新增设备巡检模块

- 从物料跟踪页面移除订单号列和表单字段
- 从导航菜单移除PDI管理,添加设备巡检
- 新增InspectionLocation和InspectionRecord后端模型和API
- 新增设备巡检前端页面(左侧点位列表,右侧设备和历史记录)
This commit is contained in:
2026-05-27 16:38:40 +08:00
commit 193da0018f
86 changed files with 11379 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
from sqlalchemy import Column, Integer, String, Float, DateTime, Text, ForeignKey, func
from app.database import Base
class DowntimeCategory(Base):
"""停机类别"""
__tablename__ = "downtime_categories"
id = Column(Integer, primary_key=True, index=True)
code = Column(String(20), unique=True, nullable=False)
name = Column(String(50), nullable=False)
category = Column(String(20), comment="大类: equipment/process/material/other")
description = Column(Text)
is_active = Column(Integer, default=1)
class DowntimeRecord(Base):
"""停机记录"""
__tablename__ = "downtime_records"
id = Column(Integer, primary_key=True, index=True)
category_id = Column(Integer, ForeignKey("downtime_categories.id"))
category_code = Column(String(20), index=True)
category_name = Column(String(50))
shift = Column(String(10), comment="班次")
shift_date = Column(DateTime, comment="班期")
start_time = Column(DateTime, nullable=False, comment="停机开始时间")
end_time = Column(DateTime, comment="停机结束时间")
duration = Column(Float, comment="停机时长min自动计算")
equipment_code = Column(String(30), comment="停机设备编号")
fault_desc = Column(Text, comment="故障描述")
action_taken = Column(Text, comment="处理措施")
root_cause = Column(Text, comment="根本原因")
reporter = Column(String(50), comment="报告人")
handler = Column(String(50), comment="处理人")
is_planned = Column(Integer, default=0, comment="是否计划停机")
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())