入库操作
This commit is contained in:
25
app/models/stock.py
Normal file
25
app/models/stock.py
Normal file
@ -0,0 +1,25 @@
|
||||
from app.extensions import db
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class StockBuy(db.Model):
|
||||
__tablename__ = 'stock_buy'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
material_id = db.Column(db.Integer, db.ForeignKey('material_base.id'), nullable=False)
|
||||
inbound_date = db.Column(db.DateTime, default=datetime.now)
|
||||
barcode = db.Column(db.String(100))
|
||||
batch_no = db.Column(db.String(100))
|
||||
|
||||
# 数量相关 (使用 Numeric 对应数据库的 NUMERIC)
|
||||
qty_inbound = db.Column(db.Numeric(19, 4), default=0)
|
||||
qty_current = db.Column(db.Numeric(19, 4), default=0)
|
||||
qty_available = db.Column(db.Numeric(19, 4), default=0)
|
||||
|
||||
price_unit = db.Column(db.Numeric(19, 4), default=0)
|
||||
price_total = db.Column(db.Numeric(19, 4), default=0)
|
||||
supplier_name = db.Column(db.String(255))
|
||||
warehouse_loc = db.Column(db.String(100))
|
||||
|
||||
# 建立关联,方便查询物料详情
|
||||
material = db.relationship('MaterialBase', backref='buy_stocks')
|
||||
Reference in New Issue
Block a user