跳到主要内容

Wms API接口

可以基于该接口访问 智慧物流系统 WMS 模块中的库存、库位与仓库任务数据。库存、库位、仓库任务提供分页列表(PageList)查询,仓库任务另外提供创建与取消接口。

基础信息

Base URL: http://logimaster-api-base-url:port/api/wms

通用约定

分页参数

三个接口均支持标准分页参数:

参数类型说明
SkipCountint跳过的记录数,默认 0
MaxResultCountint每页返回的最大记录数,默认 10
Sortingstring排序字段,如 creationTime desc

分页响应格式

所有列表接口统一返回如下结构:

{
"totalCount": 100,
"items": [ ]
}

API 端点

1. 获取库存列表

GET /stocks

分页查询库存记录。

查询参数

参数类型说明
MaterialCodestring物料编码
ContainerCodestring容器编码
StorageBinCodestring库位编码
StorageBinNamestring库位名称
Codestring库存编码
Batchstring批次
Filterstring关键字过滤
Statusesarray库存状态(可多选),见下方枚举
IsLockedboolean是否被锁定
HasStorageBinboolean是否已绑定库位

StockStatus 枚举

名称说明
0WaitingForInspection等待质检
1Normal正常库存
2Blocked冻结库存

响应

  • 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

分页查询库位信息。

查询参数

参数类型说明
Codestring库位编码
Namestring库位名称
ZoneIdGuid库区 Id
ZoneCodestring库区编码
RackingIdGuid货架 Id
Filterstring关键字过滤

响应

  • 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

分页查询仓库任务(入库、拣选、移库等)。

查询参数

参数类型说明
IdGuid任务 Id
Sourcestring源库位(编码/名称)
Destinationstring目标库位(编码/名称)
Statesarray任务状态(可多选),见下方枚举
TaskTypesarray任务类型(可多选),见下方枚举
CreatorNamestring创建人
RobotNamestring执行机器人名称
StockBatchstring库存批次
MaterialCodestring物料编码
ContainerCodestring容器编码
StartTimeDateTime创建时间起
EndTimeDateTime创建时间止

WarehouseTaskStatus 枚举

名称说明
0New新建
1Executing执行中
2Completed已完成
3Canceled已取消

WarehouseTaskGuideType 枚举

名称说明
0Inbound入库
1Outbound拣选(出库)
2Movement移库

响应

  • 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)策略自动决定。

请求体

字段类型说明
taskGuideTypeint任务类型,见 WarehouseTaskGuideType 枚举(0 入库 / 1 拣选 / 2 移库)
warehouseIdGuid所属仓库 Id(用于过滤任务指引)
containerIdGuid容器 Id
containerCodestring容器编码
containerTypeNamestring容器类型名称
stockIdsGuid[]库存 Id 列表
materialCodestring物料编码
quantityint物料需求个数
sourceStorageBinIdGuid起点库位 Id
sourceStorageBinCodestring起点库位编码
sourcePositionNamestring起点站点名称(RCS 站点)
destinationStorageBinIdGuid终点库位 Id
destinationStorageBinCodestring终点库位编码
destinationPositionNamestring终点站点名称(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: 服务器内部错误