库存模型是对企业仓库信息的描述,一个仓库可能包含多个库区,一个库区可能包含多个库位。

库存模型与工厂模型的关系如下图:

库存地点和工厂模型关系图

如果第三方应用业务需要用到库存地点,可以通过API查询库存地点或者采用订阅方式获得库存地点变更通知。

发布库存地点

提供给三方应用通过API发布库存地点,包括仓库、库区和库位。

仓库

参看API详细描述

支持带属性的批量创建

{
  "warehouses": [
    {
      "code": "warehouse",
      "name": "仓库",
      "description": "仓库描述",
      "factoryCode": "factoryCode", // 如果仓库有关联工厂,这个字段填入工厂编码
      "attributes": [
        {
          "name": "仓库属性",
          "enName": "attribute",
          "value": "value"
        }
      ]
    }
  ]
}
返回id/code的映射
{
  "code": 200,
  "data": [
    {
      "id": 158,
      "code": "warehouse"
    }
  ]
}

库区

参看API详细描述

支持带属性的批量创建

{
  "warehouseAreas": [
    {
      "code": "warehouseArea",
      "name": "库区",
      "description": "库区描述",
      "parentCode": "warehouse",
      "workshopCode": "workshopCode", // 如果库区有关联车间,这个字段填入车间编码
      "attributes": [
        {
          "name": "库区属性",
          "enName": "attribute",
          "value": "value"
        }
      ]
    }
  ]
}
返回id/code的映射
{
  "code": 200,
  "data": [
    {
      "id": 169,
      "code": "warehouseArea"
    }
  ]
}

库位

参看API详细描述

支持带属性的批量创建

{
  "locations": [
    {
      "code": "location",
      "name": "库位",
      "description": "库位描述",
      "parentCode": "location",
      "beltlineCode": "beltlineCode", // 如果库位有关联产线,这个字段填入产线编码
      "attributes": [
        {
          "name": "库位属性",
          "enName": "attribute",
          "value": "value"
        }
      ]
    }
  ]
}
返回id/code的映射
{
  "code": 200,
  "data": [
    {
      "id": 160,
      "code": "location"
    }
  ]
}

查询库存模型数据

参看API详细描述

查询仓库树的数据格式如下

{
  "code": 200,
  "data": {
    "warehouses": [
      {
        "id": 158,
        "code": "warehouse",
        "name": "仓库",
        "warehouseAreas": [
          {
            "id": 169,
            "code": "warehouseArea",
            "name": "库区",
            "locations": [
              {
                "code": "location",
                "name": "库位",
                "id": 160
              }
            ]
          }
        ]
      }
    ]
  },
  "id": "8c9063a638044f92a0657bccaf476fea"
}

仓库、库区、库位每一级的模型都可以用单独的api查询,可以指定code查询指定的模型或者不指定查询模型列表。

仓库

参看API详细描述

{
  "code": 200,
  "data": {
    "warehouses": [
      {
        "code": "warehouse",
        "name": "仓库",
        "attributes": [
          {
            "name": "仓库属性",
            "enName": "attribute",
            "value": "value"
          }
        ],
        "id": 158
      }
    ]
  },
  "id": "559b2848e20f49328205c9bdfd49f4c1"
}

库区

参看API详细描述

{
  "code": 200,
  "data": {
    "warehouseAreas": [
      {
        "code": "warehouseArea",
        "parentCode": "warehouse",
        "name": "库区",
        "attributes": [
          {
            "enName": "attribute",
            "name": "库区属性",
            "value": "value"
          }
        ],
        "id": 169
      }
    ]
  },
  "id": "5640c14ff94346c9919d46b559992dee"
}

库位

参看API详细描述

{
  "code": 200,
  "data": {
    "locations": [
      {
        "code": "location",
        "name": "库位",
        "attributes": [
          {
            "enName": "attribute",
            "name": "库位属性",
            "value": "value"
          }
        ],
        "id": 160
      }
    ]
  },
  "id": "fbb6f62647164488bc8f5788c5b4539c"
}

消息通知

消息格式

{
  "serviceType": 8,
  "action":"PUBLISH",
  "warehouses": [
    {
      "code": "testWarehouse2",
      "name": "测试仓库2",
      "id": 163
    }
  ],
  "warehouseAreas": [
    {
      "parentName": "测试仓库2",
      "code": "testReservoir",
      "parentCode": "testWarehouse2",
      "name": "测试库区",
      "id": 174
    }
  ],
  "locations": [
    {
      "parentName": "测试库区",
      "code": "testLocation",
      "parentCode": "testReservoir",
      "name": "测试库位",
      "id": 164
    }
  ]
}