后端:
- 计划录入即「准备好」,队首(最早)自动「在线」(唯一)
- 新增上卷鞍座联动引擎 line_service:移动→鞍座→(有速度/投入生产)→生产中
→带头达2000m→生产完成并自动产生实绩、持久化运行数据
- 停机自动检测:线速度为0持续>10min 自动新增待补充停机记录,恢复后自动结束
- /plan/start=移动到鞍座, 新增 /plan/{id}/commit 投入生产, /plan/saddle/current,
/plan/seed 批量插入(轧制力模式);后台引擎循环自动推进
- 新增成本管理:CostRecord 模型 + /cost CRUD + 9 类成本项(乳化液/盐酸/碱/电/水/蒸汽…)
前端:
- 入口跟踪重构为单个上卷鞍座工位(实时速度/带头长度进度/投入生产)+待上卷卡片+队列,
计划列表/卡片/队列均可「移动」
- 新增成本管理页(成本项切换 + 柱+线图 + 明细表 + 时间筛选 + 新增),布局参考乳化液耗量统计
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
2.8 KiB
Python
58 lines
2.8 KiB
Python
from sqlalchemy import Column, Integer, String, Float, DateTime, Text, func, JSON
|
|
from app.database import Base
|
|
|
|
|
|
# 计划状态:准备好/在线/生产中/产出
|
|
PLAN_STATUS = ("ready", "online", "producing", "produced")
|
|
|
|
|
|
class ProductionPlan(Base):
|
|
"""生产计划"""
|
|
__tablename__ = "production_plans"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
plan_no = Column(String(30), unique=True, nullable=False, index=True, comment="计划号")
|
|
plan_date = Column(DateTime, nullable=False, comment="计划时间")
|
|
status = Column(String(20), default="ready", comment="状态: ready/online/producing/produced")
|
|
|
|
# 新结构:卷号 / 钢种 / 厚宽 / 偏差 / 工艺
|
|
cold_coil_no = Column(String(30), index=True, comment="冷卷号")
|
|
hot_coil_no = Column(String(30), index=True, comment="热卷号")
|
|
steel_grade = Column(String(30), comment="钢种")
|
|
incoming_thickness = Column(Float, comment="来料厚度 mm")
|
|
product_thickness = Column(Float, comment="产品厚度 mm")
|
|
deviation_upper = Column(Float, comment="偏差上限 mm")
|
|
deviation_lower = Column(Float, comment="偏差下限 mm")
|
|
incoming_width = Column(Float, comment="来料宽度 mm")
|
|
product_width = Column(Float, comment="产品宽度 mm")
|
|
packaging_req = Column(String(30), comment="包装要求")
|
|
trim_req = Column(String(30), comment="切边要求")
|
|
rolling_mode = Column(String(30), comment="轧制模式")
|
|
coil_diameter = Column(Float, comment="卷径 mm")
|
|
split_count = Column(Integer, default=1, comment="分卷数")
|
|
next_process = Column(String(30), comment="下工序")
|
|
incoming_weight = Column(Float, comment="来料重量 t")
|
|
incoming_od = Column(Float, comment="来料外径 mm")
|
|
split_weights = Column(JSON, comment="分卷重量 [t,...]")
|
|
|
|
# 上卷鞍座 / 生产联动
|
|
on_saddle = Column(Integer, default=0, comment="是否在上卷鞍座 0/1")
|
|
saddle_at = Column(DateTime, comment="移动到鞍座时间")
|
|
run_started_at = Column(DateTime, comment="投入生产(有速度)时间")
|
|
run_speed = Column(Float, default=0, comment="当前线速度 m/min")
|
|
run_length_m = Column(Float, default=0, comment="带头已生产长度 m")
|
|
produced_at = Column(DateTime, comment="生产完成时间")
|
|
|
|
# 兼容历史字段
|
|
shift = Column(String(10), comment="班次")
|
|
plan_quantity = Column(Integer, default=0)
|
|
plan_weight = Column(Float, default=0)
|
|
actual_quantity = Column(Integer, default=0)
|
|
actual_weight = Column(Float, default=0)
|
|
spec_range = Column(String(50))
|
|
priority = Column(Integer, default=5)
|
|
remark = Column(Text)
|
|
created_by = Column(String(50))
|
|
created_at = Column(DateTime, server_default=func.now())
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
|