@cpzxrobot/sdk 1.2.45 → 1.2.47

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
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit, Camera } from ".";
1
+ import { Cpzxrobot, type Unit, type Camera } from ".";
2
2
 
3
3
  export class CameraGateway extends Object {
4
4
  context: Cpzxrobot;
package/car_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory } from ".";
1
+ import { Cpzxrobot, type Factory } from ".";
2
2
 
3
3
  export class CarGateway extends Object {
4
4
  context: Cpzxrobot;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Cpzxrobot,
3
- Factory,
3
+ type Factory,
4
4
  } from "./types";
5
5
 
6
6
  export class ChickenFarmGateway extends Object {
package/device_filter.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, DataQueryArgs } from ".";
1
+ import { Cpzxrobot, type DataQueryArgs } from ".";
2
2
  import type { AxiosResponse } from "axios";
3
3
  import { FieldDatas, SensorDatas } from "./sensor_datas";
4
4
 
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit, DeviceType } from "."
1
+ import { Cpzxrobot, type Unit,type DeviceType } from "."
2
2
 
3
3
  //缓存设备类型数据
4
4
  export class DeviceTypeGateway {
@@ -2,8 +2,8 @@ import {
2
2
  type FodderOrderList,
3
3
  type FeedTower,
4
4
  type FeedTowerExtraInfo,
5
- DataQueryArgs,
6
- FeedTowerV2,
5
+ type DataQueryArgs,
6
+ type FeedTowerV2,
7
7
  } from "..";
8
8
  import { DeviceFilter } from "../device_filter";
9
9
 
@@ -1,4 +1,4 @@
1
- import { Device } from "..";
1
+ import { type Device } from "..";
2
2
  import { DeviceFilter } from "../device_filter";
3
3
 
4
4
  //适配常见设备类型
package/dist/index.js CHANGED
@@ -392,22 +392,23 @@ class Cpzxrobot {
392
392
  }
393
393
  this.resolveReady(this.axios);
394
394
  });
395
- //load www.cpzxrobot.com/web_components.js as web components
396
- // const script = document.createElement("script");
397
- // script.src = "https://www.cpzxrobot.com/web_components.js";
398
- // document.body.appendChild(script);
399
- // //insert cpzxrobot_web_components into body
400
- // const div = document.createElement("cpzxrobot_web_components");
401
- // document.body.appendChild(div);
402
- // //register onUnitChanged and onFactoryChanged on div
403
- // div.addEventListener("unitChanged", function (e: any) {
404
- // // @ts-ignore
405
- // window._notifyUnitChanged(e.detail);
406
- // });
407
- // div.addEventListener("factoryChanged", function (e: any) {
408
- // // @ts-ignore
409
- // window._notifyFactoryChanged(e.detail);
410
- // });
395
+ // load www.cpzxrobot.com/web_components.js as web components
396
+ const script = document.createElement("script");
397
+ script.src = "https://www.cpzxrobot.com/webc/factory_selector.js";
398
+ document.body.appendChild(script);
399
+ //insert cpzxrobot_factory_selector into body
400
+ const div = document.createElement("cpzxrobot_factory_selector");
401
+ div.setAttribute("selector-style", "float-button");
402
+ document.body.appendChild(div);
403
+ //register onUnitChanged and onFactoryChanged on div
404
+ div.addEventListener("unitChanged", function (e) {
405
+ // @ts-ignore
406
+ window._notifyUnitChanged(e.detail);
407
+ });
408
+ div.addEventListener("factoryChanged", function (e) {
409
+ // @ts-ignore
410
+ window._notifyFactoryChanged(e.detail);
411
+ });
411
412
  return;
412
413
  }
413
414
  else {
@@ -17,15 +17,15 @@ class PigfarmGateway extends Object {
17
17
  return this.context.ready.then((axios) => {
18
18
  return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
19
19
  });
20
- /**
21
- * 获取单元统计信息
22
- *
23
- * @param unitIds 单元ID数组
24
- * @param start 开始时间,格式为"yyyy-MM-dd"
25
- * @param end 结束时间,格式为"yyyy-MM-dd"
26
- * @returns 返回Promise对象,解析后得到axios响应结果
27
- */
28
20
  }
21
+ /**
22
+ * 获取单元统计信息
23
+ *
24
+ * @param unitIds 单元ID数组
25
+ * @param start 开始时间,格式为"yyyy-MM-dd"
26
+ * @param end 结束时间,格式为"yyyy-MM-dd"
27
+ * @returns 返回Promise对象,解析后得到axios响应结果
28
+ */
29
29
  unitStat(unitIds, start, end) {
30
30
  return this.context.ready.then((axios) => {
31
31
  return axios.post(`/api/v1/pigfarm/feedStatics`, {
@@ -36,5 +36,34 @@ class QuotationGateway extends Object {
36
36
  return axios.get(`/api/v2/coremde-sale/quotation/transform?id=${id}`);
37
37
  });
38
38
  }
39
+ get apply() {
40
+ return {
41
+ add: (args) => {
42
+ return this.context.ready.then((axios) => {
43
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/add`, args);
44
+ });
45
+ },
46
+ list: (args) => {
47
+ return this.context.ready.then((axios) => {
48
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/list`, args);
49
+ });
50
+ },
51
+ get: (id) => {
52
+ return this.context.ready.then((axios) => {
53
+ return axios.get(`/api/v2/coremde-sale/quotation/apply/get?id=${id}`);
54
+ });
55
+ },
56
+ update: (args) => {
57
+ return this.context.ready.then((axios) => {
58
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/update`, args);
59
+ });
60
+ },
61
+ delete: (id) => {
62
+ return this.context.ready.then((axios) => {
63
+ return axios.get(`/api/v2/coremde-sale/quotation/apply/delete?id=${id}`);
64
+ });
65
+ }
66
+ };
67
+ }
39
68
  }
40
69
  exports.QuotationGateway = QuotationGateway;
@@ -283,6 +283,12 @@ class UserGateway extends Object {
283
283
  var axios = await this.context.ready;
284
284
  return axios.get(`/api/v2/user/info/${userId}`);
285
285
  }
286
+ //根据组织机构id获得该组织机构下所有人员
287
+ listByGroup(groupId) {
288
+ return this.context.ready.then((axios) => {
289
+ return axios.get(`/api/v2/user/list/${groupId}`);
290
+ });
291
+ }
286
292
  get position() {
287
293
  return {
288
294
  leader: () => {
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory } from "./types";
1
+ import { Cpzxrobot, type Factory } from "./types";
2
2
 
3
3
  export class FactoryGateway extends Object {
4
4
  _selectedFarm: Factory = {
package/index.ts CHANGED
@@ -443,22 +443,23 @@ export class Cpzxrobot {
443
443
  }
444
444
  this.resolveReady(this.axios);
445
445
  });
446
- //load www.cpzxrobot.com/web_components.js as web components
447
- // const script = document.createElement("script");
448
- // script.src = "https://www.cpzxrobot.com/web_components.js";
449
- // document.body.appendChild(script);
450
- // //insert cpzxrobot_web_components into body
451
- // const div = document.createElement("cpzxrobot_web_components");
452
- // document.body.appendChild(div);
453
- // //register onUnitChanged and onFactoryChanged on div
454
- // div.addEventListener("unitChanged", function (e: any) {
455
- // // @ts-ignore
456
- // window._notifyUnitChanged(e.detail);
457
- // });
458
- // div.addEventListener("factoryChanged", function (e: any) {
459
- // // @ts-ignore
460
- // window._notifyFactoryChanged(e.detail);
461
- // });
446
+ // load www.cpzxrobot.com/web_components.js as web components
447
+ const script = document.createElement("script");
448
+ script.src = "https://www.cpzxrobot.com/webc/factory_selector.js";
449
+ document.body.appendChild(script);
450
+ //insert cpzxrobot_factory_selector into body
451
+ const div = document.createElement("cpzxrobot_factory_selector");
452
+ div.setAttribute("selector-style","float-button")
453
+ document.body.appendChild(div);
454
+ //register onUnitChanged and onFactoryChanged on div
455
+ div.addEventListener("unitChanged", function (e: any) {
456
+ // @ts-ignore
457
+ window._notifyUnitChanged(e.detail);
458
+ });
459
+ div.addEventListener("factoryChanged", function (e: any) {
460
+ // @ts-ignore
461
+ window._notifyFactoryChanged(e.detail);
462
+ });
462
463
  return;
463
464
  } else {
464
465
  //if url has access_token and app_code, use it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Cpzxrobot,
3
- DeviceConfig,
4
- Factory,
5
- HeatLamp,
6
- Unit,
7
- WeightMeter,
8
- WeightMeterSensor,
9
- weightMeterSensorsConfig,
3
+ type DeviceConfig,
4
+ type Factory,
5
+ type HeatLamp,
6
+ type Unit,
7
+ type WeightMeter,
8
+ type WeightMeterSensor,
9
+ type weightMeterSensorsConfig,
10
10
  } from ".";
11
11
 
12
12
  export class PigfarmGateway extends Object {
@@ -27,16 +27,16 @@ export class PigfarmGateway extends Object {
27
27
  return this.context.ready.then((axios) => {
28
28
  return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
29
29
  });
30
-
31
- /**
32
- * 获取单元统计信息
33
- *
34
- * @param unitIds 单元ID数组
35
- * @param start 开始时间,格式为"yyyy-MM-dd"
36
- * @param end 结束时间,格式为"yyyy-MM-dd"
37
- * @returns 返回Promise对象,解析后得到axios响应结果
38
- */
39
30
  }
31
+
32
+ /**
33
+ * 获取单元统计信息
34
+ *
35
+ * @param unitIds 单元ID数组
36
+ * @param start 开始时间,格式为"yyyy-MM-dd"
37
+ * @param end 结束时间,格式为"yyyy-MM-dd"
38
+ * @returns 返回Promise对象,解析后得到axios响应结果
39
+ */
40
40
  unitStat(unitIds: Number[], start: string, end: string) {
41
41
  return this.context.ready.then((axios) => {
42
42
  return axios.post(`/api/v1/pigfarm/feedStatics`, {
@@ -252,11 +252,11 @@ export class PigfarmGateway extends Object {
252
252
  list: async (factory: Factory): Promise<any> => {
253
253
  var axios = await this.context.ready;
254
254
  return axios.get(
255
- `/api/v1/pigfarm/heatLamp/config/template/list/${factory.id }`
255
+ `/api/v1/pigfarm/heatLamp/config/template/list/${factory.id}`
256
256
  );
257
257
  },
258
258
  //增加模板
259
- add: (factory: Factory, name:String,data: HeatLamp) => {
259
+ add: (factory: Factory, name: String, data: HeatLamp) => {
260
260
  return this.context.ready.then((axios) => {
261
261
  return axios.post(`/api/v1/pigfarm/heatLamp/config/template`, {
262
262
  ...data,
@@ -264,13 +264,13 @@ export class PigfarmGateway extends Object {
264
264
  templateName: name,
265
265
  });
266
266
  });
267
- },
267
+ },
268
268
  //删除模版
269
269
  delete: (id: number) => {
270
270
  return this.context.ready.then((axios) => {
271
271
  return axios.post(`/api/v1/pigfarm/heatLamp/config/template/delete?id=${id}`);
272
272
  });
273
- }
273
+ }
274
274
  },
275
275
  list: async (unit: Unit): Promise<any> => {
276
276
  var axios = await this.context.ready;
@@ -318,18 +318,18 @@ export class PigfarmGateway extends Object {
318
318
  var axios = await this.context.ready;
319
319
  return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
320
320
  },
321
- updateByUnit: async (unit: Unit,lamp: HeatLamp,ids:Number[]|null = null): Promise<any> => {
321
+ updateByUnit: async (unit: Unit, lamp: HeatLamp, ids: Number[] | null = null): Promise<any> => {
322
322
  var axios = await this.context.ready;
323
323
  return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, {
324
324
  ...lamp,
325
325
  ids
326
326
  });
327
327
  },
328
- switchByUnit: async (unit: Unit, action: "on" | "off",ids:Number[]|null = null): Promise<any> => {
328
+ switchByUnit: async (unit: Unit, action: "on" | "off", ids: Number[] | null = null): Promise<any> => {
329
329
  var axios = await this.context.ready;
330
- var args:{
330
+ var args: {
331
331
  action: "on" | "off",
332
- ids?:Number[]
332
+ ids?: Number[]
333
333
  } = {
334
334
  action,
335
335
  }
@@ -338,13 +338,13 @@ export class PigfarmGateway extends Object {
338
338
  }
339
339
  return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, args);
340
340
  },
341
- taskStatus: async (args:{
342
- id?:number,
343
- unitId?:number,
341
+ taskStatus: async (args: {
342
+ id?: number,
343
+ unitId?: number,
344
344
  type?: string
345
345
  }): Promise<any> => {
346
346
  var axios = await this.context.ready;
347
- return axios.post(`/api/v1/pigfarm/heatLamp/task`,args);
347
+ return axios.post(`/api/v1/pigfarm/heatLamp/task`, args);
348
348
  },
349
349
  control: async (lamp: HeatLamp | number, action: "on" | "off") => {
350
350
  var axios = await this.context.ready;
@@ -49,4 +49,45 @@ export class QuotationGateway extends Object {
49
49
  return axios.get(`/api/v2/coremde-sale/quotation/transform?id=${id}`);
50
50
  });
51
51
  }
52
+
53
+ get apply() {
54
+ return {
55
+ add: (args: { projectId: number; quotationApplyDescription: string }) => {
56
+ return this.context.ready.then((axios) => {
57
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/add`, args);
58
+ });
59
+ },
60
+
61
+ list: (args: {
62
+ pageNo: number;
63
+ pageSize: number;
64
+ projectId?: number;
65
+ customerId?: number;
66
+ quotationApplyDateStart?: string;
67
+ quotationApplyDateEnd?: string;
68
+ }) => {
69
+ return this.context.ready.then((axios) => {
70
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/list`, args);
71
+ });
72
+ },
73
+
74
+ get: (id: number) => {
75
+ return this.context.ready.then((axios) => {
76
+ return axios.get(`/api/v2/coremde-sale/quotation/apply/get?id=${id}`);
77
+ });
78
+ },
79
+
80
+ update: (args: { projectId: number; quotationApplyDescription: string; id: number }) => {
81
+ return this.context.ready.then((axios) => {
82
+ return axios.post(`/api/v2/coremde-sale/quotation/apply/update`, args);
83
+ });
84
+ },
85
+
86
+ delete: (id: number) => {
87
+ return this.context.ready.then((axios) => {
88
+ return axios.get(`/api/v2/coremde-sale/quotation/apply/delete?id=${id}`);
89
+ });
90
+ }
91
+ }
92
+ }
52
93
  }
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, FodderOrder } from ".";
1
+ import { Cpzxrobot, type FodderOrder } from ".";
2
2
 
3
3
  export class TransportGateway extends Object {
4
4
  _selectedFarm: string = "";
package/unit_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Unit } from "./types";
1
+ import { Cpzxrobot, type Unit } from "./types";
2
2
 
3
3
  export class UnitGateway extends Object {
4
4
  context: Cpzxrobot;
package/user_gateway.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Cpzxrobot, Factory, Unit } from "./types";
1
+ import { Cpzxrobot, type Factory,type Unit } from "./types";
2
2
 
3
3
  export class UserGateway extends Object {
4
4
  _selectedFarm: Factory = {
@@ -313,6 +313,13 @@ export class UserGateway extends Object {
313
313
  return axios.get(`/api/v2/user/info/${userId}`);
314
314
  }
315
315
 
316
+ //根据组织机构id获得该组织机构下所有人员
317
+ listByGroup(groupId: number) {
318
+ return this.context.ready.then((axios) => {
319
+ return axios.get(`/api/v2/user/list/${groupId}`);
320
+ });
321
+ }
322
+
316
323
  get position() {
317
324
  return {
318
325
  leader: () => {