@cpzxrobot/sdk 1.3.46 → 1.3.48

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/device_gateway.ts CHANGED
@@ -211,17 +211,17 @@ export class DeviceGateway extends Object {
211
211
  }
212
212
 
213
213
  async watch(
214
- ids: number|number[],
214
+ ids: number | number[],
215
215
  fn: any,
216
216
  ) {
217
217
  var axios = await this.context.ready;
218
218
  var idQuery = "";
219
219
  if (Array.isArray(ids)) {
220
220
  idQuery = ids.map(x => `ids=${x}`).join("&");
221
- }else{
221
+ } else {
222
222
  idQuery = `ids=${ids}`;
223
223
  }
224
- return axios.getAsSse(`/api/v1/device/watch?`+idQuery, fn)
224
+ return axios.getAsSse(`/api/v1/device/watch?` + idQuery, fn)
225
225
  }
226
226
 
227
227
  private getFilter<T extends { id: number }>(
@@ -981,26 +981,35 @@ export class DeviceGateway extends Object {
981
981
 
982
982
  get disinfect() {
983
983
  return {
984
- openDoor: async (deviceId: number,door: "doora" | "doorb", open: boolean) => {
984
+ openDoor: async (deviceId: number, door: "doora" | "doorb", open: boolean) => {
985
985
  var axios = await this.context.ready;
986
986
  return axios.post(`/api/v2/disinfect/${deviceId}`, { door, open })
987
987
  },
988
- action: async (deviceId: number,action: "start"|"end") => {
988
+ action: async (deviceId: number, action: "start" | "end") => {
989
989
  var axios = await this.context.ready;
990
990
  return axios.post(`/api/v2/disinfect/${deviceId}`, { action })
991
991
  },
992
- config: async (deviceId: number, config: {
993
- mode?: number; // 0:没有消毒 1:高温消毒 2:臭氧消毒 3:高温+臭氧
994
- disinfectTime?: number; // 洗消时间(s)
995
- targetTemp?: number; // 目标温度
996
- targetOzone?: number; // 目标臭氧浓度
997
- }) => {
998
- let axios = await this.context.ready;
999
- return axios.post(`/api/v2/disinfect/${deviceId}`, config).then((res) => {
1000
- return res.data;
1001
- });
992
+ config: {
993
+ set: async (deviceId: number, config: {
994
+ mode?: number; // 0:没有消毒 1:高温消毒 2:臭氧消毒 3:高温+臭氧
995
+ disinfectTime?: number; // 洗消时间(s)
996
+ targetTemp?: number; // 目标温度
997
+ targetOzone?: number; // 目标臭氧浓度
998
+ soaktime?: number; // 浸泡时间(s)
999
+ }) => {
1000
+ let axios = await this.context.ready;
1001
+ return axios.post(`/api/v2/disinfect/${deviceId}/params`, config).then((res) => {
1002
+ return res.data;
1003
+ });
1004
+ },
1005
+ get: async (deviceId: number) => {
1006
+ let axios = await this.context.ready;
1007
+ return axios.get(`/api/v2/disinfect/${deviceId}/params`).then((res) => {
1008
+ return res.data;
1009
+ });
1010
+ }
1002
1011
  },
1003
- history: async (deviceId: number, pageNum:number,pageSize:number) => {
1012
+ history: async (deviceId: number, pageNum: number, pageSize: number) => {
1004
1013
  let axios = await this.context.ready;
1005
1014
  return axios.get(`/api/v2/disinfect/${deviceId}`, { params: { pageNum, pageSize } }).then((res) => {
1006
1015
  return res.data;
@@ -757,11 +757,19 @@ class DeviceGateway extends Object {
757
757
  var axios = await this.context.ready;
758
758
  return axios.post(`/api/v2/disinfect/${deviceId}`, { action });
759
759
  },
760
- config: async (deviceId, config) => {
761
- let axios = await this.context.ready;
762
- return axios.post(`/api/v2/disinfect/${deviceId}`, config).then((res) => {
763
- return res.data;
764
- });
760
+ config: {
761
+ set: async (deviceId, config) => {
762
+ let axios = await this.context.ready;
763
+ return axios.post(`/api/v2/disinfect/${deviceId}/params`, config).then((res) => {
764
+ return res.data;
765
+ });
766
+ },
767
+ get: async (deviceId) => {
768
+ let axios = await this.context.ready;
769
+ return axios.get(`/api/v2/disinfect/${deviceId}/params`).then((res) => {
770
+ return res.data;
771
+ });
772
+ }
765
773
  },
766
774
  history: async (deviceId, pageNum, pageSize) => {
767
775
  let axios = await this.context.ready;
@@ -320,6 +320,50 @@ class ProjectGateway extends Object {
320
320
  },
321
321
  };
322
322
  }
323
+ get consignee() {
324
+ return {
325
+ /**
326
+ * 新增收货单位
327
+ * @param args 收货单位参数
328
+ * @returns Promise
329
+ */
330
+ add: (args) => {
331
+ return this.context.ready.then((axios) => {
332
+ return axios.post(`/api/v2/coremde-sale/project/consignee/add`, args);
333
+ });
334
+ },
335
+ /**
336
+ * 修改收货单位
337
+ * @param args 收货单位参数
338
+ * @returns Promise
339
+ */
340
+ update: (args) => {
341
+ return this.context.ready.then((axios) => {
342
+ return axios.post(`/api/v2/coremde-sale/project/consignee/update`, args);
343
+ });
344
+ },
345
+ /**
346
+ * 删除收货单位
347
+ * @param id 收货单位ID
348
+ * @returns Promise
349
+ */
350
+ delete: (id) => {
351
+ return this.context.ready.then((axios) => {
352
+ return axios.get(`/api/v2/coremde-sale/project/consignee/delete?id=${id}`);
353
+ });
354
+ },
355
+ /**
356
+ * 获取收货单位列表
357
+ * @param args 分页参数和项目ID
358
+ * @returns Promise
359
+ */
360
+ list: (args) => {
361
+ return this.context.ready.then((axios) => {
362
+ return axios.post(`/api/v2/coremde-sale/project/consignee/list`, args);
363
+ });
364
+ },
365
+ };
366
+ }
323
367
  get bom() {
324
368
  return {
325
369
  /**
@@ -328,6 +328,14 @@ class UserGateway extends Object {
328
328
  return axios.post('/api/v2/coremde-sale/task/create', params);
329
329
  });
330
330
  },
331
+ flows: async (taskId) => {
332
+ var axios = await this.context.ready;
333
+ return axios.get(`/api/v2/coremde-sale/task/flow/list`, {
334
+ params: {
335
+ id: taskId,
336
+ },
337
+ });
338
+ },
331
339
  };
332
340
  }
333
341
  get position() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.46",
3
+ "version": "1.3.48",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -484,6 +484,67 @@ export class ProjectGateway extends Object {
484
484
  }
485
485
  }
486
486
 
487
+ get consignee() {
488
+ return {
489
+ /**
490
+ * 新增收货单位
491
+ * @param args 收货单位参数
492
+ * @returns Promise
493
+ */
494
+ add: (args: {
495
+ name: string
496
+ contactPeople: string
497
+ contactPhone: string
498
+ contactAddress: string
499
+ projectId: number
500
+ }) => {
501
+ return this.context.ready.then((axios) => {
502
+ return axios.post(`/api/v2/coremde-sale/project/consignee/add`, args)
503
+ })
504
+ },
505
+ /**
506
+ * 修改收货单位
507
+ * @param args 收货单位参数
508
+ * @returns Promise
509
+ */
510
+ update: (args: {
511
+ id: number
512
+ name: string
513
+ contactPeople: string
514
+ contactPhone: string
515
+ contactAddress: string
516
+ }) => {
517
+ return this.context.ready.then((axios) => {
518
+ return axios.post(`/api/v2/coremde-sale/project/consignee/update`, args)
519
+ })
520
+ },
521
+ /**
522
+ * 删除收货单位
523
+ * @param id 收货单位ID
524
+ * @returns Promise
525
+ */
526
+ delete: (id: number) => {
527
+ return this.context.ready.then((axios) => {
528
+ return axios.get(`/api/v2/coremde-sale/project/consignee/delete?id=${id}`)
529
+ })
530
+ },
531
+ /**
532
+ * 获取收货单位列表
533
+ * @param args 分页参数和项目ID
534
+ * @returns Promise
535
+ */
536
+ list: (args: {
537
+ pageNo: number
538
+ pageSize: number
539
+ projectId: number
540
+ }) => {
541
+ return this.context.ready.then((axios) => {
542
+ return axios.post(`/api/v2/coremde-sale/project/consignee/list`, args)
543
+ })
544
+ },
545
+ }
546
+ }
547
+
487
548
  get bom() {
488
549
  return {
489
550
  /**
@@ -711,7 +772,7 @@ export class ProjectGateway extends Object {
711
772
  get principal() {
712
773
  return {
713
774
  // 分配负责人
714
- assign: (args: {id: number, principalId: number, principalName: string}) => {
775
+ assign: (args: { id: number, principalId: number, principalName: string }) => {
715
776
  return this.context.ready.then((axios) => {
716
777
  return axios.post(
717
778
  `/api/v2/coremde-sale/project/principal/assign`,
package/user_gateway.ts CHANGED
@@ -52,7 +52,7 @@ export class UserGateway extends Object {
52
52
  })
53
53
  }
54
54
 
55
- async list(factory: Factory | number| undefined = undefined) {
55
+ async list(factory: Factory | number | undefined = undefined) {
56
56
  var factoryId = 0
57
57
  if (factory) {
58
58
  if (typeof factory === 'number') {
@@ -60,7 +60,7 @@ export class UserGateway extends Object {
60
60
  } else {
61
61
  factoryId = factory.id as number
62
62
  }
63
- }else{
63
+ } else {
64
64
  var selectedFarm = await this.context.user.getSelectedFarm()
65
65
  factoryId = selectedFarm.id
66
66
  }
@@ -402,11 +402,17 @@ export class UserGateway extends Object {
402
402
  return axios.post('/api/v2/coremde-sale/task/create', params)
403
403
  })
404
404
  },
405
+ flows: async (taskId: number) => {
406
+ var axios = await this.context.ready
407
+ return axios.get(`/api/v2/coremde-sale/task/flow/list`, {
408
+ params: {
409
+ id: taskId,
410
+ },
411
+ })
412
+ },
405
413
  }
406
414
  }
407
415
 
408
-
409
-
410
416
  get position() {
411
417
  return {
412
418
  leader: () => {