增加入库记录页面,同时修正三组入库的时间问题
This commit is contained in:
@ -4,6 +4,8 @@ from .semi import inbound_semi_bp
|
||||
from .base import inbound_base_bp
|
||||
# 导入 product
|
||||
from .product import inbound_product_bp
|
||||
# ★ [新增] 导入 summary
|
||||
from .inbound_summary import bp as inbound_summary_bp
|
||||
|
||||
inbound_bp = Blueprint('inbound', __name__)
|
||||
|
||||
@ -11,4 +13,7 @@ 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_base_bp, url_prefix='/base')
|
||||
# 挂载 product,前缀改为 /product
|
||||
inbound_bp.register_blueprint(inbound_product_bp, url_prefix='/product')
|
||||
inbound_bp.register_blueprint(inbound_product_bp, url_prefix='/product')
|
||||
|
||||
# ★ [新增] 挂载 summary, url 变成 /api/v1/inbound/summary/list
|
||||
inbound_bp.register_blueprint(inbound_summary_bp, url_prefix='/summary')
|
||||
35
inventory-backend/app/api/v1/inbound/inbound_summary.py
Normal file
35
inventory-backend/app/api/v1/inbound/inbound_summary.py
Normal file
@ -0,0 +1,35 @@
|
||||
from flask import Blueprint, request, jsonify
|
||||
from app.services.inbound.inbound_summary_service import InboundSummaryService
|
||||
|
||||
# 定义蓝图
|
||||
bp = Blueprint('inbound_summary', __name__)
|
||||
|
||||
@bp.route('/list', methods=['GET'])
|
||||
def get_list():
|
||||
try:
|
||||
# 获取参数
|
||||
page = request.args.get('page', 1, type=int)
|
||||
per_page = request.args.get('per_page', 20, type=int) # 默认每页20
|
||||
keyword = request.args.get('keyword', '')
|
||||
start_date = request.args.get('start_date')
|
||||
end_date = request.args.get('end_date')
|
||||
source_type = request.args.get('source_type') # 可选:筛选 specific table
|
||||
|
||||
result = InboundSummaryService.get_list(
|
||||
page=page,
|
||||
per_page=per_page,
|
||||
keyword=keyword,
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
source_type=source_type
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
'code': 200,
|
||||
'msg': 'success',
|
||||
'data': result
|
||||
})
|
||||
except Exception as e:
|
||||
# 生产环境建议记录详细日志
|
||||
print(f"Inbound Summary Error: {str(e)}")
|
||||
return jsonify({'code': 500, 'msg': str(e)}), 500
|
||||
Reference in New Issue
Block a user