weaver-work-cli 0.1.8 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -17
- package/dist/cmd/action.js +76 -0
- package/dist/cmd/index.js +2 -0
- package/dist/cmd/refs/index.js +103 -0
- package/dist/cmd/register.js +31 -0
- package/dist/cmd/root.js +1 -0
- package/dist/cmd/setup/index.js +25 -5
- package/dist/cmd/skills/index.js +37 -5
- package/dist/core/connector.js +54 -0
- package/dist/core/context.js +2 -1
- package/dist/core/input.js +48 -0
- package/dist/core/output.js +298 -3
- package/dist/core/refs.js +435 -0
- package/dist/core/state.js +26 -0
- package/dist/internal/e10/auth/commands.js +34 -19
- package/dist/internal/e10/auth/session.js +74 -2
- package/dist/internal/e10/auth/xiaoe.js +359 -94
- package/dist/internal/e10/context.js +18 -6
- package/dist/internal/e10/request-runtime.js +8 -1
- package/dist/internal/skills/install.js +148 -28
- package/dist/internal/skills/reader.js +12 -9
- package/dist/shortcuts/blog/continuation.js +74 -0
- package/dist/shortcuts/blog/errors.js +60 -0
- package/dist/shortcuts/blog/host.js +175 -0
- package/dist/shortcuts/blog/index.js +324 -0
- package/dist/shortcuts/blog/manifest.js +415 -0
- package/dist/shortcuts/blog/operations/comment.js +125 -0
- package/dist/shortcuts/blog/operations/comments.js +31 -0
- package/dist/shortcuts/blog/operations/edit.js +131 -0
- package/dist/shortcuts/blog/operations/export.js +46 -0
- package/dist/shortcuts/blog/operations/like.js +80 -0
- package/dist/shortcuts/blog/operations/publish.js +157 -0
- package/dist/shortcuts/blog/operations/query-user.js +58 -0
- package/dist/shortcuts/blog/operations/query.js +96 -0
- package/dist/shortcuts/blog/operations/registry.js +54 -0
- package/dist/shortcuts/blog/operations/remind.js +176 -0
- package/dist/shortcuts/blog/operations/shared.js +330 -0
- package/dist/shortcuts/blog/operations/types.js +16 -0
- package/dist/shortcuts/blog/operations.js +9 -0
- package/dist/shortcuts/caizhilian/continuation.js +70 -0
- package/dist/shortcuts/caizhilian/errors.js +53 -0
- package/dist/shortcuts/caizhilian/host.js +190 -0
- package/dist/shortcuts/caizhilian/index.js +186 -0
- package/dist/shortcuts/caizhilian/manifest.js +42 -0
- package/dist/shortcuts/caizhilian/operations/api.js +801 -0
- package/dist/shortcuts/caizhilian/operations/confirm.js +75 -0
- package/dist/shortcuts/caizhilian/operations/files.js +306 -0
- package/dist/shortcuts/caizhilian/operations/form.js +170 -0
- package/dist/shortcuts/caizhilian/operations/handlers/collab.js +611 -0
- package/dist/shortcuts/caizhilian/operations/handlers/document.js +890 -0
- package/dist/shortcuts/caizhilian/operations/handlers/file-collection.js +1227 -0
- package/dist/shortcuts/caizhilian/operations/handlers/file-upload.js +192 -0
- package/dist/shortcuts/caizhilian/operations/handlers/fileops.js +570 -0
- package/dist/shortcuts/caizhilian/operations/handlers/folder.js +1024 -0
- package/dist/shortcuts/caizhilian/operations/handlers/search.js +318 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-attach.js +294 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-backup.js +423 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-encrypt.js +238 -0
- package/dist/shortcuts/caizhilian/operations/handlers/setting-storage.js +364 -0
- package/dist/shortcuts/caizhilian/operations/handlers/system.js +106 -0
- package/dist/shortcuts/caizhilian/operations/registry.js +151 -0
- package/dist/shortcuts/caizhilian/operations/shared.js +408 -0
- package/dist/shortcuts/caizhilian/operations/specs.js +698 -0
- package/dist/shortcuts/caizhilian/operations/types.js +57 -0
- package/dist/shortcuts/caizhilian/operations.js +21 -0
- package/dist/shortcuts/contract/continuation.js +70 -0
- package/dist/shortcuts/contract/errors.js +62 -0
- package/dist/shortcuts/contract/host.js +205 -0
- package/dist/shortcuts/contract/index.js +318 -0
- package/dist/shortcuts/contract/manifest.js +596 -0
- package/dist/shortcuts/contract/operations/clause-reference.js +78 -0
- package/dist/shortcuts/contract/operations/form-info.js +371 -0
- package/dist/shortcuts/contract/operations/read.js +118 -0
- package/dist/shortcuts/contract/operations/registry.js +43 -0
- package/dist/shortcuts/contract/operations/request.js +300 -0
- package/dist/shortcuts/contract/operations/shared.js +133 -0
- package/dist/shortcuts/contract/operations/subject.js +157 -0
- package/dist/shortcuts/contract/operations/template.js +81 -0
- package/dist/shortcuts/contract/operations/types.js +7 -0
- package/dist/shortcuts/contract/operations/workflow.js +52 -0
- package/dist/shortcuts/contract/operations/write.js +131 -0
- package/dist/shortcuts/contract/operations.js +8 -0
- package/dist/shortcuts/hrm/index.js +83 -2
- package/dist/shortcuts/hrm/manifest.js +16 -9
- package/dist/shortcuts/hrm/operations/employee.js +160 -30
- package/dist/shortcuts/hrm/operations/org.js +17 -3
- package/dist/shortcuts/hrm/operations/position.js +18 -2
- package/dist/shortcuts/hrm/operations/registry.js +2 -0
- package/dist/shortcuts/hrm/operations/resolve.js +449 -0
- package/dist/shortcuts/index.js +5 -1
- package/dist/shortcuts/invoice/index.js +74 -36
- package/dist/shortcuts/invoice/manifest.js +674 -4
- package/dist/shortcuts/invoice/markdown.js +172 -0
- package/dist/shortcuts/invoice/operations/add.js +3 -3
- package/dist/shortcuts/invoice/operations/delete.js +2 -2
- package/dist/shortcuts/invoice/operations/get.js +10 -2
- package/dist/shortcuts/invoice/operations/import.js +2 -2
- package/dist/shortcuts/invoice/operations/registry.js +8 -1
- package/dist/shortcuts/invoice/operations/reim-auto.js +719 -0
- package/dist/shortcuts/invoice/operations/reim.js +85 -2
- package/dist/shortcuts/invoice/operations/shared.js +75 -8
- package/dist/shortcuts/invoice/operations/update.js +2 -2
- package/dist/shortcuts/invoice/operations/upload-and-validate.js +93 -0
- package/dist/shortcuts/invoice/operations/validate-preview.js +2 -1
- package/dist/shortcuts/invoice/projection.js +328 -0
- package/dist/shortcuts/meeting/host.js +18 -1
- package/dist/shortcuts/meeting/manifest.js +30 -18
- package/dist/shortcuts/meeting/operations/eb/catalog.js +390 -0
- package/dist/shortcuts/meeting/operations/eb/conflict.js +389 -0
- package/dist/shortcuts/meeting/operations/eb/factory.js +389 -0
- package/dist/shortcuts/meeting/operations/eb/index.js +22 -0
- package/dist/shortcuts/meeting/operations/env.js +8 -1
- package/dist/shortcuts/meeting/operations/registry.js +2 -0
- package/dist/shortcuts/meeting/operations/signs.js +216 -2
- package/dist/shortcuts/workflow/endpoints.js +2 -1
- package/dist/shortcuts/workflow/errors.js +8 -2
- package/dist/shortcuts/workflow/host.js +11 -4
- package/dist/shortcuts/workflow/operations/form.js +1016 -590
- package/dist/shortcuts/workflow/operations/read.js +913 -231
- package/dist/shortcuts/workflow/operations/shared.js +21 -0
- package/dist/shortcuts/workflow/operations/write.js +750 -52
- package/dist/shortcuts/workflow/operations.js +36 -10
- package/docs/_catalog.md +6 -0
- package/docs/agent-invoice.md +5 -1
- package/docs/agent-io-channel-design.md +468 -0
- package/docs/agent-skill-install.md +9 -4
- package/docs/blog.md +123 -0
- package/docs/caizhilian.md +304 -0
- package/docs/contract.md +91 -0
- package/docs/e10-auth.md +4 -2
- package/docs/hrm.md +53 -11
- package/docs/invoice.md +5 -1
- package/docs/meeting.md +1 -1
- package/docs/operation-manual.md +15 -3
- package/docs/skill-review-2026-09-19.md +2 -2
- package/package.json +1 -1
- package/scripts/package-skill.mjs +32 -20
- package/scripts/xiaoe_env.py +118 -0
- package/skill-template/business-info.json +113 -14
- package/skill-template/domains/blog.md +24 -0
- package/skill-template/domains/caizhilian.md +22 -0
- package/skill-template/domains/hrm.md +2 -1
- package/skill-template/domains/jinchengda.md +23 -0
- package/skill-template/domains/meeting.md +1 -1
- package/skill-template/domains/workflow.md +1 -1
- package/skill-template/skill-template.md +1 -1
- package/skills/weaver-e10-blog/SKILL.md +111 -0
- package/skills/weaver-e10-blog/references/blog-comment.md +51 -0
- package/skills/weaver-e10-blog/references/blog-comments.md +39 -0
- package/skills/weaver-e10-blog/references/blog-default-permission.md +38 -0
- package/skills/weaver-e10-blog/references/blog-disabled-capabilities.md +11 -0
- package/skills/weaver-e10-blog/references/blog-edit.md +51 -0
- package/skills/weaver-e10-blog/references/blog-export.md +42 -0
- package/skills/weaver-e10-blog/references/blog-like.md +50 -0
- package/skills/weaver-e10-blog/references/blog-publish.md +52 -0
- package/skills/weaver-e10-blog/references/blog-query-user.md +45 -0
- package/skills/weaver-e10-blog/references/blog-query.md +49 -0
- package/skills/weaver-e10-blog/references/blog-remind.md +51 -0
- package/skills/weaver-e10-blog/references/blog-resolve-users.md +38 -0
- package/skills/weaver-e10-blog/references/source-manifest.json +1540 -0
- package/skills/weaver-e10-caizhilian/SKILL.md +217 -0
- package/skills/weaver-e10-caizhilian/references/agent-entry.md +106 -0
- package/skills/weaver-e10-caizhilian/references/collaboration.md +112 -0
- package/skills/weaver-e10-caizhilian/references/document.md +111 -0
- package/skills/weaver-e10-caizhilian/references/file-collection.md +173 -0
- package/skills/weaver-e10-caizhilian/references/file-upload.md +309 -0
- package/skills/weaver-e10-caizhilian/references/files.md +120 -0
- package/skills/weaver-e10-caizhilian/references/folder.md +122 -0
- package/skills/weaver-e10-caizhilian/references/org-browser.md +104 -0
- package/skills/weaver-e10-caizhilian/references/setting-attach.md +440 -0
- package/skills/weaver-e10-caizhilian/references/setting-backup.md +372 -0
- package/skills/weaver-e10-caizhilian/references/setting-encrypt.md +399 -0
- package/skills/weaver-e10-caizhilian/references/setting-storage.md +603 -0
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +5694 -0
- package/skills/weaver-e10-caizhilian/references/withheld.md +93 -0
- package/skills/weaver-e10-caizhilian/references/write-protocol.md +120 -0
- package/skills/weaver-e10-calendar/SKILL.md +4 -3
- package/skills/weaver-e10-ebuilder-form/SKILL.md +4 -9
- package/skills/weaver-e10-ebuilder-form/references/context-routing.md +0 -9
- package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/fields-browser.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/list-nlist.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/openapi-read.md +1 -5
- package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -5
- package/skills/weaver-e10-esb/SKILL.md +2 -2
- package/skills/weaver-e10-esb/references/source-manifest.json +9 -9
- package/skills/weaver-e10-hrm/SKILL.md +104 -9
- package/skills/weaver-e10-hrm/references/employee.md +89 -15
- package/skills/weaver-e10-hrm/references/org.md +114 -5
- package/skills/weaver-e10-hrm/references/position.md +14 -7
- package/skills/weaver-e10-hrm/references/source-manifest.json +1 -1
- package/skills/weaver-e10-jinchengda/SKILL.md +167 -0
- package/skills/weaver-e10-jinchengda/references/contract-agent-entry.md +82 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-recommender.md +69 -0
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +78 -0
- package/skills/weaver-e10-jinchengda/references/contract-disabled-capabilities.md +27 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-status.md +71 -0
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +94 -0
- package/skills/weaver-e10-jinchengda/references/contract-signing-subjects.md +89 -0
- package/skills/weaver-e10-jinchengda/references/contract-subject-create.md +77 -0
- package/skills/weaver-e10-jinchengda/references/contract-template-selector.md +66 -0
- package/skills/weaver-e10-jinchengda/references/contract-workflow-discovery.md +94 -0
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +259 -0
- package/skills/weaver-e10-jiuchuanhui/SKILL.md +5 -11
- package/skills/weaver-e10-jucailin/SKILL.md +4 -3
- package/skills/weaver-e10-mail/SKILL.md +4 -11
- package/skills/weaver-e10-meeting/SKILL.md +66 -32
- package/skills/weaver-e10-meeting/references/meeting-change.md +5 -2
- package/skills/weaver-e10-meeting/references/meeting-create.md +2 -1
- package/skills/weaver-e10-meeting/references/meeting-eb.md +114 -0
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +9 -8
- package/skills/weaver-e10-meeting/references/meeting-receipts-signs.md +35 -7
- package/skills/weaver-e10-meeting/references/meeting-update.md +1 -1
- package/skills/weaver-e10-okr/SKILL.md +6 -11
- package/skills/weaver-e10-okr/references/source-manifest.json +3 -3
- package/skills/weaver-e10-plan/SKILL.md +3 -3
- package/skills/weaver-e10-plan/references/plan-collect-and-compose.md +1 -1
- package/skills/weaver-e10-plan/references/plan-overview-and-routing.md +1 -1
- package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
- package/skills/weaver-e10-qiyecheng/SKILL.md +4 -10
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
- package/skills/weaver-e10-shared/SKILL.md +42 -34
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +16 -43
- package/skills/weaver-e10-shared/references/json-output-contract.md +20 -11
- package/skills/weaver-e10-shared/references/non-interactive-environment.md +21 -14
- package/skills/weaver-e10-shijingran/SKILL.md +2 -1
- package/skills/weaver-e10-shijingran/references/source-manifest.json +9 -9
- package/skills/weaver-e10-skill-maker/SKILL.md +4 -10
- package/skills/weaver-e10-skill-maker/references/business-skill-generation.md +5 -3
- package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +12 -27
- package/skills/weaver-e10-skill-maker/references/module-gap-audit-and-repair.md +17 -5
- package/skills/weaver-e10-skill-maker/references/source-update-detection.md +4 -27
- package/skills/weaver-e10-skill-maker/references/weaver-skill-style.md +1 -1
- package/skills/weaver-e10-wenshuding/SKILL.md +5 -16
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +7 -7
- package/skills/weaver-e10-workflow/SKILL.md +41 -46
- package/skills/weaver-e10-workflow/references/source-manifest.json +39 -75
- package/skills/weaver-e10-workflow/references/workflow-batch.md +90 -29
- package/skills/weaver-e10-workflow/references/workflow-create.md +83 -109
- package/skills/weaver-e10-workflow/references/workflow-memory.md +19 -9
- package/skills/weaver-e10-workflow/references/workflow-operate.md +2 -2
- package/skills/weaver-e10-workflow/references/workflow-query.md +40 -27
- package/skills/weaver-e10-workflow/references/workflow-share.md +18 -2
- package/skills/weaver-e10-workflow/references/workflow-view.md +3 -4
- package/skills/weaver-e10-yepiaotong/SKILL.md +74 -39
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +22 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +3 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +135 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +15 -3
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +1 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-summarize.py +217 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +88 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-validation-preview.md +7 -2
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +89 -9
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +1 -0
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +70 -49
- package/skills/weaver-e10-yepiaotong/references/reim-fast-path.md +119 -0
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +55 -36
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +4 -0
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +149 -0
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +125 -5
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +430 -63
- package/skills/weaver-e10-yimiaoban/SKILL.md +4 -12
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +3 -3
- package/skills/weaver-e10-ziguanjia/SKILL.md +2 -1
- package/skills/weaver-e10-ziguanjia/references/ziguanjia-agent-entry.md +3 -3
- package/tools/weaver-skill-detector-1.0.13/SKILL.md +9 -9
- package/tools/weaver-skill-detector-1.0.13/references/checklist.md +3 -3
- package/tools/weaver-skill-detector-1.0.13/scripts/__pycache__/validate_skill.cpython-313.pyc +0 -0
- package/tools/weaver-skill-detector-1.0.13/scripts/validate_skill.py +98 -91
- package/scripts/sync-connector-skills.mjs +0 -172
|
@@ -104,8 +104,8 @@ CLI 已固定 `flag`(个人票夹=0 / 企业票夹=6),默认 `sreim="3"`
|
|
|
104
104
|
| --- | --- | --- | --- |
|
|
105
105
|
| `page_size` | Integer | 否 | 每页条数,默认 `10`,建议不超过 `20` |
|
|
106
106
|
| `start_pos` | Integer | 否 | 分页起始位置,默认 `0` |
|
|
107
|
-
| `date_begin` / `date_end` | Integer | 否 |
|
|
108
|
-
| `create_tm_begin` / `create_tm_end` | Integer | 否 |
|
|
107
|
+
| `date_begin` / `date_end` | Integer \| String | 否 | 开票日期范围。可传秒级时间戳,也可直接传 `"YYYY-MM-DD"`(0.1.15 起 CLI 按东八区零点换算)。用户未指定日期时,默认最近一周 |
|
|
108
|
+
| `create_tm_begin` / `create_tm_end` | Integer \| String | 否 | 录入/创建日期范围,写法同上。仅用户明确说录入/创建日期时使用 |
|
|
109
109
|
| `content` | String | 否 | 消费内容关键词(如 `"滴滴"`、`"住宿"`) |
|
|
110
110
|
| `number` | String | 否 | 发票号码精确匹配 |
|
|
111
111
|
| `types` | Array\<Integer\> | 否 | 发票类型 ID 数组(见下方映射表) |
|
|
@@ -115,6 +115,7 @@ CLI 已固定 `flag`(个人票夹=0 / 企业票夹=6),默认 `sreim="3"`
|
|
|
115
115
|
### 时间戳计算
|
|
116
116
|
|
|
117
117
|
> **所有日期参数的秒级时间戳由 AI 按内联公式直接计算(UTC+8 时区)。**
|
|
118
|
+
> 0.1.15 起 `date_begin` / `date_end` / `create_tm_begin` / `create_tm_end` 也直接接受 `"YYYY-MM-DD"`(CLI 按东八区零点换算),日期区间不跨时区歧义时优先写 `"YYYY-MM-DD"`,更省一次心算;需要精确到时分秒的边界(如 `23:59:59`)时才用秒级时间戳。
|
|
118
119
|
> 完整公式和 Fallback 见 [reim-workflow.md - 时间戳内联计算](reim-workflow.md#时间戳内联计算零工具调用)。
|
|
119
120
|
|
|
120
121
|
示例(最近一周,只传必要字段):
|
|
@@ -427,6 +428,7 @@ weaver-work-cli --json invoice run invoice.reim.requests.list --input-json '{"pa
|
|
|
427
428
|
|
|
428
429
|
- `cusCreateDateEnd` = 最晚发票 invoiceDate(事前申请不会晚于开票日期)
|
|
429
430
|
- `cusCreateDateStart` = 最早发票 invoiceDate 往前推 90 天(合理的事前申请窗口期)
|
|
431
|
+
- **话费报销例外**:话费补贴事前申请可能在很早以前审批,`cusCreateDateStart` 需往前推 **1095 天(3 年)**,并加 `requestname="话费"` 缩小结果。详见 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md)。
|
|
430
432
|
|
|
431
433
|
### 返回示例
|
|
432
434
|
|
|
@@ -869,14 +871,18 @@ weaver-work-cli --json invoice run invoice.reim.employee-superiors --input-json
|
|
|
869
871
|
"id": "1201729946891231232",
|
|
870
872
|
"name": "后端开发111"
|
|
871
873
|
},
|
|
874
|
+
"directSuperior": {
|
|
875
|
+
"id": "1201729946891231233",
|
|
876
|
+
"name": "直属主管王五"
|
|
877
|
+
},
|
|
872
878
|
"allSuperiors": [
|
|
873
879
|
{
|
|
874
880
|
"id": "1201729946891231111",
|
|
875
|
-
"name": "
|
|
881
|
+
"name": "分管领导熊总"
|
|
876
882
|
},
|
|
877
883
|
{
|
|
878
|
-
"id": "
|
|
879
|
-
"name": "
|
|
884
|
+
"id": "1201729946891231233",
|
|
885
|
+
"name": "直属主管王五"
|
|
880
886
|
}
|
|
881
887
|
]
|
|
882
888
|
},
|
|
@@ -890,16 +896,16 @@ weaver-work-cli --json invoice run invoice.reim.employee-superiors --input-json
|
|
|
890
896
|
| --- | --- |
|
|
891
897
|
| `currentEmployee.id` | 当前人员 ID(**字符串**,避免雪花 ID 超过 JS 安全整数精度) |
|
|
892
898
|
| `currentEmployee.name` | 当前人员名称 |
|
|
893
|
-
| `allSuperiors` |
|
|
894
|
-
| `allSuperiors[0]`
|
|
899
|
+
| `allSuperiors` | 所有上级列表(直接上级 + 间接上级,按层级从高到低排列),每项含 `id` 和 `name` |
|
|
900
|
+
| `directSuperior` | **直接上级**(对象,含 `id` 和 `name`)。⚠️ **与 `allSuperiors[0]` 不是同一人**:`allSuperiors[0]` 是上级链中最高层(如分管领导),直接上级必须取 `directSuperior` |
|
|
895
901
|
| `allSuperiors[].id` | 上级人员 ID(**字符串**) |
|
|
896
902
|
|
|
897
903
|
### 填单字段对应关系
|
|
898
904
|
|
|
899
905
|
| 表单字段 | 取值方式 |
|
|
900
906
|
| --- | --- |
|
|
901
|
-
| 报销人上级 | `
|
|
902
|
-
| 承担人直接上级 | `
|
|
907
|
+
| 报销人上级 | `directSuperior.id`(直接上级 ID,直接赋值;**不是 `allSuperiors[0]`**) |
|
|
908
|
+
| 承担人直接上级 | `directSuperior.id`(同上) |
|
|
903
909
|
| 承担人所有上级 | `allSuperiors` 中所有 `id` 用逗号拼接(如 `"id1,id2,id3"`) |
|
|
904
910
|
|
|
905
911
|
---
|
|
@@ -969,6 +975,80 @@ weaver-work-cli --json invoice run invoice.reim.row-info --input-json '{"invoice
|
|
|
969
975
|
|
|
970
976
|
---
|
|
971
977
|
|
|
978
|
+
## 5.6b 批量获取发票预填信息(0.1.19 新增)
|
|
979
|
+
|
|
980
|
+
CLI operation:`invoice.reim.row-info-batch`
|
|
981
|
+
|
|
982
|
+
一次调用获取多张发票的预填信息,内部并行处理(并发度 4),避免 Agent 逐张串行调用 `invoice.reim.row-info` 导致 N-1 次额外 CLI 启动与网络往返。
|
|
983
|
+
|
|
984
|
+
### 入参
|
|
985
|
+
|
|
986
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
987
|
+
| --- | --- | --- | --- |
|
|
988
|
+
| `invoiceIds` | Array\<String\> | 是 | 发票 ID 列表,1-100 个 |
|
|
989
|
+
| `requestid` | String | 否 | 事前申请流程 ID(无可不传或留空) |
|
|
990
|
+
| `cdzt` | String | 否 | 当前用户/人员 ID,不传则 CLI 使用当前登录用户 |
|
|
991
|
+
|
|
992
|
+
### 命令
|
|
993
|
+
|
|
994
|
+
macOS/Linux(bash/zsh):
|
|
995
|
+
|
|
996
|
+
```bash
|
|
997
|
+
weaver-work-cli --json invoice run invoice.reim.row-info-batch --input-json '{"invoiceIds":["1297093330645237792","1297093330645237793"]}'
|
|
998
|
+
```
|
|
999
|
+
|
|
1000
|
+
Windows PowerShell:
|
|
1001
|
+
|
|
1002
|
+
```powershell
|
|
1003
|
+
weaver-work-cli --json invoice run invoice.reim.row-info-batch --input-json '{"invoiceIds":["1297093330645237792","1297093330645237793"]}'
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
### 返回示例
|
|
1007
|
+
|
|
1008
|
+
```json
|
|
1009
|
+
{
|
|
1010
|
+
"results": [
|
|
1011
|
+
{
|
|
1012
|
+
"invoiceId": "1297093330645237792",
|
|
1013
|
+
"status": "success",
|
|
1014
|
+
"data": {
|
|
1015
|
+
"date": "2026-07-29",
|
|
1016
|
+
"fysm": "交通运输服务",
|
|
1017
|
+
"itinerary": "1298798990831518001",
|
|
1018
|
+
"subjectId": "100502270000000006"
|
|
1019
|
+
}
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
"invoiceId": "1297093330645237793",
|
|
1023
|
+
"status": "fail",
|
|
1024
|
+
"error": "获取发票 1297093330645237793 行预填失败"
|
|
1025
|
+
}
|
|
1026
|
+
],
|
|
1027
|
+
"succeeded": 1,
|
|
1028
|
+
"failed": 1,
|
|
1029
|
+
"total": 2,
|
|
1030
|
+
"workflow": { "workflow": "invoice.reim.row-info-batch", "version": 1, "state": "PARTIAL" }
|
|
1031
|
+
}
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
### 返回字段说明
|
|
1035
|
+
|
|
1036
|
+
| 字段 | 说明 |
|
|
1037
|
+
| --- | --- |
|
|
1038
|
+
| `results[].invoiceId` | 对应的发票 ID |
|
|
1039
|
+
| `results[].status` | `"success"` 或 `"fail"` |
|
|
1040
|
+
| `results[].data` | 成功时返回,结构与单张 `row-info` 一致(`date`、`fysm`、`itinerary`、`subjectId`) |
|
|
1041
|
+
| `results[].error` | 失败时返回错误信息 |
|
|
1042
|
+
| `succeeded` / `failed` / `total` | 成功/失败/总数统计 |
|
|
1043
|
+
|
|
1044
|
+
### 使用场景
|
|
1045
|
+
|
|
1046
|
+
- **手工组装报销单时**(Step 3.5),用 `row-info-batch` 替代 N 次 `row-info` 调用
|
|
1047
|
+
- 部分失败不影响其他发票,失败的回退到 AI 推断逻辑
|
|
1048
|
+
- 快速路径(`template.build`/`auto-prepare`)内部已自带批量获取,无需额外调用
|
|
1049
|
+
|
|
1050
|
+
---
|
|
1051
|
+
|
|
972
1052
|
## 5.7 获取发票详情(交通类发票行程信息)
|
|
973
1053
|
|
|
974
1054
|
CLI operation:`invoice.get`
|
|
@@ -497,6 +497,7 @@ weaver-work-cli --json invoice run invoice.reim.flow.create.apply --input ./reim
|
|
|
497
497
|
**场景**:2 张发票(交通+住宿)均匹配到同一条出差事前申请。
|
|
498
498
|
|
|
499
499
|
**出差拦截**:`workFlowName` 含「差旅」或事前申请名称含「出差」→ **必须先提醒用户填写相关客户**。
|
|
500
|
+
**话费拦截**:`workFlowName` 含「话费补贴标准审批流程」或「话费报销」→ **必须先按 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md) 核对账单截图、账单构成和岗位上限,再按标准计算实报金额**。
|
|
500
501
|
|
|
501
502
|
```markdown
|
|
502
503
|
当前为出差报销,必须填写相关客户。请提供本次出差对应的具体客户名称,否则无法继续报销。
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
# 费用科目匹配规则
|
|
2
2
|
|
|
3
|
-
> **费用类型(科目)字段必须有值。优先使用 `invoice.reim.row-info`
|
|
3
|
+
> **费用类型(科目)字段必须有值。优先使用 `invoice.reim.row-info`(或 `row-info-batch`)返回的 `subjectId`;为空时按下方查找表匹配;全部未命中则填兜底值 `"100502270000000104"`。**
|
|
4
4
|
> **绝不能为空、不能报错、不能放入 `unable_to_fill`。**
|
|
5
|
+
> **兜底科目 `"100502270000000104"` 见 [reim-workflow.md 共享常量](reim-workflow.md#报销共享常量所有-reference-统一引用本节)。**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 匹配决策树(完整流程图)
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
invoice.reim.row-info 返回 subjectId?
|
|
13
|
+
├── 有值 → 直接使用,结束
|
|
14
|
+
└── 空/null → 进入查找表匹配 ↓
|
|
15
|
+
优先级1: expenseType 匹配?
|
|
16
|
+
├── 命中 → 使用对应 ID,结束
|
|
17
|
+
└── 未命中 → ↓
|
|
18
|
+
优先级2: sellerName 关键词匹配?
|
|
19
|
+
├── 命中 → 使用对应 ID,结束
|
|
20
|
+
└── 未命中 → ↓
|
|
21
|
+
优先级3: consumeContent 关键词匹配?
|
|
22
|
+
├── 命中 → 使用对应 ID,结束
|
|
23
|
+
└── 未命中 → ↓
|
|
24
|
+
优先级4: requestname 辅助匹配?
|
|
25
|
+
├── 命中 → 使用对应 ID,结束
|
|
26
|
+
└── 未命中 → ↓
|
|
27
|
+
兜底条件匹配(押金/电子设备/家具/研发/销售)?
|
|
28
|
+
├── 命中 → 使用对应 ID,结束
|
|
29
|
+
└── 全不命中 → 填 "100502270000000104",结束
|
|
30
|
+
```
|
|
5
31
|
|
|
6
32
|
---
|
|
7
33
|
|
|
@@ -11,75 +37,69 @@
|
|
|
11
37
|
|
|
12
38
|
### 优先级1:expenseType 匹配
|
|
13
39
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
```
|
|
40
|
+
| 关键词 | 科目 ID | 科目名称 |
|
|
41
|
+
|--------|---------|----------|
|
|
42
|
+
| 市内交通 | `100502270000000006` | 市内交通费 |
|
|
43
|
+
| 住宿 | `100502270000000183` | 住宿费 |
|
|
44
|
+
| 餐饮 | `100502270000000064` | 餐饮费 |
|
|
45
|
+
| 办公 | `100502270000000003` | 办公费 |
|
|
46
|
+
| 通讯 | `100502270000000010` | 通讯费 |
|
|
47
|
+
| 活动 | `100502270000000002` | 活动费 |
|
|
48
|
+
| 招待 | `100502270000000005` | 招待费 |
|
|
25
49
|
|
|
26
50
|
> expenseType 为空或 "日常消费"/"其他费用" 等泛指值时跳过此表。
|
|
27
51
|
|
|
28
52
|
### 优先级2:sellerName 关键词匹配
|
|
29
53
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
```
|
|
54
|
+
| 关键词(任一命中) | 科目 ID | 科目名称 |
|
|
55
|
+
|---------------------|---------|----------|
|
|
56
|
+
| 滴滴、享道、曹操、高德、首汽 | `100502270000000173` | 交通费-管理费用 |
|
|
57
|
+
| 酒店、宾馆、民宿、如家、汉庭、全季 | `100502270000000183` | 住宿费 |
|
|
58
|
+
| 餐饮、饭店、海底捞、美团、饿了么 | `100502270000000064` | 餐饮费 |
|
|
59
|
+
| 办公、文具 | `100502270000000003` | 办公费 |
|
|
60
|
+
| 中国移动、中国联通、中国电信 | `100502270000000010` | 通讯费 |
|
|
39
61
|
|
|
40
62
|
### 优先级3:consumeContent 关键词匹配
|
|
41
63
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
64
|
+
| 关键词(任一命中) | 科目 ID | 科目名称 |
|
|
65
|
+
|---------------------|---------|----------|
|
|
66
|
+
| 客运服务费、运输服务 | `100502270000000006` | 市内交通费 |
|
|
67
|
+
| 住宿服务、住宿费 | `100502270000000183` | 住宿费 |
|
|
68
|
+
| 餐饮服务、餐费 | `100502270000000064` | 餐饮费 |
|
|
69
|
+
| 话费、手机账单、通信费、通讯费 | `100502270000000010` | 通讯费 |
|
|
70
|
+
| 电脑、手机、平板、显示器、电子设备 | `100502270000000128` | 电子设备 |
|
|
71
|
+
| 押金、保证金 | `100502270000000127` | 押金保证金 |
|
|
72
|
+
| 家具、桌椅、办公桌、柜子 | `100502270000000129` | 家具 |
|
|
52
73
|
|
|
53
74
|
### 优先级4:requestname 辅助匹配(事前申请名称)
|
|
54
75
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
```
|
|
76
|
+
| 关键词(任一命中) | 科目 ID | 科目名称 |
|
|
77
|
+
|---------------------|---------|----------|
|
|
78
|
+
| 招待、接待 | `100502270000000005` | 招待费 |
|
|
79
|
+
| 采购、办公 | `100502270000000003` | 办公费 |
|
|
80
|
+
| 话费、通讯 | `100502270000000010` | 通讯费 |
|
|
61
81
|
|
|
62
82
|
> 出差/差旅类事前申请 + 交通类发票 → 使用优先级2的 sellerName 匹配结果。
|
|
63
83
|
|
|
64
84
|
### 兜底(必定命中)
|
|
65
85
|
|
|
66
|
-
| 条件 | 科目 ID |
|
|
67
|
-
|
|
68
|
-
| 发票涉及押金、保证金 | `100502270000000127` |
|
|
69
|
-
| 发票涉及电脑、电子设备 | `100502270000000128` |
|
|
70
|
-
| 发票涉及家具、桌椅 | `100502270000000129` |
|
|
71
|
-
| 用户为研发部门 | `100502270000000090` |
|
|
72
|
-
| 事前申请含"销售"关键词 | `100502270000000105` |
|
|
73
|
-
| **以上都不满足** | **`100502270000000104`** |
|
|
86
|
+
| 条件 | 科目 ID | 科目名称 |
|
|
87
|
+
|------|---------|----------|
|
|
88
|
+
| 发票涉及押金、保证金 | `100502270000000127` | 押金保证金 |
|
|
89
|
+
| 发票涉及电脑、电子设备 | `100502270000000128` | 电子设备 |
|
|
90
|
+
| 发票涉及家具、桌椅 | `100502270000000129` | 家具 |
|
|
91
|
+
| 用户为研发部门 | `100502270000000090` | 研发费用 |
|
|
92
|
+
| 事前申请含"销售"关键词 | `100502270000000105` | 销售费用 |
|
|
93
|
+
| **以上都不满足** | **`100502270000000104`** | **其他-管理费用** |
|
|
74
94
|
|
|
75
95
|
---
|
|
76
96
|
|
|
77
97
|
## 滴滴/网约车科目选择
|
|
78
98
|
|
|
79
|
-
| 条件 | 科目 ID |
|
|
80
|
-
|
|
81
|
-
| 默认(无法确认部门) | `100502270000000173
|
|
82
|
-
| 确认为研发部门人员 | `100502270000000177
|
|
99
|
+
| 条件 | 科目 ID | 科目名称 |
|
|
100
|
+
|------|---------|----------|
|
|
101
|
+
| 默认(无法确认部门) | `100502270000000173` | 交通费-管理费用 |
|
|
102
|
+
| 确认为研发部门人员 | `100502270000000177` | 交通费-研发费 |
|
|
83
103
|
|
|
84
104
|
---
|
|
85
105
|
|
|
@@ -92,3 +112,4 @@
|
|
|
92
112
|
```
|
|
93
113
|
|
|
94
114
|
> ID 必须原样复制,严禁修改。每行明细的科目独立匹配。
|
|
115
|
+
> 快速路径(`template.build`/`auto-prepare`)已内置科目匹配:`row-info` 返回 `subjectId` 为空时自动使用默认科目 `"1256664958132969489"`(日常消费)。
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# 报销快速路径(0.1.13 新增 operation)
|
|
2
|
+
|
|
3
|
+
> 三个新 operation 把「查票 → 分类 → 组 payload → prepare」压成两步,人工只保留确认 + apply。
|
|
4
|
+
> 固化映射来自 2026-09-14 / 2026-09-21 两次真实 apply 成功的「总部费用报销」单据,只覆盖该流程。
|
|
5
|
+
|
|
6
|
+
## 1. `invoice.reim.candidates.list`(read)— 票夹候选分类
|
|
7
|
+
|
|
8
|
+
自动翻页拉取未报销(sreim=3)发票,并按 `oreim.list_reim` / 红冲状态分成三组,**不再需要手动翻页和逐条剔重**:
|
|
9
|
+
|
|
10
|
+
macOS/Linux(bash):
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
weaver-work-cli --json invoice run invoice.reim.candidates.list --input-json '{"date_begin":"2026-09-14","date_end":"2026-09-21"}'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Windows PowerShell:
|
|
17
|
+
|
|
18
|
+
```powershell
|
|
19
|
+
weaver-work-cli --json invoice run invoice.reim.candidates.list --input-json '{"date_begin":"2026-09-14","date_end":"2026-09-21"}'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- 入参(全部可选):`date_begin`/`date_end`(YYYY-MM-DD,开票日期范围)、`page_size`(10-200,默认 50)、`max_items`(1-500,默认 200,超出截断并产生 warning)、`include_red_reversed`(默认 `false`)。
|
|
23
|
+
- **红冲票默认已过滤**:全额红冲发票(`status=8`)不可报销,默认**不出现在结果里任何一组**,被过滤的张数由 `summary.filteredRedReversedCount` 告知(不会静默丢弃)。需要看红冲票时传 `include_red_reversed: true`,此时它们进 `redReversed` 组。
|
|
24
|
+
- 过滤发生在翻页循环内部:即使某一页全是红冲票也会继续翻页,直到凑够 `max_items` 张**可用**发票或数据取完,因此 `fetched` 只计保留下来的发票数、`total` 仍是接口返回的符合条件的总张数。
|
|
25
|
+
- 输出:`available` / `assigned` / `redReversed` 三组(后一组默认恒为空),每组元素含 `fid`、`number`、`date`、`total`、`buyer`、`payer`、`typeName`、`status`、`valid`、`reimRequests`;`summary` 给出三组的张数与金额合计,外加 `filteredRedReversedCount`;`warnings` 含截断与金额解析告警。
|
|
26
|
+
- **报销范围永远从 `available` 里选**;`assigned` 是已挂单的(重复提交 = 重复报销)。
|
|
27
|
+
- **⚠️ 关于"两次连续查询之间 assigned↔available 翻转"(2026-09-21 已定位,结论:分类是准的,不是误判)**:同一天内观察到 25 张发票从 `assigned` 翻到 `available`,一度被怀疑是 `oreim.list_reim` 缓存滞后。最终用 `workflow.detail` 逐个复核 requestId 后定案:`1313947830149185538`(报销单 2026-09-11)、`1314910388070170941`(2026-09-14)、`1317591500119752761`(当天新建)**均返回"流程已被删除"**,10+15+2 张发票随之释放。⇒ **翻转的根因是报销单被删除,发票真实释放,`candidates.list` 的三分类如实反映了状态变化。**
|
|
28
|
+
- **因此不要每次报销都对每张入选票再跑一次 `invoice.get` 复核 `oreim.list_reim`** —— 那会让快速路径失去意义。只有在**观察到异常翻转**(或对某张票的归属存疑)时才做核实,正确顺序是:`weaver-work-cli workflow run workflow.detail --input-json '{"requestId":"<id>"}'` 查单据是否还存在(被删的单会明确返回"流程已被删除")→ 再用 `invoice.get` 看 `oreim.list_reim`。
|
|
29
|
+
- **已知局限**:`list_reim` 元素只有报销单**名称**(无 requestId、无单号、无单据状态),`reimRequests` 里拿不到能直接喂给 `workflow.detail` 的 id。要核实只能先按名称用 `workflow.search` 找 requestId —— 注意**被删除的单在 `workflow.search` 里搜不到**,这本身就是一个"单可能已被删"的信号,但无法区分"从未存在"与"已被删除"。
|
|
30
|
+
- 另一个易踩点:`sreim="3"`(未报销)**不会**把挂单中的发票排除掉(实测 13 张挂单票仍出现在 `sreim=3` 的 39 张结果里),所以不能靠 `sreim` 判断是否已挂单,分类必须看 `list_reim`。
|
|
31
|
+
|
|
32
|
+
## 2. `invoice.reim.template.build`(read)— 固化模板组装 payload
|
|
33
|
+
|
|
34
|
+
输入发票 ID 列表 + 标题,一条命令产出完整 `payload`(19 个主表字段 + N 行明细)。内部自动完成:取上级(`directSuperior`)→ 解析候选工作流(或用传入 `workflowId`)→ 取表单结构并**按名称定位「费用明细」子表** → 批量取发票详情与行预填。
|
|
35
|
+
|
|
36
|
+
macOS/Linux(bash):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
weaver-work-cli --json invoice run invoice.reim.template.build --input-json '{"invoiceIds":["1317524773561163780","1317524747581644831"],"requestName":"烧烤调料及托盘采购报销-龚为明-2026-09-21(共2笔)","relatedCustomerId":"100504500000311504","contractNo":"20260999"}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Windows PowerShell:
|
|
43
|
+
|
|
44
|
+
```powershell
|
|
45
|
+
weaver-work-cli --json invoice run invoice.reim.template.build --input-json '{"invoiceIds":["1317524773561163780","1317524747581644831"],"requestName":"烧烤调料及托盘采购报销-龚为明-2026-09-21(共2笔)","relatedCustomerId":"100504500000311504","contractNo":"20260999"}'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- 入参:`invoiceIds`(必填,1-100 个,顺序 = 明细行顺序)、`requestName`(必填,≤100 字);可选 `workflowId`(不传则自动解析唯一候选流程)、`reason`(报销事由,缺省用 requestName)、`relatedCustomerId`、`relatedCustomerName`、`contractNo`(**默认值 `"20260999"`,视为必传**)。
|
|
49
|
+
- **⚠️ `contractNo` 默认填 `"20260999"`,不能省略**:主表 `合同号(100003720000001376)` 只有在入参给了 `contractNo` 时才写进 `payload.main_fields`(不传时该字段**整条缺失**,实测同一票同参数:不传 18 个主表字段,传 `"contractNo":"20260999"` 后 19 个),报销单里它会留空**且 `warnings` 不会提示**,属于静默漏填。
|
|
50
|
+
- **默认值口径与 [`reim-form-fill-rules.md`](reim-form-fill-rules.md) 的主表字段映射表一致**:合同编号 = 固定值 `"20260999"`。**除非用户明确给出别的合同号,否则一律填 `"20260999"`** —— 快速路径也必须遵守这条,不能因为「入参可选」就留空。
|
|
51
|
+
- 用户另有指定时以用户指定为准;用户明确说"不填合同号"时才允许留空。
|
|
52
|
+
- 输出:`payload`(可直接喂给 `flow.create.prepare` / apply)、`preview`、`labels`、`warnings`。
|
|
53
|
+
- `preview.mainFields[]` / `preview.detailRows[]`:**已把字典类 ID 渲染成「中文(id)」,预览直接展示这两项即可,不必再查名**(详见 `reim-workflow.md` Step 4.7)。
|
|
54
|
+
- `labels`:`employees` / `subjects` / `currencies` / `customers` / `selectOptions` / `customer` / `detailSubForm` / `workflow` 字典;`labels.unresolved` 为没取到中文名的 ID 清单,非空时如实展示并提醒用户核对。
|
|
55
|
+
- 相关客户只给名称也行:传 `relatedCustomerName`(不传 ID 时 CLI 反查 ID;ID + 名称同传则不额外请求,仅用于渲染)。
|
|
56
|
+
- 行为细节(与 2026-09 实测口径一致):
|
|
57
|
+
- 报销人上级 / 承担人直接上级 = `directSuperior.id`(**不是 allSuperiors[0]**);承担人所有上级 = allSuperiors 全部 id 逗号拼接。
|
|
58
|
+
- 费用明细子表优先按名称「费用明细」匹配,兜底按「相关发票」字段结构签名匹配。
|
|
59
|
+
- 费用说明自动去掉 `*`;科目缺省「日常消费」;币种人民币;报销方式银行(optionValue "7")。
|
|
60
|
+
- 发票已挂单 → warning;发票全额红冲(status=8)或金额合计为 0 → **直接报错拒绝组装**。
|
|
61
|
+
- `relatedCustomerId` 不传会留空并产生 warning(E10 apply 时可能因必填校验失败,非出差场景建议传)。
|
|
62
|
+
- 模板只固化了「总部费用报销」(`100003460000000060`) 的字段映射。若解析到的候选流程不是它,字段映射可能不适用 —— 此时**改走 `reim-workflow.md` 的手工组装路径**。
|
|
63
|
+
|
|
64
|
+
## 3. `invoice.reim.flow.create.auto-prepare`(read-before-write)— 一站式 prepare
|
|
65
|
+
|
|
66
|
+
与 `template.build` 相同的入参,组装 payload 后**直接签发 `flow.create.apply` 的 continuation**,一步到 `AWAITING_CONFIRMATION`:
|
|
67
|
+
|
|
68
|
+
macOS/Linux(bash):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
weaver-work-cli --json invoice run invoice.reim.flow.create.auto-prepare --input-json '{"invoiceIds":["1317524773561163780","1317524747581644831"],"requestName":"烧烤调料及托盘采购报销-龚为明-2026-09-21(共2笔)","relatedCustomerId":"100504500000311504","contractNo":"20260999"}'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Windows PowerShell:
|
|
75
|
+
|
|
76
|
+
```powershell
|
|
77
|
+
weaver-work-cli --json invoice run invoice.reim.flow.create.auto-prepare --input-json '{"invoiceIds":["1317524773561163780","1317524747581644831"],"requestName":"烧烤调料及托盘采购报销-龚为明-2026-09-21(共2笔)","relatedCustomerId":"100504500000311504","contractNo":"20260999"}'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
输出含 `payload` + `preview` + `labels` + `continuation` + `expiresInSeconds: 600`。**用户确认后**,把 payload 的字段**展开到顶层**(即 `work_flow_id` / `mainFormId` / `request_name` / `main_fields` / `detail_rows` / `need_user_confirm` / `unable_to_fill`),再补 `continuation` 与 `confirm: true`,交给 `invoice.reim.flow.create.apply` 提交。**不要写成 `{"payload": {...}, "continuation": ...}` 的嵌套结构**(`reim-api-reference.md` 第 7 节已明确「不要再包一层通用 payload」)。
|
|
81
|
+
|
|
82
|
+
## 推荐流程(快速路径)
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
candidates.list(选 available)
|
|
86
|
+
→ 向用户展示汇总并确认范围
|
|
87
|
+
→ auto-prepare(或 template.build + flow.create.prepare) ← 必带 relatedCustomerId + contractNo:"20260999"(用户另有指定时用其值)
|
|
88
|
+
→ 展示 preview + warnings(**ID 一律带中文名,见 `reim-workflow.md` Step 4.7**),等用户确认
|
|
89
|
+
→ flow.create.apply(展开 payload 到顶层 + continuation + confirm=true)
|
|
90
|
+
→ 回查验证(candidates.list 或 invoice.list)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
人工确认环节不可跳过:apply 是 high-risk-write,金额、抬头、明细、上级必须经过用户核对。
|
|
94
|
+
|
|
95
|
+
> **apply 入参改用 `--input <path>` 时的解析坑(0.1.18 实测)**:stdout 会在 JSON **之前多出一行** `[weaver-work-cli] 使用 --input <path> 读取 JSON 文件;多步传递请优先用 --input-ref,简单数据请用 --input-json。`。脚本解析必须先定位第一个 `{` 再 `JSON.parse`,直接解析会抛 `Unexpected token 'w'`。
|
|
96
|
+
|
|
97
|
+
> **continuation 只有 600 秒有效期**:`prepare` / `auto-prepare` 签发后要尽快 `apply`,中间不要插入文档查询、多轮确认或其它耗时命令,否则会返回 `validation/continuation_expired`。遇到过期**重新 `prepare` 后立即 `apply`** 即可(用户已确认过的内容无需重新征询),**不要重放旧 continuation**。
|
|
98
|
+
|
|
99
|
+
## 快速路径适用判断
|
|
100
|
+
|
|
101
|
+
Agent 在决定走快速路径还是手工路径时,按以下规则判断:
|
|
102
|
+
|
|
103
|
+
| 条件 | 走快速路径 | 走手工路径 |
|
|
104
|
+
|------|------------|------------|
|
|
105
|
+
| `workflow.resolve` 返回的 workFlowId = `100003460000000060`(总部费用报销) | ✅ | — |
|
|
106
|
+
| workFlowId 不是 `100003460000000060` | — | ✅ |
|
|
107
|
+
| `template.build` 返回 error 含 `structure_invalid` 或字段映射异常 | — | ✅(自动回退) |
|
|
108
|
+
| 需要逐字段精细控制(如手动指定某行的费用科目) | — | ✅ |
|
|
109
|
+
| 有事前申请需要绑定 | — | ✅(模板不做事前绑定) |
|
|
110
|
+
| 无事前申请 + 总部费用报销流程 | ✅(优先) | — |
|
|
111
|
+
|
|
112
|
+
> **⚠️ 快速路径的 `template.build` 和 `auto-prepare` 已内置挂单检查**:如果某张发票已挂在其他报销单上,`warnings` 会明确告知"继续组装存在重复报销风险",Agent 应展示给用户确认。
|
|
113
|
+
|
|
114
|
+
> **⚠️ 0.1.19 起 `contractNo` 默认值**:CLI 未收到 `contractNo` 入参时自动使用 `"20260999"` 并产生 warning,不再静默缺失。但仍建议显式传入以确保意图明确。
|
|
115
|
+
|
|
116
|
+
## 与手工路径的关系
|
|
117
|
+
|
|
118
|
+
- `invoice.reim.requests.list`(事前申请匹配)仍按 `reim-matching-rules.md` 走,模板不做事前申请绑定。
|
|
119
|
+
- 其他流程(出差报销等)或需要逐字段精细控制的场景,仍走 `reim-workflow.md` / `reim-form-fill-rules.md` 的手工组装路径。
|
|
@@ -102,11 +102,12 @@
|
|
|
102
102
|
|
|
103
103
|
## detail_rows 填充规则
|
|
104
104
|
|
|
105
|
-
来自 `invoice.reim.form.structure`
|
|
105
|
+
来自 `invoice.reim.form.structure` 返回的明细表列表 `subTables`。**不要机械取 `subTables[0]`** —— 部分流程(如总部费用报销 `100003460000000060`)返回多个明细表,`subTables[0]` 可能是「外包订单」等其他表。
|
|
106
106
|
|
|
107
|
-
-
|
|
107
|
+
- **必须先定位「费用明细」表**:优先按名称匹配(总部费用报销的「费用明细」`subFormId` = `100003690000000011`,排在 `subTables` 第 3 位);名称拿不准时,取含 `EinvoiceComponent` 类型字段、且字段构成符合费用行(金额/日期/费用说明/相关发票)的明细表
|
|
108
|
+
- **只填写定位到的「费用明细」表的字段,其他明细表(外包订单等)不用填值**
|
|
108
109
|
- `dataIndex` 从 1 开始递增
|
|
109
|
-
- `subFormId` = `subTables[0].subFormId
|
|
110
|
+
- `subFormId` = 费用明细表自身的 `subFormId`(按上面的定位结果取,**不是** `subTables[0].subFormId`)
|
|
110
111
|
|
|
111
112
|
### 过滤红冲发票(前置处理第一步)
|
|
112
113
|
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
|
|
143
144
|
### 明细行中的两个 EinvoiceComponent 字段
|
|
144
145
|
|
|
145
|
-
`
|
|
146
|
+
费用明细表的 `subFields` 中存在两个 `EinvoiceComponent` 类型的字段:
|
|
146
147
|
|
|
147
148
|
| 字段 | fieldType | single | 填入内容 |
|
|
148
149
|
|------|-----------|--------|----------|
|
|
@@ -239,8 +240,8 @@
|
|
|
239
240
|
| 部门/报销部门/部门ID/承担人部门 | 事前申请的 `creatorDepartmentId`,或当前用户部门 ID | 有数据就填 |
|
|
240
241
|
| 相关流程/事前申请 | 事前申请的 `requestid` | 有数据就填 |
|
|
241
242
|
| **承担主体** | **当前用户 ID(`creatorId`)** | **⚠️ 必填,永远不能为空** |
|
|
242
|
-
| **报销人上级** | **`invoice.reim.employee-superiors` 返回的 `
|
|
243
|
-
| **承担人直接上级** | **`invoice.reim.employee-superiors` 返回的 `
|
|
243
|
+
| **报销人上级** | **`invoice.reim.employee-superiors` 返回的 `directSuperior.id`(直接上级 ID,直接赋值;取值口径见 [reim-workflow.md](reim-workflow.md#报销共享常量所有-reference-统一引用本节))** | **⚠️ 必填,永远不能为空** |
|
|
244
|
+
| **承担人直接上级** | **`invoice.reim.employee-superiors` 返回的 `directSuperior.id`(直接上级 ID,直接赋值;取值口径见 [reim-workflow.md](reim-workflow.md#报销共享常量所有-reference-统一引用本节))** | **⚠️ 必填,永远不能为空** |
|
|
244
245
|
| **承担人所有上级** | **`invoice.reim.employee-superiors` 返回的 `allSuperiors` 所有 `id` 用逗号拼接(如 `"id1,id2,id3"`)** | **⚠️ 必填,永远不能为空** |
|
|
245
246
|
| **费用类型(科目)** | **优先 `invoice.reim.row-info` 返回的 `subjectId`;为空时按 [expense-subject-rules.md](reim-expense-subject-rules.md) 匹配,匹配不到用兜底 `"100502270000000104"`** | **⚠️ 必填,永远不能为空** |
|
|
246
247
|
| 相关发票 | `invoiceId` | 必填 |
|
|
@@ -254,8 +255,8 @@
|
|
|
254
255
|
> - **相关客户(出差流程)**:必须由用户提供具体客户后再填,未提供则**暂停且不允许调用 `invoice.reim.flow.create.prepare/apply`**,不能用固定值顶替
|
|
255
256
|
> - **合同编号**:固定填 `"20260999"`,不需要从其他来源提取
|
|
256
257
|
> - **承担主体**:使用当前用户 ID(`creatorId`)
|
|
257
|
-
> - **报销人上级**:`invoice.reim.employee-superiors` 返回的 `
|
|
258
|
-
> - **承担人直接上级**:`invoice.reim.employee-superiors` 返回的 `
|
|
258
|
+
> - **报销人上级**:`invoice.reim.employee-superiors` 返回的 `directSuperior.id`
|
|
259
|
+
> - **承担人直接上级**:`invoice.reim.employee-superiors` 返回的 `directSuperior.id`
|
|
259
260
|
> - **承担人所有上级**:`invoice.reim.employee-superiors` 返回的 `allSuperiors` 所有 `id` 用逗号拼接
|
|
260
261
|
|
|
261
262
|
### 出差流程相关客户(硬拦截)
|
|
@@ -286,6 +287,18 @@
|
|
|
286
287
|
5. **禁止**用固定值 `"100504500000311504"` 顶替出差的相关客户
|
|
287
288
|
6. **禁止**把出差相关客户放入 `unable_to_fill` 后继续创建报销单
|
|
288
289
|
|
|
290
|
+
### 话费补贴 / 话费报销(硬拦截)
|
|
291
|
+
|
|
292
|
+
> **命中「话费补贴标准审批流程」或「话费报销」时,必须按 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md) 计算实报金额,禁止按发票原价填 Money 字段。**
|
|
293
|
+
|
|
294
|
+
**如何判断(满足任一即可):** `workFlowName` 含「话费补贴标准审批流程」或「话费报销」;事前申请名称含「话费补贴」或「话费报销」;用户明确说话费报销 / 话费补贴。
|
|
295
|
+
|
|
296
|
+
**填单前必须齐备:** 本人实名制当月手机账单截图、账单构成、用户岗位对应的月度上限。缺任一则暂停,不允许进入 `invoice.reim.flow.create.prepare/apply`。
|
|
297
|
+
|
|
298
|
+
**实报金额:** 先从账单构成中剔除「手机设备赠送套餐」「家庭宽带套餐」,再按 `min(可报销账单金额, 岗位月度上限)` 支付。低于标准按实际可报销账单支付,超过上限按上限支付。
|
|
299
|
+
|
|
300
|
+
**Money 字段覆盖:** 本场景下明细/主表所有金额字段填上述实报金额,不填发票 `amount`。发票原始金额只用于核对,不得改写发票数据。
|
|
301
|
+
|
|
289
302
|
---
|
|
290
303
|
|
|
291
304
|
## 字段名称 → 数据来源映射表
|
|
@@ -304,11 +317,11 @@
|
|
|
304
317
|
| **相关客户** | **按是否出差分流** | **非出差**:固定填 `"100504500000311504"`(泛微上海)。**出差流程**:必须提醒用户填写具体客户,拿到客户名称后搜索 ID 再填;用户未提供则不允许报销 |
|
|
305
318
|
| **合同编号** | **固定值** | **固定填 `"20260999"`,不从其他来源提取,不能留空或放入 unable_to_fill** |
|
|
306
319
|
| **承担主体** | **事前申请/当前用户** | **`creatorId`(marked=true),不能留空或放入 unable_to_fill** |
|
|
307
|
-
| **报销人上级** | **`invoice.reim.employee-superiors`** | **`
|
|
308
|
-
| **承担人直接上级** | **`invoice.reim.employee-superiors`** | **`
|
|
320
|
+
| **报销人上级** | **`invoice.reim.employee-superiors`** | **`directSuperior.id`(直接上级 ID,直接赋值;取值口径见 [reim-workflow.md](reim-workflow.md#报销共享常量所有-reference-统一引用本节)),不能留空或放入 unable_to_fill** |
|
|
321
|
+
| **承担人直接上级** | **`invoice.reim.employee-superiors`** | **`directSuperior.id`(直接上级 ID,直接赋值;取值口径见 [reim-workflow.md](reim-workflow.md#报销共享常量所有-reference-统一引用本节)),不能留空或放入 unable_to_fill** |
|
|
309
322
|
| **承担人所有上级** | **`invoice.reim.employee-superiors`** | **`allSuperiors` 所有 `id` 用逗号拼接赋值(如 `"id1,id2,id3"`),不能留空或放入 unable_to_fill** |
|
|
310
323
|
| 币种 | options 默认选项 | 默认选"人民币"的 optionValue |
|
|
311
|
-
| 申请金额/人民币金额 | 发票 |
|
|
324
|
+
| 申请金额/人民币金额 | 发票 | 默认:发票金额合计(所有**发票**的 `amount` 之和,不含相关凭证)。**话费报销**:各行按 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md) 算出的实报金额之和 |
|
|
312
325
|
|
|
313
326
|
### 明细表字段映射
|
|
314
327
|
|
|
@@ -331,8 +344,9 @@
|
|
|
331
344
|
| **相关凭证**(`EinvoiceComponent`, `single=true`) | **`invoice.reim.row-info` 优先** → 凭证配对 | 优先 `invoice.reim.row-info` 返回的 `itinerary`,回退到凭证配对逻辑;**无凭证则不填** |
|
|
332
345
|
|
|
333
346
|
> **⚠️ 明细行金额字段填写规则(重要,容易遗漏):**
|
|
334
|
-
> 明细表中 `fieldType="Money"` 的字段,无论 `fieldName`
|
|
335
|
-
> 遍历 `subFields` 时,只要 `fieldType="Money"
|
|
347
|
+
> 明细表中 `fieldType="Money"` 的字段,无论 `fieldName` 叫什么名字(实报金额、报销金额、申请金额、人民币金额、含税金额等),**默认全部统一填该行发票的 `amount`**。
|
|
348
|
+
> 遍历 `subFields` 时,只要 `fieldType="Money"`,就填金额,不要因为字段名不是"实报金额"就跳过。
|
|
349
|
+
> **例外:** 话费补贴 / 话费报销必须改填 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md) 算出的实报金额,不能填发票原价。
|
|
336
350
|
|
|
337
351
|
### 交通类发票费用说明特殊规则
|
|
338
352
|
|
|
@@ -353,28 +367,32 @@
|
|
|
353
367
|
|
|
354
368
|
**4. 长度控制**:每个地名精简后控制在 10 字以内
|
|
355
369
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
370
|
+
**精简快速参考表**(按类型分组,覆盖常见场景):
|
|
371
|
+
|
|
372
|
+
| 原始地址 | 精简结果 | 处理说明 |
|
|
373
|
+
|----------|----------|----------|
|
|
374
|
+
| 仁济医院南院区门诊部(南门)南侧 | 仁济医院南院 | 去括号、去方位后缀、去附属设施 |
|
|
375
|
+
| 浦江瑞和城柒街区30号 | 浦江瑞和城 | 去门牌号、去街区编号 |
|
|
376
|
+
| 北京SKP(西2门)西北侧 | 北京SKP西2门 | 括号内"西2门"是出入口标识→保留;"西北侧"冗余→去 |
|
|
377
|
+
| 虹桥机场T2航站楼出发层 | 虹桥机场T2 | T2是航站楼标识→保留;"航站楼出发层"冗余→去 |
|
|
378
|
+
| 浦东国际机场T1航站楼到达层 | 浦东机场T1 | 去"国际"、"航站楼到达层" |
|
|
379
|
+
| 上海市闵行区三鲁公路3419号 | 三鲁公路 | 去行政区划前缀、去门牌号 |
|
|
380
|
+
| 泛微网络科技股份有限公司(北方大区业务运营中心) | 泛微网络(北方运营中心) | 去企业后缀,括号内精简保留 |
|
|
381
|
+
| 北京南站 | 北京南站 | 已够短,原样保留 |
|
|
382
|
+
| 上海南站地铁站2号出入口 | 上海南站 | 去"地铁站"、"出入口" |
|
|
383
|
+
| 杭州萧山国际机场T3航站楼国内出发 | 萧山机场T3 | 去城市名(已在行程上下文中)、"国际"、"国内出发" |
|
|
384
|
+
| 上海市浦东新区世纪大道100号环球金融中心 | 环球金融中心 | 去地址前缀,保留标志性建筑名 |
|
|
385
|
+
| 中国人民解放军海军军医大学第一附属医院(长海医院) | 长海医院 | 括号内是通用简称→用简称 |
|
|
386
|
+
| 上海火车站(北广场)东北侧 | 上海火车站 | 去广场方位和方向后缀 |
|
|
387
|
+
|
|
388
|
+
**边界情况处理**:
|
|
389
|
+
|
|
390
|
+
| 边界场景 | 处理方式 |
|
|
391
|
+
|----------|----------|
|
|
392
|
+
| from/to 只有经纬度或地址代码,无可读地名 | 跳过精简,回退到 `fysm` 或 `consumeContent` |
|
|
393
|
+
| 精简后 from 和 to 相同(同一地点上下车) | 保留,写成 `{地点}` 而非 `{地点}-{地点}` |
|
|
394
|
+
| from 或 to 为空 | 只写有值的那个,不加 `-` 分隔符 |
|
|
395
|
+
| 地名含英文(如 Costco、IKEA) | 原样保留英文品牌名,不翻译 |
|
|
378
396
|
|
|
379
397
|
> **注意**:交通类发票的费用说明**忽略** `invoice.reim.row-info` 返回的 `fysm` 和 `consumeContent`,只使用 `{出发地精简}-{目的地精简}`。如果 `invoice.get` 未返回 from/to,则回退到常规费用说明逻辑。
|
|
380
398
|
|
|
@@ -415,11 +433,12 @@
|
|
|
415
433
|
1.5. **⚠️ 禁止 `*` 号**:所有填入报销单的文本值(费用说明、报销事由等)**禁止包含 `*` 符号**。从 `consumeContent` 等字段取值时必须先去掉所有 `*` 号(如 `*交通运输服务*客运服务费` → `交通运输服务客运服务费`)
|
|
416
434
|
2. 设置 `work_flow_id` + `mainFormId` + 生成 `request_name`
|
|
417
435
|
2.5. **⚠️ 出差流程拦截相关客户**:若判定为出差/差旅,先提醒用户填写具体相关客户;用户未提供则**停止组装,不允许进入 Step 5**。非出差才填固定值 `"100504500000311504"`
|
|
436
|
+
2.6. **⚠️ 话费报销拦截**:若判定为「话费补贴标准审批流程」或「话费报销」,先按 [reim-phone-subsidy-rules.md](reim-phone-subsidy-rules.md) 核对账单截图、账单构成和岗位上限,再按标准计算实报金额;材料不齐或岗位未确认则**停止组装,不允许进入 Step 5**
|
|
418
437
|
3. 遍历 `mainFields` → 推断值 → 有值加入 `main_fields`,多候选→`need_user_confirm`,无法推断→`unable_to_fill`
|
|
419
438
|
4. **⚠️ 对每张发票调用 `invoice.reim.row-info` 获取预填信息**(详见 [reim-api-reference.md](reim-api-reference.md#56-获取发票明细行预填信息)):
|
|
420
439
|
- 入参:`cdzt`=当前用户ID,`requestid`=匹配到的事前申请ID(无则留空),`invoiceId`=发票ID
|
|
421
440
|
- 返回的 `date`、`fysm`、`itinerary`、`subjectId` **优先使用**,只有返回为空/null时才回退到 AI 推断
|
|
422
|
-
5. 每张**发票**(非凭证)= 一行明细(`dataIndex` 从 1
|
|
441
|
+
5. 每张**发票**(非凭证)= 一行明细(`dataIndex` 从 1 递增),**完整遍历费用明细表(按上面规则定位)的 `subFields` 每个字段**推断值
|
|
423
442
|
6. **每行必须填写**:费用类型(科目)、所有金额字段、费用日期、费用说明、相关发票等
|
|
424
443
|
7. **每行必须将发票 `invoiceId` 赋值到 `EinvoiceComponent`+`single=false` 的字段**
|
|
425
444
|
8. **相关凭证**:优先使用 `invoice.reim.row-info` 返回的 `itinerary`;如无返回,使用原有凭证配对逻辑
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
- invoiceDate 在 createTime 后 7 天内 → 加满分
|
|
85
85
|
- invoiceDate 在 createTime 后 7~30 天 → 加大部分分
|
|
86
86
|
- invoiceDate 在 createTime 后 30~90 天 → 加少量分
|
|
87
|
+
|
|
88
|
+
**话费报销例外**:话费补贴事前申请可能在审批通过后长期有效,
|
|
89
|
+
不受 90 天窗口限制。只要 invoiceDate >= createTime 即可匹配,
|
|
90
|
+
不因时间距离远而降分。详见 reim-phone-subsidy-rules.md。
|
|
87
91
|
```
|
|
88
92
|
|
|
89
93
|
### 维度3:金额校验
|