14 lines
593 B
Python
14 lines
593 B
Python
|
|
from sqlalchemy import Column, Integer, Float, DateTime, func
|
|||
|
|
from app.database import Base
|
|||
|
|
|
|||
|
|
|
|||
|
|
class LineState(Base):
|
|||
|
|
"""产线运行状态单例(id=1),用于停机自动检测。"""
|
|||
|
|
__tablename__ = "line_state"
|
|||
|
|
|
|||
|
|
id = Column(Integer, primary_key=True, index=True)
|
|||
|
|
speed = Column(Float, default=0, comment="当前线速度 m/min")
|
|||
|
|
zero_since = Column(DateTime, comment="速度为0的起始时间")
|
|||
|
|
open_downtime_id = Column(Integer, comment="当前未结束的自动停机记录id")
|
|||
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|