Wms API接口
可以基于该接口访问 智慧物流系统 WMS 模块中的库存、库位与仓库任务数据。库存、库位、仓库任务提供分页列表(PageList)查询,仓库任务另外提供创建与取消接口。
基础信息
Base URL: http://logimaster-api-base-url:port/api/wms
通用约定
分页参数
三个接口均支持标准分页参数:
| 参数 | 类型 | 说明 |
|---|---|---|
SkipCount | int | 跳过的记录数,默认 0 |
MaxResultCount | int | 每页返回的最大记录数,默认 10 |
Sorting | string | 排序字段,如 creationTime desc |
分页响应格式
所有列表接口统一返回如下结构:
{
"totalCount": 100,
"items": [ ]
}
API 端点
1. 获取库存列表
GET /stocks
分页查询库存记录。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
MaterialCode | string | 物料编码 |
ContainerCode | string | 容器编码 |
StorageBinCode | string | 库位编码 |
StorageBinName | string | 库位名称 |
Code | string | 库存编码 |
Batch | string | 批次 |
Filter | string | 关键字过滤 |
Statuses | array | 库存状态(可多选),见下方枚举 |
IsLocked | boolean | 是否被锁定 |
HasStorageBin | boolean | 是否已绑定库位 |
StockStatus 枚举
| 值 | 名称 | 说明 |
|---|---|---|
| 0 | WaitingForInspection | 等待质检 |
| 1 | Normal | 正常库存 |
| 2 | Blocked | 冻结库存 |
响应
-
200 OK: 返回库存分页列表
{"totalCount": 1,"items": [{"id": "123e4567-e89b-12d3-a456-426614174000","code": "S20260828001","batch": "B20260828","status": 1,"blockReason": null,"quantity": 100,"availableQuantity": 80,"weight": 25.5,"receivingTime": "2026-08-28T08:30:00Z","lastMovementTime": "2026-08-28T10:30:00Z","materialId": "223e4567-e89b-12d3-a456-426614174000","materialCode": "M0001","materialDescription": "白色纱锭","containerId": "323e4567-e89b-12d3-a456-426614174000","containerCode": "C0001","storageBinId": "423e4567-e89b-12d3-a456-426614174000","storageBinCode": "A-01-01","storageBinName": "A区1排1列","resourceLocks": [],"creationTime": "2026-08-28T08:30:00Z"}]}
示例
GET /api/wms/stocks?MaterialCode=M0001&Statuses=1&SkipCount=0&MaxResultCount=10
2. 获取库位列表
GET /storage-bins
分页查询库位信息。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
Code | string | 库位编码 |
Name | string | 库位名称 |
ZoneId | Guid | 库区 Id |
ZoneCode | string | 库区编码 |
RackingId | Guid | 货架 Id |
Filter | string | 关键字过滤 |
响应
-
200 OK: 返回库位分页列表
{"totalCount": 1,"items": [{"id": "423e4567-e89b-12d3-a456-426614174000","code": "A-01-01","name": "A区1排1列","zoneId": "523e4567-e89b-12d3-a456-426614174000","zoneName": "A区","isActive": true,"maxWeight": 1000,"maxVolume": 2.5,"totalCapacity": 1,"row": 1,"column": 1,"level": 1,"depth": 1,"x": 12.5,"y": 8.2,"z": 0,"positionName": "LM-A-01-01","rackingId": "623e4567-e89b-12d3-a456-426614174000","creationTime": "2026-08-28T08:30:00Z"}]}
示例
GET /api/wms/storage-bins?ZoneCode=A&SkipCount=0&MaxResultCount=10
3. 获取仓库任务列表
GET /warehouse-tasks
分页查询仓库任务(入库、拣选、移库等)。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
Id | Guid | 任务 Id |
Source | string | 源库位(编码/名称) |
Destination | string | 目标库位(编码/名称) |
States | array | 任务状态(可多选),见下方枚举 |
TaskTypes | array | 任务类型(可多选),见下方枚举 |
CreatorName | string | 创建人 |
RobotName | string | 执行机器人名称 |
StockBatch | string | 库存批次 |
MaterialCode | string | 物料编码 |
ContainerCode | string | 容器编码 |
StartTime | DateTime | 创建时间起 |
EndTime | DateTime | 创建时间止 |
WarehouseTaskStatus 枚举
| 值 | 名称 | 说明 |
|---|---|---|
| 0 | New | 新建 |
| 1 | Executing | 执行中 |
| 2 | Completed | 已完成 |
| 3 | Canceled | 已取消 |
WarehouseTaskGuideType 枚举
| 值 | 名称 | 说明 |
|---|---|---|
| 0 | Inbound | 入库 |
| 1 | Outbound | 拣选(出库) |
| 2 | Movement | 移库 |
响应
-
200 OK: 返回仓库任务分页列表
{"totalCount": 1,"items": [{"id": "723e4567-e89b-12d3-a456-426614174000","taskType": 0,"sourceStorageBinCode": "IN-01","sourceStorageBinName": "入库接驳位","sourcePositionName": "LM-IN-01","destinationStorageBinCode": "A-01-01","destinationStorageBinName": "A区1排1列","destinationPositionName": "LM-A-01-01","stockBatch": "B20260828","quantity": 100,"materialCode": "M0001","containerCode": "C0001","status": "Executing","robotName": "AGV-01","creatorName": "admin","executingTime": "2026-08-28T10:31:00Z","completedTime": null,"items": [],"creationTime": "2026-08-28T10:30:00Z"}]}
示例
GET /api/wms/warehouse-tasks?States=0&States=1&TaskTypes=0&SkipCount=0&MaxResultCount=10
4. 创建仓库任务
POST /warehouse-tasks
创建一个仓库任务(入库、拣选、移库)。起点/终点可通过库位 Id、库位编码或 RCS 站点名称三种方式之一指定;未指定的一端由任务指引(Warehouse Task Guide)策略自动决定。
请求体
| 字段 | 类型 | 说明 |
|---|---|---|
taskGuideType | int | 任务类型,见 WarehouseTaskGuideType 枚举(0 入库 / 1 拣选 / 2 移库) |
warehouseId | Guid | 所属仓库 Id(用于过滤任务指引) |
containerId | Guid | 容器 Id |
containerCode | string | 容器编码 |
containerTypeName | string | 容器类型名称 |
stockIds | Guid[] | 库存 Id 列表 |
materialCode | string | 物料编码 |
quantity | int | 物料需求个数 |
sourceStorageBinId | Guid | 起点库位 Id |
sourceStorageBinCode | string | 起点库位编码 |
sourcePositionName | string | 起点站点名称(RCS 站点) |
destinationStorageBinId | Guid | 终点库位 Id |
destinationStorageBinCode | string | 终点库位编码 |
destinationPositionName | string | 终点站点名称(RCS 站点) |
响应
- 200 OK: 返回创建成功的任务(
WarehouseTaskDto,结构同列表接口的items元素)
示例
入库:指定容器与终点库位,起点由指引决定:
POST /api/wms/warehouse-tasks
Content-Type: application/json
{
"taskGuideType": 0,
"containerCode": "C0001",
"sourcePositionName": "LM-IN-01"
}
移库:从 A 库位搬到 B 库位:
POST /api/wms/warehouse-tasks
Content-Type: application/json
{
"taskGuideType": 2,
"sourceStorageBinCode": "A-01-01",
"destinationStorageBinCode": "B-02-03"
}
5. 取消仓库任务
POST /warehouse-tasks/{id}/cancel
取消指定的仓库任务,任务状态变为 Canceled。
参数
id(路径参数): 任务 Id,类型为 Guid
响应
- 200 OK: 取消成功
示例
POST /api/wms/warehouse-tasks/723e4567-e89b-12d3-a456-426614174000/cancel
错误响应
所有API在出错时(http状态码为500)会返回标准错误格式:
{
"error": {
"code": "错误代码",
"message": "错误描述",
"details": "详细错误信息"
}
}
常见错误状态码:
- 400 Bad Request: 请求参数错误
- 404 Not Found: 资源不存在
- 500 Internal Server Error: 服务器内部错误