@cpzxrobot/sdk 1.0.22 → 1.0.24

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.
@@ -18,5 +18,31 @@ class PigfarmGateway extends Object {
18
18
  return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
19
19
  });
20
20
  }
21
+ //获得当日统计
22
+ dailyReportForUnit(unit, type) {
23
+ return this.context.ready.then((axios) => {
24
+ return axios.post(`/api/v1/pigfarm/today/${unit.id}`, {
25
+ type,
26
+ });
27
+ });
28
+ }
29
+ //获得周/月/季度统计
30
+ periodReportForUnit(unit, time, type) {
31
+ return this.context.ready.then((axios) => {
32
+ return axios.post(`/api/v1/pigfarm/statistics/${unit.id}`, {
33
+ time: time,
34
+ type: type,
35
+ });
36
+ });
37
+ }
38
+ //获得周期时间内的峰谷平能耗统计
39
+ peakValleyForUnit(unit, start, end) {
40
+ return this.context.ready.then((axios) => {
41
+ return axios.post(`/api/v1/pigfarm/electric/${unit.id}`, {
42
+ start: start,
43
+ end: end,
44
+ });
45
+ });
46
+ }
21
47
  }
22
48
  exports.PigfarmGateway = PigfarmGateway;
@@ -28,7 +28,11 @@ class TransportGateway extends Object {
28
28
  });
29
29
  });
30
30
  },
31
- //获取设备打料数据
31
+ //获取打料详情
32
+ get inputs() {
33
+ return this.getDetail;
34
+ },
35
+ //获取设备打料数据 deperecated
32
36
  getDetail: (ids, date) => {
33
37
  return this.context.ready.then(() => {
34
38
  return this.context.axios
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -19,4 +19,37 @@ export class PigfarmGateway extends Object {
19
19
  return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
20
20
  });
21
21
  }
22
+
23
+ //获得当日统计
24
+ dailyReportForUnit(unit: Unit, type: "feed" | "water" | "electric") {
25
+ return this.context.ready.then((axios) => {
26
+ return axios.post(`/api/v1/pigfarm/today/${unit.id}`, {
27
+ type,
28
+ });
29
+ });
30
+ }
31
+
32
+ //获得周/月/季度统计
33
+ periodReportForUnit(
34
+ unit: Unit,
35
+ time: "week" | "month" | "season",
36
+ type: "feed" | "water" | "electric"
37
+ ) {
38
+ return this.context.ready.then((axios) => {
39
+ return axios.post(`/api/v1/pigfarm/statistics/${unit.id}`, {
40
+ time: time,
41
+ type: type,
42
+ });
43
+ });
44
+ }
45
+
46
+ //获得周期时间内的峰谷平能耗统计
47
+ peakValleyForUnit(unit: Unit, start: string, end: string) {
48
+ return this.context.ready.then((axios) => {
49
+ return axios.post(`/api/v1/pigfarm/electric/${unit.id}`, {
50
+ start: start,
51
+ end: end,
52
+ });
53
+ });
54
+ }
22
55
  }
@@ -37,7 +37,11 @@ export class TransportGateway extends Object {
37
37
  });
38
38
  });
39
39
  },
40
- //获取设备打料数据
40
+ //获取打料详情
41
+ get inputs() {
42
+ return this.getDetail;
43
+ },
44
+ //获取设备打料数据 deperecated
41
45
  getDetail: (ids: Array<number>, date: string): Promise<any> => {
42
46
  return this.context.ready.then(() => {
43
47
  return this.context.axios