@cpzxrobot/sdk 1.3.71 → 1.3.72

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
@@ -7,6 +7,7 @@ import type {
7
7
  DeviceV2,
8
8
  Factory,
9
9
  Supplier,
10
+ DeviceAlarmStatsResponse,
10
11
  } from ".";
11
12
 
12
13
  class DeviceFault {
@@ -985,4 +986,21 @@ export class DeviceGateway extends Object {
985
986
  }
986
987
  }
987
988
 
989
+ /**
990
+ * 获取设备告警统计信息
991
+ * @param factoryId 工厂ID
992
+ * @returns Promise 包含告警统计信息的数据
993
+ */
994
+ async getAlarmStats(factoryId: number): Promise<DeviceAlarmStatsResponse> {
995
+ const axios = await this.context.ready;
996
+ return axios.get(`/api/v2/device/stat/alarms`, {
997
+ params: { factoryId }
998
+ }).then((res) => {
999
+ if (res.data.code !== 200) {
1000
+ throw new Error(res.data.message || '获取设备告警统计信息失败');
1001
+ }
1002
+ return res.data;
1003
+ });
1004
+ }
1005
+
988
1006
  }
@@ -780,5 +780,23 @@ class DeviceGateway extends Object {
780
780
  })
781
781
  };
782
782
  }
783
+ /**
784
+ * 获取设备告警统计信息
785
+ * @param factoryId 工厂ID
786
+ * @returns Promise 包含告警统计信息的数据
787
+ */
788
+ getAlarmStats(factoryId) {
789
+ return __awaiter(this, void 0, void 0, function* () {
790
+ const axios = yield this.context.ready;
791
+ return axios.get(`/api/v2/device/stat/alarms`, {
792
+ params: { factoryId }
793
+ }).then((res) => {
794
+ if (res.data.code !== 200) {
795
+ throw new Error(res.data.message || '获取设备告警统计信息失败');
796
+ }
797
+ return res.data;
798
+ });
799
+ });
800
+ }
783
801
  }
784
802
  exports.DeviceGateway = DeviceGateway;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.71",
3
+ "version": "1.3.72",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/types.d.ts CHANGED
@@ -13,8 +13,6 @@ import { ProductGateway } from "@cpzxrobot/sdk/product_gateway";
13
13
  import { ContractGateway } from "@cpzxrobot/sdk/contract_gateway";
14
14
  import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
15
15
  import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
16
- import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
17
- import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
18
16
  import { QuotationGateway } from "./quotation_gateway";
19
17
  import { AiGateway } from "./ai_gateway";
20
18
  import { EnergyGateway } from "./energy_gateway";
@@ -23,6 +21,9 @@ import { ConstructionGateway } from "./construction_gateway";
23
21
  import { SystemGateway } from "./system_gateway";
24
22
  import { PlatformInterface } from "./platform_interface";
25
23
  import { WarehouseGateway } from "./warehouse_gateway";
24
+ import { ProductionGateway } from "./production_gateway";
25
+ import { SparePartGateway } from "./sparepart_gateway";
26
+ import { PurchaseGateway } from "./purchase_gateway";
26
27
 
27
28
  type Device = {
28
29
  id: number;
@@ -370,6 +371,34 @@ interface DataQueryArgs {
370
371
  aggerate?: string;
371
372
  }
372
373
 
374
+ /**
375
+ * 设备告警统计数据接口
376
+ */
377
+ interface DeviceAlarmStats {
378
+ /** 告警总数 */
379
+ alarmAmount: number;
380
+ /** 已解决告警数 */
381
+ alarResolved: number;
382
+ /** 当前告警数 */
383
+ alarming: number;
384
+ /** 平均解决时间(秒) */
385
+ averageResolveTime: number;
386
+ /** 最大解决时间(秒) */
387
+ maxResolveTime: number;
388
+ }
389
+
390
+ /**
391
+ * 设备告警统计响应接口
392
+ */
393
+ interface DeviceAlarmStatsResponse {
394
+ /** 响应码 */
395
+ code: number;
396
+ /** 告警统计数据 */
397
+ data: DeviceAlarmStats;
398
+ /** 响应消息 */
399
+ message: string;
400
+ }
401
+
373
402
  declare class Cpzxrobot {
374
403
  transport: TransportGateway;
375
404
  ready: Promise<MyAxiosInstance>;
@@ -381,7 +410,7 @@ declare class Cpzxrobot {
381
410
  axios: MyAxiosInstance;
382
411
  camera: CameraGateway;
383
412
  pigfarm: PigfarmGateway;
384
- chickenfarm: ChickenfarmGateway;
413
+ chickenfarm: ChickenFarmGateway;;
385
414
  car: CarGateway;
386
415
  product: ProductGateway;
387
416
  project: ProjectGateway;
@@ -453,7 +482,8 @@ declare module "@cpzxrobot/sdk" {
453
482
  HeatLamp,
454
483
  DeviceV2,
455
484
  FieldDatas,
456
-
485
+ DeviceAlarmStats,
486
+ DeviceAlarmStatsResponse,
457
487
  ElectricMeterRate,
458
488
  DevicePurpose,
459
489
  };