增加类型检查,且允许混合上传

This commit is contained in:
Yu Sun
2022-07-11 23:58:53 +08:00
parent 70d1e43c76
commit 5fdfc04349
4 changed files with 244 additions and 117 deletions

View File

@@ -18,18 +18,17 @@
**请求**
> 需保证每次传入数据的**工序单元working subclass和数值类型type** 一致
>
> 在此基础上尽量单次传入尽量多数据使得性能最大化。
> 上位机程序中请单次传入尽量多的数据使得性能最大化
>
> 但仍需兼顾传输速率和超时时间。
>
> 无需指定数值类型,服务端会自动根据已添加的节点信息检查,若不符则会报错。
```json
{
"action": "set_node_data",
"param": {
"working_subclass": <string>,
"type": "string" | "int" | "float" | "bool",
"data": [
{
"code": <string>,
@@ -56,17 +55,37 @@
```json
{
"action": "result_set_data",
"action": "result_set_node_data",
"errcode": 0,
"errmsg": ""
}
```
操作失败:
操作失败**工序单元尚未登记**
```json
{
"action": "result_set_data",
"action": "result_set_node_data",
"errcode": 4002,
"errmsg": "未登记过的工序单元!"
}
```
操作失败(**数值类型错误**
```json
{
"action": "result_set_node_data",
"errcode": 4002,
"errmsg": "节点编码和数值类型不匹配!"
}
```
操作失败(不明原因):
```json
{
"action": "result_set_node_data",
"errcode": 4002,
"errmsg": "ROLLBACKed: Bad data received (structure and/or values)"
}
@@ -115,7 +134,7 @@ yarn serve
客户端连接:
```bash
sudo apt install postgresql-client
# sudo apt install postgresql-client
# 登入
psql -h localhost -U postgres
# 显示数据库列表