对于半成品的条形码进行更改
This commit is contained in:
@ -5,7 +5,6 @@ from app.extensions import db
|
||||
class StockSemi(db.Model):
|
||||
"""
|
||||
半成品入库库存表
|
||||
对应数据库表: stock_semi
|
||||
"""
|
||||
__tablename__ = 'stock_semi'
|
||||
|
||||
@ -16,7 +15,7 @@ class StockSemi(db.Model):
|
||||
production_date = db.Column(db.Date)
|
||||
barcode = db.Column(db.String(100))
|
||||
serial_number = db.Column(db.String(100))
|
||||
# SQL 无 batch_number,此处移除
|
||||
batch_number = db.Column(db.String(100))
|
||||
|
||||
# 数量
|
||||
in_quantity = db.Column(db.Numeric(19, 4), default=0)
|
||||
@ -27,20 +26,27 @@ class StockSemi(db.Model):
|
||||
status = db.Column(db.String(50))
|
||||
warehouse_location = db.Column(db.String(100))
|
||||
|
||||
# 半成品特有字段 (SQL 字段映射)
|
||||
bom_code = db.Column('bom_id', db.String(100)) # 映射 SQL: bom_id
|
||||
# 半成品特有字段
|
||||
bom_code = db.Column('bom_id', db.String(100))
|
||||
bom_version = db.Column(db.String(50))
|
||||
work_order_code = db.Column('work_order_id', db.String(100)) # 映射 SQL: work_order_id
|
||||
work_order_code = db.Column('work_order_id', db.String(100))
|
||||
|
||||
raw_material_cost = db.Column(db.Numeric(19, 4), default=0)
|
||||
manual_cost = db.Column(db.Numeric(19, 4), default=0)
|
||||
total_price = db.Column(db.Numeric(19, 4), default=0)
|
||||
|
||||
production_manager = db.Column('producer_name', db.String(100)) # 映射 SQL: producer_name
|
||||
production_manager = db.Column('producer_name', db.String(100))
|
||||
production_start_time = db.Column(db.DateTime)
|
||||
production_end_time = db.Column(db.DateTime)
|
||||
production_time_range = db.Column(db.String(255))
|
||||
|
||||
quality_status = db.Column(db.String(50))
|
||||
quality_report_link = db.Column(db.Text)
|
||||
detail_link = db.Column(db.Text)
|
||||
remark = db.Column(db.Text)
|
||||
|
||||
# [新增] 全局打印流水号 (请务必确保数据库已添加此列)
|
||||
global_print_id = db.Column(db.Integer)
|
||||
|
||||
# 关系定义
|
||||
material = db.relationship('MaterialBase', back_populates='stock_semis')
|
||||
@ -63,6 +69,7 @@ class StockSemi(db.Model):
|
||||
'inbound_date': self.production_date.strftime('%Y-%m-%d') if self.production_date else '',
|
||||
'barcode': self.barcode,
|
||||
'serial_number': self.serial_number,
|
||||
'batch_number': self.batch_number,
|
||||
'warehouse_loc': self.warehouse_location,
|
||||
'status': self.status,
|
||||
|
||||
@ -81,13 +88,15 @@ class StockSemi(db.Model):
|
||||
'unit_total_cost': unit_total,
|
||||
'production_manager': self.production_manager,
|
||||
'production_time_range': self.production_time_range,
|
||||
# 简单的时间拆分逻辑,防止 split 报错
|
||||
'production_start_time': self.production_time_range.split(' ~ ')[
|
||||
0] if self.production_time_range and ' ~ ' in self.production_time_range else '',
|
||||
'production_end_time': self.production_time_range.split(' ~ ')[
|
||||
1] if self.production_time_range and ' ~ ' in self.production_time_range else '',
|
||||
|
||||
'production_start_time': str(self.production_start_time) if self.production_start_time else '',
|
||||
'production_end_time': str(self.production_end_time) if self.production_end_time else '',
|
||||
|
||||
'quality_status': self.quality_status,
|
||||
'quality_report_link': self.quality_report_link,
|
||||
'detail_link': self.detail_link
|
||||
'detail_link': self.detail_link,
|
||||
'remark': self.remark,
|
||||
|
||||
'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