kboss/b/invoice/save_user_invoice.dspy
2025-07-16 14:27:17 +08:00

39 lines
1.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async def save_invoice_info(ns={}):
"""
保存用户发票信息
:param ns:
:return:
"""
data = {}
try:
data['orgid'] = ns['orgid']
data['user_id'] = ns['user_id']
data['client_id'] = ns['client_id']
# `title_type` int(1) DEFAULT NULL COMMENT '抬头类型1个人2公司3组织',
data['title_type'] = ns['title_type']
if data['title_type'] != 1:
data['contract_number'] = ns['contract_number']
data['invoice_type'] = ns['invoice_type']
data['invoice_title'] = ns['invoice_title']
data['tax_no'] = ns['tax_no']
ns['del_flg'] = 0
ns['id'] = uuid()
except Exception as e:
return {"status": False, "msg": f"get key error, please check key:{str(e)}"}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
await sor.C('invoice_info', ns)
return {"status": True, "msg": "ok"}
except Exception as e:
if "for key " in str(e):
return {"status":False,"msg":"合同号重复,无法录入数据,请联系管理员"}
info(f"save_invoice_info sql error:{e}")
return {"status": False, "msg": "sql error"}
ret = await save_invoice_info(params_kw)
return ret