质量管理: 由平铺记录改为任务制工作流(qc_task/qc_task_item/qc_defect三表) 设备巡检: 由点位+记录改为巡检模板制(eqp_checklist/item/record/detail四表) 前端: Quality.vue 支持任务列表+检验项详情+缺陷记录双Tab 前端: Inspection.vue 支持模板管理+项目维护+巡检记录+明细查看 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
55 lines
2.4 KiB
Python
55 lines
2.4 KiB
Python
from sqlalchemy import Column, Integer, String, DateTime, Text, Boolean, ForeignKey, func
|
|
from app.database import Base
|
|
|
|
|
|
class EqpChecklist(Base):
|
|
"""设备巡检模板"""
|
|
__tablename__ = "eqp_checklist"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(100), nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
equipment_code = Column(String(30), nullable=True, index=True)
|
|
equipment_name = Column(String(100), nullable=True)
|
|
period = Column(String(20), default="daily") # daily/weekly/monthly
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|
|
|
|
|
|
class EqpChecklistItem(Base):
|
|
"""巡检模板项目"""
|
|
__tablename__ = "eqp_checklist_item"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
checklist_id = Column(Integer, ForeignKey("eqp_checklist.id"), nullable=False, index=True)
|
|
item_name = Column(String(100), nullable=False)
|
|
item_standard = Column(String(200), nullable=True)
|
|
sort_order = Column(Integer, default=0)
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
|
|
|
|
class EqpInspectionRecord(Base):
|
|
"""巡检记录"""
|
|
__tablename__ = "eqp_inspection_record"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
checklist_id = Column(Integer, ForeignKey("eqp_checklist.id"), nullable=False, index=True)
|
|
checklist_name = Column(String(100), nullable=True)
|
|
inspector = Column(String(50), nullable=False)
|
|
inspect_time = Column(DateTime, nullable=False)
|
|
status = Column(String(20), default="ok") # ok/issue/urgent
|
|
overall_result = Column(String(20), nullable=True) # pass/fail
|
|
remark = Column(Text, nullable=True)
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
|
|
|
|
class EqpInspectionDetail(Base):
|
|
"""巡检记录明细"""
|
|
__tablename__ = "eqp_inspection_detail"
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
record_id = Column(Integer, ForeignKey("eqp_inspection_record.id"), nullable=False, index=True)
|
|
checklist_item_id = Column(Integer, nullable=True)
|
|
item_name = Column(String(100), nullable=False)
|
|
actual_value = Column(String(100), nullable=True)
|
|
is_ok = Column(Boolean, default=True)
|
|
notes = Column(Text, nullable=True)
|
|
created_at = Column(DateTime, server_default=func.now())
|