@cpzxrobot/sdk 1.0.39 → 1.0.41

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/camera_gateway.ts CHANGED
@@ -6,24 +6,25 @@ export class CameraGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- //搜索摄像头,传入unit对象或者unit的id
9
+
10
10
  async search(
11
11
  data:
12
12
  | Unit
13
13
  | {
14
- workshop_id: number;
15
- factory_id: number;
16
- unit_id: number;
14
+ workshop_id?: number;
15
+ factory_id?: number;
16
+ unit_id?: number;
17
17
  }
18
18
  ): Promise<any> {
19
19
  var axios = await this.context.ready;
20
20
  var params = {};
21
21
 
22
22
  if (!("id" in data)) {
23
+ //should has unit_id or factory_id or workshop_id at least one, if has more than one, use unit_id first,then workshop_id, then factory_id
23
24
  params = data as {
24
- workshop_id: number;
25
- factory_id: number;
26
- unit_id: number;
25
+ workshop_id?: number;
26
+ factory_id?: number;
27
+ unit_id?: number;
27
28
  };
28
29
  }else{
29
30
  params = {unit_id:data.id}
package/device_filter.ts CHANGED
@@ -313,6 +313,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
313
313
  unit: options?.unit,
314
314
  data: options?.data,
315
315
  status: options?.status,
316
+ supplier: options?.supplier,
316
317
  },
317
318
  });
318
319
  })
@@ -6,11 +6,11 @@ class CameraGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- //搜索摄像头,传入unit对象或者unit的id
10
9
  async search(data) {
11
10
  var axios = await this.context.ready;
12
11
  var params = {};
13
12
  if (!("id" in data)) {
13
+ //should has unit_id or factory_id or workshop_id at least one, if has more than one, use unit_id first,then workshop_id, then factory_id
14
14
  params = data;
15
15
  }
16
16
  else {
@@ -253,6 +253,7 @@ class DeviceFilter {
253
253
  unit: options === null || options === void 0 ? void 0 : options.unit,
254
254
  data: options === null || options === void 0 ? void 0 : options.data,
255
255
  status: options === null || options === void 0 ? void 0 : options.status,
256
+ supplier: options === null || options === void 0 ? void 0 : options.supplier,
256
257
  },
257
258
  });
258
259
  })
package/dist/index.js CHANGED
@@ -249,6 +249,7 @@ class Cpzxrobot {
249
249
  return;
250
250
  }
251
251
  this.token = "Bearer " + res.data.token;
252
+ localStorage.setItem("token", this.token);
252
253
  this.resolveReady(this.axios);
253
254
  });
254
255
  return;
@@ -39,7 +39,7 @@ class TransportGateway extends Object {
39
39
  return this.context.axios
40
40
  .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
41
41
  params: {
42
- fodderld: id,
42
+ fodderId: id,
43
43
  },
44
44
  })
45
45
  .then((res) => {
package/index.ts CHANGED
@@ -283,6 +283,7 @@ export class Cpzxrobot {
283
283
  return;
284
284
  }
285
285
  this.token = "Bearer " + res.data.token;
286
+ localStorage.setItem("token", this.token);
286
287
  this.resolveReady(this.axios);
287
288
  });
288
289
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -116,6 +116,10 @@ factory_id: 工厂id
116
116
 
117
117
  如果入参为:{factory_id:xxx}则按工厂搜索
118
118
 
119
+ 如果入参为:{workshop_id:xxx}则按车间搜索
120
+
121
+ 如果入参为Unit对象,则按Unit对象的id进行搜索
122
+
119
123
  ### app功能相关
120
124
 
121
125
  `cpzxrobot().saveBlob(blob,filname)`
@@ -134,4 +138,5 @@ heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它
134
138
  **cpzxrobot().pigfarm.heatlamp.add(unit, data)**:添加新的热灯配置。
135
139
  **cpzxrobot().pigfarm.heatlamp.list(unit)**:列出指定单元的所有热灯配置。
136
140
  **cpzxrobot().pigfarm.heatlamp.get(id)**:获取指定 ID 的热灯配置。
137
- **cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
141
+ **cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
142
+
@@ -49,7 +49,7 @@ export class TransportGateway extends Object {
49
49
  return this.context.axios
50
50
  .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
51
51
  params: {
52
- fodderld: id,
52
+ fodderId: id,
53
53
  },
54
54
  })
55
55
  .then((res) => {
package/types.d.ts CHANGED
@@ -77,8 +77,6 @@ type Unit = {
77
77
  id?: number;
78
78
  type?: string;
79
79
  workshopName?: string;
80
- workshopId?: number;
81
- factoryId?: number;
82
80
  };
83
81
 
84
82
  type HeatLamp = {