@cpzxrobot/sdk 1.1.3 → 1.1.5

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.
@@ -42,7 +42,7 @@ export class FeedTowerGateway extends DeviceFilter<FeedTower> {
42
42
  throw res[0].data.Error;
43
43
  } else {
44
44
  if (!args.ingoreInput) {
45
- if (res[1].data.data.list == undefined){
45
+ if (res[1].data.data.list == undefined) {
46
46
  throw "未查询到饲料下料数据,请联系管理员";
47
47
  }
48
48
  res[1].data.data.list.forEach((item: any) => {
@@ -166,22 +166,22 @@ export class FeedTowerGateway extends DeviceFilter<FeedTower> {
166
166
  options:
167
167
  | undefined
168
168
  | {
169
- id?: Number | null | undefined; //工厂id
170
- data?:
171
- | "diffPerDay"
172
- | "sumPerDay"
173
- | "latest"
174
- | "weekoverweek"
175
- | "last"
176
- | "rangeOfDay"
177
- | "rangeToday"
178
- | null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
179
- status?: string;
180
- unit?: Number;
181
- detail?: boolean;
182
- type?: string;
183
- supplier?: string; //供应商,可用于过滤设备
184
- } = undefined
169
+ id?: Number | null | undefined; //工厂id
170
+ data?:
171
+ | "diffPerDay"
172
+ | "sumPerDay"
173
+ | "latest"
174
+ | "weekoverweek"
175
+ | "last"
176
+ | "rangeOfDay"
177
+ | "rangeToday"
178
+ | null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
179
+ status?: string;
180
+ unit?: Number;
181
+ detail?: boolean;
182
+ type?: string;
183
+ supplier?: string; //供应商,可用于过滤设备
184
+ } = undefined
185
185
  ) => {
186
186
  return this.context.axios.get(
187
187
  `/api/v2/device/feedTower/list/${options?.id}`
@@ -193,12 +193,18 @@ export class FeedTowerGateway extends DeviceFilter<FeedTower> {
193
193
  update: (ft: FeedTowerV2) => {
194
194
  return this.context.axios.post("/api/v2/device/feedTower/update", ft);
195
195
  },
196
- adzero: (ft: FeedTowerV2,force = false) => {
197
- return this.context.axios.post(`/api/v2/device/feedTower/adzero`,{
196
+ adzero: (ft: FeedTowerV2, force = false) => {
197
+ return this.context.axios.post(`/api/v2/device/feedTower/adzero`, {
198
198
  id: ft.id,
199
199
  force: force
200
200
  });
201
- }
201
+ },
202
+ correctWeight: (ft: FeedTowerV2, amount: Number) => {
203
+ return this.context.axios.post(`/api/v2/device/feedTower/correctWeight`, {
204
+ id: ft.id,
205
+ suttle: amount,
206
+ });
207
+ }
202
208
  };
203
209
  }
204
210
  }
@@ -136,6 +136,12 @@ class FeedTowerGateway extends device_filter_1.DeviceFilter {
136
136
  id: ft.id,
137
137
  force: force
138
138
  });
139
+ },
140
+ correctWeight: (ft, amount) => {
141
+ return this.context.axios.post(`/api/v2/device/feedTower/correctWeight`, {
142
+ id: ft.id,
143
+ suttle: amount,
144
+ });
139
145
  }
140
146
  };
141
147
  }
@@ -198,6 +198,19 @@ class PigfarmGateway extends Object {
198
198
  var axios = await this.context.ready;
199
199
  return axios.post(`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`);
200
200
  },
201
+ template: {
202
+ //获取配置模版列表
203
+ list: async (factory) => {
204
+ var axios = await this.context.ready;
205
+ return axios.get(`/api/v1/pigfarm/heatLamp/config/template/list/${factory.id}`);
206
+ },
207
+ //增加模板
208
+ add: (factory, name, data) => {
209
+ return this.context.ready.then((axios) => {
210
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, Object.assign(Object.assign({}, data), { factoryId: factory.id, templateName: name }));
211
+ });
212
+ },
213
+ },
201
214
  list: async (unit) => {
202
215
  var axios = await this.context.ready;
203
216
  return axios.post(`/api/v1/pigfarm/heatLamp/list/${unit.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -247,6 +247,25 @@ export class PigfarmGateway extends Object {
247
247
  `/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`
248
248
  );
249
249
  },
250
+ template: {
251
+ //获取配置模版列表
252
+ list: async (factory: Factory): Promise<any> => {
253
+ var axios = await this.context.ready;
254
+ return axios.get(
255
+ `/api/v1/pigfarm/heatLamp/config/template/list/${factory.id }`
256
+ );
257
+ },
258
+ //增加模板
259
+ add: (factory: Factory, name:String,data: HeatLamp) => {
260
+ return this.context.ready.then((axios) => {
261
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, {
262
+ ...data,
263
+ factoryId: factory.id,
264
+ templateName: name,
265
+ });
266
+ });
267
+ },
268
+ },
250
269
  list: async (unit: Unit): Promise<any> => {
251
270
  var axios = await this.context.ready;
252
271
  return axios.post(`/api/v1/pigfarm/heatLamp/list/${unit.id}`);
package/readme.md CHANGED
@@ -112,6 +112,8 @@ baseURL: "/"
112
112
  | cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
113
113
  | cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
114
114
  | cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
115
+ | cpzxrobot().pigfarm.heatlamp.template.add | 添加保温灯的模板 |
116
+ | cpzxrobot().pigfarm.heatlamp.template.list | 获取保温灯的模板列表 |
115
117
  | cpzxrobot().pigfarm.threshold | 获取单元中特定类型的阈值信息 |
116
118
  | cpzxrobot().scanQrcode | 调用扫码功能,获得扫码文字 |
117
119
  | cpzxrobot().vibrate | 调用震动功能 |