lingxingapi 1.1.4__py3-none-any.whl

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 (65) hide show
  1. lingxingapi/__init__.py +7 -0
  2. lingxingapi/ads/__init__.py +0 -0
  3. lingxingapi/ads/api.py +5946 -0
  4. lingxingapi/ads/param.py +192 -0
  5. lingxingapi/ads/route.py +134 -0
  6. lingxingapi/ads/schema.py +2615 -0
  7. lingxingapi/api.py +557 -0
  8. lingxingapi/base/__init__.py +0 -0
  9. lingxingapi/base/api.py +568 -0
  10. lingxingapi/base/param.py +59 -0
  11. lingxingapi/base/route.py +11 -0
  12. lingxingapi/base/schema.py +198 -0
  13. lingxingapi/basic/__init__.py +0 -0
  14. lingxingapi/basic/api.py +466 -0
  15. lingxingapi/basic/param.py +72 -0
  16. lingxingapi/basic/route.py +20 -0
  17. lingxingapi/basic/schema.py +218 -0
  18. lingxingapi/errors.py +152 -0
  19. lingxingapi/fba/__init__.py +0 -0
  20. lingxingapi/fba/api.py +1691 -0
  21. lingxingapi/fba/param.py +250 -0
  22. lingxingapi/fba/route.py +30 -0
  23. lingxingapi/fba/schema.py +987 -0
  24. lingxingapi/fields.py +50 -0
  25. lingxingapi/finance/__init__.py +0 -0
  26. lingxingapi/finance/api.py +3091 -0
  27. lingxingapi/finance/param.py +616 -0
  28. lingxingapi/finance/route.py +44 -0
  29. lingxingapi/finance/schema.py +1243 -0
  30. lingxingapi/product/__init__.py +0 -0
  31. lingxingapi/product/api.py +2643 -0
  32. lingxingapi/product/param.py +934 -0
  33. lingxingapi/product/route.py +49 -0
  34. lingxingapi/product/schema.py +1004 -0
  35. lingxingapi/purchase/__init__.py +0 -0
  36. lingxingapi/purchase/api.py +496 -0
  37. lingxingapi/purchase/param.py +126 -0
  38. lingxingapi/purchase/route.py +11 -0
  39. lingxingapi/purchase/schema.py +215 -0
  40. lingxingapi/sales/__init__.py +0 -0
  41. lingxingapi/sales/api.py +3200 -0
  42. lingxingapi/sales/param.py +723 -0
  43. lingxingapi/sales/route.py +70 -0
  44. lingxingapi/sales/schema.py +1718 -0
  45. lingxingapi/source/__init__.py +0 -0
  46. lingxingapi/source/api.py +1799 -0
  47. lingxingapi/source/param.py +176 -0
  48. lingxingapi/source/route.py +38 -0
  49. lingxingapi/source/schema.py +1011 -0
  50. lingxingapi/tools/__init__.py +0 -0
  51. lingxingapi/tools/api.py +291 -0
  52. lingxingapi/tools/param.py +73 -0
  53. lingxingapi/tools/route.py +8 -0
  54. lingxingapi/tools/schema.py +169 -0
  55. lingxingapi/utils.py +456 -0
  56. lingxingapi/warehourse/__init__.py +0 -0
  57. lingxingapi/warehourse/api.py +1778 -0
  58. lingxingapi/warehourse/param.py +506 -0
  59. lingxingapi/warehourse/route.py +28 -0
  60. lingxingapi/warehourse/schema.py +926 -0
  61. lingxingapi-1.1.4.dist-info/METADATA +73 -0
  62. lingxingapi-1.1.4.dist-info/RECORD +65 -0
  63. lingxingapi-1.1.4.dist-info/WHEEL +5 -0
  64. lingxingapi-1.1.4.dist-info/licenses/LICENSE +22 -0
  65. lingxingapi-1.1.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1778 @@
1
+ # -*- coding: utf-8 -*-c
2
+ import datetime
3
+ from typing import Literal
4
+ from lingxingapi import errors
5
+ from lingxingapi.base.api import BaseAPI
6
+ from lingxingapi.warehourse import param, route, schema
7
+
8
+ # Type Aliases ---------------------------------------------------------------------------------------------------------
9
+ INVENTORY_SEARCH_FIELD = Literal[
10
+ "msku",
11
+ "lsku",
12
+ "fnsku",
13
+ "product_name",
14
+ "asin",
15
+ "parent_asin",
16
+ "spu",
17
+ "spu_name",
18
+ ]
19
+ SELLER_INVENTORY_SEARCH_FIELD = Literal[
20
+ "msku",
21
+ "lsku",
22
+ "fnsku",
23
+ "product_name",
24
+ "transaction_number",
25
+ "batch_number",
26
+ "source_batch_number",
27
+ "purchase_plan_number",
28
+ "purchase_number",
29
+ "receiving_number",
30
+ ]
31
+
32
+
33
+ # API ------------------------------------------------------------------------------------------------------------------
34
+ class WarehouseAPI(BaseAPI):
35
+ """领星API `仓库数据` 接口
36
+
37
+ ## Notice
38
+ 请勿直接实例化此类
39
+ """
40
+
41
+ # 公共 API --------------------------------------------------------------------------------------
42
+ # . 仓库 - 仓库设置
43
+ async def Warehouses(
44
+ self,
45
+ *,
46
+ warehouse_type: int | None = None,
47
+ overseas_warehouse_type: int | None = None,
48
+ deleted: int | None = None,
49
+ offset: int | None = None,
50
+ length: int | None = None,
51
+ ) -> schema.Warehouses:
52
+ """查询仓库
53
+
54
+ ## Docs
55
+ - 仓库 - 仓库设置: [查询仓库列表](https://apidoc.lingxing.com/#/docs/Warehouse/WarehouseLists)
56
+
57
+ :param warehouse_type `<'int/None'>`: 仓库类型 (1: 本地仓, 3: 海外仓, 4: 亚马逊平台仓, 6: AWD仓),
58
+ 默认 `None` (查询`1: 本地仓`)
59
+ :param overseas_warehouse_type `<'int/None'>`: 海外仓库类型 (1: 无API海外仓, 2: 有API海外仓),
60
+ 此参数只在`warehouse_type=3`时生效, 默认 `None` (查询所有海外仓)
61
+ :param deleted `<'int/None'>`: 是否已删除 (0: 未删除, 1: 已删除),
62
+ 默认 `None` (查询`0: 未删除`)
63
+ :param offset `<'int'>`: 分页偏移量, 默认 `None` (使用: 0)
64
+ :param length `<'int'>`: 分页长度, 默认 `None` (使用: 1000)
65
+ :returns `<'Warehouses'>`: 返回查询到的仓库数据
66
+ ```python
67
+ {
68
+ # 状态码
69
+ "code": 0,
70
+ # 提示信息
71
+ "message": "success",
72
+ # 错误信息
73
+ "errors": [],
74
+ # 请求ID
75
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
76
+ # 响应时间
77
+ "response_time": "2025-08-13 19:23:04",
78
+ # 响应数据量
79
+ "response_count": 2,
80
+ # 总数据量
81
+ "total_count": 2,
82
+ # 响应数据
83
+ "data": [
84
+ {
85
+ # 仓库ID [原字段 'wid']
86
+ "warehouse_id": 1****,
87
+ # 仓库类型 [原字段 'type']
88
+ # (1: 本地仓, 3: 海外仓, 4: 亚马逊平台仓, 6: AWD仓)
89
+ "warehouse_type": 3,
90
+ # 仓库名称 [原字段 'name']
91
+ "warehouse_name": "测试海外仓",
92
+ # 仓库国家代码 [原字段 'country_code']
93
+ "warehouse_country_code": "DE",
94
+ # 仓库服务商ID (仅仓库类型为3时有值) [原字段 'wp_id']
95
+ "provider_id": 267,
96
+ # 仓库服务商名称 (仅仓库类型为3时有值) [原字段 'wp_name']
97
+ "provider_name": "测试服务商",
98
+ # 第三方仓库名称 [原字段 't_warehouse_name']
99
+ "third_party_warehouse_name": "DE Warehouse",
100
+ # 第三方仓库代码 [原字段 't_warehouse_code']
101
+ "third_party_warehouse_code": "DE0001",
102
+ # 第三方仓库所在地理位置 [原字段 't_country_area_name']
103
+ "thrid_party_warehouse_location": "德国",
104
+ # 第三方仓库状态 (1: 启用, 0: 停用) [原字段 't_status']
105
+ "thrid_party_warehouse_status": 1,
106
+ # 是否已删除 (0: 否, 1: 是) [原字段 'is_delete']
107
+ "deleted": 0,
108
+ },
109
+ ...
110
+ ],
111
+ }
112
+ ```
113
+ """
114
+ url = route.WAREHOUSES
115
+ # 解析并验证参数
116
+ args = {
117
+ "warehouse_type": warehouse_type,
118
+ "overseas_warehouse_type": overseas_warehouse_type,
119
+ "deleted": deleted,
120
+ "offset": offset,
121
+ "length": length,
122
+ }
123
+ try:
124
+ p = param.Warehouses.model_validate(args)
125
+ except Exception as err:
126
+ raise errors.InvalidParametersError(err, url, args) from err
127
+
128
+ # 发送请求
129
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
130
+ return schema.Warehouses.model_validate(data)
131
+
132
+ async def WarehouseBins(
133
+ self,
134
+ *,
135
+ warehouse_ids: int | list[int] | None = None,
136
+ bin_ids: int | list[int] | None = None,
137
+ bin_status: int | None = None,
138
+ bin_type: int | None = None,
139
+ offset: int | None = None,
140
+ length: int | None = None,
141
+ ) -> schema.WarehouseBins:
142
+ """查询仓库货架(仓位)
143
+
144
+ ## Docs
145
+ - 仓库 - 仓库设置: [查询本地仓位列表](https://apidoc.lingxing.com/#/docs/Warehouse/warehouseBin)
146
+
147
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库IDs,
148
+ 默认 `None` (查询所有仓库)
149
+ :param bin_ids `<'int/list[int]/None'>`: 仓库货架(仓位)IDs,
150
+ 默认 `None` (查询所有仓库货架)
151
+ :param bin_status `<'int/None'>`: 仓库货架(仓位)状态 (1: 启用, 0: 停用),
152
+ 默认 `None` (查询所有状态)
153
+ :param bin_type `<'int/None'>`: 仓库货架(仓位)类型 (5: 可用, 6: 次品),
154
+ 默认 `None` (查询所有类型)
155
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
156
+ :param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 20)
157
+ :returns `<'WarehouseBins'>`: 返回查询到的仓库货架(仓位)数据
158
+ ```python
159
+ {
160
+ # 状态码
161
+ "code": 0,
162
+ # 提示信息
163
+ "message": "success",
164
+ # 错误信息
165
+ "errors": [],
166
+ # 请求ID
167
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
168
+ # 响应时间
169
+ "response_time": "2025-08-13 19:23:04",
170
+ # 响应数据量
171
+ "response_count": 2,
172
+ # 总数据量
173
+ "total_count": 2,
174
+ # 响应数据
175
+ "data": [
176
+ {
177
+ # 仓库ID [原字段 'wid']
178
+ "warehouse_id": 1,
179
+ # 仓库名称 [原字段 'Ware_house_name']
180
+ "warehouse_name": "测试仓库",
181
+ # 仓库货架(仓位)ID [原字段 'id']
182
+ "bin_id": 1,
183
+ # 仓库货架(仓位)名称 [原字段 'storage_bin']
184
+ "bin_name": "A-1-3",
185
+ # 仓库货架(仓位)类型 (5: 可用, 6: 次品) [原字段 'type']
186
+ "bin_type": 5,
187
+ # 仓库货架(仓位)状态 (0: 停用, 1: 启用) [原字段 'status']
188
+ "bin_status": 1,
189
+ # 仓库货架(仓位)货物列表 [原字段 'sku_fnsku']
190
+ "skus": [
191
+ {
192
+ # 领星店铺ID [原字段 'store_id']
193
+ "sid": "1",
194
+ # 领星店铺名称
195
+ "seller_name": "测试卖家",
196
+ # 领星本地商品SKU [原字段 'sku']
197
+ "lsku": "SKU*******",
198
+ # 商品FNSKU
199
+ "fnsku": "X0********",
200
+ # 领星商品ID
201
+ "product_id": 1****,
202
+ # 领星商品名称
203
+ "product_name": "P********",
204
+ },
205
+ ...
206
+ ],
207
+ },
208
+ ...
209
+ ],
210
+ }
211
+ ```
212
+ """
213
+ url = route.WAREHOUSE_BINS
214
+ # 解析并验证参数
215
+ args = {
216
+ "warehouse_ids": warehouse_ids,
217
+ "bin_ids": bin_ids,
218
+ "bin_status": bin_status,
219
+ "bin_type": bin_type,
220
+ "offset": offset,
221
+ "length": length,
222
+ }
223
+ try:
224
+ p = param.WarehouseBins.model_validate(args)
225
+ except Exception as err:
226
+ raise errors.InvalidParametersError(err, url, args) from err
227
+
228
+ # 发送请求
229
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
230
+ return schema.WarehouseBins.model_validate(data)
231
+
232
+ # . 仓库 - 库存&流水
233
+ async def FbaInventory(
234
+ self,
235
+ sids: int | list[int],
236
+ *,
237
+ offset: int | None = None,
238
+ length: int | None = None,
239
+ ) -> schema.FbaInventory:
240
+ """查询FBA库存
241
+
242
+ ## Docs
243
+ - 仓库 - 库存&流水: [查询FBA库存列表](https://apidoc.lingxing.com/#/docs/Warehouse/FBAStock)
244
+
245
+ :param sids `<'int/list[int]'>`: 领星店铺ID
246
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
247
+ :param length `<'int/None'>`: 分页长度, 默认 `None` (使用: 15)
248
+ :returns `<'FbaInventory'>`: 返回查询到的FBA库存数据
249
+ ```python
250
+ {
251
+ # 状态码
252
+ "code": 0,
253
+ # 提示信息
254
+ "message": "success",
255
+ # 错误信息
256
+ "errors": [],
257
+ # 请求ID
258
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
259
+ # 响应时间
260
+ "response_time": "2025-08-13 19:23:04",
261
+ # 响应数据量
262
+ "response_count": 2,
263
+ # 总数据量
264
+ "total_count": 2,
265
+ # 响应数据
266
+ "data": [
267
+ {
268
+ # 仓库名称 [原字段 'wname']
269
+ "warehouse_name": "EU欧洲仓",
270
+ # 领星店铺ID [sid + msku 唯一键]
271
+ "sid": 1,
272
+ # 商品ASIN
273
+ "asin": "B0********",
274
+ # 亚马逊SKU
275
+ "msku": "SKU********",
276
+ # 领星本地SKU [原字段 'sku']
277
+ "lsku": "LOCAL*******",
278
+ # 亚马逊FNSKU
279
+ "fnsku": "X00*******",
280
+ # 领星商品名称
281
+ "product_name": "P********",
282
+ # 商品类型ID
283
+ "category_id": 0,
284
+ # 商品类型名称
285
+ "category_name": "",
286
+ # 商品品牌ID
287
+ "brand_id": 0,
288
+ # 商品品牌名称
289
+ "brand_name": "",
290
+ # 商品图片链接 [原字段 'product_image']
291
+ "image_url": "https://m.media-amazon.com/****.jpg",
292
+ # 商品配送方式 (如: "FBA" 或 "FBM") [原字段 'fulfillment_channel_name']
293
+ "fulfillment_channel": "FBA",
294
+ # 库存共享类型 [原字段 'share_type']
295
+ # (0: 库存不共享, 1: 库存北美共享, 2: 库存欧洲共享)
296
+ "stock_share_type": 2,
297
+ # FBA 多国店铺本地可售库存信息列表 [原字段 'afn_fulfillable_quantity_multi']
298
+ "afn_fulfillable_local": [
299
+ {
300
+ # 店铺名称 [原字段 'name']
301
+ "seller_name": "EU-FR",
302
+ # 店铺本地可售数量 [原字段 'quantity_for_local_fulfillment']
303
+ "afn_fulfillable_local": 447
304
+ },
305
+ ...
306
+ ],
307
+ # FBA 总可售库存数量 [原字段 'total_fulfillable_quantity']
308
+ # afn_fulfillable + afn_reserved_fc_processing + afn_reserved_fc_transfers
309
+ "afn_fulfillable_total": 447,
310
+ # FBA 可售库存数量 [原字段 'afn_fulfillable_quantity']
311
+ "afn_fulfillable": 443,
312
+ # FBA 在库待调仓的库存数量 [原字段 'reserved_fc_processing']
313
+ "afn_reserved_fc_processing": 4,
314
+ # FBA 在库调仓中的库存数量 [原字段 'reserved_fc_transfers']
315
+ "afn_reserved_fc_transfers": 0,
316
+ # FBA 在库待发货的库存数量 [原字段 'reserved_customerorders']
317
+ "afn_reserved_customer_order": 0,
318
+ # FBA 在库不可售的库存数量 [原字段 'afn_unsellable_quantity']
319
+ "afn_unsellable": 0,
320
+ # FBA 实际发货在途的数量 [原字段 'afn_erp_real_shipped_quantity']
321
+ "afn_actual_shipped": 0,
322
+ # FBA 发货在途的库存数量 [原字段 'afn_inbound_shipped_quantity']
323
+ "afn_inbound_shipped": 0,
324
+ # FBA 发货计划入库的库存数量 [原字段 'afn_inbound_working_quantity']
325
+ "afn_inbound_working": 0,
326
+ # FBA 发货入库接收中的库存数量 [原字段 'afn_inbound_receiving_quantity']
327
+ "afn_inbound_receiving": 0,
328
+ # FBA 调查中的库存数量 [原字段 'afn_researching_quantity']
329
+ "afn_researching": 0,
330
+ # 库龄0-30天的库存数量 [原字段 'inv_age_0_to_30_days']
331
+ "age_0_to_30_days": 1,
332
+ # 库龄31-60天的库存数量 [原字段 'inv_age_31_to_60_days']
333
+ "age_31_to_60_days": 448,
334
+ # 库龄61-90天的库存数量 [原字段 'inv_age_61_to_90_days']
335
+ "age_61_to_90_days": 0,
336
+ # 库龄0-90天的库存数量 [原字段 'inv_age_0_to_90_days']
337
+ "age_0_to_90_days": 449,
338
+ # 库龄91-180天的库存数量 [原字段 'inv_age_91_to_180_days']
339
+ "age_91_to_180_days": 0,
340
+ # 库龄181-270天的库存数量 [原字段 'inv_age_181_to_270_days']
341
+ "age_181_to_270_days": 0,
342
+ # 库龄271-330天的库存数量 [原字段 'inv_age_271_to_330_days']
343
+ "age_271_to_330_days": 0,
344
+ # 库龄271-365天的库存数量 [原字段 'inv_age_271_to_365_days']
345
+ "age_271_to_365_days": 0,
346
+ # 库龄331-365天的库存数量 [原字段 'inv_age_331_to_365_days']
347
+ "age_331_to_365_days": 0,
348
+ # 库龄365天以上的库存数量 [原字段 'inv_age_365_plus_days']
349
+ "age_365_plus_days": 0,
350
+ # 库存售出率 (过去 90 天销量除以平均可售库存) [原字段 'sell_through']
351
+ "sell_through_rate": 1.57,
352
+ # 历史供货天数 (取短期&长期更大值)
353
+ "historical_days_of_supply": 491.3,
354
+ # 历史短期供货天数 [原字段 'short_term_historical_days_of_supply']
355
+ "historical_st_days_of_supply": 281.3,
356
+ # 历史长期供货天数 [原字段 'long_term_historical_days_of_supply']
357
+ "historical_lt_days_of_supply": 491.3,
358
+ # 库存成本金额 [原字段 'cost']
359
+ "inventory_cost_amt": 0.0,
360
+ # 库存货值金额 [原字段 'stock_cost_total']
361
+ "inventory_value_amt": 0.0,
362
+ # 亚马逊预测的库存健康状态 [原字段 'fba_inventory_level_health_status']
363
+ "inventory_health_status": "",
364
+ # 亚马逊低库存水平费收费情况 [原字段 'low_inventory_level_fee_applied']
365
+ "inventory_low_level_fee_status": "豁免收取",
366
+ # 亚马逊预测的从今天起30天内产生的仓储费 [原字段 'estimated_storage_cost_next_month']
367
+ "estimated_30d_storage_fee": 2.11,
368
+ # 亚马逊预估的冗余商品数量 [原字段 'estimated_excess_quantity']
369
+ "estimated_excess_qty": 0.0,
370
+ # 亚马逊建议的最低库存量 [原字段 'fba_minimum_inventory_level']
371
+ "recommended_minimum_qty": 58.0,
372
+ # 亚马逊建议的操作 [原字段 'recommended_action']
373
+ "recommended_action": "No Excess Inventory",
374
+ },
375
+ ...
376
+ ]
377
+ }
378
+ ```
379
+ """
380
+ url = route.FBA_INVENTORY
381
+ # 解析并验证参数
382
+ args = {
383
+ "sids": sids,
384
+ "offset": offset,
385
+ "length": length,
386
+ }
387
+ try:
388
+ p = param.FbaInventory.model_validate(args)
389
+ except Exception as err:
390
+ raise errors.InvalidParametersError(err, url, args) from err
391
+
392
+ # 发送请求
393
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
394
+ return schema.FbaInventory.model_validate(data)
395
+
396
+ async def FbaInventoryDetails(
397
+ self,
398
+ *,
399
+ search_field: INVENTORY_SEARCH_FIELD | None = None,
400
+ search_value: str | None = None,
401
+ category_ids: int | list[int] | None = None,
402
+ brand_ids: int | list[int] | None = None,
403
+ operator_ids: int | list[int] | None = None,
404
+ attr_value_id: int | None = None,
405
+ fulfillment_channel: Literal["FBA", "FBM"] | None = None,
406
+ status: int | None = None,
407
+ exclude_zero_stock: int | None = None,
408
+ exclude_deleted: int | None = None,
409
+ offset: int | None = None,
410
+ length: int | None = None,
411
+ ) -> schema.FbaInventoryDetails:
412
+ """查询FBA库存详情
413
+
414
+ ## Docs
415
+ - 仓库 - 库存&流水: [查询FBA库存列表-v2](https://apidoc.lingxing.com/#/docs/Warehouse/FBAStockDetail)
416
+
417
+ :param search_field `<'str/None'>`: 搜索字段, 默认 `None` (不搜索), 可选值:
418
+
419
+ - `"msku"` (亚马逊SKU)
420
+ - `"lsku"` (领星本地SKU)
421
+ - `"fnsku"` (亚马逊FNSKU)
422
+ - `"product_name"` (领星商品名称)
423
+ - `"asin"` (商品ASIN)
424
+ - `"parent_asin"` (商品父ASIN)
425
+ - `"spu"` (领星SPU编码)
426
+ - `"spu_name"` (领星SPU名称)
427
+
428
+ :param search_value `<'str/None'>`: 搜索内容, 需搭配`search_field`一起使用, 默认 `None` (不搜索)
429
+ :param category_ids `<'int/list[int]/None'>`: 产品分类ID或ID列表, 默认 `None` (不筛选)
430
+ :param brand_ids `<'int/list[int]/None'>`: 产品品牌ID或ID列表, 默认 `None` (不筛选)
431
+ :param operator_ids `<'int/list[int]/None'>`: 产品负责人ID或ID列表, 默认 `None` (不筛选)
432
+ :param attr_value_id `<'int/None'>`: 多属性SPU产品属性值ID, 默认 `None` (不筛选)
433
+ :param fulfillment_channel `<'str/None'>`: 产品配送方式 ("FBA", "FBM"), 默认 `None` (不筛选), 可选值:
434
+ :param status `<'int/None'>`: 产品状态 (0: 停售, 1: 在售), 默认 `None` (不筛选)
435
+ :param exclude_zero_stock `<'int/None'>`: 是否去除零库存 (0: 保留, 1: 去除), 默认 `None` (使用0)
436
+ :param exclude_deleted `<'int/None'>`: 是否去除已删除产品 (0: 保留, 1: 去除), 默认 `None` (使用0)
437
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
438
+ :param length `<'int/None'>`: 分页长度, 最大值200, 默认 `None` (使用: 20)
439
+ :returns `<'FbaInventoryDetails'>`: 返回查询到的FBA库存详情数据
440
+ ```python
441
+ {
442
+ # 状态码
443
+ "code": 0,
444
+ # 提示信息
445
+ "message": "success",
446
+ # 错误信息
447
+ "errors": [],
448
+ # 请求ID
449
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
450
+ # 响应时间
451
+ "response_time": "2025-08-13 19:23:04",
452
+ # 响应数据量
453
+ "response_count": 2,
454
+ # 总数据量
455
+ "total_count": 2,
456
+ # 响应数据
457
+ "data": [
458
+ {
459
+ # 仓库名称 [原字段 'name']
460
+ "warehouse_name": "EU欧洲仓",
461
+ # 领星店铺ID (共享库存时为0)
462
+ "sid": 0,
463
+ # 商品ASIN
464
+ "asin": "B0********",
465
+ # 亚马逊SKU [原字段 'seller_sku']
466
+ "msku": "SKU********",
467
+ # 领星本地SKU [原字段 'sku']
468
+ "lsku": "LOCAL*******",
469
+ # 亚马逊FNSKU
470
+ "fnsku": "X000*******",
471
+ # 领星商品名称
472
+ "product_name": "P********",
473
+ # 商品类型ID [原字段 'cid']
474
+ "category_id": 0,
475
+ # 商品类型名称 [原字段 'category_text']
476
+ "category_name": "",
477
+ # 商品品牌ID [原字段 'bid']
478
+ "brand_id": 0,
479
+ # 商品品牌名称 [原字段 'product_brand_text']
480
+ "brand_name": "",
481
+ # 商品略缩图链接 [原字段 'small_image_url']
482
+ "thumbnail_url": "https://image.distributetop.com/****.jpg",
483
+ # 商品配送方式
484
+ "fulfillment_channel": "AMAZON_EU",
485
+ # 库存共享类型 [原字段 'share_type']
486
+ # (0: 库存不共享, 1: 库存北美共享, 2: 库存欧洲共享)
487
+ "stock_share_type": 2,
488
+ # 库存总数量 [原字段 'total']
489
+ "stock_total": 472,
490
+ # 库存总货值金额 [原字段 'total_price']
491
+ "stock_total_amt": 30977.36,
492
+ # 库存总可售数量 [原字段 'available_total']
493
+ "stock_total_fulfillable": 472,
494
+ # 库存总可售货值金额 [原字段 'available_total_price']
495
+ "stock_total_fulfillable_amt": 30977.36,
496
+ # FBA 多国店铺本地可售库存信息列表 [原字段 'fba_storage_quantity_list']
497
+ "afn_fulfillable_local": [
498
+ {
499
+ # 领星店铺ID
500
+ "sid": 1,
501
+ # 店铺名称 [原字段 'name']
502
+ "seller_name": "DE-Store",
503
+ # 店铺本地可售数量 [原字段 'quantity_for_local_fulfillment']
504
+ "afn_fulfillable_local": 75
505
+ },
506
+ ...
507
+ ],
508
+ # afn_fulfillable + afn_reserved_fc_processing + afn_reserved_fc_transfers
509
+ # FBA 总可售库存数量 [原字段 'total_fulfillable_quantity']
510
+ "afn_fulfillable_total": 462,
511
+ # FBA 可售库存数量 [原字段 'afn_fulfillable_quantity']
512
+ "afn_fulfillable": 161,
513
+ # FBA 可售库存货值金额 [原字段 'afn_fulfillable_quantity_price']
514
+ "afn_fulfillable_amt": 10566.43,
515
+ # FBA 在库待调仓的库存数量 [原字段 'reserved_fc_processing']
516
+ "afn_reserved_fc_processing": 1,
517
+ # FBA 在库待调仓的库存货值金额 [原字段 'reserved_fc_processing_price']
518
+ "afn_reserved_fc_processing_amt": 65.63,
519
+ # FBA 在库调仓中的库存数量 [原字段 'reserved_fc_transfers']
520
+ "afn_reserved_fc_transfers": 300,
521
+ # FBA 在库调仓中的库存货值金额 [原字段 'reserved_fc_transfers_price']
522
+ "afn_reserved_fc_transfers_amt": 19689.0,
523
+ # FBA 在库待发货的库存数量 [原字段 'reserved_customerorders']
524
+ "afn_reserved_customer_order": 10,
525
+ # FBA 在库待发货的库存货值金额 [原字段 'reserved_customerorders_price']
526
+ "afn_reserved_customer_order_amt": 656.3,
527
+ # FBA 在库不可售的库存数量 [原字段 'afn_unsellable_quantity']
528
+ "afn_unsellable": 2,
529
+ # FBA 在库不可售的库存货值金额 [原字段 'afn_unsellable_quantity_price']
530
+ "afn_unsellable_amt": 131.26,
531
+ # FBA 实际发货在途的数量 [原字段 'stock_up_num']
532
+ "afn_actual_shipped": 0,
533
+ # FBA 实际发货在途的货值金额 [原字段 'stock_up_num_price']
534
+ "afn_actual_shipped_amt": 0.0,
535
+ # FBA 发货在途的库存数量 [原字段 'afn_inbound_shipped_quantity']
536
+ "afn_inbound_shipped": 0,
537
+ # FBA 发货在途的库存货值金额 [原字段 'afn_inbound_shipped_quantity_price']
538
+ "afn_inbound_shipped_amt": 0.0,
539
+ # FBA 发货计划入库的库存数量 [原字段 'afn_inbound_working_quantity']
540
+ "afn_inbound_working": 0,
541
+ # FBA 发货计划入库的库存货值金额 [原字段 'afn_inbound_working_quantity_price']
542
+ "afn_inbound_working_amt": 0.0,
543
+ # FBA 发货入库接收中的库存数量 [原字段 'afn_inbound_receiving_quantity']
544
+ "afn_inbound_receiving": 0,
545
+ # FBA 发货入库接收中的库存货值金额 [原字段 'afn_inbound_receiving_quantity_price']
546
+ "afn_inbound_receiving_amt": 0.0,
547
+ # FBA 调查中的库存数量 [原字段 'afn_researching_quantity']
548
+ "afn_researching": 2,
549
+ # FBA 调查中的库存货值金额 [原字段 'afn_researching_quantity_price']
550
+ "afn_researching_amt": 131.26,
551
+ # FBM 可售库存数量 [原字段 'quantity']
552
+ "mfn_fulfillable": 0,
553
+ # FBM 可售库存货值金额 [原字段 'quantity_price']
554
+ "mfn_fulfillable_amt": 0.0,
555
+ # 库龄0-30天的库存数量 [原字段 'inv_age_0_to_30_days']
556
+ "age_0_to_30_days": 7,
557
+ # 库龄0-30天的库存货值金额 [原字段 'inv_age_0_to_30_price']
558
+ "age_0_to_30_days_amt": 459.41,
559
+ # 库龄31-60天的库存数量 [原字段 'inv_age_31_to_60_days']
560
+ "age_31_to_60_days": 280,
561
+ # 库龄31-60天的库存货值金额 [原字段 'inv_age_31_to_60_price']
562
+ "age_31_to_60_days_amt": 18376.4,
563
+ # 库龄61-90天的库存数量 [原字段 'inv_age_61_to_90_days']
564
+ "age_61_to_90_days": 0,
565
+ # 库龄61-90天的库存货值金额 [原字段 'inv_age_61_to_90_price']
566
+ "age_61_to_90_days_amt": 0.0,
567
+ # 库龄0-90天的库存数量 [原字段 'inv_age_0_to_90_days']
568
+ "age_0_to_90_days": 287,
569
+ # 库龄0-90天的库存货值金额 [原字段 'inv_age_0_to_90_price']
570
+ "age_0_to_90_days_amt": 18835.81,
571
+ # 库龄91-180天的库存数量 [原字段 'inv_age_91_to_180_days']
572
+ "age_91_to_180_days": 0,
573
+ # 库龄91-180天的库存货值金额 [原字段 'inv_age_91_to_180_price']
574
+ "age_91_to_180_days_amt": 0.0,
575
+ # 库龄181-270天的库存数量 [原字段 'inv_age_181_to_270_days']
576
+ "age_181_to_270_days": 0,
577
+ # 库龄181-270天的库存货值金额 [原字段 'inv_age_181_to_270_price']
578
+ "age_181_to_270_days_amt": 0.0,
579
+ # 库龄271-330天的库存数量 [原字段 'inv_age_271_to_330_days']
580
+ "age_271_to_330_days": 0,
581
+ # 库龄271-330天的库存货值金额 [原字段 'inv_age_271_to_330_price']
582
+ "age_271_to_330_days_amt": 0.0,
583
+ # 库龄271-365天的库存数量 [原字段 'inv_age_271_to_365_days']
584
+ "age_271_to_365_days": 0,
585
+ # 库龄271-365天的库存货值金额 [原字段 'inv_age_271_to_365_price']
586
+ "age_271_to_365_days_amt": 0.0,
587
+ # 库龄331-365天的库存数量 [原字段 'inv_age_331_to_365_days']
588
+ "age_331_to_365_days": 0,
589
+ # 库龄331-365天的库存货值金额 [原字段 'inv_age_331_to_365_price']
590
+ "age_331_to_365_days_amt": 0.0,
591
+ # 库龄365天以上的库存数量 [原字段 'inv_age_365_plus_days']
592
+ "age_365_plus_days": 0,
593
+ # 库龄365天以上的库存货值金额 [原字段 'inv_age_365_plus_price']
594
+ "age_365_plus_days_amt": 0.0,
595
+ # 库存售出率 (过去 90 天销量除以平均可售库存) [原字段 'sell_through']
596
+ "sell_through_rate": 1.31,
597
+ # 历史供货天数 (取短期&长期更大值)
598
+ "historical_days_of_supply": 56.1,
599
+ # 历史供货天数货值金额 [原字段 'historical_days_of_supply_price']
600
+ "historical_days_of_supply_amt": "56.10",
601
+ # 亚马逊预测的库存健康状态 [原字段 'fba_inventory_level_health_status']
602
+ "inventory_health_status": "",
603
+ # 亚马逊低库存水平费收费情况 [原字段 'low_inventory_level_fee_applied']
604
+ "inventory_low_level_fee_status": "本周未收",
605
+ # 亚马逊预测的从今天起30天内产生的仓储费 [原字段 'estimated_storage_cost_next_month']
606
+ "estimated_30d_storage_fee": 0.0,
607
+ # 亚马逊预估的冗余商品数量 [原字段 'estimated_excess_quantity']
608
+ "estimated_excess_qty": 0.0,
609
+ # 亚马逊建议的最低库存量 [原字段 'fba_minimum_inventory_level']
610
+ "recommended_minimum_qty": 258.0,
611
+ # 亚马逊建议的操作 [原字段 'recommended_action']
612
+ "recommended_action": "Go to Restock",
613
+ },
614
+ ...
615
+ ],
616
+ }
617
+ ```
618
+ """
619
+ url = route.FBA_INVENTORY_DETAILS
620
+ # 解析并验证参数
621
+ args = {
622
+ "search_field": search_field,
623
+ "search_value": search_value,
624
+ "category_ids": category_ids,
625
+ "brand_ids": brand_ids,
626
+ "attr_value_id": attr_value_id,
627
+ "operator_ids": operator_ids,
628
+ "fulfillment_channel": fulfillment_channel,
629
+ "status": status,
630
+ "exclude_zero_stock": exclude_zero_stock,
631
+ "exclude_deleted": exclude_deleted,
632
+ "offset": offset,
633
+ "length": length,
634
+ }
635
+ try:
636
+ p = param.FbaInventoryDetails.model_validate(args)
637
+ except Exception as err:
638
+ raise errors.InvalidParametersError(err, url, args) from err
639
+
640
+ # 发送请求
641
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
642
+ return schema.FbaInventoryDetails.model_validate(data)
643
+
644
+ async def AwdInventory(
645
+ self,
646
+ *,
647
+ search_field: INVENTORY_SEARCH_FIELD | None = None,
648
+ search_value: str | None = None,
649
+ warehouse_ids: int | list[int] | None = None,
650
+ category_ids: int | list[int] | None = None,
651
+ brand_ids: int | list[int] | None = None,
652
+ operator_ids: int | list[int] | None = None,
653
+ attr_value_id: int | None = None,
654
+ status: int | None = None,
655
+ exclude_zero_stock: int | None = None,
656
+ offset: int | None = None,
657
+ length: int | None = None,
658
+ ) -> schema.AwdInventory:
659
+ """查询AWD库存
660
+
661
+ ## Docs
662
+ - 仓库 - 库存&流水: [查询AWD库存列表](https://apidoc.lingxing.com/#/docs/Warehouse/AwdWarehouseDetail)
663
+
664
+ :param search_field `<'str/None'>`: 搜索字段, 默认 `None` (不搜索), 可选值:
665
+
666
+ - `"msku"` (亚马逊SKU)
667
+ - `"lsku"` (领星本地SKU)
668
+ - `"fnsku"` (亚马逊FNSKU)
669
+ - `"product_name"` (领星商品名称)
670
+ - `"asin"` (商品ASIN)
671
+ - `"parent_asin"` (商品父ASIN)
672
+ - `"spu"` (领星SPU编码)
673
+ - `"spu_name"` (领星SPU名称)
674
+
675
+ :param search_value `<'str/None'>`: 搜索内容, 需搭配`search_field`一起使用, 默认 `None` (不搜索)
676
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
677
+ :param category_ids `<'int/list[int]/None'>`: 产品分类ID或ID列表, 默认 `None` (不筛选)
678
+ :param brand_ids `<'int/list[int]/None'>`: 产品品牌ID或ID列表, 默认 `None` (不筛选)
679
+ :param operator_ids `<'int/list[int]/None'>`: 产品负责人ID或ID列表, 默认 `None` (不筛选)
680
+ :param attr_value_id `<'int/None'>`: 多属性SPU产品属性值ID, 默认 `None` (不筛选)
681
+ :param status `<'int/None'>`: 产品状态 (0: 停售, 1: 在售), 默认 `None` (不筛选)
682
+ :param exclude_zero_stock `<'int/None'>`: 是否去除零库存 (0: 保留, 1: 去除), 默认 `None` (使用0)
683
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
684
+ :param length `<'int/None'>`: 分页长度, 最大值200, 默认 `None` (使用: 20)
685
+ :returns `<'AwdInventory'>`: 返回查询到的AWD库存数据
686
+ ```python
687
+ {
688
+ # 状态码
689
+ "code": 0,
690
+ # 提示信息
691
+ "message": "success",
692
+ # 错误信息
693
+ "errors": [],
694
+ # 请求ID
695
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
696
+ # 响应时间
697
+ "response_time": "2025-08-13 19:23:04",
698
+ # 响应数据量
699
+ "response_count": 2,
700
+ # 总数据量
701
+ "total_count": 2,
702
+ # 响应数据
703
+ "data": [
704
+ {
705
+ # 仓库名称 [原字段 'wname']
706
+ "warehouse_name": "US美国仓(AWD)",
707
+ # 领星站点ID
708
+ "mid": 1,
709
+ # 国家 [原字段 'nation']
710
+ "country": "美国",
711
+ # 领星店铺ID
712
+ "sid": 50,
713
+ # 领星店铺名称
714
+ "seller_name": "韧啸-US",
715
+ # 商品父ASIN
716
+ "parent_asin": "B0CPT1TVV7",
717
+ # 商品ASIN
718
+ "asin": "B0CPT1TVV7",
719
+ # 商品ASIN链接
720
+ "asin_url": "https://www.amazon.com/dp/B0CPT1TVV7",
721
+ # 亚马逊SKU [原字段 'seller_sku']
722
+ "msku": "HM300-BLACK",
723
+ # 领星本地SKU [原字段 'sku']
724
+ "lsku": "",
725
+ # 亚马逊FNSKU
726
+ "fnsku": "",
727
+ # 多属性SPU产品编码
728
+ "spu": "",
729
+ # 多属性SPU产品名称
730
+ "spu_name": "",
731
+ # 领星产品ID
732
+ "product_id": 0,
733
+ # 领星商品名称
734
+ "product_name": "",
735
+ # 商品类型ID [原字段 'cid']
736
+ "category_id": 0,
737
+ # 商品类型名称 [原字段 'category_text']
738
+ "category_name": "",
739
+ # 商品类型1级名称
740
+ "category_level1": "",
741
+ # 商品类型2级名称
742
+ "category_level2": "",
743
+ # 商品类型3级名称
744
+ "category_level3": "",
745
+ # 商品类型列表 [原字段 'category_Arr']
746
+ "categories": [],
747
+ # 商品品牌ID [原字段 'bid']
748
+ "brand_id": 0,
749
+ # 商品品牌名称 [原字段 'product_brand_text']
750
+ "brand_name": "",
751
+ # 产品图片链接 [原字段 'pic_url']
752
+ "image_url": "",
753
+ # 产品略缩图链接 [原字段 'small_image_url']
754
+ "thumbnail_url": "https://m.media-amazon.com/images/I/41yXqZiD0JL._SL75_.jpg",
755
+ # 产品负责人列表 [原字段 'asin_principal_list']
756
+ "operators": [],
757
+ # 商品属性列表 [原字段 'attribute']
758
+ "attributes": [],
759
+ # AWD 总库存数量 [原字段 'total_onhand_quantity']
760
+ "awd_total": 24,
761
+ # AWD 总库存货值金额 [原字段 'total_onhand_quantity_price']
762
+ "awd_total_amt": 0.0,
763
+ # AWD 可分发库存数量 [原字段 'available_distributable_quantity']
764
+ "awd_distributable": 14,
765
+ # AWD 可分发库存货值金额 [原字段 'available_distributable_quantity_price']
766
+ "awd_distributable_amt": 0.0,
767
+ # AWD 在途分发至FBA数量 [原字段 'awd_to_fba_quantity_shipped']
768
+ "awd_distributing": 0,
769
+ # AWD 在途分发至FBA货值金额 [原字段 'awd_to_fba_quantity_shipped_price']
770
+ "awd_distributing_amt": 0.0,
771
+ # AWD 在库待分发数量 [原字段 'reserved_distributable_quantity']
772
+ "awd_reserved_distributes": 10,
773
+ # AWD 在库待分发货值金额 [原字段 'reserved_distributable_quantity_price']
774
+ "awd_reserved_distributes_amt": 0.0,
775
+ # AWD 实际发货在途的数量 [原字段 'awd_actual_quantity_shipped']
776
+ "awd_actual_shipped": 0,
777
+ # AWD 实际发货在途的货值金额 [原字段 'awd_actual_quantity_shipped_price']
778
+ "awd_actual_shipped_amt": 0.0,
779
+ # AWD 发货在途的库存数量 [原字段 'awd_quantity_shipped']
780
+ "awd_inbound_shipped": 0,
781
+ # AWD 发货在途的库存货值金额 [原字段 'awd_quantity_shipped_price']
782
+ "awd_inbound_shipped_amt": 0.0,
783
+ },
784
+ ...
785
+ ]
786
+ }
787
+ ```
788
+ """
789
+ urls = route.AWD_INVENTORY
790
+ # 解析并验证参数
791
+ args = {
792
+ "search_field": search_field,
793
+ "search_value": search_value,
794
+ "warehouse_ids": warehouse_ids,
795
+ "category_ids": category_ids,
796
+ "brand_ids": brand_ids,
797
+ "operator_ids": operator_ids,
798
+ "attr_value_id": attr_value_id,
799
+ "status": status,
800
+ "exclude_zero_stock": exclude_zero_stock,
801
+ "offset": offset,
802
+ "length": length,
803
+ }
804
+ try:
805
+ p = param.AwdInventory.model_validate(args)
806
+ except Exception as err:
807
+ raise errors.InvalidParametersError(err, urls, args) from err
808
+
809
+ # 发送请求
810
+ data = await self._request_with_sign("POST", urls, body=p.model_dump_params())
811
+ return schema.AwdInventory.model_validate(data)
812
+
813
+ async def SellerInventory(
814
+ self,
815
+ *,
816
+ warehouse_ids: int | list[int] | None = None,
817
+ lsku: str | None = None,
818
+ offset: int | None = None,
819
+ length: int | None = None,
820
+ ) -> schema.SellerInventory:
821
+ """卖家(本地/海外)仓库库存产品信息
822
+
823
+ ## Docs
824
+ - 仓库 - 库存&流水: [查询仓库库存明细](https://apidoc.lingxing.com/#/docs/Warehouse/InventoryDetails)
825
+
826
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
827
+ :param lsku `<'str/None'>`: 领星本地SKU, 默认 `None` (不筛选)
828
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
829
+ :param length `<'int/None'>`: 分页长度, 最大值800, 默认 `None` (使用: 20)
830
+ :returns `<'SellerInventory'>`: 返回查询到的卖家仓库库存产品信息数据
831
+ ```python
832
+ {
833
+ # 状态码
834
+ "code": 0,
835
+ # 提示信息
836
+ "message": "success",
837
+ # 错误信息
838
+ "errors": [],
839
+ # 请求ID
840
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
841
+ # 响应时间
842
+ "response_time": "2025-08-13 19:23:04",
843
+ # 响应数据量
844
+ "response_count": 2,
845
+ # 总数据量
846
+ "total_count": 2,
847
+ # 响应数据
848
+ "data": [
849
+ {
850
+ # 仓库ID [原字段 'wid']
851
+ "warehouse_id": 1***,
852
+ # 领星店铺ID [原字段 'seller_id']
853
+ "sid": 1,
854
+ # 领星本地商品SKU [原字段 'sku']
855
+ "lsku": "LOCAL*******",
856
+ # 亚马逊FNSKU
857
+ "fnsku": "X00*******",
858
+ # 产品总库存数量 [原字段 'product_total']
859
+ # 领星商品ID
860
+ "product_id": 2*****,
861
+ "total_qty": 0,
862
+ # 产品库存可售数量 [原字段 'product_valid_num']
863
+ "fulfillable_qty": 0,
864
+ # 产品库存可售预留数量 [原字段 'good_lock_num']
865
+ "fulfillable_reserved_qty": 0,
866
+ # 产品库存次品数量 [原字段 'product_bad_num']
867
+ "unsellable_qty": 0,
868
+ # 产品库存不可售预留数量 [原字段 'bad_lock_num']
869
+ "unsellable_reserved_qty": 0,
870
+ # 产品库存加工计划单品的预留数量 [原字段 'product_lock_num']
871
+ "process_reserved_qty": 0,
872
+ # 产品库存待质检数量 [原字段 'product_qc_num']
873
+ "pending_qc_qty": 0,
874
+ # 产品待到货数量 [原字段 'quantity_receive']
875
+ "pending_arrival_qty": 100,
876
+ # 产品调拨在途数量 [原字段 'product_onway']
877
+ "transit_qty": 0,
878
+ # 产品调拨在途头程成本 [原字段 'transit_head_cost']
879
+ "transit_first_leg_fee": 0.0,
880
+ # 外箱可售数量 [原字段 'available_inventory_box_qty']
881
+ "box_fulfillable_qty": 0,
882
+ # 第三方海外仓库存信息 [原字段 'third_inventory']
883
+ "overseas_inventory": {
884
+ # 产品可售库存数量 [原字段 'qty_sellable']
885
+ "fulfillable_qty": 0,
886
+ # 产品待上架库存数量 [原字段 'qty_pending']
887
+ "pending_qty": 0,
888
+ # 产品预留库存数量 [原字段 'qty_reserved']
889
+ "reserved_qty": 0,
890
+ # 产品调拨在途数量 [原字段 'qty_onway']
891
+ "transit_qty": 0,
892
+ # 外箱可售数量 [原字段 'box_qty_sellable']
893
+ "box_fulfillable_qty": 0,
894
+ # 外箱待上架数量 [原字段 'box_qty_pending']
895
+ "box_pending_qty": 0,
896
+ # 外箱预留数量 [原字段 'box_qty_reserved']
897
+ "box_reserved_qty": 0,
898
+ # 外箱调拨在途数量 [原字段 'box_qty_onway']
899
+ "box_transit_qty": 0,
900
+ },
901
+ # 库存单价成本 [原字段 'stock_cost']
902
+ "stock_item_cost_amt": 0.0,
903
+ # 库存总成本金额 [原字段 'stock_cost_total']
904
+ "stock_total_cost_amt": 0.0,
905
+ # 平均库龄 [原字段 'average_age']
906
+ "age_avg_days": 0,
907
+ # 库龄列表 [原字段 'stock_age_list']
908
+ "ages": [
909
+ {
910
+ # 库龄信息 [原字段 'name']
911
+ "age": "0-15天库龄",
912
+ # 库龄数量
913
+ "qty": 0
914
+ },
915
+ ...,
916
+ ],
917
+ },
918
+ ...
919
+ ],
920
+ }
921
+ ```
922
+ """
923
+ url = route.SELLER_INVENTORY
924
+ # 解析并验证参数
925
+ args = {
926
+ "warehouse_ids": warehouse_ids,
927
+ "lsku": lsku,
928
+ "offset": offset,
929
+ "length": length,
930
+ }
931
+ try:
932
+ p = param.SellerInventory.model_validate(args)
933
+ except Exception as err:
934
+ raise errors.InvalidParametersError(err, url, args) from err
935
+
936
+ # 发送请求
937
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
938
+ return schema.SellerInventory.model_validate(data)
939
+
940
+ async def SellerInventoryBins(
941
+ self,
942
+ *,
943
+ warehouse_ids: int | list[int] | None = None,
944
+ bin_types: int | list[int] | None = None,
945
+ offset: int | None = None,
946
+ length: int | None = None,
947
+ ) -> schema.SellerInventoryBins:
948
+ """查询卖家(本地/海外)仓库库存货架(仓位)信息
949
+
950
+ ## Docs
951
+ - 仓库 - 库存&流水: [查询仓位库存明细](https://apidoc.lingxing.com/#/docs/Warehouse/inventoryBinDetails)
952
+
953
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
954
+ :param bin_types `<'int/list[int]/None'>`: 仓位类型ID或ID列表, 默认 `None` (不筛选), 可选值:
955
+
956
+ - `1`: 待检暂存
957
+ - `2`: 可用暂存
958
+ - `3`: 次品暂存
959
+ - `4`: 拣货暂存
960
+ - `5`: 可用
961
+ - `6`: 次品
962
+
963
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
964
+ :param length `<'int/None'>`: 分页长度, 最大值500, 默认 `None` (使用: 20)
965
+ :returns `<'SellerInventoryBin'>`: 返回查询到的卖家仓库库存货架信息数据
966
+ ```python
967
+ {
968
+ # 状态码
969
+ "code": 0,
970
+ # 提示信息
971
+ "message": "success",
972
+ # 错误信息
973
+ "errors": [],
974
+ # 请求ID
975
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
976
+ # 响应时间
977
+ "response_time": "2025-08-13 19:23:04",
978
+ # 响应数据量
979
+ "response_count": 2,
980
+ # 总数据量
981
+ "total_count": 2,
982
+ # 响应数据
983
+ "data": [
984
+ {
985
+ # 仓库ID [原字段 'wid']
986
+ "warehouse_id": 1****,
987
+ # 仓库名称 [原字段 'wh_name']
988
+ "warehouse_name": "US Warehouse",
989
+ # 仓库货架ID [原字段 'whb_id']
990
+ "bin_id": 4****,
991
+ # 仓库货架名称 [原字段 'whb_name']
992
+ "bin_name": "可用暂存",
993
+ # 仓库货架类型 [原字段 'whb_type']
994
+ "bin_type": 2,
995
+ # 仓库货架类型描述 [原字段 'whb_type_name']
996
+ "bin_type_desc": "可用暂存",
997
+ # 领星店铺ID [原字段 'store_id']
998
+ "sid": 0,
999
+ # 亚马逊SKU
1000
+ "msku": "",
1001
+ # 领星本地商品SKU [原字段 'sku']
1002
+ "lsku": "P*******",
1003
+ # 亚马逊FNSKU
1004
+ "fnsku": "",
1005
+ # 领星商品ID
1006
+ "product_id": 237229,
1007
+ # 领星商品名称
1008
+ "product_name": "LOCAL*******",
1009
+ # 产品总库存数量 [原字段 'total']
1010
+ "total_qty": 0,
1011
+ # 产品库存可售数量 [原字段 'validNum']
1012
+ "fulfillable_qty": 0,
1013
+ # 产品库存预留数量 [原字段 'lockNum']
1014
+ "reserved_qty": 0,
1015
+ # 第三方海外仓库存信息 [原字段 'third_inventory']
1016
+ "overseas_inventory": {
1017
+ # 产品可售库存数量 [原字段 'qty_sellable']
1018
+ "fulfillable_qty": 0,
1019
+ # 产品待上架库存数量 [原字段 'qty_pending']
1020
+ "pending_qty": 0,
1021
+ # 产品预留库存数量 [原字段 'qty_reserved']
1022
+ "reserved_qty": 0,
1023
+ # 产品调拨在途数量 [原字段 'qty_onway']
1024
+ "transit_qty": 0,
1025
+ # 外箱可售数量 [原字段 'box_qty_sellable']
1026
+ "box_fulfillable_qty": 0,
1027
+ # 外箱待上架数量 [原字段 'box_qty_pending']
1028
+ "box_pending_qty": 0,
1029
+ # 外箱预留数量 [原字段 'box_qty_reserved']
1030
+ "box_reserved_qty": 0,
1031
+ # 外箱调拨在途数量 [原字段 'box_qty_onway']
1032
+ "box_transit_qty": 0,
1033
+ },
1034
+ },
1035
+ ...
1036
+ ],
1037
+ }
1038
+ ```
1039
+ """
1040
+ url = route.SELLER_INVENTORY_BINS
1041
+ # 解析并验证参数
1042
+ args = {
1043
+ "warehouse_ids": warehouse_ids,
1044
+ "bin_types": bin_types,
1045
+ "offset": offset,
1046
+ "length": length,
1047
+ }
1048
+ try:
1049
+ p = param.SellerInventoryBins.model_validate(args)
1050
+ except Exception as err:
1051
+ raise errors.InvalidParametersError(err, url, args) from err
1052
+
1053
+ # 发送请求
1054
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
1055
+ return schema.SellerInventoryBins.model_validate(data)
1056
+
1057
+ async def SellerInventoryBatches(
1058
+ self,
1059
+ *,
1060
+ search_field: SELLER_INVENTORY_SEARCH_FIELD | None = None,
1061
+ search_value: str | None = None,
1062
+ warehouse_ids: int | list[int] | None = None,
1063
+ transaction_types: int | list[int] | None = None,
1064
+ exclude_zero_stock: int | None = None,
1065
+ offset: int | None = None,
1066
+ length: int | None = None,
1067
+ ) -> schema.SellerInventoryBatches:
1068
+ """查询卖家(本地/海外)仓库出入库批次明细
1069
+
1070
+ ## Docs
1071
+ - 仓库 - 库存&流水: [查询批次明细](https://apidoc.lingxing.com/#/docs/Warehouse/GetBatchDetailList)
1072
+
1073
+ :param search_field `<'str/None'>`: 搜索字段, 默认 `None` (不搜索), 可选值:
1074
+
1075
+ - `"sku"` (亚马逊SKU)
1076
+ - `"lsku"` (领星本地SKU)
1077
+ - `"fnsku"` (亚马逊FNSKU)
1078
+ - `"product_name"` (领星商品名称)
1079
+ - `"transaction_number"` (出入库单号)
1080
+ - `"batch_number"` (批次号)
1081
+ - `"source_batch_number"` (源头批次号)
1082
+ - `"purchase_plan_number"` (采购计划单号)
1083
+ - `"purchase_number"` (采购单号)
1084
+ - `"receiving_number"` (收货单号)
1085
+
1086
+ :param search_value `<'str/None'>`: 搜索内容, 需搭配`search_field`一起使用, 默认 `None` (不搜索)
1087
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
1088
+ :param transaction_types `<'int/list[int]/None'>`: 出入库类型ID或ID列表, 默认 `None` (不筛选), 可选值:
1089
+
1090
+ - `16`: 换标入库
1091
+ - `17`: 加工入库
1092
+ - `18`: 拆分入库
1093
+ - `19`: 其他入库
1094
+ - `22`: 采购入库
1095
+ - `24`: 调拨入库
1096
+ - `23`: 委外入库
1097
+ - `25`: 盘盈入库
1098
+ - `26`: 退货入库
1099
+ - `27`: 移除入库
1100
+ - `45`: 赠品入库
1101
+
1102
+ :param exclude_zero_stock `<'int/None'>`: 是否去除零库存 (0: 保留, 1: 去除), 默认 `None` (使用0)
1103
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
1104
+ :param length `<'int/None'>`: 分页长度, 最大值400, 默认 `None` (使用: 20)
1105
+ :returns `<'SellerInventoryBatches'>`: 返回查询到的卖家仓库出入库批次明细数据
1106
+ ```python
1107
+ {
1108
+ # 状态码
1109
+ "code": 0,
1110
+ # 提示信息
1111
+ "message": "success",
1112
+ # 错误信息
1113
+ "errors": [],
1114
+ # 请求ID
1115
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
1116
+ # 响应时间
1117
+ "response_time": "2025-08-13 19:23:04",
1118
+ # 响应数据量
1119
+ "response_count": 2,
1120
+ # 总数据量
1121
+ "total_count": 2,
1122
+ # 响应数据
1123
+ "data": [
1124
+ {
1125
+ # 仓库ID [原字段 'wid']
1126
+ "warehouse_id": 1****,
1127
+ # 仓库名称 [原字段 'wh_name']
1128
+ "warehouse_name": "默认仓库",
1129
+ # 批次号 [原字段 'batch_no']
1130
+ "batch_number": "24********-1",
1131
+ # 源头批次号 [原字段 'source_batch_no']
1132
+ "source_batch_numbers": [],
1133
+ # 出入库单号 [原字段 'order_sn']
1134
+ "transaction_number": "IB2********",
1135
+ # 出入库类型 [原字段 'type']
1136
+ "transaction_type": 2202,
1137
+ # 出入库类型描述 [原字段 'type_name']
1138
+ "transaction_type_desc": "采购入库",
1139
+ # 领星店铺ID [原字段 'store_id']
1140
+ "sid": 1,
1141
+ # 领星店铺名称 [原字段 'store_name']
1142
+ "seller_name": "NA店铺",
1143
+ # 亚马逊SKU
1144
+ "msku": "SKU********",
1145
+ # 领星本地商品SKU [原字段 'sku']
1146
+ "lsku": "LOCAL********",
1147
+ # 亚马逊FNSKU
1148
+ "fnsku": "X00*******",
1149
+ # 领星商品ID
1150
+ "product_id": 2*****,
1151
+ # 领星商品名称
1152
+ "product_name": "P********",
1153
+ # 批次总数 [原字段 'total']
1154
+ "total_qty": 300,
1155
+ # 批次在库结存 [原字段 'balance_num']
1156
+ "ending_balance_qty": 300,
1157
+ # 批次在途结存 [原字段 'transit_balance_num']
1158
+ "transit_balance_qty": 0,
1159
+ # 批次可售在途 [原字段 'good_transit_num']
1160
+ "transit_fulfillable_qty": 0,
1161
+ # 批次不可售在途 [原字段 'bad_transit_num']
1162
+ "transit_unsellable_qty": 0,
1163
+ # 批次可售数量 [原字段 'good_num']
1164
+ "fulfillable_qty": 300,
1165
+ # 批次不可售数量 [原字段 'bad_num']
1166
+ "unsellable_qty": 0,
1167
+ # 批次待质检数量 [原字段 'qc_num']
1168
+ "pending_qc_qty": 0,
1169
+ # 批次货物成本 [原字段 'stock_cost']
1170
+ "cost_amt": 7635.0,
1171
+ # 批次头程费用 [原字段 'head_stock_cost']
1172
+ "first_leg_fee": 0.0,
1173
+ # 批次出入库费用 [原字段 'fee']
1174
+ "transaction_fee": 0.0,
1175
+ # 批次总货值 [原字段 'amount']
1176
+ "value_amt": 7635.0,
1177
+ # 采购计划单号列表 [原字段 'plan_sn']
1178
+ "purchase_plan_numbers": ["PP2********", "PP2********"],
1179
+ # 采购单号列表 [原字段 'purchase_order_sns']
1180
+ "purchase_order_numbers": ["PO2********"],
1181
+ # 收货单号列表 [原字段 'delivery_order_sns']
1182
+ "delivery_order_numbers": ["CR2********"],
1183
+ # 供应商ID列表
1184
+ "supplier_ids": [6***],
1185
+ # 供应商名称列表
1186
+ "supplier_names": ["中********"],
1187
+ # 批次创建时间 (北京时间)
1188
+ "batch_time": "2024-11-12 14:06",
1189
+ # 采购时间 (北京时间) [原字段 'purchase_in_time']
1190
+ "purchase_time": "2024-11-12 14:06",
1191
+ # 更新时间 (北京时间)
1192
+ "update_time": "2024-11-12 14:06",
1193
+ },
1194
+ ...
1195
+ ],
1196
+ }
1197
+ ```
1198
+ """
1199
+ url = route.SELLER_INVENTORY_BATCHES
1200
+ # 解析并验证参数
1201
+ args = {
1202
+ "search_field": search_field,
1203
+ "search_value": search_value,
1204
+ "warehouse_ids": warehouse_ids,
1205
+ "transaction_types": transaction_types,
1206
+ "exclude_zero_stock": exclude_zero_stock,
1207
+ "offset": offset,
1208
+ "length": length,
1209
+ }
1210
+ try:
1211
+ p = param.SellerInventoryBatches.model_validate(args)
1212
+ except Exception as err:
1213
+ raise errors.InvalidParametersError(err, url, args) from err
1214
+
1215
+ # 发送请求
1216
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
1217
+ return schema.SellerInventoryBatches.model_validate(data)
1218
+
1219
+ async def SellerInventoryRecords(
1220
+ self,
1221
+ *,
1222
+ search_field: SELLER_INVENTORY_SEARCH_FIELD | None = None,
1223
+ search_value: str | None = None,
1224
+ warehouse_ids: int | list[int] | None = None,
1225
+ transaction_types: int | list[int] | None = None,
1226
+ offset: int | None = None,
1227
+ length: int | None = None,
1228
+ ) -> schema.SellerInventoryRecords:
1229
+ """查询卖家(本地/海外)仓库出入库批次流水
1230
+
1231
+ ## Docs
1232
+ - 仓库 - 库存&流水: [查询批次流水](https://apidoc.lingxing.com/#/docs/Warehouse/GetBatchStatementList)
1233
+
1234
+ :param search_field `<'str/None'>`: 搜索字段, 默认 `None` (不搜索), 可选值:
1235
+
1236
+ - `"msku"` (亚马逊SKU)
1237
+ - `"lsku"` (领星本地SKU)
1238
+ - `"fnsku"` (亚马逊FNSKU)
1239
+ - `"product_name"` (领星商品名称)
1240
+ - `"transaction_number"` (出入库单号)
1241
+ - `"batch_number"` (批次号)
1242
+ - `"source_batch_number"` (源头批次号)
1243
+ - `"purchase_plan_number"` (采购计划单号)
1244
+ - `"purchase_number"` (采购单号)
1245
+ - `"receiving_number"` (收货单号)
1246
+
1247
+ :param search_value `<'str/None'>`: 搜索内容, 需搭配`search_field`一起使用, 默认 `None` (不搜索)
1248
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
1249
+ :param transaction_types `<'int/list[int]/None'>`: 出入库类型ID或ID列表, 默认 `None` (不筛选), 可选值:
1250
+
1251
+ - `19`: 其他入库
1252
+ - `22`: 采购入库
1253
+ - `24`: 调拨入库
1254
+ - `23`: 委外入库
1255
+ - `25`: 盘盈入库
1256
+ - `16`: 换标入库
1257
+ - `17`: 加工入库
1258
+ - `18`: 拆分入库
1259
+ - `47`: VC-PO出库
1260
+ - `48`: VC-DF出库
1261
+ - `42`: 其他出库
1262
+ - `41`: 调拨出库
1263
+ - `32`: 委外出库
1264
+ - `33`: 盘亏出库
1265
+ - `34`: 换标出库
1266
+ - `35`: 加工出库
1267
+ - `36`: 拆分出库
1268
+ - `37`: FBA出库
1269
+ - `38`: FBM出库
1270
+ - `39`: 退货出库
1271
+ - `26`: 退货入库
1272
+ - `27`: 移除入库
1273
+ - `28`: 采购质检
1274
+ - `29`: 委外质检
1275
+ - `71`: 采购上架
1276
+ - `72`: 委外上架
1277
+ - `65`: WFS出库
1278
+ - `45`: 赠品入库
1279
+ - `46`: 赠品质检入库
1280
+ - `73`: 赠品上架
1281
+ - `201`: 期初成本调整
1282
+ - `202`: 尾差成本调整
1283
+
1284
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
1285
+ :param length `<'int/None'>`: 分页长度, 最大值400, 默认 `None` (使用: 20)
1286
+ :returns `<'SellerInventoryRecords'>`: 返回查询到的卖家仓库出入库批次流水数据
1287
+ ```python
1288
+ {
1289
+ # 状态码
1290
+ "code": 0,
1291
+ # 提示信息
1292
+ "message": "success",
1293
+ # 错误信息
1294
+ "errors": [],
1295
+ # 请求ID
1296
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
1297
+ # 响应时间
1298
+ "response_time": "2025-08-13 19:23:04",
1299
+ # 响应数据量
1300
+ "response_count": 2,
1301
+ # 总数据量
1302
+ "total_count": 2,
1303
+ # 响应数据
1304
+ "data": [
1305
+ {
1306
+ # 仓库ID [原字段 'wid']
1307
+ "warehouse_id": 1****,
1308
+ # 仓库名称 [原字段 'wh_name']
1309
+ "warehouse_name": "DE Warehouse",
1310
+ # 批次流水号 [原字段 'batch_state_id']
1311
+ "batch_record_number": "25********-1",
1312
+ # 批次号 [原字段 'batch_no']
1313
+ "batch_number": "25********-1",
1314
+ # 源头批次号 [原字段 'source_batch_no']
1315
+ "source_batch_numbers": [],
1316
+ # 出入库单号 [原字段 'order_sn']
1317
+ "transaction_number": "WO10****************",
1318
+ # 源头出入库单号列表 [原字段 'source_order_sn']
1319
+ "source_transaction_numbers": [],
1320
+ # 出入库类型 [原字段 'type']
1321
+ "transaction_type": 3801,
1322
+ # 出入库类型描述 [原字段 'type_name']
1323
+ "transaction_type_desc": "FBM出库",
1324
+ # 领星店铺ID [原字段 'store_id']
1325
+ "sid": 0,
1326
+ # 领星店铺名称 [原字段 'store_name']
1327
+ "seller_name": "",
1328
+ # 亚马逊SKU
1329
+ "msku": "",
1330
+ # 领星本地商品SKU [原字段 'sku']
1331
+ "lsku": "LOCAL********",
1332
+ # 亚马逊FNSKU
1333
+ "fnsku": "",
1334
+ # 领星商品ID
1335
+ "product_id": 23****,
1336
+ # 领星商品名称
1337
+ "product_name": "P********",
1338
+ # 批次流水在库结存 [原字段 'balance_num']
1339
+ "ending_balance_qty": 115,
1340
+ # 批次流水在途结存 [原字段 'transit_balance_num']
1341
+ "transit_balance_qty": 0,
1342
+ # 批次流水可售在途 [原字段 'good_transit_num']
1343
+ "transit_fulfillable_qty": 0,
1344
+ # 批次流水不可售在途 [原字段 'bad_transit_num']
1345
+ "transit_unsellable_qty": 0,
1346
+ # 批次流水可售数量 [原字段 'good_num']
1347
+ "fulfillable_qty": -1,
1348
+ # 批次流水不可售数量 [原字段 'bad_num']
1349
+ "unsellable_qty": 0,
1350
+ # 批次流水待质检数量 [原字段 'qc_num']
1351
+ "pending_qc_qty": 0,
1352
+ # 批次流水货物成本 [原字段 'stock_cost']
1353
+ "cost_amt": 99.8,
1354
+ # 批次流水头程费用 [原字段 'head_stock_cost']
1355
+ "first_leg_fee": 0.0,
1356
+ # 批次流水出入库费用 [原字段 'fee']
1357
+ "transaction_fee": 0.0,
1358
+ # 批次流水总货值 [原字段 'amount']
1359
+ "value_amt": 99.8,
1360
+ # 采购计划单号列表 [原字段 'plan_sn']
1361
+ "purchase_plan_numbers": [],
1362
+ # 采购单号列表 [原字段 'purchase_order_sns']
1363
+ "purchase_numbers": [],
1364
+ # 收货单号列表 [原字段 'delivery_order_sns']
1365
+ "receiving_numbers": [],
1366
+ # 供应商ID列表
1367
+ "supplier_ids": [],
1368
+ # 供应商名称列表
1369
+ "supplier_names": [],
1370
+ },
1371
+ ...
1372
+ ],
1373
+ }
1374
+ ```
1375
+ """
1376
+ url = route.SELLER_INVENTORY_RECORDS
1377
+ # 解析并验证参数
1378
+ args = {
1379
+ "search_field": search_field,
1380
+ "search_value": search_value,
1381
+ "warehouse_ids": warehouse_ids,
1382
+ "transaction_types": transaction_types,
1383
+ "offset": offset,
1384
+ "length": length,
1385
+ }
1386
+ try:
1387
+ p = param.SellerInventoryRecords.model_validate(args)
1388
+ except Exception as err:
1389
+ raise errors.InvalidParametersError(err, url, args) from err
1390
+
1391
+ # 发送请求
1392
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
1393
+ return schema.SellerInventoryRecords.model_validate(data)
1394
+
1395
+ async def SellerInventoryOperations(
1396
+ self,
1397
+ *,
1398
+ warehouse_ids: int | list[int] | None = None,
1399
+ transaction_types: int | list[int] | None = None,
1400
+ transaction_sub_types: int | list[int] | None = None,
1401
+ start_date: str | datetime.date | datetime.datetime | None = None,
1402
+ end_date: str | datetime.date | datetime.datetime | None = None,
1403
+ offset: int | None = None,
1404
+ length: int | None = None,
1405
+ ) -> schema.SellerInventoryOperations:
1406
+ """查询卖家(本地/海外)仓库出入库操作流水
1407
+
1408
+ ## Docs
1409
+ - 仓库 - 库存&流水: [查询库存流水(新)](https://apidoc.lingxing.com/#/docs/Warehouse/WarehouseStatementNew)
1410
+
1411
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
1412
+ :param transaction_types `<'int/list[int]/None'>`: 操作类型ID或ID列表, 默认 `None` (不筛选), 可选值:
1413
+
1414
+ - `19`: 其他入库
1415
+ - `22`: 采购入库
1416
+ - `24`: 调拨入库
1417
+ - `23`: 委外入库
1418
+ - `25`: 盘盈入库
1419
+ - `15`: FBM退货
1420
+ - `16`: 换标入库
1421
+ - `17`: 加工入库
1422
+ - `18`: 拆分入库
1423
+ - `26`: 退货入库
1424
+ - `27`: 移除入库
1425
+ - `28`: 采购质检
1426
+ - `29`: 委外质检
1427
+ - `71`: 采购上架
1428
+ - `72`: 委外上架
1429
+ - `42`: 其他出库
1430
+ - `41`: 调拨出库
1431
+ - `32`: 委外出库
1432
+ - `33`: 盘亏出库
1433
+ - `34`: 换标出库
1434
+ - `35`: 加工出库
1435
+ - `36`: 拆分出库
1436
+ - `37`: FBA出库
1437
+ - `38`: FBM出库
1438
+ - `39`: 退货出库
1439
+ - `65`: WFS出库
1440
+ - `100`: 锁定流水
1441
+ - `51`: 销毁出库
1442
+
1443
+ :param transaction_sub_types `<'int/list[int]/None'>`: 操作子类型ID或ID列表, 默认 `None` (不筛选), 可选值:
1444
+
1445
+ - `1901`: 其他入库 手工其他入库
1446
+ - `1902`: 其他入库 用户初始化
1447
+ - `1903`: 其他入库 系统初始化
1448
+ - `2201`: 采购入库 手工采购入库
1449
+ - `2202`: 采购入库 采购单创建入库单
1450
+ - `2801`: 采购质检 质检
1451
+ - `7101`: 采购上架 PDA上架入库
1452
+ - `7201`: 委外上架 PDA委外上架
1453
+ - `2401`: 调拨入库 调拨单入在途
1454
+ - `2402`: 调拨入库 调拨单收货
1455
+ - `2403`: 调拨入库 备货单入在途
1456
+ - `2404`: 调拨入库 备货单收货
1457
+ - `2405`: 调拨入库 备货单入库结束到货
1458
+ - `2301`: 委外入库 委外订单完成加工后入库
1459
+ - `2901`: 委外质检 委外订单质检
1460
+ - `2501`: 盘盈入库 盘点单入库
1461
+ - `2502`: 盘盈入库 数量调整单正向
1462
+ - `1501`: FBM退货 退货入库
1463
+ - `1502`: FBM退货 退货入库质检
1464
+ - `1601`: 换标入库 换标调整入库
1465
+ - `1701`: 加工入库 加工单入库
1466
+ - `1702`: 加工入库 委外订单加工入库
1467
+ - `1801`: 拆分入库 拆分单入库
1468
+ - `2601`: 自动退货入库
1469
+ - `2602`: 手动退货入库
1470
+ - `2701`: 移除入库
1471
+ - `4201`: 其他出库 手工其他出库
1472
+ - `4101`: 调拨出库 调拨单出库
1473
+ - `4102`: 调拨出库 备货单出库
1474
+ - `3201`: 委外出库 委外订单完成加工后出库
1475
+ - `3301`: 盘亏出库 盘点单出库
1476
+ - `3302`: 盘亏出库 数量调整单负向
1477
+ - `3401`: 换标出库 换标调整出库
1478
+ - `3501`: 加工出库 加工单出库
1479
+ - `3502`: 加工出库 委外订单加工出库
1480
+ - `3601`: 拆分出库 拆分单出库
1481
+ - `3701`: FBA出库 发货单出库
1482
+ - `3702`: FBA出库 手工FBA出库
1483
+ - `3801`: FBM出库 销售出库单
1484
+ - `3901`: 退货出库 手工退货出库
1485
+ - `3902`: 退货出库 采购单生成的退货出库单
1486
+ - `10001`: 库存锁定-出库
1487
+ - `10002`: 库存锁定-调拨
1488
+ - `10003`: 库存锁定-调整
1489
+ - `10004`: 库存锁定-加工
1490
+ - `10005`: 库存锁定-加工计划
1491
+ - `10006`: 库存锁定-拆分
1492
+ - `10007`: 库存锁定-海外备货
1493
+ - `10008`: 库存锁定-发货
1494
+ - `10009`: 库存锁定-自发货
1495
+ - `10010`: 库存锁定-主动释放
1496
+ - `10012`: 库存锁定-发货拣货
1497
+ - `10013`: 库存锁定-发货计划
1498
+ - `10014`: 库存锁定-WFS库存调整
1499
+ - `10011`: 仓位转移和一键上架
1500
+
1501
+ :param start_date `<'str/date/datetime/None'>`: 操作开始日期, 默认 `None` (不筛选)
1502
+ :param end_date `<'str/date/datetime/None'>`: 操作结束日期, 默认 `None` (不筛选)
1503
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
1504
+ :param length `<'int/None'>`: 分页长度, 最大值400, 默认 `None` (使用: 20)
1505
+ :returns `<'SellerInventoryOperations'>`: 返回查询到的卖家仓库出入库操作流水数据
1506
+ ```python
1507
+ {
1508
+ # 状态码
1509
+ "code": 0,
1510
+ # 提示信息
1511
+ "message": "success",
1512
+ # 错误信息
1513
+ "errors": [],
1514
+ # 请求ID
1515
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
1516
+ # 响应时间
1517
+ "response_time": "2025-08-13 19:23:04",
1518
+ # 响应数据量
1519
+ "response_count": 2,
1520
+ # 总数据量
1521
+ "total_count": 2,
1522
+ # 响应数据
1523
+ "data": [
1524
+ {
1525
+ # 仓库ID [原字段 'wid']
1526
+ "warehouse_id": 1****,
1527
+ # 仓库名称 [原字段 'wh_name']
1528
+ "warehouse_name": "DE Warehouse",
1529
+ # 出入库单号 [原字段 'order_sn']
1530
+ "transaction_number": "WO103***************",
1531
+ # 关联出入库单号 [原字段 'ref_order_sn']
1532
+ "ref_transaction_number": "",
1533
+ # 操作ID [原字段 'statement_id']
1534
+ "transaction_id": "4016**************",
1535
+ # 操作类型 [原字段 'type']
1536
+ "transaction_type": 100,
1537
+ # 操作类型描述 [原字段 'type_text']
1538
+ "transaction_type_desc": "库存调整",
1539
+ # 出入库子类型 [原字段 'sub_type']
1540
+ "transaction_sub_type": "10009",
1541
+ # 出入库子类型描述 [原字段 'sub_type_text']
1542
+ "transaction_sub_type_desc": "库存调整-自发货【配货锁库存】",
1543
+ # 操作备注
1544
+ "transaction_note": "自发货配货锁定",
1545
+ # 操作时间 (北京时间) [原字段 'opt_time']
1546
+ "transaction_time": "2025-08-04 17:26",
1547
+ # 操作人ID [原字段 'opt_uid']
1548
+ "operator_id": 10******,
1549
+ # 操作人名称 [原字段 'opt_real_name']
1550
+ "operator_name": "白小白",
1551
+ # 领星店铺ID [原字段 'seller_id']
1552
+ "sid": 0,
1553
+ # 领星本地商品SKU [原字段 'sku']
1554
+ "lsku": "LOCAL********",
1555
+ # 亚马逊FNSKU
1556
+ "fnsku": "",
1557
+ # 领星商品ID
1558
+ "product_id": 23****,
1559
+ # 领星商品名称
1560
+ "product_name": "P********",
1561
+ # 品牌ID [原字段 'bid']
1562
+ "brand_id": 0,
1563
+ # 品牌名称
1564
+ "brand_name": "",
1565
+ # 操作流水总数 [原字段 'product_total']
1566
+ "total_qty": 0,
1567
+ # 在途流水可售数量 [原字段 'good_transit_num']
1568
+ "transit_fulfillable_qty": 0,
1569
+ # 在途流水可售结存数量 [原字段 'good_transit_balance_num']
1570
+ "transit_fulfillable_balance_qty": 0,
1571
+ # 在途流水不可售数量 [原字段 'bad_transit_num']
1572
+ "transit_unsellable_qty": 0,
1573
+ # 在途流水不可售结存数量 [原字段 'bad_transit_balance_num']
1574
+ "transit_unsellable_balance_qty": 0,
1575
+ # 操作流水可售数量 [原字段 'product_good_num']
1576
+ "fulfillable_qty": -1,
1577
+ # 操作流水可售结存数量 [原字段 'good_balance_num']
1578
+ "fulfillable_balance_qty": 149,
1579
+ # 操作流水可售预留数量 [原字段 'product_lock_good_num']
1580
+ "fulfillable_reserved_qty": 1,
1581
+ # 操作流水可售预留结存数量 [原字段 'good_lock_balance_num']
1582
+ "fulfillable_reserved_balance_qty": 3,
1583
+ # 操作流水不可售数量 [原字段 'product_bad_num']
1584
+ "unsellable_qty": 0,
1585
+ # 操作流水不可售结存数量 [原字段 'bad_balance_num']
1586
+ "unsellable_balance_qty": 0,
1587
+ # 操作流水不可售预留数量 [原字段 'product_lock_bad_num']
1588
+ "unsellable_reserved_qty": 0,
1589
+ # 操作流水不可售预留结存数量 [原字段 'bad_lock_balance_num']
1590
+ "unsellable_reserved_balance_qty": 0,
1591
+ # 操作流水待质检数量 [原字段 'product_qc_num']
1592
+ "pending_qc_qty": 0,
1593
+ # 操作流水质检结存数量 [原字段 'qc_balance_num']
1594
+ "qc_balance_qty": 0,
1595
+ # 操作流水单位采购价格 [原字段 'single_cg_price']
1596
+ "item_purchase_price": 0.0,
1597
+ # 操作流水货物成本 [原字段 'stock_cost']
1598
+ "cost_amt": 0.0,
1599
+ # 操作流水单位货物成本 [原字段 'single_stock_price']
1600
+ "item_cost_amt": 0.0,
1601
+ # 操作流水头程费用 [原字段 'head_stock_cost']
1602
+ "first_leg_fee": 0.0,
1603
+ # 操作流水单位头程费用 [原字段 'head_stock_price']
1604
+ "item_first_leg_fee": 0.0,
1605
+ # 操作流水出入库费用 [原字段 'fee_cost']
1606
+ "transaction_fee": 0.0,
1607
+ # 操作流水单位出入库费用 [原字段 'single_fee_cost']
1608
+ "item_transaction_fee": 0.0,
1609
+ # 操作流水总货值 [原字段 'product_amounts']
1610
+ "value_amt": 0.0,
1611
+ },
1612
+ ...
1613
+ ],
1614
+ }
1615
+ ```
1616
+ """
1617
+ url = route.SELLER_INVENTORY_OPERATIONS
1618
+ # 解析并验证参数
1619
+ args = {
1620
+ "warehouse_ids": warehouse_ids,
1621
+ "transaction_types": transaction_types,
1622
+ "transaction_sub_types": transaction_sub_types,
1623
+ "start_date": start_date,
1624
+ "end_date": end_date,
1625
+ "offset": offset,
1626
+ "length": length,
1627
+ }
1628
+ try:
1629
+ p = param.SellerInventoryOperations.model_validate(args)
1630
+ except Exception as err:
1631
+ raise errors.InvalidParametersError(err, url, args) from err
1632
+
1633
+ # 发送请求
1634
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
1635
+ return schema.SellerInventoryOperations.model_validate(data)
1636
+
1637
+ async def SellerInventoryBinRecords(
1638
+ self,
1639
+ *,
1640
+ warehouse_ids: int | list[int] | None = None,
1641
+ transaction_types: int | list[int] | None = None,
1642
+ bin_types: int | list[int] | None = None,
1643
+ start_date: str | datetime.date | datetime.datetime | None = None,
1644
+ end_date: str | datetime.date | datetime.datetime | None = None,
1645
+ offset: int | None = None,
1646
+ length: int | None = None,
1647
+ ) -> schema.SellerInventoryBinRecords:
1648
+ """查询卖家(本地/海外)仓库货架(仓位)出入流水
1649
+
1650
+ ## Docs
1651
+ - 仓库 - 库存&流水: [查询仓位流水](https://apidoc.lingxing.com/#/docs/Warehouse/wareHouseBinStatement)
1652
+
1653
+ :param warehouse_ids `<'int/list[int]/None'>`: 仓库ID或ID列表, 默认 `None` (不筛选)
1654
+ :param transaction_types `<'int/list[int]/None'>`: 出入库类型ID或ID列表, 默认 `None` (不筛选), 可选值:
1655
+
1656
+ - `16`: 换标入库
1657
+ - `17`: 加工入库
1658
+ - `18`: 拆分入库
1659
+ - `19`: 其他入库
1660
+ - `22`: 采购入库
1661
+ - `23`: 委外入库
1662
+ - `24`: 调拨入库
1663
+ - `25`: 盘盈入库
1664
+ - `26`: 退货入库
1665
+ - `27`: 移除入库
1666
+ - `28`: 采购质检
1667
+ - `29`: 委外质检
1668
+ - `32`: 委外出库
1669
+ - `33`: 盘亏出库
1670
+ - `34`: 换标出库
1671
+ - `35`: 加工出库
1672
+ - `36`: 拆分出库
1673
+ - `37`: FBA出库
1674
+ - `38`: FBM出库
1675
+ - `39`: 退货出库
1676
+ - `41`: 调拨出库
1677
+ - `42`: 其他出库
1678
+ - `65`: WFS出库
1679
+ - `71`: 采购上架
1680
+ - `72`: 委外上架
1681
+ - `100`: 库存调整
1682
+ - `200`: 成本补录
1683
+ - `30001`: 已撤销
1684
+
1685
+ :param bin_types `<'int/list[int]/None'>`: 货架(仓位)类型或列表, 默认 `None` (不筛选), 可选值:
1686
+
1687
+ - `1`: 待检暂存
1688
+ - `2`: 可用暂存
1689
+ - `3`: 次品暂存
1690
+ - `4`: 拣货暂存
1691
+ - `5`: 可用
1692
+ - `6`: 次品
1693
+
1694
+ :param start_date `<'str/date/datetime/None'>`: 操作开始日期, 默认 `None` (不筛选)
1695
+ :param end_date `<'str/date/datetime/None'>`: 操作结束日期, 默认 `None` (不筛选)
1696
+ :param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
1697
+ :param length `<'int/None'>`: 分页长度, 最大值400, 默认 `None` (使用: 20)
1698
+ :returns `<'SellerInventoryBinRecords'>`: 返回查询到的卖家仓库货架(仓位)出入流水数据
1699
+ ```python
1700
+ {
1701
+ # 状态码
1702
+ "code": 0,
1703
+ # 提示信息
1704
+ "message": "success",
1705
+ # 错误信息
1706
+ "errors": [],
1707
+ # 请求ID
1708
+ "request_id": "44DAC5AE-7D76-9054-2431-0EF7E357CFE5",
1709
+ # 响应时间
1710
+ "response_time": "2025-08-13 19:23:04",
1711
+ # 响应数据量
1712
+ "response_count": 2,
1713
+ # 总数据量
1714
+ "total_count": 2,
1715
+ # 响应数据
1716
+ "data": [
1717
+ {
1718
+ # 仓库ID [原字段 'wid']
1719
+ "warehouse_id": 1****,
1720
+ # 仓库名称 [原字段 'wh_name']
1721
+ "warehouse_name": "默认仓库",
1722
+ # 仓库货架ID [原字段 'whb_id']
1723
+ "bin_id": 3****,
1724
+ # 仓库货架名称 [原字段 'whb_name']
1725
+ "bin_name": "可用暂存",
1726
+ # 仓库货架类型描述 [原字段 'whb_type_name']
1727
+ "bin_type_desc": "可用暂存",
1728
+ # 出入库单号 [原字段 'order_sn']
1729
+ "transaction_number": "QC2********",
1730
+ # 出入库类型 [原字段 'type']
1731
+ "transaction_type": 28,
1732
+ # 出入库类型描述 [原字段 'type_text']
1733
+ "transaction_type_desc": "采购质检",
1734
+ # 出入库备注
1735
+ "transaction_note": "采购单号:PO241029001;收货单号:CR241112001",
1736
+ # 出入库时间 (北京时间) [原字段 'opt_time']
1737
+ "transaction_time": "2024-11-12 14:06",
1738
+ # 出入库数量 [原字段 'num']
1739
+ "transaction_qty": 300,
1740
+ # 操作人ID [原字段 'opt_uid']
1741
+ "operator_id": 10******,
1742
+ # 操作人名称 [原字段 'opt_realname']
1743
+ "operator_name": "白小白",
1744
+ # 领星店铺ID [原字段 'seller_id']
1745
+ "sid": 1,
1746
+ # 领星本地商品SKU [原字段 'sku']
1747
+ "lsku": "LOCAL********",
1748
+ # 亚马逊FNSKU
1749
+ "fnsku": "X00*******",
1750
+ # 领星商品ID
1751
+ "product_id": 2*****,
1752
+ # 领星商品名称
1753
+ "product_name": "P********",
1754
+ },
1755
+ ...
1756
+ ],
1757
+ }
1758
+ ```
1759
+ """
1760
+ url = route.SELLER_INVENTORY_BIN_RECORDS
1761
+ # 解析并验证参数
1762
+ args = {
1763
+ "warehouse_ids": warehouse_ids,
1764
+ "transaction_types": transaction_types,
1765
+ "bin_types": bin_types,
1766
+ "start_date": start_date,
1767
+ "end_date": end_date,
1768
+ "offset": offset,
1769
+ "length": length,
1770
+ }
1771
+ try:
1772
+ p = param.SellerInventoryBinRecords.model_validate(args)
1773
+ except Exception as err:
1774
+ raise errors.InvalidParametersError(err, url, args) from err
1775
+
1776
+ # 发送请求
1777
+ data = await self._request_with_sign("POST", url, body=p.model_dump_params())
1778
+ return schema.SellerInventoryBinRecords.model_validate(data)