supplychain/wwwroot/api/supplier_resource_price_update.dspy

19 lines
685 B
Plaintext

result = {'widgettype': 'Message', 'options': {'title': 'Error', 'message': 'Invalid', 'type': 'error'}}
try:
dbname = get_module_dbname('supplychain')
data = dict(params_kw)
record_id = data.get('id')
if not record_id:
raise ValueError('Missing id')
data['updated_at'] = timestampstr()
async with DBPools().sqlorContext(dbname) as sor:
await sor.U('supplier_resource_price', 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