@cpzxrobot/sdk 1.0.35 → 1.0.37

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.
@@ -44,5 +44,26 @@ class PigfarmGateway extends Object {
44
44
  });
45
45
  });
46
46
  }
47
+ get heatlamp() {
48
+ return {
49
+ add: (unit, data) => {
50
+ return this.context.ready.then((axios) => {
51
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, Object.assign(Object.assign({}, data), { unitId: unit.id }));
52
+ });
53
+ },
54
+ list: async (unit) => {
55
+ var axios = await this.context.ready;
56
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`);
57
+ },
58
+ get: async (id) => {
59
+ var axios = await this.context.ready;
60
+ return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`);
61
+ },
62
+ update: async (lamp) => {
63
+ var axios = await this.context.ready;
64
+ return axios.get(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
65
+ },
66
+ };
67
+ }
47
68
  }
48
69
  exports.PigfarmGateway = PigfarmGateway;
@@ -33,6 +33,23 @@ class TransportGateway extends Object {
33
33
  get inputs() {
34
34
  return this.getDetail;
35
35
  },
36
+ //按料单获得对应的料塔
37
+ getDeviceByFodderld: (id) => {
38
+ return this.context.ready.then(() => {
39
+ return this.context.axios
40
+ .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderld", {
41
+ params: {
42
+ fodderld: id,
43
+ },
44
+ })
45
+ .then((res) => {
46
+ if (res.data.code != 200) {
47
+ throw res.data.message;
48
+ }
49
+ return res.data.data;
50
+ });
51
+ });
52
+ },
36
53
  //获取设备打料数据 deperecated
37
54
  getDetail: (ids, date) => {
38
55
  return this.context.ready.then(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.35",
3
+ "version": "1.0.37",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit } from ".";
1
+ import { Cpzxrobot, HeatLamp, Unit } from ".";
2
2
 
3
3
  export class PigfarmGateway extends Object {
4
4
  context: Cpzxrobot;
@@ -52,4 +52,29 @@ export class PigfarmGateway extends Object {
52
52
  });
53
53
  });
54
54
  }
55
+
56
+ get heatlamp() {
57
+ return {
58
+ add: (unit:Unit, data: HeatLamp) => {
59
+ return this.context.ready.then((axios) => {
60
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, {
61
+ ...data,
62
+ unitId: unit.id,
63
+ });
64
+ });
65
+ },
66
+ list: async (unit:Unit):Promise<any>=> {
67
+ var axios = await this.context.ready;
68
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`)
69
+ },
70
+ get: async (id: number):Promise<any>=> {
71
+ var axios = await this.context.ready;
72
+ return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`)
73
+ },
74
+ update:async (lamp: HeatLamp):Promise<any>=> {
75
+ var axios = await this.context.ready;
76
+ return axios.get(`/api/v1/pigfarm/heatLamp/config/update`,lamp)
77
+ },
78
+ };
79
+ }
55
80
  }
package/readme.md CHANGED
@@ -80,6 +80,9 @@ baseURL: "/"
80
80
  | cpzxrobot().device.xxx | 获得设备的相关信息 |
81
81
  | cpzxrobot().camera.xxx | 获得摄像头的相关信息 |
82
82
  | cpzxrobot().factory.entry| 获得工厂的可显示动态信息 |
83
+ | cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
84
+ | cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
85
+
83
86
 
84
87
  ### 工厂信息接口
85
88
 
@@ -43,6 +43,23 @@ export class TransportGateway extends Object {
43
43
  get inputs() {
44
44
  return this.getDetail;
45
45
  },
46
+ //按料单获得对应的料塔
47
+ getDeviceByFodderld: (id: number): Promise<any> => {
48
+ return this.context.ready.then(() => {
49
+ return this.context.axios
50
+ .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderld", {
51
+ params: {
52
+ fodderld: id,
53
+ },
54
+ })
55
+ .then((res) => {
56
+ if (res.data.code != 200) {
57
+ throw res.data.message;
58
+ }
59
+ return res.data.data;
60
+ });
61
+ });
62
+ },
46
63
  //获取设备打料数据 deperecated
47
64
  getDetail: (ids: Array<number>, date: string): Promise<any> => {
48
65
  return this.context.ready.then(() => {
package/types.d.ts CHANGED
@@ -79,6 +79,27 @@ type Unit = {
79
79
  workshopName?: string;
80
80
  };
81
81
 
82
+ type HeatLamp = {
83
+ id: number;
84
+ unitId: number;
85
+ lampLine: number;
86
+ lampColumn: number;
87
+ startDate: string;
88
+ //运行天数
89
+ runDays: number;
90
+ workMode: "auto" | "manual";
91
+ //   告警阈值下限
92
+ alarmLower: number;
93
+ //   告警阈值上限
94
+ alarmUpper: number;
95
+ // 环境温度补偿值
96
+ tempCompensation: number;
97
+ periodList: {
98
+ startTemp: number,
99
+ startDayage: number,
100
+ }[]
101
+ }
102
+
82
103
  type Electricity = {
83
104
  deviceId: string;
84
105
  nextDeviceList: number[] | [];