@cpzxrobot/sdk 1.0.82 → 1.0.83

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.
@@ -48,7 +48,13 @@ class FactoryGateway extends Object {
48
48
  //获得工厂的所有单元信息,以车间为单位树状结构
49
49
  async units(id) {
50
50
  var axios = await this.context.ready;
51
- const response = await axios.get(`/api/v1/factory/${id}/units`);
51
+ const response = await axios.get(`/api/v2/factory/${id}/units`);
52
+ return response.data;
53
+ }
54
+ //获得工厂的业务类型
55
+ async businessType(data) {
56
+ var axios = await this.context.ready;
57
+ const response = await axios.get(`/api/v2/factory/businessType/${data.type}`);
52
58
  return response.data;
53
59
  }
54
60
  async company(data) {
@@ -68,5 +74,16 @@ class FactoryGateway extends Object {
68
74
  const response = await axios.get(`/api/v1/factory/${factory.id}/entry/${name}`);
69
75
  return response.data;
70
76
  }
77
+ get banner() {
78
+ return {
79
+ //上传banner,formData中包含key为file的文件,返回code
80
+ add: (factory, form) => {
81
+ return this.context.axios.get(`/api/v1/factory/${factory.id}/banner/add`);
82
+ },
83
+ del: (code) => {
84
+ return this.context.axios.get(`/api/v1/factory/banner/delete?id=${code}`);
85
+ }
86
+ };
87
+ }
71
88
  }
72
89
  exports.FactoryGateway = FactoryGateway;
@@ -56,7 +56,16 @@ export class FactoryGateway extends Object {
56
56
  //获得工厂的所有单元信息,以车间为单位树状结构
57
57
  async units(id: number): Promise<any> {
58
58
  var axios = await this.context.ready;
59
- const response = await axios.get(`/api/v1/factory/${id}/units`);
59
+ const response = await axios.get(`/api/v2/factory/${id}/units`);
60
+ return response.data;
61
+ }
62
+
63
+ //获得工厂的业务类型
64
+ async businessType(data: Factory): Promise<any> {
65
+ var axios = await this.context.ready;
66
+ const response = await axios.get(
67
+ `/api/v2/factory/businessType/${data.type}`
68
+ );
60
69
  return response.data;
61
70
  }
62
71
 
@@ -86,4 +95,20 @@ export class FactoryGateway extends Object {
86
95
  );
87
96
  return response.data;
88
97
  }
98
+
99
+ get banner() {
100
+ return {
101
+ //上传banner,formData中包含key为file的文件,返回code
102
+ add: (factory: Factory, form: FormData) => {
103
+ return this.context.axios.get(
104
+ `/api/v1/factory/${factory.id}/banner/add`
105
+ );
106
+ },
107
+ del: (code: String) => {
108
+ return this.context.axios.get(
109
+ `/api/v1/factory/banner/delete?id=${code}`
110
+ );
111
+ }
112
+ };
113
+ }
89
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.82",
3
+ "version": "1.0.83",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -89,6 +89,8 @@ baseURL: "/"
89
89
  | cpzxrobot().factory.entry | 获得工厂的可显示动态信息 |
90
90
  | cpzxrobot().factory.info.get | 获得工厂的附加信息 |
91
91
  | cpzxrobot().factory.info.post | 更新或更新工厂的附加信息 |
92
+ | cpzxrobot().factory.banner.add | 添加工厂的banner图片,提交formdata,需要传入file参数 |
93
+ | cpzxrobot().factory.banner.delete | 删除工厂的banner图片,需要传入id参数 |
92
94
  | cpzxrobot().transport.fodder.getDeviceByFodderld | 获得料单对应的设备 |
93
95
  | cpzxrobot().pigfarm.heatlamp.xxx | 操作保温灯 |
94
96
  | cpzxrobot().pigfarm.weightMeter.config.list | 获取称重计的配置信息 |
package/types.d.ts CHANGED
@@ -73,6 +73,7 @@ type Factory = {
73
73
  name?: string;
74
74
  company_code: string;
75
75
  id?: number;
76
+ type?: string;
76
77
  };
77
78
  type Unit = {
78
79
  name?: string;
package/unit_gateway.ts CHANGED
@@ -10,7 +10,7 @@ export class UnitGateway extends Object {
10
10
  return {
11
11
  add: (
12
12
  unit: Unit,
13
- type: "HeatLamp",
13
+ type: "HeatLamp" | "DeviceFilter",
14
14
  config: {
15
15
  [key: string]: any;
16
16
  }
@@ -38,7 +38,7 @@ export class UnitGateway extends Object {
38
38
  });
39
39
  });
40
40
  },
41
- get: (unit: Unit, type: "heatLamp") => {
41
+ get: (unit: Unit, type: "HeatLamp"| "") => {
42
42
  return this.context.ready.then((axios) => {
43
43
  return axios.get(`/api/v2/unit/config`, {
44
44
  params: {