(no commit message provided)
Co-authored-by: aider (openai/DeepSeek-V3.2-Thinking) <aider@aider.chat>
This commit is contained in:
@ -1,22 +1,23 @@
|
|||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|
||||||
|
# 首先创建主蓝图,避免子模块导入时出现循环依赖
|
||||||
|
inbound_bp = Blueprint('inbound', __name__)
|
||||||
|
|
||||||
|
# 导入各子模块的蓝图(此时 inbound_bp 已定义,子模块可以安全导入它)
|
||||||
from .buy import inbound_buy_bp
|
from .buy import inbound_buy_bp
|
||||||
from .semi import inbound_semi_bp
|
from .semi import inbound_semi_bp
|
||||||
from .base import inbound_base_bp
|
from .base import inbound_base_bp
|
||||||
from .product import inbound_product_bp
|
from .product import inbound_product_bp
|
||||||
from .inbound_summary import bp as inbound_summary_bp
|
from .inbound_summary import bp as inbound_summary_bp
|
||||||
|
|
||||||
# ★ [修正] 正确导入 service 模块的蓝图 (假设你在 service.py 里定义的是 bp)
|
# 导入 service 模块,使其路由装饰器可以正常注册到 inbound_bp 上
|
||||||
from .service import bp as inbound_service_bp
|
from . import service
|
||||||
|
|
||||||
inbound_bp = Blueprint('inbound', __name__)
|
# 注册子蓝图
|
||||||
|
|
||||||
# 注册原有模块
|
|
||||||
inbound_bp.register_blueprint(inbound_buy_bp, url_prefix='/buy')
|
inbound_bp.register_blueprint(inbound_buy_bp, url_prefix='/buy')
|
||||||
inbound_bp.register_blueprint(inbound_semi_bp, url_prefix='/semi')
|
inbound_bp.register_blueprint(inbound_semi_bp, url_prefix='/semi')
|
||||||
inbound_bp.register_blueprint(inbound_base_bp, url_prefix='/base')
|
inbound_bp.register_blueprint(inbound_base_bp, url_prefix='/base')
|
||||||
inbound_bp.register_blueprint(inbound_product_bp, url_prefix='/product')
|
inbound_bp.register_blueprint(inbound_product_bp, url_prefix='/product')
|
||||||
inbound_bp.register_blueprint(inbound_summary_bp, url_prefix='/summary')
|
inbound_bp.register_blueprint(inbound_summary_bp, url_prefix='/summary')
|
||||||
|
|
||||||
# ★ [修正] 注册 service 模块,前缀设为 /service
|
# service 模块的路由已经直接附加到 inbound_bp,无需再注册子蓝图
|
||||||
# 最终访问路径: /api/v1/inbound/service
|
|
||||||
inbound_bp.register_blueprint(inbound_service_bp, url_prefix='/service')
|
|
||||||
|
|||||||
@ -51,3 +51,42 @@ class TransBorrow(db.Model):
|
|||||||
'status': self.status,
|
'status': self.status,
|
||||||
'remark': self.remark
|
'remark': self.remark
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class TransRepair(db.Model):
|
||||||
|
__tablename__ = 'trans_repair'
|
||||||
|
|
||||||
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
sku = db.Column(db.String(100))
|
||||||
|
source_table = db.Column(db.String(50))
|
||||||
|
stock_id = db.Column(db.Integer)
|
||||||
|
|
||||||
|
fault_description = db.Column(db.Text)
|
||||||
|
repair_result = db.Column(db.Text)
|
||||||
|
repair_manager = db.Column(db.String(100))
|
||||||
|
|
||||||
|
cost_price = db.Column(db.Numeric(10, 2))
|
||||||
|
sale_price = db.Column(db.Numeric(10, 2))
|
||||||
|
|
||||||
|
arrival_date = db.Column(db.Date)
|
||||||
|
shipping_date = db.Column(db.Date)
|
||||||
|
|
||||||
|
created_at = db.Column(db.DateTime, default=datetime.now)
|
||||||
|
updated_at = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now)
|
||||||
|
|
||||||
|
def to_dict(self):
|
||||||
|
return {
|
||||||
|
'id': self.id,
|
||||||
|
'sku': self.sku,
|
||||||
|
'source_table': self.source_table,
|
||||||
|
'stock_id': self.stock_id,
|
||||||
|
'fault_description': self.fault_description,
|
||||||
|
'repair_result': self.repair_result,
|
||||||
|
'repair_manager': self.repair_manager,
|
||||||
|
'cost_price': float(self.cost_price) if self.cost_price is not None else None,
|
||||||
|
'sale_price': float(self.sale_price) if self.sale_price is not None else None,
|
||||||
|
'arrival_date': self.arrival_date.strftime('%Y-%m-%d') if self.arrival_date else None,
|
||||||
|
'shipping_date': self.shipping_date.strftime('%Y-%m-%d') if self.shipping_date else None,
|
||||||
|
'created_at': self.created_at.strftime('%Y-%m-%d %H:%M:%S') if self.created_at else None,
|
||||||
|
'updated_at': self.updated_at.strftime('%Y-%m-%d %H:%M:%S') if self.updated_at else None,
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user