Files
pickling-mes/backend/app/models/energy.py
wangyu 193da0018f feat: 移除PDI和订单号字段,新增设备巡检模块
- 从物料跟踪页面移除订单号列和表单字段
- 从导航菜单移除PDI管理,添加设备巡检
- 新增InspectionLocation和InspectionRecord后端模型和API
- 新增设备巡检前端页面(左侧点位列表,右侧设备和历史记录)
2026-05-27 16:38:40 +08:00

37 lines
1.6 KiB
Python

from sqlalchemy import Column, Integer, String, Float, DateTime, Text, func
from app.database import Base
class EnergyRecord(Base):
"""班次能耗记录"""
__tablename__ = "energy_records"
id = Column(Integer, primary_key=True, index=True)
shift = Column(String(10), nullable=True, comment="班次 甲/乙/丙/丁")
shift_date = Column(DateTime, nullable=True, comment="班期")
# 产量
production_weight_kg = Column(Float, nullable=True, comment="本班产量 kg")
# 电力
power_consumption_kwh = Column(Float, nullable=True, comment="电耗 kWh")
power_unit = Column(Float, nullable=True, comment="电耗单耗 kWh/t")
# 蒸汽
steam_consumption_kg = Column(Float, nullable=True, comment="蒸汽消耗 kg")
steam_unit = Column(Float, nullable=True, comment="蒸汽单耗 kg/t")
# 盐酸
acid_consumption_kg = Column(Float, nullable=True, comment="盐酸消耗 kg")
acid_unit = Column(Float, nullable=True, comment="酸耗单耗 kg/t")
# 冷却水
cooling_water_m3 = Column(Float, nullable=True, comment="冷却水 m³")
water_unit = Column(Float, nullable=True, comment="冷却水单耗 m³/t")
# 各槽HCl平均浓度 (JSON字符串, e.g. '[180,175,170,165,160,155]')
acid_conc_avg = Column(Text, nullable=True, comment="各槽HCl平均浓度 JSON g/L")
created_at = Column(DateTime, server_default=func.now())
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())