# wande-doc **Repository Path**: jeffxiao/wande-doc ## Basic Information - **Project Name**: wande-doc - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-10-16 - **Last Updated**: 2021-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 说明: 1. 请求API中的domain-url应该配置为实际的服务器地址 2. 返回的数据中若没有明确指明,数据类型为数字或字符串 3. 请求API地址中,若包含有汉字或其他特殊字符,请使用encodeURIComponent编码 4. 服务端采用Bearer Token验证模式,所以所有请求的请求头中都需要附带登录后获取的访问令牌(accessToken),请求头格式如下: ``` headers: { "Authorization": "Bearer 1234567890123456789abcd" } ``` - 其中Bearer为固定字符串,Bearer后紧接一个空格然后紧接访问令牌 5. 通用请求数据返回格式: ``` { "code": 200, "message":"消息内容", "data": array|object|any others } ``` - code:请求结果状态,200标识请求成功,非200标识请求失败 - message:请求结果消息,如果code为200,可能没有message,如果非200,会附带message返回 - data:实际返回数据,具体参考后续接口的返回数据结构 **0. 用户登录** 请求API:POST http://domain-url/login 请求Body: ``` // 可视化系统用户名密码登录 { "type": "visual", "username": "admin", "password": "admin" } ``` 返回数据结构: ``` { "accessToken": "1234567890123456789abcd", "avatar": "http://domain-url/file/download/avatar/avatar.png", "id": 1, "nickname": "管理员" } ``` **1. 库房列表** 请求API:GET http://domain-url/visual/store-room 返回结果:所有库房列表 返回数据结构: ``` [ { "id": 1, "code": "001", "name": "库房1", "memo": "库房1的备注", "thumb": "http://domain-url/file/download/images/thumb1.png", "model": "http://domain-url/file/download/images/model1.assetbundle" }, { "id": 2, "code": "002", "name": "库房2", "memo": "库房2的备注", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle" } ] ``` 字段说明: - memo:备注 - thumb:缩略图 - model:模型 **2. 库房详情** 请求API:GET http://domain-url/visual/store-room/{id} 参数: - id:库房id 返回结果:指定库房的详细信息 返回数据结构: ``` { "id": 2, "code": "002", "name": "库房2", "memo": "库房2的备注", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "total": 100, "idle": 30, "zones: [ { "id": 1, "code": "001", "name": "默认库区", "category": "备件分类1", "memo": "默认库区备注", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "total": 10, "idle": 6 }, { "id": 2, "code": "002", "name": "库区1", "category": "备件分类1", "memo": "默认库区备注", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "total": 20, "idle": 12 } ] } ``` 字段说明 - total:总货位数 - idle:空闲货位数 - zones:按库区分别统计货位数和空闲货位数 **3. 出入库信息** 请求API:POST http://domain-url/visual/store-room/{id}/history 参数: - id:库房id - 请求体(body) ``` 查询 start<=操作时间<=end的出入库信息 { "start": "2019-11-27T03:54:29.616Z", "end": "2019-11-27T03:54:29.616Z", } *其中日期格式为:YYYY-MM-DDThh:mm:ss.zzzZ 如果没有end值,查询结束时间为服务器当前时间 ``` 返回结果:返回指定库房的前n条出入库记录,时间倒序 返回数据结构: ``` [ { "id": 1, "name": "张三", "when": "2019-01-01 12:12:12", "operation": "备件入库", "action": "入库20件润滑油" }, { "id": 2, "name": "李四", "when": "2019-02-02 12:12:12", "operation": "备件出库", "action": "出库100个螺丝" } ] ``` **4. 库区详细** 请求API: GET http://domain-url/visual/store-zone/{id} 参数: - id:库区id 返回结果:指定库区详细信息,包括货架,货位,状态等 返回数据结构: ``` { "id": 1, "code": "001", "name": "默认库区", "category": "备件分类1", "memo": "默认库区备注", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "shelves": [ { "id": 1, "code": "001", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "levels": [ [ { "level": 1, "row": 1, "col": 1, "status": 0 }, { "level": 1, "row": 1, "col": 2, "status": 1 }, { "level": 1, "row": 1, "col": 3, "status": 2 } ], [ { "level": 2, "row": 1, "col": 1, "status": 0 }, { "level": 2, "row": 1, "col": 2, "status": 1 }, { "level": 2, "row": 1, "col": 3, "status": 2 } ] ] }, { "id": 2, "code": "002", "thumb": "http://domain-url/file/download/images/thumb2.png", "model": "http://domain-url/file/download/images/model2.assetbundle", "levels": [ [ { "level": 1, "row": 1, "col": 1, "status": 0 }, { "level": 1, "row": 1, "col": 2, "status": 1 }, { "level": 1, "row": 1, "col": 3, "status": 2 } ], [ { "level": 2, "row": 1, "col": 1, "status": 0 }, { "level": 2, "row": 1, "col": 2, "status": 1 }, { "level": 2, "row": 1, "col": 3, "status": 2 } ] ] } ] } ``` 字段说明: - category:库区绑定的备件分类 - memo:备注 - thumb:缩略图 - model:模型 - shelves:货架 - levels:货架所包含的层,该数据为数组的数组,数组第一个元素为第一层的货位数据,第二个元素为第二层的数据,以此类推;每个元素又是货位数据的数组,包含行号(目前默认为1),列号,以及状态(**状态有三个值,0:空闲,1:使用并且货物正常,2,使用并且获取即将过期或已经过期**) **5. 模糊查询货物位置(按照名称和型号规格group)** 请求API: POST http://domain-url/visual/accessory/search/ 请求体: ``` 数据查询的请求体为json格式,支持以下字段 { "key": "关键字", "roomId": "指定库房Id", "zoneId": "指定库区Id", "shelfId": "货架Id", "level": 1, "row": 1, "col": 1 } level为层值,row为行值,col为列值 以上7个字段为And关系,即任有值的字段才会参与查询,并且这些有值的字段以And的关系作为条件 示例: 条件1: { "key":"螺丝" } 查询所有备件名称中包含有”螺丝“的库存信息 示例2: { "roomId": 1, "zoneId": 1, "shelfId": 1, "level": 1, "row": 1, "col": 1 } 查询所有库房Id为1,并且库区Id为1,并且货架Id为1,并且1层,1行,1列的库存信息 ``` 返回结果:指定查询条件的库存信息 **模糊查询和指定货位的查询都可以使用这个接口** 返回数据结构: ``` [ { "categoryId": 1, "categoryName": "螺丝", "typeId": 1, "typeName": "螺丝1" "spec": "型号规格", "quantity": "10", "unit": "个", "thumb": "http://domain-url/file/download/images/thumb1.png", "model": "http://domain-url/file/download/images/model1.assetbundle" }, { "categoryId": 2, "categoryName": "阀门", "typeId": 1, "typeName": "阀门1" "spec": "型号规格", "quantity": "15", "unit": "台", "thumb": "http://domain-url/file/download/images/thumb1.png", "model": "http://domain-url/file/download/images/model1.assetbundle" } ] ``` 字段说明: - category:备件的分类 - spec:型号规格 - thumb:缩略图 - model:模型 **6. 货物库存详细信息** 请求API: GET http://domain-url/visual/accessory/detail/{name}/{spec} 注意:URL需要编码 参数:typeId:备件类型Id 返回结果:返回指定备件类型Id的备件库存的详细信息 返回数据结构: ``` { "id": 1, "category": "备件分类", "name": "备件名称1", "spec": "型号规格", "quantity": 30, "unit": "个", "thumb": "http://domain-url/file/download/images/thumb1.png", "model": "http://domain-url/file/download/images/model1.assetbundle", "locations": [ { "roomId": 1, "roomCode": "001", "roomName": "备件库房", "zoneId": 1, "zoneCode": "001", "zoneName": "默认库区", "shelfId": 1, "shelfCode": "001", "level": 1, "row": 1, "col": 4, "quantity": 15, "warranty": "2019-12-12", "vendor": "生产厂家", "batch": "批次" }, { "roomId": 1, "roomCode": "001", "roomName": "备件库房", "zoneId": 1, "zoneCode": "001", "zoneName": "默认库区", "shelfId": 1, "shelfCode": "001", "level": 1, "row": 1, "col": 5, "quantity": 15, "warranty": "2019-12-12", "vendor": "生产厂家", "batch": "批次" } ] } ``` 字段说明: - thumb:缩略图 - model:模型 - warranty:保质期 - roomId:库房Id - roomCode:库房编号 - roomName:库房名称 - zoneId:库区Id - zoneCode:库区编号 - zoneName:库区名称 - shelfId:货架Id - shelfCode:货架编号