@cpzxrobot/sdk 1.1.20 → 1.1.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/dist/factory_gateway.js +4 -0
- package/dist/pigfarm_gateway.js +14 -0
- package/factory_gateway.ts +5 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +14 -0
- package/readme.md +3 -0
package/dist/factory_gateway.js
CHANGED
|
@@ -23,6 +23,10 @@ class FactoryGateway extends Object {
|
|
|
23
23
|
const response = await axios.get(`/api/v1/workshop/unit/${id}`);
|
|
24
24
|
return response.data;
|
|
25
25
|
}
|
|
26
|
+
async add(factory) {
|
|
27
|
+
var axios = await this.context.ready;
|
|
28
|
+
return axios.post("/api/v2/company/factory", factory);
|
|
29
|
+
}
|
|
26
30
|
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
27
31
|
async apps(id, withRoles = false) {
|
|
28
32
|
var axios = await this.context.ready;
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -259,6 +259,20 @@ class PigfarmGateway extends Object {
|
|
|
259
259
|
var axios = await this.context.ready;
|
|
260
260
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
261
261
|
},
|
|
262
|
+
updateByUnit: async (unit, lamp) => {
|
|
263
|
+
var axios = await this.context.ready;
|
|
264
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, lamp);
|
|
265
|
+
},
|
|
266
|
+
switchByUnit: async (unit, action) => {
|
|
267
|
+
var axios = await this.context.ready;
|
|
268
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, {
|
|
269
|
+
action,
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
taskStatus: async (no) => {
|
|
273
|
+
var axios = await this.context.ready;
|
|
274
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/task/${no}`);
|
|
275
|
+
},
|
|
262
276
|
control: async (lamp, action) => {
|
|
263
277
|
var axios = await this.context.ready;
|
|
264
278
|
var id = typeof lamp === "number" ? lamp : lamp.id;
|
package/factory_gateway.ts
CHANGED
|
@@ -28,6 +28,11 @@ export class FactoryGateway extends Object {
|
|
|
28
28
|
return response.data;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
async add(factory: Factory) {
|
|
32
|
+
var axios = await this.context.ready;
|
|
33
|
+
return axios.post("/api/v2/company/factory", factory);
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
32
37
|
async apps(id: number, withRoles = false): Promise<any> {
|
|
33
38
|
var axios = await this.context.ready;
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -318,6 +318,20 @@ export class PigfarmGateway extends Object {
|
|
|
318
318
|
var axios = await this.context.ready;
|
|
319
319
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
320
320
|
},
|
|
321
|
+
updateByUnit: async (unit: Unit,lamp: HeatLamp): Promise<any> => {
|
|
322
|
+
var axios = await this.context.ready;
|
|
323
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, lamp);
|
|
324
|
+
},
|
|
325
|
+
switchByUnit: async (unit: Unit, action: "on" | "off"): Promise<any> => {
|
|
326
|
+
var axios = await this.context.ready;
|
|
327
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, {
|
|
328
|
+
action,
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
taskStatus: async (no: String): Promise<any> => {
|
|
332
|
+
var axios = await this.context.ready;
|
|
333
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/task/${no}`);
|
|
334
|
+
},
|
|
321
335
|
control: async (lamp: HeatLamp | number, action: "on" | "off") => {
|
|
322
336
|
var axios = await this.context.ready;
|
|
323
337
|
var id = typeof lamp === "number" ? lamp : lamp.id;
|
package/readme.md
CHANGED
|
@@ -122,6 +122,9 @@ baseURL: "/"
|
|
|
122
122
|
| cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
|
|
123
123
|
| cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
|
|
124
124
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
125
|
+
| cpzxrobot().pigfarm.heatlamp.switchByUnit | 按单元id开关,返回task |
|
|
126
|
+
| cpzxrobot().pigfarm.heatlamp.updateByUnit | 按单元id设置保温灯的参数,返回task |
|
|
127
|
+
| cpzxrobot().pigfarm.heatlamp.taskStatus | 获取保温灯的任务状态,传入taskId参数 |
|
|
125
128
|
| cpzxrobot().pigfarm.heatlamp.template.add | 添加保温灯的模板 |
|
|
126
129
|
| cpzxrobot().pigfarm.heatlamp.template.list | 获取保温灯的模板列表 |
|
|
127
130
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|