@cpzxrobot/sdk 1.2.21 → 1.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/car_gateway.ts +13 -0
- package/dist/car_gateway.js +12 -0
- package/package.json +1 -1
- package/readme.md +42 -0
package/car_gateway.ts
CHANGED
|
@@ -57,4 +57,17 @@ export class CarGateway extends Object {
|
|
|
57
57
|
},
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
//POST /api/v2/car/record
|
|
62
|
+
// {
|
|
63
|
+
// "id":123,
|
|
64
|
+
// "manualLoadWeight":40000,
|
|
65
|
+
// "manualLoadWeightTime":"2025-05-08 05:10:49"
|
|
66
|
+
// "manualCarWeight":20000,
|
|
67
|
+
// "manualCarWeightTime":"2025-05-08 08:20:49"
|
|
68
|
+
// }
|
|
69
|
+
async updateRecord(factory: Factory, record: any) {
|
|
70
|
+
var axios = await this.context.ready;
|
|
71
|
+
return axios.post(`/api/v2/car/${factory.pid}/weightRecord`, record);
|
|
72
|
+
}
|
|
60
73
|
}
|
package/dist/car_gateway.js
CHANGED
|
@@ -50,5 +50,17 @@ class CarGateway extends Object {
|
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
//POST /api/v2/car/record
|
|
54
|
+
// {
|
|
55
|
+
// "id":123,
|
|
56
|
+
// "manualLoadWeight":40000,
|
|
57
|
+
// "manualLoadWeightTime":"2025-05-08 05:10:49"
|
|
58
|
+
// "manualCarWeight":20000,
|
|
59
|
+
// "manualCarWeightTime":"2025-05-08 08:20:49"
|
|
60
|
+
// }
|
|
61
|
+
async updateRecord(factory, record) {
|
|
62
|
+
var axios = await this.context.ready;
|
|
63
|
+
return axios.post(`/api/v2/car/${factory.pid}/weightRecord`, record);
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
exports.CarGateway = CarGateway;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -112,11 +112,44 @@ cpzxrobot().device.validate(serialNumbers)
|
|
|
112
112
|
cpzxrobot().device.thresholdConfig.list()
|
|
113
113
|
|
|
114
114
|
// 获取设备报警列表
|
|
115
|
+
cpzxrobot().device.alert(factoryId, type)
|
|
115
116
|
|
|
116
117
|
// 报告设备问题
|
|
117
118
|
cpzxrobot().device.report(deviceId, status, description)
|
|
118
119
|
```
|
|
119
120
|
|
|
121
|
+
### alert函数说明
|
|
122
|
+
|
|
123
|
+
获取工厂设备的告警列表
|
|
124
|
+
|
|
125
|
+
#### 参数
|
|
126
|
+
- `factoryId`: string - 工厂ID
|
|
127
|
+
- `type`?: string - (可选)告警类型
|
|
128
|
+
|
|
129
|
+
#### 返回值
|
|
130
|
+
Promise<DeviceFault[]> - 按时间排序的告警记录数组
|
|
131
|
+
|
|
132
|
+
#### 使用示例
|
|
133
|
+
```typescript
|
|
134
|
+
// 获取工厂123的所有告警
|
|
135
|
+
const alerts = await cpzxrobot().device.alert("123");
|
|
136
|
+
|
|
137
|
+
// 获取工厂123的温度相关告警
|
|
138
|
+
const tempAlerts = await cpzxrobot().device.alert("123", "temperature");
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### DeviceFault接口
|
|
142
|
+
```typescript
|
|
143
|
+
interface DeviceFault {
|
|
144
|
+
category: string; // 告警类别
|
|
145
|
+
time: Date; // 发生时间
|
|
146
|
+
resolved: boolean; // 是否已解决
|
|
147
|
+
repeated?: number; // 重复次数(可选)
|
|
148
|
+
value?: any; // 告警值(可选)
|
|
149
|
+
message?: string; // 告警消息(可选)
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
120
153
|
### report函数说明
|
|
121
154
|
|
|
122
155
|
报告设备问题状态
|
|
@@ -755,6 +788,15 @@ cpzxrobot().car.listByDistrict(district)
|
|
|
755
788
|
// 获取车辆运单
|
|
756
789
|
cpzxrobot().car.orders(factoryId)
|
|
757
790
|
cpzxrobot().car.ordersByFactory(factoryId)
|
|
791
|
+
|
|
792
|
+
// 更新车辆称重记录
|
|
793
|
+
cpzxrobot().car.updateRecord(factory: Factory, record: {
|
|
794
|
+
id: number, // 记录ID
|
|
795
|
+
manualLoadWeight: number, // 手动装载重量(kg)
|
|
796
|
+
manualLoadWeightTime: string, // 手动装载时间(格式: "YYYY-MM-DD HH:mm:ss")
|
|
797
|
+
manualCarWeight: number, // 手动车辆重量(kg)
|
|
798
|
+
manualCarWeightTime: string // 手动车辆称重时间(格式: "YYYY-MM-DD HH:mm:ss")
|
|
799
|
+
})
|
|
758
800
|
```
|
|
759
801
|
```
|
|
760
802
|
cpzxrobot({
|