feat: 同步本地未提交的前后端更新(plan/quality/material/inspection/production 等模块)
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
from sqlalchemy import Column, Integer, String, Float, DateTime, Enum, Text, func
|
||||
from sqlalchemy import Column, Integer, String, Float, DateTime, Text, func
|
||||
from app.database import Base
|
||||
import enum
|
||||
|
||||
|
||||
class PlanStatus(str, enum.Enum):
|
||||
DRAFT = "draft" # 草稿
|
||||
CONFIRMED = "confirmed" # 已确认
|
||||
IN_PROGRESS = "in_progress" # 执行中
|
||||
COMPLETED = "completed" # 完成
|
||||
CANCELLED = "cancelled" # 取消
|
||||
# 计划状态:准备好/在线/生产中/产出
|
||||
PLAN_STATUS = ("ready", "online", "producing", "produced")
|
||||
|
||||
|
||||
class ProductionPlan(Base):
|
||||
@@ -17,16 +12,34 @@ class ProductionPlan(Base):
|
||||
|
||||
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="计划日期")
|
||||
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="下工序")
|
||||
|
||||
# 兼容历史字段
|
||||
shift = Column(String(10), comment="班次")
|
||||
plan_quantity = Column(Integer, default=0, comment="计划数量(卷)")
|
||||
plan_weight = Column(Float, default=0, comment="计划重量kg")
|
||||
actual_quantity = Column(Integer, default=0, comment="实际数量(卷)")
|
||||
actual_weight = Column(Float, default=0, comment="实际重量kg")
|
||||
status = Column(Enum(PlanStatus), default=PlanStatus.DRAFT)
|
||||
steel_grade = Column(String(30), comment="主要钢种")
|
||||
spec_range = Column(String(50), comment="规格范围")
|
||||
priority = Column(Integer, default=5, comment="优先级1-10")
|
||||
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())
|
||||
|
||||
Reference in New Issue
Block a user