query_bill_to_file
Export large Kingdee K3Cloud bill datasets to local NDJSON or CSV files by paging results and streaming writes without memory buildup, then return the file path and row statistics.
Instructions
自动翻页并流式写入本地文件,适合大数据量导出(万行以上)。
不在内存中累积数据,写入完成后返回文件路径和统计信息。 仅接受文件名,保存到 KD_EXPORT_DIR 或本实例的独立临时目录,不覆盖已有文件。 使用返回的 path 通过 Read 工具抽检,或交由 pandas/polars 处理。
返回格式: {"path": "...", "row_count": N, "bytes": M, "format": "ndjson"} 若中途出错:{"error": "...", "path": "...", "row_count": <已写入>, "bytes": M}
Args: form_id: 表单ID。如 SAL_SaleOrder、PUR_PurchaseOrder、BD_MATERIAL 等 field_keys: 查询字段,逗号分隔。如 "FBillNo,FDate,FAmount" filter_string: 过滤条件。如 "FDate >= '2025-01-01'" output_path: 输出文件名,如 "orders.ndjson";不可包含目录,不覆盖已有文件 format: 输出格式,ndjson(每行一个 JSON 对象)或 csv,默认 ndjson page_size: 每页行数,默认 2000 max_rows: 最大写入行数,默认 500000;超过则截断并正常返回
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"form_id": "<form_id>",
"field_keys": "<field_keys>"
},
"name": "query_bill_to_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | ndjson | |
| form_id | Yes | ||
| max_rows | No | ||
| page_size | No | ||
| field_keys | Yes | ||
| output_path | No | ||
| filter_string | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |