42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
|
#!/usr/bin/env python
|
|||
|
# -*- coding: utf-8 -*-
|
|||
|
|
|||
|
"""
|
|||
|
库位操作记录模型
|
|||
|
记录库位相关的操作日志
|
|||
|
"""
|
|||
|
|
|||
|
from sqlalchemy import Column, String, Text, DateTime, func
|
|||
|
from sqlalchemy.dialects.postgresql import UUID
|
|||
|
from data.models.base import BaseModel
|
|||
|
import uuid
|
|||
|
|
|||
|
|
|||
|
class StorageLocationLog(BaseModel):
|
|||
|
"""
|
|||
|
库位操作记录表
|
|||
|
记录库位相关的所有操作
|
|||
|
"""
|
|||
|
|
|||
|
__tablename__ = "storage_location_logs"
|
|||
|
|
|||
|
# 主键ID
|
|||
|
# id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, comment="记录ID")
|
|||
|
|
|||
|
# 操作时间
|
|||
|
operation_time = Column(DateTime, nullable=False, default=func.now(), comment="操作时间")
|
|||
|
|
|||
|
# 操作人
|
|||
|
operator = Column(String(100), nullable=False, comment="操作人")
|
|||
|
|
|||
|
# 操作类型/功能
|
|||
|
operation_type = Column(String(50), nullable=False, comment="操作类型")
|
|||
|
|
|||
|
# 影响的库位列表(JSON格式存储)
|
|||
|
affected_storage_locations = Column(Text, nullable=False, comment="影响的库位列表,JSON格式")
|
|||
|
|
|||
|
# 操作描述
|
|||
|
description = Column(String(500), nullable=True, comment="操作描述")
|
|||
|
|
|||
|
def __repr__(self):
|
|||
|
return f"<StorageLocationLog(id={self.id}, operator={self.operator}, operation_type={self.operation_type})>"
|