半成品入库与出库相关联

This commit is contained in:
dxc
2026-02-05 11:51:25 +08:00
parent 1e5627dc0a
commit bf8cf37ff9
3 changed files with 104 additions and 58 deletions

View File

@ -8,7 +8,7 @@ inbound_semi_bp = Blueprint('inbound_semi', __name__)
# ------------------------------------------------------------------
# 0. 基础物料搜索 (复用逻辑)
# 0. 基础物料搜索
# ------------------------------------------------------------------
@inbound_semi_bp.route('/search-base', methods=['GET'])
def search_base():
@ -18,7 +18,6 @@ def search_base():
"""
try:
keyword = request.args.get('keyword', '')
# 这里复用 Service 中的搜索逻辑
data = SemiInboundService.search_base_material(keyword)
return jsonify({
"code": 200,
@ -38,10 +37,13 @@ def get_list():
try:
page = request.args.get('page', 1, type=int)
limit = request.args.get('pageSize', 15, type=int)
# 支持按关键字搜索BOM号、工单号、SN、批号等
keyword = request.args.get('keyword', '')
result = SemiInboundService.get_list(page, limit, keyword)
# 获取状态列表参数
statuses_str = request.args.get('statuses', '')
statuses = statuses_str.split(',') if statuses_str else []
result = SemiInboundService.get_list(page, limit, keyword, statuses)
return jsonify({"code": 200, "msg": "success", "data": result})
except Exception as e:
traceback.print_exc()
@ -49,7 +51,7 @@ def get_list():
# ------------------------------------------------------------------
# 2. 新增半成品入库 (修改:返回创建的对象数据)
# 2. 新增半成品入库
# ------------------------------------------------------------------
@inbound_semi_bp.route('/submit', methods=['POST'])
def submit():
@ -58,10 +60,8 @@ def submit():
if not data:
return jsonify({"code": 400, "msg": "No data"}), 400
# 修改:调用 Service 处理入库,获取新创建的对象
new_stock = SemiInboundService.handle_inbound(data)
# 修改返回成功信息以及新创建的数据包含生成的ID和SKU供前端打印使用
return jsonify({
"code": 200,
"msg": "入库成功",