@cpzxrobot/sdk 1.3.85 → 1.3.87
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/device_gateway.ts +27 -16
- package/dist/device_gateway.js +19 -11
- package/package.json +1 -1
package/device_gateway.ts
CHANGED
|
@@ -1021,10 +1021,10 @@ export class DeviceGateway extends Object {
|
|
|
1021
1021
|
* @returns Promise 包含设备报警统计列表分页数据
|
|
1022
1022
|
*/
|
|
1023
1023
|
async getAlarmStatistics(
|
|
1024
|
-
factoryId: number | undefined = undefined,
|
|
1025
1024
|
resolveType: number = 2,
|
|
1026
1025
|
pageNum: number = 1,
|
|
1027
|
-
pageSize: number = 10
|
|
1026
|
+
pageSize: number = 10,
|
|
1027
|
+
factoryId: number | undefined = undefined
|
|
1028
1028
|
): Promise<DeviceAlarmStatisticsResponse> {
|
|
1029
1029
|
const axios = await this.context.ready;
|
|
1030
1030
|
var _factoryId = factoryId || 0;
|
|
@@ -1094,10 +1094,10 @@ export class DeviceGateway extends Object {
|
|
|
1094
1094
|
* @returns Promise 包含报警分类统计数据
|
|
1095
1095
|
*/
|
|
1096
1096
|
async getAlarmStatisticsByType(
|
|
1097
|
-
factoryId: number | undefined = undefined,
|
|
1098
|
-
topN?: number,
|
|
1099
1097
|
fromDate?: string,
|
|
1100
|
-
toDate?: string
|
|
1098
|
+
toDate?: string,
|
|
1099
|
+
factoryId?: number,
|
|
1100
|
+
topN?: number,
|
|
1101
1101
|
): Promise<AlarmStatisticsByTypeResponse> {
|
|
1102
1102
|
const axios = await this.context.ready;
|
|
1103
1103
|
var _factoryId = factoryId || 0;
|
|
@@ -1141,16 +1141,20 @@ export class DeviceGateway extends Object {
|
|
|
1141
1141
|
* @param factoryId 工厂ID
|
|
1142
1142
|
* @param fromDate 查询起始时间(格式:YYYY-MM-DDTHH:mm:ss.sssZ,不传则默认对所有的报警信息进行归类统计)
|
|
1143
1143
|
* @param toDate 查询终止时间(格式:YYYY-MM-DDTHH:mm:ss.sssZ,不传则默认对所有的报警信息进行归类统计)
|
|
1144
|
+
* @param duration 报警恢复时长阈值,按秒计(不传则默认对所有的报警信息进行归类统计)
|
|
1145
|
+
* @param hourMode 是否按小时统计(不传则默认按天统计)
|
|
1144
1146
|
* @returns Promise 包含报警趋势数据
|
|
1145
1147
|
*/
|
|
1146
|
-
async getAlarmTrend(
|
|
1147
|
-
factoryId: number | undefined = undefined,
|
|
1148
|
+
async getAlarmTrend(args: {
|
|
1148
1149
|
fromDate?: Date,
|
|
1149
|
-
toDate?: Date
|
|
1150
|
-
|
|
1150
|
+
toDate?: Date,
|
|
1151
|
+
duration?: number,
|
|
1152
|
+
hourMode?: boolean,
|
|
1153
|
+
factoryId?: number,
|
|
1154
|
+
} = {}): Promise<AlarmTrendResponse> {
|
|
1151
1155
|
const axios = await this.context.ready;
|
|
1152
|
-
var _factoryId = factoryId || 0;
|
|
1153
|
-
if (!factoryId) {
|
|
1156
|
+
var _factoryId = args.factoryId || 0;
|
|
1157
|
+
if (!args.factoryId) {
|
|
1154
1158
|
const farm = await this.context.user.getSelectedFarm();
|
|
1155
1159
|
_factoryId = farm?.id || 0;
|
|
1156
1160
|
}
|
|
@@ -1159,17 +1163,24 @@ export class DeviceGateway extends Object {
|
|
|
1159
1163
|
if (!_factoryId) {
|
|
1160
1164
|
throw new Error('工厂ID不能为空');
|
|
1161
1165
|
}
|
|
1162
|
-
if (fromDate && toDate && fromDate > toDate) {
|
|
1166
|
+
if (args.fromDate && args.toDate && args.fromDate > args.toDate) {
|
|
1163
1167
|
throw new Error('fromDate不能晚于toDate');
|
|
1164
1168
|
}
|
|
1165
1169
|
|
|
1166
1170
|
// 构建请求参数
|
|
1167
1171
|
const params: any = { factoryId: _factoryId };
|
|
1168
|
-
if (fromDate) {
|
|
1169
|
-
params.fromDate = fromDate.toISOString();
|
|
1172
|
+
if (args.fromDate) {
|
|
1173
|
+
params.fromDate = args.fromDate.toISOString();
|
|
1170
1174
|
}
|
|
1171
|
-
if (toDate) {
|
|
1172
|
-
params.toDate = toDate.toISOString();
|
|
1175
|
+
if (args.toDate) {
|
|
1176
|
+
params.toDate = args.toDate.toISOString();
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
if (args.duration !== undefined) {
|
|
1180
|
+
params.duration = args.duration;
|
|
1181
|
+
}
|
|
1182
|
+
if (args.hourMode !== undefined) {
|
|
1183
|
+
params.perHour = args.hourMode;
|
|
1173
1184
|
}
|
|
1174
1185
|
|
|
1175
1186
|
return axios.get(`/api/v2/device/stat/alarms/trend`, {
|
package/dist/device_gateway.js
CHANGED
|
@@ -812,7 +812,7 @@ class DeviceGateway extends Object {
|
|
|
812
812
|
* @returns Promise 包含设备报警统计列表分页数据
|
|
813
813
|
*/
|
|
814
814
|
getAlarmStatistics() {
|
|
815
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
815
|
+
return __awaiter(this, arguments, void 0, function* (resolveType = 2, pageNum = 1, pageSize = 10, factoryId = undefined) {
|
|
816
816
|
const axios = yield this.context.ready;
|
|
817
817
|
var _factoryId = factoryId || 0;
|
|
818
818
|
if (!factoryId) {
|
|
@@ -877,8 +877,8 @@ class DeviceGateway extends Object {
|
|
|
877
877
|
* @param toDate 查询终止时间(格式:YYYY-MM-DD HH:mm:ss,不传则默认对所有的报警信息进行归类统计)
|
|
878
878
|
* @returns Promise 包含报警分类统计数据
|
|
879
879
|
*/
|
|
880
|
-
getAlarmStatisticsByType() {
|
|
881
|
-
return __awaiter(this,
|
|
880
|
+
getAlarmStatisticsByType(fromDate, toDate, factoryId, topN) {
|
|
881
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
882
882
|
const axios = yield this.context.ready;
|
|
883
883
|
var _factoryId = factoryId || 0;
|
|
884
884
|
if (!factoryId) {
|
|
@@ -918,13 +918,15 @@ class DeviceGateway extends Object {
|
|
|
918
918
|
* @param factoryId 工厂ID
|
|
919
919
|
* @param fromDate 查询起始时间(格式:YYYY-MM-DDTHH:mm:ss.sssZ,不传则默认对所有的报警信息进行归类统计)
|
|
920
920
|
* @param toDate 查询终止时间(格式:YYYY-MM-DDTHH:mm:ss.sssZ,不传则默认对所有的报警信息进行归类统计)
|
|
921
|
+
* @param duration 报警恢复时长阈值,按秒计(不传则默认对所有的报警信息进行归类统计)
|
|
922
|
+
* @param hourMode 是否按小时统计(不传则默认按天统计)
|
|
921
923
|
* @returns Promise 包含报警趋势数据
|
|
922
924
|
*/
|
|
923
925
|
getAlarmTrend() {
|
|
924
|
-
return __awaiter(this, arguments, void 0, function* (
|
|
926
|
+
return __awaiter(this, arguments, void 0, function* (args = {}) {
|
|
925
927
|
const axios = yield this.context.ready;
|
|
926
|
-
var _factoryId = factoryId || 0;
|
|
927
|
-
if (!factoryId) {
|
|
928
|
+
var _factoryId = args.factoryId || 0;
|
|
929
|
+
if (!args.factoryId) {
|
|
928
930
|
const farm = yield this.context.user.getSelectedFarm();
|
|
929
931
|
_factoryId = (farm === null || farm === void 0 ? void 0 : farm.id) || 0;
|
|
930
932
|
}
|
|
@@ -932,16 +934,22 @@ class DeviceGateway extends Object {
|
|
|
932
934
|
if (!_factoryId) {
|
|
933
935
|
throw new Error('工厂ID不能为空');
|
|
934
936
|
}
|
|
935
|
-
if (fromDate && toDate && fromDate > toDate) {
|
|
937
|
+
if (args.fromDate && args.toDate && args.fromDate > args.toDate) {
|
|
936
938
|
throw new Error('fromDate不能晚于toDate');
|
|
937
939
|
}
|
|
938
940
|
// 构建请求参数
|
|
939
941
|
const params = { factoryId: _factoryId };
|
|
940
|
-
if (fromDate) {
|
|
941
|
-
params.fromDate = fromDate.toISOString();
|
|
942
|
+
if (args.fromDate) {
|
|
943
|
+
params.fromDate = args.fromDate.toISOString();
|
|
942
944
|
}
|
|
943
|
-
if (toDate) {
|
|
944
|
-
params.toDate = toDate.toISOString();
|
|
945
|
+
if (args.toDate) {
|
|
946
|
+
params.toDate = args.toDate.toISOString();
|
|
947
|
+
}
|
|
948
|
+
if (args.duration !== undefined) {
|
|
949
|
+
params.duration = args.duration;
|
|
950
|
+
}
|
|
951
|
+
if (args.hourMode !== undefined) {
|
|
952
|
+
params.perHour = args.hourMode;
|
|
945
953
|
}
|
|
946
954
|
return axios.get(`/api/v2/device/stat/alarms/trend`, {
|
|
947
955
|
params: params
|