weaver-work-cli 0.1.61 → 0.1.62

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.
@@ -1,204 +0,0 @@
1
- # 发票浏览按钮字段数据
2
-
3
- ## 什么时候读取
4
-
5
- 用户要把业票通发票填入 E10 流程表单的发票浏览按钮控件,或要求"生成发票字段结构化数据""流程填单发票对象数据"时读取本文件。
6
-
7
- ## Operation
8
-
9
- | Operation | 风险 | 输入 |
10
- | --- | --- | --- |
11
- | `invoice.browse-field.data` | read | `fid`、`fids` 或已取得的 `detail` 响应三选一 |
12
-
13
- ## 业务用途
14
-
15
- E10 流程填单时,发票字段使用浏览按钮控件,填值必须传入包含完整票面信息的 JSON 对象,不能传简单文本。CLI 根据 `fid` 自动完成详情查询和 JSON 转换。
16
-
17
- ## 命令
18
-
19
- Windows PowerShell:
20
-
21
- ```powershell
22
- weaver-work-cli --json invoice run invoice.browse-field.data --input-json '{"fid":"12345"}'
23
- ```
24
-
25
- macOS/Linux(bash/zsh):
26
-
27
- ```bash
28
- weaver-work-cli --json invoice run invoice.browse-field.data --input-json '{"fid":"12345"}'
29
- ```
30
-
31
- 多张发票:
32
-
33
- Windows PowerShell:
34
-
35
- ```powershell
36
- weaver-work-cli --json invoice run invoice.browse-field.data --input-json '{"fids":["12345","67890"]}'
37
- ```
38
-
39
- macOS/Linux(bash/zsh):
40
-
41
- ```bash
42
- weaver-work-cli --json invoice run invoice.browse-field.data --input-json '{"fids":["12345","67890"]}'
43
- ```
44
-
45
- ## 目标 JSON 结构
46
-
47
- 下表定义每个发票对象的字段。`D` 代指发票详情响应中的 `infos[].info`。
48
-
49
- | 键 | 类型 | 来源 | 说明 |
50
- |---|---|---|---|
51
- | `optionId` / `id` / `fid` | string | `D.fid` | 三者取相同值,发票唯一标识。 |
52
- | `type` | integer | `D.comm_info.pro.type` | 票种编码。 |
53
- | `typeName` | string | `D.comm_info.pro.cname`;缺失时按 `type` 查[票种名称表](#票种编码与名称) | 票种中文名称。 |
54
- | `number` | string | `D.number` | 发票号码。 |
55
- | `code` | string | `D.code` | 发票代码;无代码票种取空串。 |
56
- | `content` / `name` | string | `"{typeName}-{number}"` 拼接 | 显示用摘要,两者取相同值。 |
57
- | `total` | string | `D.comm_info.price.total` | 价税合计,单位元。 |
58
- | `ttax` | string | `D.ext` → `ttax` | 票面税额。 |
59
- | `seller` | string | `D.comm_info.payer.company` | 销售方名称。 |
60
- | `sellerId` | string | `D.comm_info.payer.tcode` | 销售方税号。 |
61
- | `buyer` | string | `D.comm_info.buyer.company` | 购买方名称。 |
62
- | `buyerId` | string | `D.comm_info.buyer.tcode` | 购买方税号。 |
63
- | `incDate` | string | `D.comm_info.pro.date` | 开票日期 `yyyy-MM-dd`。 |
64
- | `incDateTimestamp` | integer | `incDate` 转 UTC+8 零时毫秒时间戳 | 空时取 `0`。 |
65
- | `validStatus` | string | `D.comm_info.pro.valid` 查[查验状态表](#查验状态) | 查验状态文本。 |
66
- | `source` | string | `D.modify_info.source` 查[录入来源表](#录入来源) | 录入来源文本。 |
67
- | `invoiceStatus` | integer | `D.comm_info.pro.status` | 发票状态;`0` 正常。 |
68
- | `del` | integer | `D.modify_info.del` | 删除状态;`0` 正常。 |
69
- | `currency` / `currencyName` | string | `D.currency` / `D.currencyName` | 默认 `"CNY"` / `"人民币"`。 |
70
- | `taxRate` | string | `D.ext` → `taxRate` 或 `products[0].taxRate` | 税率,如 `"13.000"`。 |
71
- | `consumeContent` | string | `D.ext` → `products` 各项 `productName` 拼接 | 消费内容。 |
72
- | `fylx` | string | `D.fylx` | 费用类型 ID;缺失取 `"0"`。 |
73
- | `inputDate` | string | `D.modify_info.createDate` | 录入日期 `yyyy-MM-dd HH:mm:ss`。 |
74
- | `incTotal` | integer | 固定 `0` | 预留字段。 |
75
- | `reimingMoney` | string | `D.comm_info.price.reimingMoney` | 报销中金额;缺失取空串。 |
76
- | `reimedMoney` | string | `D.comm_info.price.reimedMoney` | 已报销金额;缺失取空串。 |
77
- | `notReimMoney` | string | `total - reimedMoney - reimingMoney` | 无报销数据时等于 `total`。 |
78
- | `reimDate` | string | 报销日期 | 缺失取空串。 |
79
- | `reimProcess` | string | 报销流程 ID | 缺失取空串。 |
80
-
81
- 缺失字段统一按类型填充:字符串用空串 `""`,数值用 `0`。
82
-
83
- ## 枚举映射表
84
-
85
- ### 票种编码与名称
86
-
87
- 优先使用详情响应中的 `cname`。仅当 `cname` 缺失时按以下表查找。
88
-
89
- | `type` | `typeName` |
90
- |---:|---|
91
- | 1 | 增值税专用发票 |
92
- | 2 | 增值税普通发票 |
93
- | 3 | 增值税电子普通发票 |
94
- | 4 | 卷式发票 |
95
- | 5 | 通行费增值税电子普通发票 |
96
- | 6 | 机动车销售统一发票 |
97
- | 7 | 定额发票 |
98
- | 8 | 客运汽车票 |
99
- | 9 | 航空运输电子客票行程单 |
100
- | 10 | 火车票 |
101
- | 11 | 出租车票 |
102
- | 12 | 其他 |
103
- | 13 | 汽车通行费发票 |
104
- | 14 | 船票 |
105
- | 22 | 二手车销售统一发票 |
106
- | 28 | 增值税电子专用发票 |
107
- | 32 | 电子发票(增值税专用发票) |
108
- | 33 | 电子发票(普通发票) |
109
- | 47 | 医疗收费票据 |
110
- | 48 | 财政非税收入统一票据 |
111
- | 49 | 海关进口增值税专用缴款书 |
112
- | 50 | 电子发票服务平台纸质普票 |
113
- | 52 | 完税凭证 |
114
- | 53 | 国际小票 |
115
- | 54 | 银行回单 |
116
- | 56 | 代扣代缴税收缴款凭证 |
117
-
118
- 未匹配的 `type` 使用 `"未知票种"`。
119
-
120
- ### 查验状态
121
-
122
- | `valid` | `validStatus` |
123
- |---:|---|
124
- | 0 | 未查验 |
125
- | 1 | 有效已查验 |
126
- | 2 | 有效未查验 |
127
- | 3 | 查验失败 |
128
- | 4 | 发票无效 |
129
- | 5 | 票面校验不一致 |
130
-
131
- ### 录入来源
132
-
133
- | `source` | 文本 |
134
- |---:|---|
135
- | 1 | 微信 |
136
- | 2 | 支付宝 |
137
- | 4 | 邮箱 |
138
- | 5 | 拍照 |
139
- | 6 | 扫码 |
140
- | 7 | 手动 |
141
- | 9 | 查验录入 |
142
- | 10 | 企业微信 |
143
- | 11 | 公众号 |
144
- | 12 | 企业台账 |
145
- | 13 | 文件 |
146
- | 14 | Excel |
147
- | 15 | 短信 |
148
- | 16 | 链接录入 |
149
-
150
- 未匹配的 `source` 使用空串。
151
-
152
- ## 输出示例
153
-
154
- ```json
155
- {
156
- "optionId": "1307869223054704650",
157
- "id": "1307869223054704650",
158
- "fid": "1307869223054704650",
159
- "type": 32,
160
- "typeName": "电子发票(增值税专用发票)",
161
- "number": "26932000001429154341",
162
- "code": "",
163
- "content": "电子发票(增值税专用发票)-26932000001429154341",
164
- "name": "电子发票(增值税专用发票)-26932000001429154341",
165
- "total": "368269.14",
166
- "ttax": "42367.25",
167
- "seller": "宁波市北仑亮峰精密机械制造有限公司",
168
- "sellerId": "91330206744967935K",
169
- "buyer": "宁波海伯集团有限公司",
170
- "buyerId": "913302041443146316",
171
- "incDate": "2026-08-25",
172
- "incDateTimestamp": 1787587200000,
173
- "validStatus": "有效已查验",
174
- "source": "邮箱",
175
- "invoiceStatus": 0,
176
- "del": 0,
177
- "currency": "CNY",
178
- "currencyName": "人民币",
179
- "taxRate": "13.000",
180
- "consumeContent": "*金属制品*主齿轮",
181
- "fylx": "0",
182
- "inputDate": "2026-08-26 10:40:33",
183
- "incTotal": 0,
184
- "reimingMoney": "",
185
- "reimedMoney": "",
186
- "notReimMoney": "368269.14",
187
- "reimDate": "",
188
- "reimProcess": ""
189
- }
190
- ```
191
-
192
- ## 输出处理
193
-
194
- 成功时 `data.items` 是浏览按钮可用对象数组。如果批量详情中有部分发票失败,operation 返回 `meta.status="PARTIAL"`,成功项仍在 `data.items`,失败项在 `data.errors`。Agent 回复用户时只展示成功数量、失败数量和关键发票字段;不要粘贴完整大 JSON。
195
-
196
- ## 边界与错误处理
197
-
198
- - 详情查询固定 `mask=0`、`userFlag=1`、`isDelFlag=1`。
199
- - `ext` 为 JSON 字符串,解析失败时 `ttax`、`taxRate`、`consumeContent` 取空串,不中断记录生成。
200
- - 批量 fid 中部分查询失败时,成功项正常输出,失败项出现在 `errors` 数组中。
201
-
202
- ## 注意
203
-
204
- 该 operation 由 CLI 封装,Agent 只需调用 `invoice.browse-field.data` 或 `invoice.get`,不能直接 `curl` E10 接口,也不需要运行旧源码里的 Python 脚本。