@cpzxrobot/sdk 1.1.21 → 1.1.23
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/company_gateway.js +20 -0
- 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 +4 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductGateway = void 0;
|
|
4
|
+
class ProductGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
list(args) {
|
|
10
|
+
return this.context.ready.then((axios) => {
|
|
11
|
+
return axios.post(`/api/v2/coremde-sale/product/list`, args);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
get(id) {
|
|
15
|
+
return this.context.ready.then((axios) => {
|
|
16
|
+
return axios.get(`/api/v2/coremde-sale/product/get?id=${id}`);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ProductGateway = ProductGateway;
|
package/dist/factory_gateway.js
CHANGED
|
@@ -27,6 +27,10 @@ class FactoryGateway extends Object {
|
|
|
27
27
|
var axios = await this.context.ready;
|
|
28
28
|
return axios.post("/api/v2/company/factory", factory);
|
|
29
29
|
}
|
|
30
|
+
async listByCompany(companyId) {
|
|
31
|
+
var axios = await this.context.ready;
|
|
32
|
+
return axios.get(`/api/v2/company/${companyId}/factory`);
|
|
33
|
+
}
|
|
30
34
|
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
31
35
|
async apps(id, withRoles = false) {
|
|
32
36
|
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
|
@@ -33,6 +33,11 @@ export class FactoryGateway extends Object {
|
|
|
33
33
|
return axios.post("/api/v2/company/factory", factory);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
async listByCompany(companyId: number) {
|
|
37
|
+
var axios = await this.context.ready;
|
|
38
|
+
return axios.get(`/api/v2/company/${companyId}/factory`);
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
//获得工厂的应用信息, 如果指定withRoles为true,则返回app和app的详细角色信息
|
|
37
42
|
async apps(id: number, withRoles = false): Promise<any> {
|
|
38
43
|
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
|
@@ -91,6 +91,7 @@ baseURL: "/"
|
|
|
91
91
|
| cpzxrobot().factory.roles | 获得工厂的角色列表 |
|
|
92
92
|
| cpzxrobot().factory.addRole | 添加工厂的角色 |
|
|
93
93
|
| cpzxrobot().factory.deleteRole | 删除工厂的角色 |
|
|
94
|
+
| cpzxrobot().factory.listByCompany | 获得工厂列表,传入companyId参数 |
|
|
94
95
|
| cpzxrobot().factory.info.get | 获得工厂的附加信息 |
|
|
95
96
|
| cpzxrobot().factory.info.post | 更新或更新工厂的附加信息 |
|
|
96
97
|
| cpzxrobot().factory.banner.add | 添加工厂的banner图片,提交formdata,需要传入file参数 |
|
|
@@ -122,6 +123,9 @@ baseURL: "/"
|
|
|
122
123
|
| cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
|
|
123
124
|
| cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
|
|
124
125
|
| cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
|
|
126
|
+
| cpzxrobot().pigfarm.heatlamp.switchByUnit | 按单元id开关,返回task |
|
|
127
|
+
| cpzxrobot().pigfarm.heatlamp.updateByUnit | 按单元id设置保温灯的参数,返回task |
|
|
128
|
+
| cpzxrobot().pigfarm.heatlamp.taskStatus | 获取保温灯的任务状态,传入taskId参数 |
|
|
125
129
|
| cpzxrobot().pigfarm.heatlamp.template.add | 添加保温灯的模板 |
|
|
126
130
|
| cpzxrobot().pigfarm.heatlamp.template.list | 获取保温灯的模板列表 |
|
|
127
131
|
| cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
|