supplychain/wwwroot/api/get_search_sub_reseller_id.dspy
Hermes Agent 047ec1800a feat: 完善分销商管理CRUD — sub_distributors/distribution_agreements/distribution_agreement_items
- 增强3个CRUD JSON配置:过滤器、子表关联、下拉选择alters
- 修复9个API dspy文件:移除违规import,改用init.py函数直接调用
- 新增2个搜索API:get_search_sub_reseller_id、get_search_agreement_id
- 自动生成分销商编号(SD-YYYYMMDD-NNNN)和协议编号(DA-YYYYMMDD-NNNN)
- 级联删除:删除分销商时级联删除协议及明细,删除协议时级联删除明细
- 更新load_path.py注册新API路径
2026-06-17 15:18:27 +08:00

17 lines
751 B
Plaintext

result = [{'sub_reseller_id': '', 'sub_reseller_id_text': '全部'}]
try:
userorgid = await get_userorgid()
if not userorgid:
return json.dumps(result, ensure_ascii=False)
db = DBPools()
dbname = get_module_dbname('supplychain')
async with db.sqlorContext(dbname) as sor:
rows = await sor.sqlExe(
"select id as sub_reseller_id, sub_reseller_name as sub_reseller_id_text from sub_resellers where resellerid = ${userorgid}$ and status = '1' order by sub_reseller_name",
{"userorgid": userorgid}
)
return json.dumps(result + list(rows), ensure_ascii=False)
except Exception as e:
debug(f'get_search_sub_reseller_id error: {e}')
return json.dumps(result, ensure_ascii=False)