@cpzxrobot/sdk 1.3.134 → 1.3.136
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/aiform_gateway.ts +41 -6
- package/dist/aiform_gateway.js +31 -6
- package/package.json +1 -1
- package/types.d.ts +13 -0
package/aiform_gateway.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
AiformStructTypeResponse,
|
|
21
21
|
AiformStructListResponse,
|
|
22
22
|
AiformStructDetailResponse,
|
|
23
|
+
AiformStructSourceResponse,
|
|
23
24
|
AiformMetadataResponse,
|
|
24
25
|
} from ".";
|
|
25
26
|
|
|
@@ -567,7 +568,11 @@ export class AiformGateway extends Object {
|
|
|
567
568
|
* @param searchParams 搜索条件(可选)
|
|
568
569
|
* @returns Promise 包含表头列表
|
|
569
570
|
*/
|
|
570
|
-
list: async (factoryId: number, structType: string,
|
|
571
|
+
list: async (factoryId: number, structType: string, params?: {
|
|
572
|
+
searchParams?: object,
|
|
573
|
+
pageNum?: number,
|
|
574
|
+
pageSize?: number,
|
|
575
|
+
}): Promise<AiformStructListResponse> => {
|
|
571
576
|
const axios = await this.context.ready;
|
|
572
577
|
|
|
573
578
|
if (!factoryId) {
|
|
@@ -577,10 +582,14 @@ export class AiformGateway extends Object {
|
|
|
577
582
|
throw new Error('结构化类型不能为空');
|
|
578
583
|
}
|
|
579
584
|
|
|
585
|
+
const { searchParams, pageNum = 1, pageSize = 10 } = params || {};
|
|
586
|
+
|
|
580
587
|
return axios.post(`/api/v2/form/pigfarm/list`,searchParams, {
|
|
581
588
|
params: {
|
|
582
589
|
factoryId,
|
|
583
|
-
structType
|
|
590
|
+
structType,
|
|
591
|
+
pageNum,
|
|
592
|
+
pageSize,
|
|
584
593
|
}
|
|
585
594
|
}).then((res) => {
|
|
586
595
|
if (res.data.code !== 200) {
|
|
@@ -615,15 +624,41 @@ export class AiformGateway extends Object {
|
|
|
615
624
|
});
|
|
616
625
|
},
|
|
617
626
|
|
|
627
|
+
/**
|
|
628
|
+
* 按行ID查询来源数据
|
|
629
|
+
* GET /api/v2/form/pigfarm/source/{rowId}
|
|
630
|
+
* @param rowId 行ID
|
|
631
|
+
* @returns Promise 包含来源数据
|
|
632
|
+
*/
|
|
633
|
+
source: async (rowId: number): Promise<AiformStructSourceResponse> => {
|
|
634
|
+
const axios = await this.context.ready;
|
|
635
|
+
|
|
636
|
+
if (!rowId) {
|
|
637
|
+
throw new Error('行ID不能为空');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return axios.get(`/api/v2/form/pigfarm/source/${rowId}`).then((res) => {
|
|
641
|
+
if (res.data.code !== 200) {
|
|
642
|
+
throw new Error(res.data.message || '获取来源数据失败');
|
|
643
|
+
}
|
|
644
|
+
return res.data;
|
|
645
|
+
});
|
|
646
|
+
},
|
|
647
|
+
|
|
618
648
|
/**
|
|
619
649
|
* 查询标准化支持的 structType 枚举
|
|
620
|
-
* GET /api/v2/form/pigfarm/standardize/struct-
|
|
621
|
-
* @returns Promise 包含 structType
|
|
650
|
+
* GET /api/v2/form/pigfarm/standardize/struct-type/{factoryId}
|
|
651
|
+
* @returns Promise 包含 structType 列表(如 WEANING、WEANING_DETAIL 等)
|
|
622
652
|
*/
|
|
623
|
-
getStructTypes: async (): Promise<AiformStructTypeResponse> => {
|
|
653
|
+
getStructTypes: async (factoryId: number | undefined): Promise<AiformStructTypeResponse> => {
|
|
624
654
|
const axios = await this.context.ready;
|
|
625
655
|
|
|
626
|
-
|
|
656
|
+
if (!factoryId) {
|
|
657
|
+
const factory = await this.context.user.getSelectedFarm();
|
|
658
|
+
factoryId = factory.id;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return axios.get(`/api/v2/form/pigfarm/standardize/struct-types/${factoryId}`).then((res) => {
|
|
627
662
|
if (res.data.code !== 200) {
|
|
628
663
|
throw new Error(res.data.message || '获取结构化类型失败');
|
|
629
664
|
}
|
package/dist/aiform_gateway.js
CHANGED
|
@@ -479,7 +479,7 @@ class AiformGateway extends Object {
|
|
|
479
479
|
* @param searchParams 搜索条件(可选)
|
|
480
480
|
* @returns Promise 包含表头列表
|
|
481
481
|
*/
|
|
482
|
-
list: (factoryId, structType,
|
|
482
|
+
list: (factoryId, structType, params) => __awaiter(this, void 0, void 0, function* () {
|
|
483
483
|
const axios = yield this.context.ready;
|
|
484
484
|
if (!factoryId) {
|
|
485
485
|
throw new Error('工厂ID不能为空');
|
|
@@ -487,10 +487,13 @@ class AiformGateway extends Object {
|
|
|
487
487
|
if (!structType) {
|
|
488
488
|
throw new Error('结构化类型不能为空');
|
|
489
489
|
}
|
|
490
|
+
const { searchParams, pageNum = 1, pageSize = 10 } = params || {};
|
|
490
491
|
return axios.post(`/api/v2/form/pigfarm/list`, searchParams, {
|
|
491
492
|
params: {
|
|
492
493
|
factoryId,
|
|
493
|
-
structType
|
|
494
|
+
structType,
|
|
495
|
+
pageNum,
|
|
496
|
+
pageSize,
|
|
494
497
|
}
|
|
495
498
|
}).then((res) => {
|
|
496
499
|
if (res.data.code !== 200) {
|
|
@@ -521,14 +524,36 @@ class AiformGateway extends Object {
|
|
|
521
524
|
return res.data;
|
|
522
525
|
});
|
|
523
526
|
}),
|
|
527
|
+
/**
|
|
528
|
+
* 按行ID查询来源数据
|
|
529
|
+
* GET /api/v2/form/pigfarm/source/{rowId}
|
|
530
|
+
* @param rowId 行ID
|
|
531
|
+
* @returns Promise 包含来源数据
|
|
532
|
+
*/
|
|
533
|
+
source: (rowId) => __awaiter(this, void 0, void 0, function* () {
|
|
534
|
+
const axios = yield this.context.ready;
|
|
535
|
+
if (!rowId) {
|
|
536
|
+
throw new Error('行ID不能为空');
|
|
537
|
+
}
|
|
538
|
+
return axios.get(`/api/v2/form/pigfarm/source/${rowId}`).then((res) => {
|
|
539
|
+
if (res.data.code !== 200) {
|
|
540
|
+
throw new Error(res.data.message || '获取来源数据失败');
|
|
541
|
+
}
|
|
542
|
+
return res.data;
|
|
543
|
+
});
|
|
544
|
+
}),
|
|
524
545
|
/**
|
|
525
546
|
* 查询标准化支持的 structType 枚举
|
|
526
|
-
* GET /api/v2/form/pigfarm/standardize/struct-
|
|
527
|
-
* @returns Promise 包含 structType
|
|
547
|
+
* GET /api/v2/form/pigfarm/standardize/struct-type/{factoryId}
|
|
548
|
+
* @returns Promise 包含 structType 列表(如 WEANING、WEANING_DETAIL 等)
|
|
528
549
|
*/
|
|
529
|
-
getStructTypes: () => __awaiter(this, void 0, void 0, function* () {
|
|
550
|
+
getStructTypes: (factoryId) => __awaiter(this, void 0, void 0, function* () {
|
|
530
551
|
const axios = yield this.context.ready;
|
|
531
|
-
|
|
552
|
+
if (!factoryId) {
|
|
553
|
+
const factory = yield this.context.user.getSelectedFarm();
|
|
554
|
+
factoryId = factory.id;
|
|
555
|
+
}
|
|
556
|
+
return axios.get(`/api/v2/form/pigfarm/standardize/struct-types/${factoryId}`).then((res) => {
|
|
532
557
|
if (res.data.code !== 200) {
|
|
533
558
|
throw new Error(res.data.message || '获取结构化类型失败');
|
|
534
559
|
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1229,6 +1229,18 @@ interface AiformStructDetailResponse {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* 结构化来源数据响应接口
|
|
1234
|
+
*/
|
|
1235
|
+
interface AiformStructSourceResponse {
|
|
1236
|
+
/** 响应码 */
|
|
1237
|
+
code: number;
|
|
1238
|
+
/** 提示信息 */
|
|
1239
|
+
message: string;
|
|
1240
|
+
/** 来源数据 */
|
|
1241
|
+
data: any;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1232
1244
|
/**
|
|
1233
1245
|
* 元数据字段信息接口
|
|
1234
1246
|
*/
|
|
@@ -1539,6 +1551,7 @@ declare module "@cpzxrobot/sdk" {
|
|
|
1539
1551
|
AiformStructTypeResponse,
|
|
1540
1552
|
AiformStructListResponse,
|
|
1541
1553
|
AiformStructDetailResponse,
|
|
1554
|
+
AiformStructSourceResponse,
|
|
1542
1555
|
AiformMetadataResponse,
|
|
1543
1556
|
AiformMetadataField,
|
|
1544
1557
|
AlarmRuleDetail,
|