@cpzxrobot/sdk 1.3.41 → 1.3.43
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 +36 -3
- package/dist/device_gateway.js +29 -2
- package/package.json +1 -1
- package/types.d.ts +3 -3
package/device_gateway.ts
CHANGED
|
@@ -137,6 +137,7 @@ export class DeviceGateway extends Object {
|
|
|
137
137
|
return res.data;
|
|
138
138
|
});
|
|
139
139
|
},
|
|
140
|
+
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
143
|
|
|
@@ -210,11 +211,17 @@ export class DeviceGateway extends Object {
|
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
async watch(
|
|
213
|
-
|
|
214
|
+
ids: number|number[],
|
|
214
215
|
fn: any,
|
|
215
216
|
) {
|
|
216
217
|
var axios = await this.context.ready;
|
|
217
|
-
|
|
218
|
+
var idQuery = "";
|
|
219
|
+
if (Array.isArray(ids)) {
|
|
220
|
+
idQuery = ids.map(x => `ids=${x}`).join("&");
|
|
221
|
+
}else{
|
|
222
|
+
idQuery = `ids=${ids}`;
|
|
223
|
+
}
|
|
224
|
+
return axios.getAsSse(`/api/v1/device/watch?`+idQuery, fn)
|
|
218
225
|
}
|
|
219
226
|
|
|
220
227
|
private getFilter<T extends { id: number }>(
|
|
@@ -930,7 +937,7 @@ export class DeviceGateway extends Object {
|
|
|
930
937
|
public maintenanceStatus = this.generateFunctionsForDict('maintenance-status');
|
|
931
938
|
|
|
932
939
|
//外委中状态列表
|
|
933
|
-
public maintenanceOutsourceStatus =this.generateFunctionsForDict('maintenance-outsource-status');
|
|
940
|
+
public maintenanceOutsourceStatus = this.generateFunctionsForDict('maintenance-outsource-status');
|
|
934
941
|
|
|
935
942
|
//故障来源
|
|
936
943
|
public troubleDetectSource = this.generateFunctionsForDict('trouble-detect-source');
|
|
@@ -972,4 +979,30 @@ export class DeviceGateway extends Object {
|
|
|
972
979
|
};
|
|
973
980
|
}
|
|
974
981
|
|
|
982
|
+
get disinfect() {
|
|
983
|
+
return {
|
|
984
|
+
openDoor: async (deviceId: number,door: "doora" | "doorb", open: boolean) => {
|
|
985
|
+
var axios = await this.context.ready;
|
|
986
|
+
return axios.post(`/api/v2/device/disinfect/${deviceId}`, { door, open })
|
|
987
|
+
},
|
|
988
|
+
config: async (deviceId: number, config: {
|
|
989
|
+
mode?: number; // 0:没有消毒 1:高温消毒 2:臭氧消毒 3:高温+臭氧
|
|
990
|
+
disinfectTime?: number; // 洗消时间(s)
|
|
991
|
+
targetTemp?: number; // 目标温度
|
|
992
|
+
targetOzone?: number; // 目标臭氧浓度
|
|
993
|
+
}) => {
|
|
994
|
+
let axios = await this.context.ready;
|
|
995
|
+
return axios.post(`/api/v2/device/disinfect/${deviceId}`, config).then((res) => {
|
|
996
|
+
return res.data;
|
|
997
|
+
});
|
|
998
|
+
},
|
|
999
|
+
history: async (deviceId: number, pageNum:number,pageSize:number) => {
|
|
1000
|
+
let axios = await this.context.ready;
|
|
1001
|
+
return axios.get(`/api/v2/device/disinfect/${deviceId}`, { params: { pageNum, pageSize } }).then((res) => {
|
|
1002
|
+
return res.data;
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
975
1008
|
}
|
package/dist/device_gateway.js
CHANGED
|
@@ -168,9 +168,16 @@ class DeviceGateway extends Object {
|
|
|
168
168
|
show(id, type = "datapoint") {
|
|
169
169
|
this.context.platform.showInDeviceManager(id, type);
|
|
170
170
|
}
|
|
171
|
-
async watch(
|
|
171
|
+
async watch(ids, fn) {
|
|
172
172
|
var axios = await this.context.ready;
|
|
173
|
-
|
|
173
|
+
var idQuery = "";
|
|
174
|
+
if (Array.isArray(ids)) {
|
|
175
|
+
idQuery = ids.map(x => `ids=${x}`).join("&");
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
idQuery = `ids=${ids}`;
|
|
179
|
+
}
|
|
180
|
+
return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn);
|
|
174
181
|
}
|
|
175
182
|
getFilter(type, cls) {
|
|
176
183
|
// 如果filters中已经有对应type的过滤器,则直接返回该过滤器
|
|
@@ -740,5 +747,25 @@ class DeviceGateway extends Object {
|
|
|
740
747
|
}
|
|
741
748
|
};
|
|
742
749
|
}
|
|
750
|
+
get disinfect() {
|
|
751
|
+
return {
|
|
752
|
+
openDoor: async (deviceId, door, open) => {
|
|
753
|
+
var axios = await this.context.ready;
|
|
754
|
+
return axios.post(`/api/v2/device/disinfect/${deviceId}`, { door, open });
|
|
755
|
+
},
|
|
756
|
+
config: async (deviceId, config) => {
|
|
757
|
+
let axios = await this.context.ready;
|
|
758
|
+
return axios.post(`/api/v2/device/disinfect/${deviceId}`, config).then((res) => {
|
|
759
|
+
return res.data;
|
|
760
|
+
});
|
|
761
|
+
},
|
|
762
|
+
history: async (deviceId, pageNum, pageSize) => {
|
|
763
|
+
let axios = await this.context.ready;
|
|
764
|
+
return axios.get(`/api/v2/device/disinfect/${deviceId}`, { params: { pageNum, pageSize } }).then((res) => {
|
|
765
|
+
return res.data;
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
};
|
|
769
|
+
}
|
|
743
770
|
}
|
|
744
771
|
exports.DeviceGateway = DeviceGateway;
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ type Device = {
|
|
|
33
33
|
currentAmount: number;
|
|
34
34
|
location: string;
|
|
35
35
|
supplier?: string;
|
|
36
|
-
data?:
|
|
36
|
+
data?: any;
|
|
37
37
|
typeCode: string;
|
|
38
38
|
unitId: number;
|
|
39
39
|
};
|
|
@@ -87,9 +87,9 @@ type Assistant = {
|
|
|
87
87
|
id: Number;
|
|
88
88
|
};
|
|
89
89
|
type Factory = {
|
|
90
|
-
code
|
|
90
|
+
code?: string;
|
|
91
91
|
name?: string;
|
|
92
|
-
company_code
|
|
92
|
+
company_code?: string;
|
|
93
93
|
id?: number;
|
|
94
94
|
type?: string;
|
|
95
95
|
kind?: string;
|