对于成品的条形码进行功能实现
This commit is contained in:
@ -12,11 +12,12 @@ class StockProduct(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
base_id = db.Column(db.Integer, db.ForeignKey('material_base.id'), nullable=False)
|
||||
|
||||
# 身份标识
|
||||
sku = db.Column(db.String(100))
|
||||
production_date = db.Column(db.Date)
|
||||
barcode = db.Column(db.String(100))
|
||||
serial_number = db.Column(db.String(100))
|
||||
# SQL 无 batch_number
|
||||
# Note: 成品通常按SN管理,SQL定义无 batch_number
|
||||
|
||||
# 数量
|
||||
in_quantity = db.Column(db.Numeric(19, 4), default=0)
|
||||
@ -48,6 +49,9 @@ class StockProduct(db.Model):
|
||||
inspection_report_link = db.Column(db.Text)
|
||||
order_id = db.Column(db.String(100))
|
||||
|
||||
# [新增] 全局打印流水号 (用于跨表连续编号,对应 Sequence: global_print_seq)
|
||||
global_print_id = db.Column(db.Integer)
|
||||
|
||||
# 关系定义
|
||||
material = db.relationship('MaterialBase', back_populates='stock_products')
|
||||
|
||||
@ -98,5 +102,9 @@ class StockProduct(db.Model):
|
||||
|
||||
'sale_price': float(self.sale_price or 0),
|
||||
'inspection_report_link': self.inspection_report_link,
|
||||
'order_id': self.order_id
|
||||
'order_id': self.order_id,
|
||||
|
||||
# [新增] 返回全局打印ID及其格式化字符串
|
||||
'global_print_id': self.global_print_id,
|
||||
'global_print_id_str': f"{self.global_print_id:010d}" if self.global_print_id else ""
|
||||
}
|
||||
Reference in New Issue
Block a user