57 lines
3.4 KiB
Python
57 lines
3.4 KiB
Python
from datetime import datetime
|
|
|
|
from sqlalchemy import Column, DateTime, Integer, Numeric, SmallInteger, String
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class BizQcMaterial(Base):
|
|
__tablename__ = "biz_qc_material"
|
|
|
|
id = Column(String(64), primary_key=True, comment="主键ID")
|
|
material_code = Column(String(64), nullable=False, comment="物料编码")
|
|
material_name = Column(String(200), nullable=False, comment="物料名称")
|
|
spec_model = Column(String(200), nullable=True, comment="规格型号")
|
|
unit = Column(String(32), nullable=True, comment="单位")
|
|
stock_qty = Column(Numeric(18, 4), nullable=False, default=0, comment="当前库存量")
|
|
warning_qty = Column(Numeric(18, 4), nullable=False, default=0, comment="预警库存量")
|
|
status = Column(String(1), nullable=False, default="1", comment="1-启用 0-停用")
|
|
tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
|
|
order_num = Column(Integer, nullable=True, comment="排序号")
|
|
remark = Column(String(512), nullable=True, comment="备注")
|
|
create_by = Column(String(64), nullable=True, comment="创建人id")
|
|
create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID")
|
|
create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
|
|
update_by = Column(String(64), nullable=True, comment="更新人id")
|
|
update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
|
|
del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
|
|
|
|
|
|
class BizQcMaterialUsage(Base):
|
|
__tablename__ = "biz_qc_material_usage"
|
|
|
|
id = Column(String(64), primary_key=True, comment="主键ID")
|
|
material_id = Column(String(64), nullable=False, comment="物料ID")
|
|
material_code = Column(String(64), nullable=True, comment="物料编码快照")
|
|
material_name = Column(String(200), nullable=True, comment="物料名称快照")
|
|
change_type = Column(String(16), nullable=False, comment="变动类型:use使用 / in入库")
|
|
change_qty = Column(Numeric(18, 4), nullable=False, comment="变动数量")
|
|
stock_after = Column(Numeric(18, 4), nullable=False, comment="变动后库存量")
|
|
qc_task_id = Column(String(64), nullable=True, comment="关联质检任务ID")
|
|
qc_task_no = Column(String(32), nullable=True, comment="质检任务号快照")
|
|
receiver = Column(String(64), nullable=True, comment="领用人(手动出库)")
|
|
purpose = Column(String(512), nullable=True, comment="用途/事由(手动出库)")
|
|
source_type = Column(
|
|
String(16),
|
|
nullable=False,
|
|
comment="来源:task_complete / manual_in / manual_out",
|
|
)
|
|
tenant_no = Column(String(64), nullable=False, default="zkxw", comment="租户编号")
|
|
remark = Column(String(512), nullable=True, comment="备注")
|
|
create_by = Column(String(64), nullable=True, comment="创建人id")
|
|
create_dept_id = Column(String(64), nullable=False, default="", comment="创建人部门ID")
|
|
create_time = Column(DateTime, nullable=False, default=datetime.now, comment="创建时间")
|
|
update_by = Column(String(64), nullable=True, comment="更新人id")
|
|
update_time = Column(DateTime, nullable=False, default=datetime.now, onupdate=datetime.now, comment="更新时间")
|
|
del_flag = Column(SmallInteger, nullable=False, default=0, comment="删除标记")
|