cbs-4px-merchant-cli 0.0.11 → 0.0.13

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.
Files changed (42) hide show
  1. package/dist/cli.js +135 -12
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/config.js +145 -8
  4. package/dist/commands/config.js.map +1 -1
  5. package/dist/commands/custody.d.ts +49 -0
  6. package/dist/commands/custody.js +245 -0
  7. package/dist/commands/custody.js.map +1 -1
  8. package/dist/commands/onboarding.d.ts +5 -0
  9. package/dist/commands/onboarding.js +22 -0
  10. package/dist/commands/onboarding.js.map +1 -1
  11. package/dist/commands/order.d.ts +15 -0
  12. package/dist/commands/order.js +194 -8
  13. package/dist/commands/order.js.map +1 -1
  14. package/dist/commands/platform.d.ts +42 -0
  15. package/dist/commands/platform.js +98 -5
  16. package/dist/commands/platform.js.map +1 -1
  17. package/dist/commands/update.js +124 -3
  18. package/dist/commands/update.js.map +1 -1
  19. package/dist/errors.d.ts +29 -1
  20. package/dist/errors.js +11 -1
  21. package/dist/errors.js.map +1 -1
  22. package/dist/services/api-client.d.ts +37 -2
  23. package/dist/services/api-client.js +70 -4
  24. package/dist/services/api-client.js.map +1 -1
  25. package/dist/services/binary-source.d.ts +30 -0
  26. package/dist/services/binary-source.js +88 -0
  27. package/dist/services/binary-source.js.map +1 -0
  28. package/dist/services/binary-update.d.ts +62 -0
  29. package/dist/services/binary-update.js +179 -0
  30. package/dist/services/binary-update.js.map +1 -0
  31. package/dist/services/install-detector.d.ts +13 -1
  32. package/dist/services/install-detector.js +20 -1
  33. package/dist/services/install-detector.js.map +1 -1
  34. package/dist/types/index.d.ts +137 -1
  35. package/package.json +7 -1
  36. package/skill/SKILL.md +11 -4
  37. package/skill/package.json +1 -1
  38. package/skill/reference/custody.md +217 -4
  39. package/skill/reference/index.md +9 -3
  40. package/skill/reference/onboarding.md +42 -0
  41. package/skill/reference/order.md +134 -4
  42. package/skill/reference/platform.md +84 -1
@@ -97,6 +97,51 @@ export interface BillingFeeItemDetailVO {
97
97
  currencyCode: string | null;
98
98
  billingSuccessDateStr: string | null;
99
99
  }
100
+ /** 单条字段规则(长度/正则/必填等),来自规则库配置 */
101
+ export interface FieldRule {
102
+ ruleType: string | null;
103
+ ruleTypeDesc: string | null;
104
+ ruleValue: string | null;
105
+ }
106
+ /** 某个下单字段的规则集合 */
107
+ export interface OrderFieldRuleItem {
108
+ field: string | null;
109
+ /**
110
+ * 该字段在 order create/edit 的 JSON 里的路径,如 receiver.name、parcel.weight、
111
+ * declareItems[].qty。后端直接给出,不需要自己从 field 换算(两套命名不是驼峰转换)。
112
+ * null 表示该字段不能通过建单/改单接口设置。
113
+ */
114
+ requestPath: string | null;
115
+ fieldLabel: string | null;
116
+ fieldElabel: string | null;
117
+ required: boolean | null;
118
+ rules: FieldRule[];
119
+ placeholder: string[];
120
+ msg: string | null;
121
+ }
122
+ /**
123
+ * 跨字段联动约束。无法用「单字段必填」表达,必须单独判断。
124
+ */
125
+ export interface FieldRuleLinkage {
126
+ iossOrVatEitherRequired: boolean | null;
127
+ hscodeRequiredWhenIoss: boolean | null;
128
+ idOrVatEitherRequired: boolean | null;
129
+ currencyCustoms: string | null;
130
+ currencyMustBeConsistent: boolean | null;
131
+ }
132
+ /**
133
+ * 下单字段规则全量清单。
134
+ *
135
+ * 必填性由规则库按 (产品, 目的国, 客户, 单据状态) 配置,不同产品结论不同 —— 这是
136
+ * 判断字段必填的唯一权威来源,不要在客户端另写一份清单。
137
+ */
138
+ export interface OrderFieldRulesResp {
139
+ productCode: string | null;
140
+ country: string | null;
141
+ fields: OrderFieldRuleItem[];
142
+ linkage: FieldRuleLinkage | null;
143
+ chatReply: string | null;
144
+ }
100
145
  export interface OrderDetailResp {
101
146
  orderDTO: OrderVO | null;
102
147
  shipperConsigneeDTO: ShipperConsigneeVO | null;
@@ -340,6 +385,9 @@ export interface ProblemListRequest {
340
385
  pageSize?: number;
341
386
  }
342
387
  export interface AbnormalProblem {
388
+ reasonCode: string | null;
389
+ abnId: number | null;
390
+ reasonId: number | null;
343
391
  abnormalTypeName: string | null;
344
392
  abnormalReasonName: string | null;
345
393
  abnormalDescription: string | null;
@@ -458,6 +506,42 @@ export interface ChangeProductResp {
458
506
  success: boolean;
459
507
  message: string | null;
460
508
  }
509
+ /** 下达走货指令参数 */
510
+ export interface ShipmentSubmitParams {
511
+ orderNo: string;
512
+ reasonCode: string;
513
+ solutionChildTypeNo: number;
514
+ newFpxTrackNo?: string;
515
+ remark?: string;
516
+ content?: string;
517
+ }
518
+ /** 下达退件指令参数 */
519
+ export interface ReturnSubmitParams {
520
+ orderNo: string;
521
+ reasonCode: string;
522
+ returnAddressId?: number;
523
+ }
524
+ /** 下达销毁指令参数 */
525
+ export interface DestroySubmitParams {
526
+ orderNo: string;
527
+ reasonCode: string;
528
+ }
529
+ /** 退件地址项 */
530
+ export interface ReturnAddressItem {
531
+ id: number | null;
532
+ consigneeName: string | null;
533
+ consigneeTel: string | null;
534
+ province: string | null;
535
+ city: string | null;
536
+ district: string | null;
537
+ streetAddress: string | null;
538
+ returnType: string | null;
539
+ isDefault: string | null;
540
+ }
541
+ /** 退件地址库列表 */
542
+ export interface ReturnAddressListResp {
543
+ list: ReturnAddressItem[];
544
+ }
461
545
  export interface ServiceRepairOrderListRequest {
462
546
  orderCodeListString?: string;
463
547
  businessLineId?: number;
@@ -913,6 +997,24 @@ export interface PlatformOrderItem {
913
997
  createdTime: string | null;
914
998
  pushTime: string | null;
915
999
  }
1000
+ export interface PlatformOrderUpdateResp {
1001
+ updatedIds: string[];
1002
+ failed: {
1003
+ id: string;
1004
+ errMsg: string;
1005
+ }[];
1006
+ }
1007
+ /**
1008
+ * push 的失败明细(每个未能推送的订单一条)。
1009
+ *
1010
+ * 后端只回失败项:**空数组表示全部推送成功**。已推送的单会以
1011
+ * "订单已推送…不能重复推送" 出现在这里 —— 后端按状态拒绝,防止重复建物流单。
1012
+ */
1013
+ export interface PlatformOrderPushFailure {
1014
+ id?: string | null;
1015
+ customerOrderNo?: string | null;
1016
+ errMsg?: string | null;
1017
+ }
916
1018
  export interface PlatformOrderListResp {
917
1019
  pageNum: number;
918
1020
  pageSize: number;
@@ -950,6 +1052,31 @@ export interface PlatformOrderDetailResp {
950
1052
  buyerId: string | null;
951
1053
  buyerNote: string | null;
952
1054
  createdTime: string | null;
1055
+ receiverCompany: string | null;
1056
+ addressLine1: string | null;
1057
+ addressLine2: string | null;
1058
+ countryCode: string | null;
1059
+ countryName: string | null;
1060
+ county: string | null;
1061
+ buyerEmail: string | null;
1062
+ sellerNote: string | null;
1063
+ /** 寄件人整组:平台单 sync 回来必为空,push 前须补齐 */
1064
+ senderName: string | null;
1065
+ senderCompany: string | null;
1066
+ senderTelephone: string | null;
1067
+ senderAddress: string | null;
1068
+ senderCity: string | null;
1069
+ senderProvince: string | null;
1070
+ senderPostcode: string | null;
1071
+ senderId: string | null;
1072
+ ioss: string | null;
1073
+ vatNo: string | null;
1074
+ eori: string | null;
1075
+ tariffno: string | null;
1076
+ hasBattery: string | null;
1077
+ returnsign: string | null;
1078
+ transactionId: string | null;
1079
+ fulfillmentOrderId: string | null;
953
1080
  items: PlatformOrderItemDetail[] | null;
954
1081
  }
955
1082
  export interface IndivAuthRequest {
@@ -1143,6 +1270,8 @@ export interface OrderParcelInfo {
1143
1270
  dutyPayMode?: string;
1144
1271
  batteryType?: string;
1145
1272
  iossNo?: string;
1273
+ /** EORI 号(欧盟进口商登记号)。后端字段名为 tariffNo */
1274
+ eoriNo?: string;
1146
1275
  orderNote?: string;
1147
1276
  salesPlatform?: string;
1148
1277
  warehouseCode?: string;
@@ -1162,12 +1291,19 @@ export interface OrderDeclareItemInfo {
1162
1291
  url?: string;
1163
1292
  brand?: string;
1164
1293
  }
1165
- /** `P` = 预报(直接提交),`D` = 草稿(保存不提交)。后端默认 `P`。 */
1294
+ /**
1295
+ * `P` = 预报(直接提交),`D` = 草稿(保存不提交)。后端默认 `P`。
1296
+ *
1297
+ * 后端已改用语义化的 `draft` 布尔,`status` 仅作兼容保留。订单 JSON 里两者都接受,
1298
+ * CLI 会统一转成 `draft` 发出。
1299
+ */
1166
1300
  export type OrderWriteStatus = 'P' | 'D';
1167
1301
  export interface CreateOrderRequest {
1168
1302
  productCode: string;
1169
1303
  destinationCountry: string;
1170
1304
  originCountry?: string;
1305
+ /** 保存为草稿。与 status 二选一,同时存在时 draft 优先 */
1306
+ draft?: boolean;
1171
1307
  status?: OrderWriteStatus;
1172
1308
  customerOrderNo?: string;
1173
1309
  pieces?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbs-4px-merchant-cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Cbs merchant CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,6 +26,12 @@
26
26
  "build:cainiao:test": "SITE=cainiao ENV=test npm run build",
27
27
  "build:cainiao:pre": "SITE=cainiao ENV=pre npm run build",
28
28
  "package:role-skills": "bash scripts/package-role-skills.sh",
29
+ "build:binary:4px": "node scripts/build-binary.mjs --site 4px --env prod",
30
+ "build:binary:cainiao": "node scripts/build-binary.mjs --site cainiao --env prod",
31
+ "build:binary:host": "node scripts/build-binary.mjs --site 4px --env prod --host",
32
+ "oss:upload": "node scripts/oss-upload.mjs",
33
+ "oss:upload:dry": "node scripts/oss-upload.mjs --dry-run",
34
+ "release:binary": "npm run build:binary:4px && npm run build:binary:cainiao && npm run oss:upload",
29
35
  "dev:4px:test": "SITE=4px ENV=test npm run build && node dist/index.js skill install",
30
36
  "dev:4px:pre": "SITE=4px ENV=pre npm run build && node dist/index.js skill install",
31
37
  "dev:cainiao:test": "SITE=cainiao ENV=test npm run build && node dist/index.js skill install",
package/skill/SKILL.md CHANGED
@@ -42,7 +42,7 @@ description: >-
42
42
  | 产品推荐 | [`reference/product.md`](reference/product.md) | 参数多(国家/重量/电池/邮编等),必须确认 |
43
43
  | 理赔查询 | [`reference/service.md`](reference/service.md) | 参数多(单号/时间/状态/分页),必须确认 |
44
44
  | 异常件管理 | [`reference/problem.md`](reference/problem.md) | 确认子命令和参数格式 |
45
- | 异常托管(改带电/改产品) | [`reference/custody.md`](reference/custody.md) | 含写操作,必须确认参数和确认机制 |
45
+ | 异常托管(改带电/改产品/走货/退件/销毁) | [`reference/custody.md`](reference/custody.md) | 含写操作(销毁不可逆),必须确认参数和确认机制 |
46
46
  | 服务中心 | [`reference/service.md`](reference/service.md) | 确认子命令和参数格式 |
47
47
  | 财务管理 | [`reference/finance.md`](reference/finance.md) | 确认子命令和参数格式 |
48
48
  | 揽收管理 | [`reference/pickup.md`](reference/pickup.md) | 确认参数格式 |
@@ -70,7 +70,7 @@ description: >-
70
70
  | `product` | 产品推荐:推荐产品、产品列表、产品详情、时效查询、搜索产品 | [`reference/product.md`](reference/product.md) |
71
71
  | `claim` | 理赔查询:按单号/时间/状态查询理赔列表(挂在 `service` 下,即 `fmc service claim ...`) | [`reference/service.md`](reference/service.md) |
72
72
  | `problem` | 异常件管理:问题件列表、AI处理建议、通知件、尾程异常、欠费件、拦截件 | [`reference/problem.md`](reference/problem.md) |
73
- | `custody` | 异常托管:改带电产品查询、AI推荐改产品、批量提交改产品(写操作) | [`reference/custody.md`](reference/custody.md) |
73
+ | `custody` | 异常托管:改带电/改产品查询与提交、查可下达指令、走货/退件/销毁指令下达(写操作,销毁不可逆)、退件地址库查询 | [`reference/custody.md`](reference/custody.md) |
74
74
  | `service` | 服务中心:售后工单、查件、投诉、服务单详情、处理记录、理赔详情 | [`reference/service.md`](reference/service.md) |
75
75
  | `finance` | 财务管理:账户余额、账单、每日费用、未出账汇总及明细、充值记录(在线及线下)、计费明细 | [`reference/finance.md`](reference/finance.md) |
76
76
  | `pickup` | 揽收管理:物料申请单查询 | [`reference/pickup.md`](reference/pickup.md) |
@@ -106,6 +106,10 @@ description: >-
106
106
  用户提到"拦截/拦截件" → `fmc problem intercepted`
107
107
  用户提到"改带电/换带电产品" → `fmc custody electric`
108
108
  用户提到"改产品/换产品/推荐异常产品" → `fmc custody recommend`
109
+ 用户提到"这个异常能下哪些指令/可下达指令" → `fmc custody help`
110
+ 用户提到"走货/确认走货/换单号走货" → `fmc custody ship`(写操作,先确认)
111
+ 用户提到"退件/退回/退货" → `fmc custody return`(写操作,先确认);查退件地址用 `custody address`
112
+ 用户提到"销毁/丢弃/不要了" → `fmc custody destroy`(写操作,不可逆,务必确认)
109
113
  用户提到"批量处理异常/托管处理" → 参考跟单助理角色 SOP
110
114
  用户提到"工单/售后/报修" → `fmc service repair`
111
115
  用户提到"查件/查件进度" → `fmc service check`
@@ -119,7 +123,8 @@ description: >-
119
123
  用户提到"计费明细" → `fmc finance fee-detail`
120
124
  用户提到"地址簿/地址列表" → `fmc order address-book`
121
125
  用户提到"目的国/国家查询/搜索国家" → `fmc order country`
122
- 用户提到"下单/开单/建单/寄一个包裹" → `fmc order create --draft`(**写**,先建草稿让用户核对)
126
+ 用户提到"哪些字段必填/要填什么/这个字段怎么填" → `fmc order field-rules --product-code <code> --country <cc>`
127
+ 用户提到"下单/开单/建单/寄一个包裹" → 先 `fmc order field-rules --required-only` 查必填,再 `fmc order create --draft`(**写**,先建草稿让用户核对)
123
128
  用户提到"改单/修改订单/改地址改重量" → `fmc order edit`(**写**,仅草稿与已取消单可改)
124
129
  用户提到"提交预报/发出去/确认发货" → `fmc order forecast`(**写**)
125
130
  用户提到"取消订单/不寄了/作废" → `fmc order cancel`(**写**)
@@ -144,6 +149,7 @@ description: >-
144
149
  用户提到"对公打款/要不要打款" → 入驻流程已取消对公打款环节(`auth organ` 成功即认证完成),用 `fmc onboarding auth schedule` 佐证后告知"无需打款"
145
150
  用户提到"可开通品牌/有哪些品牌" → `fmc onboarding brand list`
146
151
  用户提到"开通品牌/申请合同" → `fmc onboarding brand open`(**写**)
152
+ 用户提到"重复入驻/账号重复注册/通知销售" → `fmc onboarding notify-saler`(**写**,仅在 `brand open` 报重复入驻时用,勿重复发送)
147
153
  用户提到"合同/我的合同" → `fmc onboarding contract list`
148
154
  用户提到"签合同/签署链接/下载合同" → `fmc onboarding contract url`(须带 `--status`,取自 `contract list`)
149
155
  用户提到"登录/配置key/认证" → `fmc auth login`
@@ -210,6 +216,7 @@ export BPORTAL_API_KEY=sk-xxxxx
210
216
  | `platform order push` | 订单进入物流履约流程 |
211
217
  | `onboarding auth indiv` / `auth code` / `auth organ` / `auth gat` | 提交实名认证资料 |
212
218
  | `onboarding brand open` | 开通品牌并发起合同申请 |
219
+ | `onboarding notify-saler` | 重复入驻时通知对应销售(勿重复发送) |
213
220
 
214
221
  执行规则:
215
222
 
@@ -327,7 +334,7 @@ fmc config set baseUrl https://b.4px.com
327
334
  - [`reference/order.md`](reference/order.md) — 订单管理详细参数
328
335
  - [`reference/product.md`](reference/product.md) — 产品推荐与查询详细参数
329
336
  - [`reference/problem.md`](reference/problem.md) — 异常件管理详细参数
330
- - [`reference/custody.md`](reference/custody.md) — 异常托管(改带电/改产品)详细参数
337
+ - [`reference/custody.md`](reference/custody.md) — 异常托管(改带电/改产品/走货/退件/销毁)详细参数
331
338
  - [`reference/service.md`](reference/service.md) — 服务中心与理赔查询详细参数
332
339
  - [`reference/finance.md`](reference/finance.md) — 财务管理详细参数
333
340
  - [`reference/pickup.md`](reference/pickup.md) — 揽收管理详细参数
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cbs-4px-merchant-cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "BPortal Merchant CLI (fmc) skill — BPortal",
5
5
  "files": [
6
6
  "SKILL.md",
@@ -1,13 +1,19 @@
1
1
  # `fmc custody` command
2
2
 
3
- > 异常托管 — 改带电 / 改产品。配合 `fmc problem list` 使用。
3
+ > 异常托管 — 改带电 / 改产品 / 走货 / 退件 / 销毁。配合 `fmc problem list` 使用。
4
4
 
5
5
  ## 背景
6
6
 
7
7
  当订单在仓库上架时出现异常(如内置电池、磁性物品、无渠道等),商家可通过以下命令将订单
8
- 改换为支持带电的物流产品或替换为有渠道的产品,从而让异常单恢复正常走货。
8
+ 改换为支持带电的物流产品或替换为有渠道的产品,或直接对异常单下达走货/退件/销毁指令,
9
+ 从而让异常单闭环处理。
9
10
 
10
- ### 异常原因编码速查
11
+ ### reasonCode 获取方式
12
+
13
+ `problem list --output json` 返回的 `abnormalProblems[]` 中直接包含 `reasonCode`、`abnId`、
14
+ `reasonId` 三个定位字段——**下达指令时的 `--reason` 直接取 `reasonCode`,无需再做中文名映射**。
15
+
16
+ ### 改带电/改产品异常原因编码速查
11
17
 
12
18
  | abnormalReasonName | reasonCode | 处理流程 |
13
19
  | --- | --- | --- |
@@ -15,7 +21,22 @@
15
21
  | 磁性物品 | CXW | 改带电 → `custody electric` |
16
22
  | 无渠道 | NC | 改产品 → `custody recommend` |
17
23
 
18
- `problem list --output json` 返回的 `abnormalProblems[].abnormalReasonName` 即为上表中文列。
24
+ ### 走货二级指令支持矩阵
25
+
26
+ `custody ship` 仅支持**无附件、无复杂表单**的走货二级指令;其余指令请转页面处理。
27
+
28
+ | 类别 | 二级指令编号 | 命令支持 | 备注 |
29
+ | --- | --- | --- | --- |
30
+ | 直接走货 | 1, 5, 23 | ✅ | 认可重量/认可费用/填充包装走货 |
31
+ | 换单号走货 | 8, 13, 26 | ✅ | **必须** `--new-track-no` |
32
+ | 带说明走货 | 24, 25, 27, 28 | ✅ | **必须** `--remark` |
33
+ | 其他 | 17 | ✅ | **必须** `--content` |
34
+ | 需上传附件 | 2, 9, 11, 12, 16 | ❌ | 转页面处理 |
35
+ | 需填复杂表单 | 3, 6, 7, 15 | ❌ | 转页面处理 |
36
+ | 改带电/改产品 | 32, 33 | ❌ | 改用 `custody change` |
37
+
38
+ > 服务端在提交前会强制调 `get_abnormality_help` 校验该指令是否允许下达;若指令不可下达,
39
+ > 命令会**原样输出服务端返回的可下达指令列表提示**,据此改用正确的二级指令编号重试。
19
40
 
20
41
  ---
21
42
 
@@ -167,6 +188,185 @@ fmc custody change --order-nos FPX12345678 --pk-code ECO-PKG-BAT --reason NZDC -
167
188
 
168
189
  ---
169
190
 
191
+ ### `fmc custody help`
192
+
193
+ | Field | Value |
194
+ | --- | --- |
195
+ | **Name** | `custody help` |
196
+ | **Description** | 查询异常单当前可下达的一级/二级指令列表 |
197
+ | **Usage** | `fmc custody help <orderNo> --reason <code> [flags]` |
198
+
199
+ 需要 API Key 认证。下达走货/退件/销毁指令前,先用它确认可下达的指令编号。
200
+
201
+ #### Arguments
202
+
203
+ | Argument | Type | Required | Description |
204
+ | --- | --- | --- | --- |
205
+ | `<orderNo>` | string | yes | 物流单号 |
206
+
207
+ #### Options
208
+
209
+ | Flag | Type | Required | Description |
210
+ | --- | --- | --- | --- |
211
+ | `--reason <code>` | string | yes | 异常原因编码,取自 problem list 的 `abnormalProblems[].reasonCode` |
212
+
213
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
214
+
215
+ #### Examples
216
+
217
+ ```bash
218
+ fmc custody help FPX12345678 --reason WD
219
+ fmc custody help FPX12345678 --reason WD --output json
220
+ ```
221
+
222
+ #### Output (text mode)
223
+
224
+ ```
225
+ 可下达指令
226
+ ──────────────────────────────────────────────────
227
+
228
+ 走货(1)
229
+ → 认可重量,确认走货(1)
230
+ → 更换新单号走货(8)
231
+
232
+ 退件(2)
233
+ 无二级指令
234
+
235
+ 销毁(3)
236
+ 无二级指令
237
+ ```
238
+
239
+ ---
240
+
241
+ ### `fmc custody ship`
242
+
243
+ | Field | Value |
244
+ | --- | --- |
245
+ | **Name** | `custody ship` |
246
+ | **Description** | 对异常单下达走货指令(写操作) |
247
+ | **Usage** | `fmc custody ship --order-nos <nos> --reason <code> --child <no> [flags]` |
248
+
249
+ 需要 API Key 认证。**这是写操作**,默认二次确认;非交互环境须加 `-y`。走货支持矩阵见上方「走货二级指令支持矩阵」。
250
+
251
+ #### Options
252
+
253
+ | Flag | Type | Required | Description |
254
+ | --- | --- | --- | --- |
255
+ | `--order-nos <nos>` | string | yes | 物流单号,多个用逗号分隔 |
256
+ | `--reason <code>` | string | yes | 异常原因编码 |
257
+ | `--child <no>` | string | yes | 走货二级指令编号,取自 `custody help` 输出 |
258
+ | `--new-track-no <no>` | string | no | 新物流单号(二级指令 8/13/26 必填) |
259
+ | `--remark <text>` | string | no | 说明(二级指令 24/25/27/28 必填) |
260
+ | `--content <text>` | string | no | 补充说明文本(二级指令 17 必填) |
261
+ | `-y, --yes` | boolean | no | 跳过确认 |
262
+
263
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
264
+
265
+ #### Examples
266
+
267
+ ```bash
268
+ # 认可重量走货
269
+ fmc custody ship --order-nos FPX12345678 --reason WD --child 1
270
+ # 换新单号走货(必带新单号)
271
+ fmc custody ship --order-nos FPX001,FPX002 --reason WD --child 8 --new-track-no FPXNEW001 -y
272
+ # 其他(必带说明文本)
273
+ fmc custody ship --order-nos FPX12345678 --reason WD --child 17 --content "已与客户确认继续走货"
274
+ ```
275
+
276
+ ---
277
+
278
+ ### `fmc custody return`
279
+
280
+ | Field | Value |
281
+ | --- | --- |
282
+ | **Name** | `custody return` |
283
+ | **Description** | 对异常单下达退件指令(写操作) |
284
+ | **Usage** | `fmc custody return --order-nos <nos> --reason <code> [flags]` |
285
+
286
+ 需要 API Key 认证。**这是写操作**。退件地址取自商家退件地址库;未指定 `--address-id` 时使用默认退件地址(确认文案会提示)。可先用 `custody address` 查看可用地址。
287
+
288
+ #### Options
289
+
290
+ | Flag | Type | Required | Description |
291
+ | --- | --- | --- | --- |
292
+ | `--order-nos <nos>` | string | yes | 物流单号,多个用逗号分隔 |
293
+ | `--reason <code>` | string | yes | 异常原因编码 |
294
+ | `--address-id <id>` | string | no | 退件地址标识(取自 `custody address`,不传则使用默认退件地址) |
295
+ | `-y, --yes` | boolean | no | 跳过确认 |
296
+
297
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
298
+
299
+ #### Examples
300
+
301
+ ```bash
302
+ # 使用默认退件地址
303
+ fmc custody return --order-nos FPX12345678 --reason WD
304
+ # 指定退件地址
305
+ fmc custody return --order-nos FPX001,FPX002 --reason WD --address-id 3 -y
306
+ ```
307
+
308
+ ---
309
+
310
+ ### `fmc custody destroy`
311
+
312
+ | Field | Value |
313
+ | --- | --- |
314
+ | **Name** | `custody destroy` |
315
+ | **Description** | 对异常单下达销毁指令(写操作,**不可逆**) |
316
+ | **Usage** | `fmc custody destroy --order-nos <nos> --reason <code> [flags]` |
317
+
318
+ 需要 API Key 认证。**这是不可逆写操作**,确认文案含销毁警示,下达前务必与用户确认。
319
+
320
+ #### Options
321
+
322
+ | Flag | Type | Required | Description |
323
+ | --- | --- | --- | --- |
324
+ | `--order-nos <nos>` | string | yes | 物流单号,多个用逗号分隔 |
325
+ | `--reason <code>` | string | yes | 异常原因编码 |
326
+ | `-y, --yes` | boolean | no | 跳过确认 |
327
+
328
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
329
+
330
+ #### Examples
331
+
332
+ ```bash
333
+ fmc custody destroy --order-nos FPX12345678 --reason WD
334
+ ```
335
+
336
+ ---
337
+
338
+ ### `fmc custody address`
339
+
340
+ | Field | Value |
341
+ | --- | --- |
342
+ | **Name** | `custody address` |
343
+ | **Description** | 查询商家退件地址库列表 |
344
+ | **Usage** | `fmc custody address [flags]` |
345
+
346
+ 需要 API Key 认证。下达退件指令前用它确认 `--address-id`,或核对默认地址。
347
+
348
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
349
+
350
+ #### Examples
351
+
352
+ ```bash
353
+ fmc custody address
354
+ fmc custody address --output json
355
+ ```
356
+
357
+ #### Output (text mode)
358
+
359
+ ```
360
+ 退件地址库
361
+ ──────────────────────────────────────────────────
362
+
363
+ id=3 [默认] 张三 13800000000
364
+ 广东省深圳市南山区科技园路1号
365
+ 退件方式:快递退件
366
+ ```
367
+
368
+ ---
369
+
170
370
  ## 典型工作流
171
371
 
172
372
  ### A. 内电/磁性物品 → 改带电
@@ -191,3 +391,16 @@ fmc custody change --order-nos FPX12345678 --pk-code ECO-PKG-BAT --reason NZDC -
191
391
  4. 无渠道类 → 逐单 `custody recommend` 查推荐 → 汇总后一次 `custody change`
192
392
  5. 首次执行前向用户确认,确认后加 `-y` 批量执行
193
393
  6. 执行完毕后向用户报告成功/失败/差价
394
+
395
+ ### D. 走货 / 退件 / 销毁(通用异常处理闭环)
396
+
397
+ 1. `fmc problem list --abnormal-status unresolved --output json`
398
+ → 取每条异常问题的 `reasonCode`(直接来自 `abnormalProblems[].reasonCode`,无需中文名映射)
399
+ 2. `fmc custody help <orderNo> --reason <reasonCode>` → 列出可下达的一级/二级指令编号
400
+ 3. 根据用户诉求选择指令下达(写操作,`-y` 前须先向用户确认):
401
+ - 走货:`custody ship --order-nos <no> --reason <code> --child <二级编号> [--new-track-no|--remark|--content]`
402
+ - 退件:先 `custody address` 确认地址 → `custody return --order-nos <no> --reason <code> [--address-id <id>]`
403
+ - 销毁(**不可逆**):`custody destroy --order-nos <no> --reason <code>`(务必向用户强调不可逆)
404
+ 4. 若提交因前置校验未通过失败:命令会原样输出「可下达指令列表」提示,据此改用正确的二级指令编号重试
405
+ 5. 走货指令若命中不支持矩阵(附件类/复杂表单类/改带电改产品),提示用户转页面处理或改用 `custody change`
406
+ 6. 执行完毕后向用户报告成功/失败明细
@@ -41,6 +41,11 @@ Command **details** are in sibling `<group>.md` files in this directory.
41
41
  | `fmc custody electric` | 查询可改带电产品列表 | [custody.md](custody.md) |
42
42
  | `fmc custody recommend` | 获取 AI 推荐改产品方案 | [custody.md](custody.md) |
43
43
  | `fmc custody change` | 批量提交改带电/改产品(写) | [custody.md](custody.md) |
44
+ | `fmc custody help` | 查询异常单可下达的指令列表 | [custody.md](custody.md) |
45
+ | `fmc custody ship` | 下达走货指令(写) | [custody.md](custody.md) |
46
+ | `fmc custody return` | 下达退件指令(写) | [custody.md](custody.md) |
47
+ | `fmc custody destroy` | 下达销毁指令(写,不可逆) | [custody.md](custody.md) |
48
+ | `fmc custody address` | 查询退件地址库 | [custody.md](custody.md) |
44
49
  | `fmc service repair list` | 查询售后工单列表 | [service.md](service.md) |
45
50
  | `fmc service check list` | 查询查件列表 | [service.md](service.md) |
46
51
  | `fmc service complaint list` | 查询投诉列表 | [service.md](service.md) |
@@ -85,6 +90,7 @@ Command **details** are in sibling `<group>.md` files in this directory.
85
90
  | `fmc onboarding auth gat` | 提交港澳台/海外实名资料(写) | [onboarding.md](onboarding.md) |
86
91
  | `fmc onboarding brand list` | 查询可开通品牌 | [onboarding.md](onboarding.md) |
87
92
  | `fmc onboarding brand open` | 开通品牌并申请合同(写) | [onboarding.md](onboarding.md) |
93
+ | `fmc onboarding notify-saler` | 重复入驻时通知对应销售(写) | [onboarding.md](onboarding.md) |
88
94
  | `fmc onboarding contract list` | 查询合同列表 | [onboarding.md](onboarding.md) |
89
95
  | `fmc onboarding contract url` | 获取合同签署/下载链接 | [onboarding.md](onboarding.md) |
90
96
  | `fmc update` | 升级 CLI 及对应 skill 到最新版本 | [update.md](update.md) |
@@ -103,14 +109,14 @@ Command **details** are in sibling `<group>.md` files in this directory.
103
109
  | `order` | `get`, `list`, `address-book`, `country`, `create`, `edit`, `forecast`, `cancel`, `intercept` | [order.md](order.md) |
104
110
  | `product` | `recommend`, `list`, `detail`, `eta`, `search` | [product.md](product.md) |
105
111
  | `problem` | `list`, `suggest`, `notify list`, `notify type`, `lastmile list`, `arrear list`, `intercepted list` | [problem.md](problem.md) |
106
- | `custody` | `electric`, `recommend`, `change` | [custody.md](custody.md) |
112
+ | `custody` | `electric`, `recommend`, `change`, `help`, `ship`, `return`, `destroy`, `address` | [custody.md](custody.md) |
107
113
  | `service` | `repair list`, `check list`, `complaint list`, `detail`, `record`, `claim list`, `claim detail`, `claim reason` | [service.md](service.md) |
108
114
  | `finance` | `balance`, `bill list`, `daily-fee list`, `unbilled list`, `recharge list`, `fee detail`, `frozen list` | [finance.md](finance.md) |
109
115
  | `pickup` | `material list`, `material detail`, `material quota`, `address list` | [pickup.md](pickup.md) |
110
116
  | `notice` | `list`, `detail`, `message list`, `message detail`, `message unread` | [notice.md](notice.md) |
111
117
  | `customs` | `cargo list`, `commodity list`, `commodity detail`, `hscode search`, `registration info` | [customs.md](customs.md) |
112
118
  | `platform` | `account list`, `sync`, `sync-record list`, `order list`, `order detail`, `order push` | [platform.md](platform.md) |
113
- | `onboarding` | `progress`, `customer-type`, `auth schedule`, `auth indiv`, `auth code`, `auth organ`, `auth gat`, `brand list`, `brand open`, `contract list`, `contract url` | [onboarding.md](onboarding.md) |
119
+ | `onboarding` | `progress`, `customer-type`, `auth schedule`, `auth indiv`, `auth code`, `auth organ`, `auth gat`, `brand list`, `brand open`, `notify-saler`, `contract list`, `contract url` | [onboarding.md](onboarding.md) |
114
120
  | `update` | (no subcommand) | [update.md](update.md) |
115
121
  | `skill` | `install`, `status`, `uninstall` | [update.md](update.md) |
116
122
 
@@ -129,7 +135,7 @@ Command **details** are in sibling `<group>.md` files in this directory.
129
135
  - `track get` 命令无需认证即可使用。
130
136
  - 其余大部分命令需要先配置 API Key:`fmc auth login --api-key <key>`。Key 是控制台生成的原串(常见前缀 `SK_` 或 `sk-`),原样传入,不要校验或改写。
131
137
  - 新增的 `problem`、`service`、`finance`、`pickup`、`notice`、`customs`、`platform`、`onboarding` 模块均需要 API Key 认证。`order` 模块下的 `address-book`、`country` 子命令也需要认证。
132
- - **写操作**(`platform sync`、`platform order push`、`onboarding auth *`、`onboarding brand open`)默认在终端二次确认;非交互环境(管道、CI、AI Agent)必须显式加 `-y`,否则命令会拒绝执行并以退出码 1 结束。先用 `--dry-run` 可查看将发送的请求。
138
+ - **写操作**(`platform sync`、`platform order push`、`onboarding auth *`、`onboarding brand open`、`onboarding notify-saler`)默认在终端二次确认;非交互环境(管道、CI、AI Agent)必须显式加 `-y`,否则命令会拒绝执行并以退出码 1 结束。先用 `--dry-run` 可查看将发送的请求。
133
139
  - 实名认证会提交身份证号、银行卡号、验证码、手机号等敏感信息。这些参数在 `--verbose` / `--dry-run` 的**打印**里被遮蔽为 `****`,但真实值仍会随请求发送。
134
140
  - 配置文件位于 `~/.bportal/config.json`;升级状态缓存位于 `~/.bportal/update-state.json`。
135
141
  - 当检测到新版本可用时,stderr 会输出 `{"_notice":{"type":"update",...}}`;设置环境变量 `BPORTAL_NO_UPDATE_NOTIFIER=1` 可关闭。
@@ -495,6 +495,48 @@ fmc onboarding brand open --service-code DSS \
495
495
 
496
496
  ---
497
497
 
498
+ ### `fmc onboarding notify-saler`
499
+
500
+ | Field | Value |
501
+ | --- | --- |
502
+ | **Name** | `onboarding notify-saler` |
503
+ | **Description** | 重复入驻场景下,向当前客户对应的销售推送钉钉通知 |
504
+ | **Usage** | `fmc onboarding notify-saler [flags]` |
505
+
506
+ 需要 API Key 认证。**写操作**,默认二次确认。无业务参数:客户编码由
507
+ 服务端从 API Key 上下文自动取,通知标题与正文也由服务端写死(含企业名称与客户编码)。
508
+
509
+ **仅在确认客户存在重复入驻时调用**:即 `brand open` 被拦且错误文案明确包含
510
+ `账号存在重复申请,请等待人工审核通过后再发起申请服务`(底层业务码 50001)或
511
+ `因您重复申请账号,审核未通过,不可继续申请服务`(底层业务码 50002)时才用。
512
+ MCP 层可能将底层码包装成 `OPEN_BRAND_ERROR`,因此按错误文案判断,不要只匹配错误码。
513
+ **请勿重复发送**;通知后销售需在四方钉—工作台—OA审批发起「GPN客户发起:客户账号重复注册审核申请」。
514
+
515
+ #### Options
516
+
517
+ | Flag | Type | Required | Description |
518
+ | --- | --- | --- | --- |
519
+ | `-y, --yes` | boolean | no | 跳过交互确认(非交互环境必传) |
520
+
521
+ 支持全局选项: `--output`, `--verbose`, `--dry-run`
522
+
523
+ #### Examples
524
+
525
+ ```bash
526
+ fmc onboarding notify-saler -y
527
+ ```
528
+
529
+ #### Output (text mode)
530
+
531
+ ```
532
+ ✔ 已向该客户对应的销售推送重复入驻通知
533
+
534
+ 通知含企业名称与客户编码,并指引销售走 OA「客户账号重复注册审核申请」
535
+ 请勿重复发送;等销管审批通过后再重试 brand open
536
+ ```
537
+
538
+ ---
539
+
498
540
  ### `fmc onboarding contract list`
499
541
 
500
542
  | Field | Value |