initial commit

This commit is contained in:
cnbugs
2026-05-29 19:24:43 +08:00
commit 188edfa287
12 changed files with 1187 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
from sqlalchemy import Column, Integer, String, Float, DateTime, Text, func
from database import Base
class Inventory(Base):
"""库存表"""
__tablename__ = "inventory"
id = Column(Integer, primary_key=True, index=True, autoincrement=True, comment="序号")
cInvCode = Column(String(100), nullable=False, index=True, comment="产品编码")
supplier = Column(String(200), nullable=True, comment="供应商")
casing_label_remark = Column(Text, nullable=True, comment="现外壳&标签&备注")
batch = Column(String(100), nullable=True, comment="批次")
current_remaining = Column(Float, default=0, comment="当前时间剩余")
storage_location = Column(String(200), nullable=True, comment="存货地点")
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
class TransactionLog(Base):
"""出入库记录表"""
__tablename__ = "transaction_log"
id = Column(Integer, primary_key=True, index=True, autoincrement=True)
inventory_id = Column(Integer, nullable=False, index=True, comment="库存ID")
cInvCode = Column(String(100), nullable=False, index=True, comment="产品编码")
type = Column(String(10), nullable=False, comment="类型: in/out")
quantity = Column(Float, nullable=False, comment="数量")
remark = Column(Text, nullable=True, comment="备注")
created_at = Column(DateTime, server_default=func.now(), comment="操作时间")