pl_dispatch_calendar.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. """独立手工派车记录,与运输计划无写入联动。"""
  2. from datetime import datetime
  3. from sqlalchemy import Column, Date, DateTime, Index, Integer, SmallInteger, String
  4. from app.core.database import Base
  5. class PlDispatchCalendar(Base):
  6. __tablename__ = "pl_dispatch_calendar"
  7. __table_args__ = (
  8. Index("idx_dispatch_calendar_month", "tenant_no", "del_flag", "dispatch_date"),
  9. Index("idx_dispatch_calendar_vehicle", "tenant_no", "vehicle_id", "dispatch_date"),
  10. )
  11. id = Column(String(64), primary_key=True, comment="主键UUID")
  12. dispatch_date = Column(Date, nullable=False, comment="派车日期")
  13. vehicle_id = Column(String(64), nullable=False, comment="车辆ID")
  14. license_plate = Column(String(20), nullable=False, comment="车牌快照")
  15. product_id = Column(String(64), nullable=False, comment="产品ID")
  16. product_name = Column(String(200), nullable=False, comment="产品名称快照")
  17. origin = Column(String(255), nullable=False, comment="始发地")
  18. destination = Column(String(255), nullable=False, comment="目的地")
  19. quantity = Column(String(16), nullable=True, comment="数量文本(吨),最多两位小数,不参与汇总")
  20. calendar_kind = Column(
  21. String(16), nullable=False, default="acid", server_default="acid",
  22. comment="日历类型:acid酸派车 alkali碱派车 other其他",
  23. )
  24. tenant_no = Column(String(64), nullable=False, comment="租户编号")
  25. order_num = Column(Integer, nullable=True, comment="排序号")
  26. remark = Column(String(500), nullable=True, comment="备注")
  27. create_by = Column(String(64), nullable=True, comment="创建人")
  28. create_dept_id = Column(String(64), nullable=False, default="", comment="创建部门")
  29. create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
  30. update_by = Column(String(64), nullable=True, comment="更新人")
  31. update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
  32. del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")