cbs-4px-merchant-cli 0.0.8 → 0.0.11

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 (50) hide show
  1. package/README.4px.md +5 -5
  2. package/README.cainiao.md +5 -5
  3. package/README.md +5 -5
  4. package/dist/cli.js +92 -25
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/address.d.ts +7 -1
  7. package/dist/commands/address.js +29 -10
  8. package/dist/commands/address.js.map +1 -1
  9. package/dist/commands/auth.d.ts +1 -0
  10. package/dist/commands/auth.js +87 -0
  11. package/dist/commands/auth.js.map +1 -1
  12. package/dist/commands/config.d.ts +9 -2
  13. package/dist/commands/config.js +45 -12
  14. package/dist/commands/config.js.map +1 -1
  15. package/dist/commands/custody.d.ts +38 -0
  16. package/dist/commands/custody.js +176 -0
  17. package/dist/commands/custody.js.map +1 -0
  18. package/dist/commands/onboarding.d.ts +16 -7
  19. package/dist/commands/onboarding.js +73 -18
  20. package/dist/commands/onboarding.js.map +1 -1
  21. package/dist/commands/order.d.ts +23 -6
  22. package/dist/commands/order.js +60 -30
  23. package/dist/commands/order.js.map +1 -1
  24. package/dist/commands/platform.d.ts +8 -0
  25. package/dist/commands/platform.js +10 -1
  26. package/dist/commands/platform.js.map +1 -1
  27. package/dist/commands/problem.js +1 -1
  28. package/dist/commands/problem.js.map +1 -1
  29. package/dist/commands/product.d.ts +3 -0
  30. package/dist/commands/product.js +3 -0
  31. package/dist/commands/product.js.map +1 -1
  32. package/dist/services/api-client.d.ts +53 -12
  33. package/dist/services/api-client.js +235 -47
  34. package/dist/services/api-client.js.map +1 -1
  35. package/dist/types/index.d.ts +170 -12
  36. package/dist/utils/run-command.d.ts +6 -0
  37. package/dist/utils/run-command.js +13 -0
  38. package/dist/utils/run-command.js.map +1 -1
  39. package/package.json +1 -1
  40. package/skill/SKILL.md +16 -11
  41. package/skill/package.json +2 -1
  42. package/skill/reference/auth.md +20 -1
  43. package/skill/reference/custody.md +193 -0
  44. package/skill/reference/index.md +5 -2
  45. package/skill/reference/onboarding.md +79 -52
  46. package/skill/reference/order.md +84 -34
  47. package/skill/reference/platform.md +1 -1
  48. package/skill/reference/product.md +3 -0
  49. package/dist/digital-employee-skills/cbs-4px-merchant-cli-order-fulfillment.zip +0 -0
  50. package/dist/digital-employee-skills/cbs-cainiao-merchant-cli-order-fulfillment.zip +0 -0
@@ -49,6 +49,13 @@ fmc order get FPX12345678 --verbose
49
49
  实重(g) 500
50
50
  计费重(g) 600
51
51
 
52
+ 包裹信息
53
+ 件数 1
54
+ 申报重(g) 500
55
+ 尺寸(cm) 20 x 15 x 10
56
+ IOSS税号 IM1234567890
57
+ 关税方式 DDU
58
+
52
59
  收件人信息
53
60
  姓名 John Doe
54
61
  国家 US
@@ -58,7 +65,7 @@ fmc order get FPX12345678 --verbose
58
65
  电话 +1234567890
59
66
 
60
67
  申报信息
61
- 1 T-Shirt 10.00 USD
68
+ 1 T-Shirt x2 10.00 USD HS:6109100021
62
69
 
63
70
  费用明细
64
71
  运费 应付: 25.00 USD
@@ -86,10 +93,18 @@ fmc order get FPX12345678 --verbose
86
93
  | `--status <status>` | string | no | 订单状态筛选,如 IN_TRANSIT、DELIVERED、CREATED 等 |
87
94
  | `--customer-order-no <no>` | string | no | 客户订单号 |
88
95
  | `--fpx-track-no <no>` | string | no | FPX 运单号 |
96
+ | `--date-type <type>` | string | no | 日期类型: RECEIVED_DATE(预报,默认)/CREATE_DATE(创建)/IN_OPERATION_DATE(入库)/OUT_OPERATION_DATE(出库) |
89
97
  | `--start-date <date>` | string | no | 起始日期,格式 yyyy-MM-dd |
90
98
  | `--end-date <date>` | string | no | 结束日期,格式 yyyy-MM-dd |
91
99
  | `--product-code <code>` | string | no | 产品代码 |
92
100
  | `--destination-country <code>` | string | no | 目的国家二字码 |
101
+ | `--consignee-name <name>` | string | no | 收件人姓名 |
102
+ | `--buyer-id <id>` | string | no | 买家ID |
103
+ | `--is-print <Y\|N>` | string | no | 是否已打印 |
104
+ | `--oda-confirm <status>` | string | no | 偏远订单确认状态 |
105
+ | `--intercept-status <status>` | string | no | 拦截状态 |
106
+ | `--change-no-status <status>` | string | no | 换号状态 |
107
+ | `--is-history <Y\|N>` | string | no | 是否查历史订单(>6个月) |
93
108
  | `--page <num>` | number | no | 页码,默认 1 |
94
109
  | `--size <num>` | number | no | 每页数量,默认 10 |
95
110
 
@@ -133,6 +148,9 @@ fmc order list --page 2 --size 20 --output json
133
148
  创建时间 2024-01-14 08:00:00
134
149
  ```
135
150
 
151
+ 列表里的**单号**可直接用于 `order edit --orderNo`、`order forecast --orderNo`、`order cancel --orderNo`、
152
+ `order intercept --orderNo`。全部写操作只认单号,不需要也不接受订单 ID。
153
+
136
154
  ---
137
155
 
138
156
  ### `fmc order address-book`
@@ -140,14 +158,19 @@ fmc order list --page 2 --size 20 --output json
140
158
  | Field | Value |
141
159
  | --- | --- |
142
160
  | **Name** | `order address-book` |
143
- | **Description** | 查询发件地址簿(商家预存的发件/揽收/退件地址) |
161
+ | **Description** | 查询商家地址簿(发件人/收件人/退件/揽收地址,含默认标记) |
144
162
  | **Usage** | `fmc order address-book [flags]` |
145
163
 
146
164
  需要 API Key 认证。
147
165
 
148
166
  #### Options
149
167
 
150
- 无额外参数。
168
+ | Flag | Type | Required | Description |
169
+ | --- | --- | --- | --- |
170
+ | `--type <type>` | string | no | 地址类型: shipper 发件人(默认)/consignee 收件人/return 退件/collect 揽收 |
171
+ | `--keyword <word>` | string | no | 搜索关键词(姓名/公司/电话) |
172
+ | `--page <num>` | number | no | 页码,默认 1 |
173
+ | `--size <num>` | number | no | 每页数量,默认 10 |
151
174
 
152
175
  支持全局选项: `--output`, `--verbose`, `--dry-run`
153
176
 
@@ -158,33 +181,37 @@ fmc order address-book
158
181
  ```
159
182
 
160
183
  ```bash
161
- fmc order address-book --output json
184
+ fmc order address-book --type consignee --keyword 张
185
+ ```
186
+
187
+ ```bash
188
+ fmc order address-book --type collect --output json
162
189
  ```
163
190
 
164
191
  #### Output (text mode)
165
192
 
166
193
  ```
167
- 地址簿列表
194
+ 发件人地址列表
168
195
  ──────────────────────────────────────────────────
169
196
  共 3 条
170
197
 
171
- 深圳仓库
172
- 联系人 张三
198
+ 1001 [默认] 张三
199
+ 公司 shencom
173
200
  电话 13800138000
174
- 国家 CN
175
- 城市 深圳
176
- 地址 广东省深圳市南山区科技园路1号
201
+ 地区 CN guangdong shenzhen
202
+ 详细地址 科技园路1号
177
203
  邮编 518000
178
204
 
179
- 广州仓库
180
- 联系人 李四
205
+ 1002 李四
206
+ 公司 XSS Company
181
207
  电话 13900139000
182
- 国家 CN
183
- 城市 广州
184
- 地址 广东省广州市天河区天河路2号
208
+ 地区 CN Guangdong Guangzhou
209
+ 详细地址 天河路2号
185
210
  邮编 510000
186
211
  ```
187
212
 
213
+ 创建订单时可直接复用地址簿中的地址信息填充 sender/receiver。
214
+
188
215
  ---
189
216
 
190
217
  ### `fmc order country`
@@ -266,10 +293,13 @@ fmc order country 日本 --output json
266
293
  | `originCountry` | string | no | 始发国 ISO2,如 `CN` |
267
294
  | `status` | string | no | `P` 预报(默认)、`D` 草稿;`--draft` 自动设 D |
268
295
  | `customerOrderNo` | string | no | 客户参考号,建议传店铺订单号 |
269
- | `sender` | object | no | `name` `company` `phone` `address` `country` `postcode` `city` `province` |
270
- | `receiver` | object | no | `name` `company` `phone` `mobile` `address` `city` `province` `postcode` `country` `email` |
271
- | `parcel` | object | no | `weight`(kg) `length` `width` `height`(cm) `dutyPayMode` |
272
- | `declareItems` | array | no | 每项含 `ename` `cname` `qty` `unitPrice` `currency` `weight` `hsCode` |
296
+ | `pieces` | number | no | 件数,默认 1 |
297
+ | `hasBattery` | string | no | 是否带电 `Y`/`N`;为 `Y` 时 `parcel.batteryType` 必填 |
298
+ | `buyerId` | string | no | 电商平台买家 ID |
299
+ | `sender` | object | no | `name` `company` `phone` `mobile` `email` `address` `address2` `country` `postcode` `city` `province` |
300
+ | `receiver` | object | no | `name` `company` `phone` `mobile` `firstName` `lastName` `address` `address2` `street` `doorNo` `city` `province` `postcode` `country` `email` `idCode` `vatNo` |
301
+ | `parcel` | object | no | `weight`(kg) `length` `width` `height`(cm) `dutyPayMode` `batteryType` `iossNo` `orderNote` `salesPlatform` `warehouseCode` `codPrice` `codCurrency` |
302
+ | `declareItems` | array | no | 每项含 `ename` `cname` `qty` `unitPrice` `currency` `weight`(kg) `hsCode` `material` `uses` `url` `brand` |
273
303
 
274
304
  完整示例 `order.json`:
275
305
 
@@ -279,10 +309,15 @@ fmc order country 日本 --output json
279
309
  "destinationCountry": "US",
280
310
  "originCountry": "CN",
281
311
  "customerOrderNo": "SHOP-20260831-001",
312
+ "pieces": 1,
313
+ "hasBattery": "N",
282
314
  "sender": {
283
315
  "name": "深圳仓",
284
316
  "phone": "13800000000",
317
+ "mobile": "13800000000",
318
+ "email": "ship@example.com",
285
319
  "address": "宝安区 xx 路 1 号",
320
+ "address2": "3 栋 5 楼",
286
321
  "country": "CN",
287
322
  "province": "广东",
288
323
  "city": "深圳",
@@ -290,8 +325,11 @@ fmc order country 日本 --output json
290
325
  },
291
326
  "receiver": {
292
327
  "name": "John Doe",
328
+ "firstName": "John",
329
+ "lastName": "Doe",
293
330
  "mobile": "+1 555 0100",
294
331
  "address": "123 Main St",
332
+ "address2": "Apt 4B",
295
333
  "city": "Portland",
296
334
  "province": "OR",
297
335
  "postcode": "97201",
@@ -303,7 +341,9 @@ fmc order country 日本 --output json
303
341
  "length": 20,
304
342
  "width": 15,
305
343
  "height": 10,
306
- "dutyPayMode": "DDU"
344
+ "dutyPayMode": "DDU",
345
+ "iossNo": "IM1234567890",
346
+ "orderNote": "轻拿轻放"
307
347
  },
308
348
  "declareItems": [
309
349
  {
@@ -313,13 +353,15 @@ fmc order country 日本 --output json
313
353
  "unitPrice": 15.5,
314
354
  "currency": "USD",
315
355
  "weight": 0.5,
316
- "hsCode": "8518220000"
356
+ "hsCode": "8518220000",
357
+ "material": "ABS",
358
+ "uses": "家用"
317
359
  }
318
360
  ]
319
361
  }
320
362
  ```
321
363
 
322
- 后端只硬校验 `productCode` 和 `destinationCountry`。CLI 还会对收件人姓名/地址/国家/邮编/电话、发件人、重量、申报品英文名/数量/单价缺失打印 `⚠`。有告警先补齐,不要直接提交。
364
+ 后端只硬校验 `productCode` 和 `destinationCountry`。CLI 还会对收件人姓名/地址/国家/邮编/电话、发件人、重量、申报品英文名/数量/单价缺失打印 `⚠`;`hasBattery=Y` 但缺 `parcel.batteryType` 也会告警。有告警先补齐,不要直接提交。欧盟 ≤150EUR 包裹记得填 `parcel.iossNo`,欧美目的国建议拆填 `receiver.firstName`/`lastName` 和 `address2`。
323
365
 
324
366
  ### `fmc order create`
325
367
 
@@ -353,31 +395,35 @@ fmc order create --file ./order.json -y
353
395
 
354
396
  ```bash
355
397
  # 改后保持草稿
356
- fmc order edit --order-id 1001 --file ./patch.json --draft -y
398
+ fmc order edit --orderNo ORD-20240115-001 --file ./patch.json --draft -y
357
399
 
358
400
  # 改完直接预报
359
- fmc order edit --order-id 1001 --file ./patch.json -y
401
+ fmc order edit --orderNo ORD-20240115-001 --file ./patch.json -y
360
402
  ```
361
403
 
362
404
  | Flag | Required | Description |
363
405
  | --- | --- | --- |
364
- | `--order-id <id>` | yes | 订单 ID(数字) |
406
+ | `--orderNo <no>` | yes | 要编辑的订单单号(4px 物流单号或客户订单号) |
365
407
  | `--file <path>` | yes | JSON 文件路径;`-` 表示 stdin |
366
408
  | `--draft` | no | 保持草稿;不传则改完预报 |
367
409
  | `-y, --yes` | non-TTY yes | 跳过终端交互确认 |
368
410
 
411
+ > **所有订单写操作一律用单号 `--orderNo`。** 数据库自增主键已从接口彻底移除,不存在 `--ids` 参数。
412
+ > 单号可以是 4px 物流单号(如 `4PX3003136946232CN`)或客户订单号(如 `TEST22026090700014129`),
413
+ > 后端两者都能识别。草稿单还没有 4px 物流单号,用客户订单号。
414
+
369
415
  ### `fmc order forecast`
370
416
 
371
417
  将草稿提交为预报(写操作):
372
418
 
373
419
  ```bash
374
- fmc order forecast --ids 1001 -y
375
- fmc order forecast --ids 1001,1002 -y
420
+ fmc order forecast --orderNo TEST22026090700014129 -y
421
+ fmc order forecast --orderNo TEST2026...01,TEST2026...02 -y
376
422
  ```
377
423
 
378
424
  | Flag | Required | Description |
379
425
  | --- | --- | --- |
380
- | `--ids <ids>` | yes | 草稿订单 ID,多个逗号分隔 |
426
+ | `--orderNo <nos>` | yes | 草稿订单单号(客户订单号;草稿还没有 4px 物流单号),多个逗号分隔 |
381
427
  | `-y, --yes` | non-TTY yes | 跳过终端交互确认 |
382
428
 
383
429
  批量预报可能部分成功。失败数大于 0 时应按 `failDetails` 逐单处理,不要整批重试。
@@ -387,29 +433,33 @@ fmc order forecast --ids 1001,1002 -y
387
433
  取消草稿或已预报订单(写操作):
388
434
 
389
435
  ```bash
390
- fmc order cancel --ids 1001 --reason "客户取消" -y
436
+ fmc order cancel --orderNo 4PX3003136946232CN --reason "客户取消" -y
437
+ fmc order cancel --orderNo 4PX3003...CN,4PX3003...CN --reason "客户取消" -y
391
438
  ```
392
439
 
393
440
  | Flag | Required | Description |
394
441
  | --- | --- | --- |
395
- | `--ids <ids>` | yes | 订单 ID,多个逗号分隔 |
442
+ | `--orderNo <nos>` | yes | 订单单号(4px 物流单号或客户订单号),多个逗号分隔 |
396
443
  | `--reason <text>` | yes | 取消原因,优先使用用户原话 |
397
444
  | `-y, --yes` | non-TTY yes | 跳过终端交互确认 |
398
445
 
446
+ 仅**预报**或**草稿**状态可取消,其他状态后端会明确拒绝并告知该单当前状态。
447
+
399
448
  ### `fmc order intercept`
400
449
 
401
450
  对已预报订单申请拦截(写操作):
402
451
 
403
452
  ```bash
404
- fmc order intercept --ids 1001 -y
453
+ fmc order intercept --orderNo 4PX3003136946232CN -y
405
454
  ```
406
455
 
407
456
  | Flag | Required | Description |
408
457
  | --- | --- | --- |
409
- | `--ids <ids>` | yes | 订单 ID,多个逗号分隔 |
458
+ | `--orderNo <nos>` | yes | 订单单号(4px 物流单号或客户订单号),多个逗号分隔 |
410
459
  | `-y, --yes` | non-TTY yes | 跳过终端交互确认 |
411
460
 
412
461
  拦截是申请制,不保证成功;已出库或已交接承运商的包裹可能拦不住,必须按每个订单的返回明细告知用户。
462
+ 返回明细里的单号就是你传入的单号,可直接对应。
413
463
 
414
464
  ### 完整下单流程
415
465
 
@@ -428,7 +478,7 @@ fmc customs hscode search --name 蓝牙音箱
428
478
  fmc order create --file ./order.json --draft -y
429
479
  fmc order get FPX12345678
430
480
 
431
- # 5. 用户确认后提交预报、取面单
432
- fmc order forecast --ids 1001 -y
481
+ # 5. 用户确认后提交预报、取面单(用单号,不用查 ID)
482
+ fmc order forecast --orderNo ORD-20240114-002 -y
433
483
  fmc label get FPX12345678
434
484
  ```
@@ -291,7 +291,7 @@ fmc platform order detail 20001 --output json
291
291
 
292
292
  | Flag | Type | Required | Description |
293
293
  | --- | --- | --- | --- |
294
- | `--ids <ids>` | string | yes | 平台订单 ID,多个用逗号分隔 |
294
+ | `--ids <ids>` | string | yes | **平台订单** ID(从 `platform order list` 返回值取),多个用逗号分隔。注意这与物流订单无关——物流订单的写操作一律用 `--orderNo` 单号 |
295
295
  | `-y, --yes` | boolean | no | 跳过交互确认(非交互环境必传) |
296
296
 
297
297
  支持全局选项: `--output`, `--verbose`, `--dry-run`
@@ -22,6 +22,9 @@
22
22
  | `--post-code <code>` | string | no | 目的地邮编 |
23
23
  | `--is-battery <flag>` | string | no | 是否带电:1-带电 2-普货 |
24
24
  | `--declare-value <amount>` | number | no | 申报总价值 |
25
+ | `--length <cm>` | number | no | 包裹长(cm),体积重计费产品建议传 |
26
+ | `--width <cm>` | number | no | 包裹宽(cm) |
27
+ | `--height <cm>` | number | no | 包裹高(cm) |
25
28
 
26
29
  支持全局选项: `--output`, `--verbose`, `--dry-run`
27
30