初始提交:项目基础结构
- backend: FastAPI 后端服务 (Python) - frontend: React + Tauri 前端应用 - docker-compose.yml: 容器编排配置
This commit is contained in:
31
backend/app/models/production_order.py
Normal file
31
backend/app/models/production_order.py
Normal file
@ -0,0 +1,31 @@
|
||||
"""生产订单模型"""
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from sqlalchemy import String, DateTime
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.models.base import Base
|
||||
|
||||
|
||||
class ProductionOrder(Base):
|
||||
__tablename__ = "production_orders"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), primary_key=True, default=uuid.uuid4,
|
||||
)
|
||||
order_no: Mapped[str] = mapped_column(
|
||||
String(64), unique=True, index=True, nullable=False, comment="订单编号",
|
||||
)
|
||||
customer_info: Mapped[str | None] = mapped_column(
|
||||
String(500), nullable=True, comment="客户信息",
|
||||
)
|
||||
status: Mapped[str] = mapped_column(
|
||||
String(50), nullable=False, default="pending", comment="订单状态",
|
||||
)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), comment="创建时间",
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<ProductionOrder {self.order_no}>"
|
||||
Reference in New Issue
Block a user