supplychain/wwwroot/api/product_supplier_mapping_create.dspy

24 lines
824 B
Plaintext

result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
try:
user_id = await get_user()
user_orgid = (await get_userorgid()) or '0'
dbname = get_module_dbname('supplychain')
data = dict(params_kw)
data['id'] = getID()
data['resellerid'] = user_orgid
data['created_by'] = user_id
data['created_at'] = timestampstr()
data['updated_at'] = timestampstr()
async with DBPools().sqlorContext(dbname) as sor:
await sor.C('product_supplier_mapping', data)
result = {'widgettype': 'Message', 'options': {'title': 'Success', 'message': '产品供应商映射创建成功', 'type': 'success'}}
except Exception as e:
result['options'] = {'title': 'Error', 'message': '创建失败: ' + str(e), 'type': 'error'}
return result