feat(inbound): handle batch duplication gracefully, support spec search, and auto-fill historical locations

This commit is contained in:
DXC
2026-04-08 09:41:04 +08:00
parent c58a0a6d14
commit 9380508a89
9 changed files with 141 additions and 15 deletions

View File

@ -145,7 +145,15 @@ def submit():
for field in list(data.keys()):
perm_code = field_to_perm.get(field)
if perm_code and perm_code not in user_permissions: data.pop(field, None)
new_stock = ProductInboundService.handle_inbound(data)
result = ProductInboundService.handle_inbound(data)
# 检查是否返回了业务校验错误
if isinstance(result, dict) and result.get('error'):
return jsonify({"code": 400, "msg": result['error']}), 400
new_stock = result
return jsonify({"code": 200, "msg": "入库成功", "data": new_stock.to_dict()})
except Exception as e:
traceback.print_exc()