@cpzxrobot/sdk 1.2.24 → 1.2.26

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/ai_gateway.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { Cpzxrobot } from "./types";
2
+
3
+ export class AiGateway extends Object {
4
+ context: Cpzxrobot;
5
+
6
+ constructor(context: Cpzxrobot) {
7
+ super();
8
+ this.context = context;
9
+ }
10
+
11
+ detechDeviceType(args:{
12
+ field: string;
13
+ }){
14
+ return this.context.ready.then(axios => {
15
+ return axios.post(" /api/chatai/deviceMatch", args);
16
+ })
17
+ }
18
+
19
+ }
@@ -184,8 +184,6 @@ export class CustomerGateway extends Object {
184
184
  });
185
185
  }
186
186
 
187
-
188
-
189
187
  //获得客户类型列表
190
188
  types() {
191
189
  return this.context.ready.then((axios) => {
@@ -232,7 +230,13 @@ export class CustomerGateway extends Object {
232
230
  return this.context.ready.then((axios) => {
233
231
  return axios.post(`/api/v2/coremde-sale/customer/contact/delete`, args);
234
232
  });
235
- }
233
+ },
234
+ // 获取联系人列表
235
+ list: (id:number) => {
236
+ return this.context.ready.then((axios) => {
237
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
238
+ });
239
+ },
236
240
  }
237
241
  }
238
242
  }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AiGateway = void 0;
4
+ class AiGateway extends Object {
5
+ constructor(context) {
6
+ super();
7
+ this.context = context;
8
+ }
9
+ detechDeviceType(args) {
10
+ return this.context.ready.then(axios => {
11
+ return axios.post(" /api/chatai/deviceMatch", args);
12
+ });
13
+ }
14
+ }
15
+ exports.AiGateway = AiGateway;
@@ -166,7 +166,13 @@ class CustomerGateway extends Object {
166
166
  return this.context.ready.then((axios) => {
167
167
  return axios.post(`/api/v2/coremde-sale/customer/contact/delete`, args);
168
168
  });
169
- }
169
+ },
170
+ // 获取联系人列表
171
+ list: (id) => {
172
+ return this.context.ready.then((axios) => {
173
+ return axios.get(`/api/v2/coremde-sale/customer/contact/list?id=${id}`);
174
+ });
175
+ },
170
176
  };
171
177
  }
172
178
  }
@@ -103,6 +103,10 @@ class FactoryGateway extends Object {
103
103
  //获得工厂的所有单元信息,以车间为单位树状结构
104
104
  async units(id) {
105
105
  var axios = await this.context.ready;
106
+ if (id === null) {
107
+ var farm = await this.context.user.getSelectedFarm();
108
+ id = farm.id;
109
+ }
106
110
  const response = await axios.get(`/api/v2/factory/${id}/units`);
107
111
  return response.data;
108
112
  }
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ const news_gateway_1 = require("./news_gateway");
26
26
  const logs_gateway_1 = require("./logs_gateway");
27
27
  const robot_gateway_1 = require("./robot_gateway");
28
28
  const quotation_gateway_1 = require("./quotation_gateway");
29
+ const ai_gateway_1 = require("./ai_gateway");
29
30
  class Cpzxrobot {
30
31
  constructor(appCode) {
31
32
  this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
@@ -44,6 +45,7 @@ class Cpzxrobot {
44
45
  this.logs = new logs_gateway_1.LogsGateway(this);
45
46
  this.robot = new robot_gateway_1.RobotGateway(this);
46
47
  this.quotation = new quotation_gateway_1.QuotationGateway(this);
48
+ this.ai = new ai_gateway_1.AiGateway(this);
47
49
  //获取当前浏览器的域名
48
50
  this.ready = new Promise((resolve, reject) => {
49
51
  this.resolveReady = resolve;
@@ -116,8 +116,12 @@ export class FactoryGateway extends Object {
116
116
  }
117
117
 
118
118
  //获得工厂的所有单元信息,以车间为单位树状结构
119
- async units(id: number): Promise<any> {
119
+ async units(id: number|null): Promise<any> {
120
120
  var axios = await this.context.ready;
121
+ if (id === null) {
122
+ var farm = await this.context.user.getSelectedFarm();
123
+ id = farm.id;
124
+ }
121
125
  const response = await axios.get(`/api/v2/factory/${id}/units`);
122
126
  return response.data;
123
127
  }
package/index.ts CHANGED
@@ -21,6 +21,7 @@ import { NewsGateway } from "./news_gateway";
21
21
  import { LogsGateway } from "./logs_gateway";
22
22
  import { RobotGateway } from "./robot_gateway";
23
23
  import { QuotationGateway } from "./quotation_gateway";
24
+ import { AiGateway } from "./ai_gateway";
24
25
 
25
26
  export class Cpzxrobot {
26
27
  device: DeviceGateway;
@@ -72,6 +73,7 @@ export class Cpzxrobot {
72
73
  logs: LogsGateway = new LogsGateway(this);
73
74
  robot: RobotGateway = new RobotGateway(this);
74
75
  quotation: QuotationGateway = new QuotationGateway(this);
76
+ ai: AiGateway = new AiGateway(this);
75
77
 
76
78
 
77
79
  constructor(appCode: string) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.24",
3
+ "version": "1.2.26",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -79,6 +79,7 @@ server: {
79
79
  11. 车辆管理
80
80
  12. 新闻管理
81
81
  13. 日志管理
82
+ 14. AI网关管理
82
83
 
83
84
  ## 接口参考
84
85
  ### 工厂管理
@@ -183,7 +184,7 @@ await cpzxrobot().device.report(123, 4, "传感器读数异常");
183
184
  await cpzxrobot().device.report(456, 64, "设备已报废");
184
185
  ```
185
186
 
186
- ## faults函数说明
187
+ ### faults函数说明
187
188
 
188
189
  获取设备故障记录
189
190
 
@@ -918,7 +919,7 @@ baseURL: "/"
918
919
  * 调用对应的接口方法,例如`cpzxrobot().factory.workshops(factory_id)`
919
920
 
920
921
 
921
- ### 调用接口
922
+ ## 调用接口列表
922
923
 
923
924
  主要包入口:
924
925
 
@@ -1113,6 +1114,7 @@ baseURL: "/"
1113
1114
  | cpzxrobot().logs.operations | 获得操作日志列表,传入必要的参数 |
1114
1115
  | cpzxrobot().robot.cage | 获得栏位信息 |
1115
1116
  | cpzxrobot().robot.alarm | 获得报警信息,传入必要的参数 |
1117
+ | cpzxrobot().ai.detechDeviceType | 使用AI匹配设备类型 |
1116
1118
 
1117
1119
  ### 工厂信息接口
1118
1120
 
package/types.d.ts CHANGED
@@ -16,6 +16,7 @@ import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
16
16
  import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
17
17
  import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
18
18
  import { QuotationGateway } from "./quotation_gateway";
19
+ import { AiGateway } from "./ai_gateway";
19
20
 
20
21
  type Device = {
21
22
  id: number;
@@ -335,6 +336,7 @@ class Cpzxrobot {
335
336
  logs: LogsGateway;
336
337
  robot: RobotGateway;
337
338
  quotation: QuotationGateway;
339
+ ai: AiGateway;
338
340
  dict: (key: string) => any;
339
341
  _getSelectedFarmFromMiniApp: () => Promise<Factory>;
340
342
  _getSelectedUnitFromMiniApp: () => Promise<Unit>;