@cpzxrobot/sdk 1.3.31 → 1.3.33
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/company_gateway.ts +20 -3
- package/device_filter.ts +1 -0
- package/device_gateway.ts +249 -32
- package/dist/company_gateway.js +16 -0
- package/dist/device_gateway.js +182 -11
- package/dist/index.js +4 -0
- package/dist/project_gateway.js +68 -0
- package/dist/purchase_gateway.js +53 -0
- package/dist/sparepart_gateway.js +40 -0
- package/dist/stage_template_service.js +9 -0
- package/dist/warehouse_gateway.js +30 -0
- package/dist/web_platform.js +2 -1
- package/index.ts +6 -0
- package/package.json +1 -1
- package/project_gateway.ts +105 -1
- package/purchase_gateway.ts +101 -1
- package/sparepart_gateway.ts +45 -0
- package/stage_template_service.ts +10 -0
- package/types.d.ts +17 -1
- package/warehouse_gateway.ts +35 -0
- package/web_platform.ts +5 -1
package/dist/device_gateway.js
CHANGED
|
@@ -490,7 +490,7 @@ class DeviceGateway extends Object {
|
|
|
490
490
|
return this.context.axios.get(`/api/v3/device/purpose`);
|
|
491
491
|
}
|
|
492
492
|
else {
|
|
493
|
-
return this.context.axios.get(`/api/v3/device/purpose/${parentId}`);
|
|
493
|
+
return this.context.axios.get(`/api/v3/device/purpose/${parentId}/children`);
|
|
494
494
|
}
|
|
495
495
|
});
|
|
496
496
|
},
|
|
@@ -503,18 +503,24 @@ class DeviceGateway extends Object {
|
|
|
503
503
|
return this.context.ready.then(() => {
|
|
504
504
|
return this.context.axios.delete(`/api/v3/device/purpose/${id}`);
|
|
505
505
|
});
|
|
506
|
-
}
|
|
506
|
+
},
|
|
507
|
+
detail: (id) => {
|
|
508
|
+
return this.context.ready.then(() => {
|
|
509
|
+
return this.context.axios.get(`/api/v3/device/purpose/${id}`);
|
|
510
|
+
});
|
|
511
|
+
},
|
|
507
512
|
};
|
|
508
513
|
}
|
|
509
514
|
get trouble() {
|
|
510
515
|
return {
|
|
511
|
-
list: async (
|
|
516
|
+
list: async (args = {
|
|
517
|
+
sourceType: "device",
|
|
518
|
+
pageNum: 1,
|
|
519
|
+
pageSize: 10,
|
|
520
|
+
}) => {
|
|
512
521
|
const axios = await this.context.ready;
|
|
513
522
|
return axios.get('/api/v3/device/trouble/list', {
|
|
514
|
-
params:
|
|
515
|
-
pageNum,
|
|
516
|
-
pageSize
|
|
517
|
-
}
|
|
523
|
+
params: args
|
|
518
524
|
});
|
|
519
525
|
},
|
|
520
526
|
create: async (data) => {
|
|
@@ -526,7 +532,27 @@ class DeviceGateway extends Object {
|
|
|
526
532
|
}
|
|
527
533
|
return res.data;
|
|
528
534
|
});
|
|
529
|
-
}
|
|
535
|
+
},
|
|
536
|
+
history: async (troubleId) => {
|
|
537
|
+
const axios = await this.context.ready;
|
|
538
|
+
return axios.get(`/api/v3/device/trouble/${troubleId}/handle-records`)
|
|
539
|
+
.then((res) => {
|
|
540
|
+
if (res.data.code !== 200) {
|
|
541
|
+
throw new Error(res.data.message || '获取处理记录失败');
|
|
542
|
+
}
|
|
543
|
+
return res.data;
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
delete: async (troubleIds) => {
|
|
547
|
+
const axios = await this.context.ready;
|
|
548
|
+
return axios.delete('/api/v3/device/trouble/delete', troubleIds)
|
|
549
|
+
.then((res) => {
|
|
550
|
+
if (res.data.code !== 200) {
|
|
551
|
+
throw new Error(res.data.message || '删除故障失败');
|
|
552
|
+
}
|
|
553
|
+
return res.data;
|
|
554
|
+
});
|
|
555
|
+
},
|
|
530
556
|
};
|
|
531
557
|
}
|
|
532
558
|
get troubleLevel() {
|
|
@@ -541,6 +567,30 @@ class DeviceGateway extends Object {
|
|
|
541
567
|
}
|
|
542
568
|
};
|
|
543
569
|
}
|
|
570
|
+
get troubleReason() {
|
|
571
|
+
return {
|
|
572
|
+
list: async () => {
|
|
573
|
+
var axios = await this.context.ready;
|
|
574
|
+
return axios.get('/api/v3/device/trouble-reason');
|
|
575
|
+
},
|
|
576
|
+
create: async (data) => {
|
|
577
|
+
var axios = await this.context.ready;
|
|
578
|
+
return axios.post('/api/v3/device/trouble-reason', data);
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
get troubleEmergency() {
|
|
583
|
+
return {
|
|
584
|
+
list: async () => {
|
|
585
|
+
var axios = await this.context.ready;
|
|
586
|
+
return axios.get('/api/v3/device/trouble-emergency');
|
|
587
|
+
},
|
|
588
|
+
create: async (data) => {
|
|
589
|
+
var axios = await this.context.ready;
|
|
590
|
+
return axios.post('/api/v3/device/trouble-emergency', data);
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
}
|
|
544
594
|
get troubleType() {
|
|
545
595
|
return {
|
|
546
596
|
// 获取根节点(原list方法)
|
|
@@ -597,6 +647,10 @@ class DeviceGateway extends Object {
|
|
|
597
647
|
delete: async (id) => {
|
|
598
648
|
var axios = await this.context.ready;
|
|
599
649
|
return axios.delete(`/api/v3/device/model/${id}`);
|
|
650
|
+
},
|
|
651
|
+
detail: async (id) => {
|
|
652
|
+
var axios = await this.context.ready;
|
|
653
|
+
return axios.get(`/api/v3/device/model/${id}`);
|
|
600
654
|
}
|
|
601
655
|
};
|
|
602
656
|
}
|
|
@@ -612,9 +666,7 @@ class DeviceGateway extends Object {
|
|
|
612
666
|
// 创建维护组
|
|
613
667
|
create: async (factoryId, group) => {
|
|
614
668
|
const axios = await this.context.ready;
|
|
615
|
-
return axios.post(
|
|
616
|
-
params: { factoryId }
|
|
617
|
-
});
|
|
669
|
+
return axios.post(`/api/v3/device/maintenance-groups?factoryId=${factoryId}`, group);
|
|
618
670
|
},
|
|
619
671
|
// 删除维护组
|
|
620
672
|
delete: async (factoryId, groupId) => {
|
|
@@ -622,6 +674,125 @@ class DeviceGateway extends Object {
|
|
|
622
674
|
return axios.delete(`/api/v3/device/maintenance-groups/${groupId}`, {
|
|
623
675
|
params: { factoryId }
|
|
624
676
|
});
|
|
677
|
+
},
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
get maintenanceLevels() {
|
|
681
|
+
return {
|
|
682
|
+
// 获取维护级别列表
|
|
683
|
+
list: async (factoryId) => {
|
|
684
|
+
const axios = await this.context.ready;
|
|
685
|
+
return axios.get('/api/v3/device/maintenance-levels', {
|
|
686
|
+
params: { factoryId }
|
|
687
|
+
});
|
|
688
|
+
},
|
|
689
|
+
create: async (data) => {
|
|
690
|
+
var axios = await this.context.ready;
|
|
691
|
+
return axios.post('/api/v3/device/maintenance-levels', data);
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
get maintenanceTypes() {
|
|
696
|
+
return {
|
|
697
|
+
// 获取维护类型列表
|
|
698
|
+
list: async (factoryId) => {
|
|
699
|
+
const axios = await this.context.ready;
|
|
700
|
+
return axios.get('/api/v3/device/maintenance-types', {
|
|
701
|
+
params: { factoryId }
|
|
702
|
+
});
|
|
703
|
+
},
|
|
704
|
+
create: async (data) => {
|
|
705
|
+
var axios = await this.context.ready;
|
|
706
|
+
return axios.post('/api/v3/device/maintenance-levels', data);
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
get maintenanceFeedbackTypes() {
|
|
711
|
+
return {
|
|
712
|
+
// 获取维护类型列表
|
|
713
|
+
list: async (factoryId) => {
|
|
714
|
+
const axios = await this.context.ready;
|
|
715
|
+
return axios.get('/api/v3/device/maintenance-feedback-types', {
|
|
716
|
+
params: { factoryId }
|
|
717
|
+
});
|
|
718
|
+
},
|
|
719
|
+
create: async (data) => {
|
|
720
|
+
var axios = await this.context.ready;
|
|
721
|
+
return axios.post('/api/v3/device/maintenance-feedback-types', data);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
//维修中状态
|
|
726
|
+
get maintenanceStatus() {
|
|
727
|
+
return {
|
|
728
|
+
list: async () => {
|
|
729
|
+
const axios = await this.context.ready;
|
|
730
|
+
return axios.get('/api/v3/device/maintenance-status');
|
|
731
|
+
},
|
|
732
|
+
create: async (data) => {
|
|
733
|
+
var axios = await this.context.ready;
|
|
734
|
+
return axios.post('/api/v3/device/maintenance-status', data);
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
//外委中状态列表
|
|
739
|
+
get maintenanceOutsourceStatus() {
|
|
740
|
+
return {
|
|
741
|
+
list: async () => {
|
|
742
|
+
const axios = await this.context.ready;
|
|
743
|
+
return axios.get('/api/v3/device/maintenance-outsource-status');
|
|
744
|
+
},
|
|
745
|
+
create: async (data) => {
|
|
746
|
+
var axios = await this.context.ready;
|
|
747
|
+
return axios.post('/api/v3/device/maintenance-outsource-status', data);
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
}
|
|
751
|
+
//故障来源
|
|
752
|
+
get troubleDetectSource() {
|
|
753
|
+
return {
|
|
754
|
+
list: async () => {
|
|
755
|
+
const axios = await this.context.ready;
|
|
756
|
+
return axios.get('/api/v3/device/trouble-detect-source');
|
|
757
|
+
},
|
|
758
|
+
create: async (data) => {
|
|
759
|
+
var axios = await this.context.ready;
|
|
760
|
+
return axios.post('/api/v3/device/trouble-detect-source', data);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
get usage() {
|
|
765
|
+
return {
|
|
766
|
+
/**
|
|
767
|
+
* 获取设备使用情况
|
|
768
|
+
* @param deviceId 设备ID
|
|
769
|
+
* @returns Promise 包含设备使用情况的数据
|
|
770
|
+
*/
|
|
771
|
+
get: async (deviceId) => {
|
|
772
|
+
const axios = await this.context.ready;
|
|
773
|
+
return axios.get(`/api/v3/device/usage/${deviceId}`)
|
|
774
|
+
.then((res) => {
|
|
775
|
+
if (res.data.code !== 200) {
|
|
776
|
+
throw new Error(res.data.message || '获取设备使用情况失败');
|
|
777
|
+
}
|
|
778
|
+
return res.data;
|
|
779
|
+
});
|
|
780
|
+
},
|
|
781
|
+
/**
|
|
782
|
+
* 更新设备使用情况
|
|
783
|
+
* @param deviceId 设备ID
|
|
784
|
+
* @param usageData 使用情况数据
|
|
785
|
+
* @returns Promise 包含更新后的设备使用情况数据
|
|
786
|
+
*/
|
|
787
|
+
update: async (deviceId, usageData) => {
|
|
788
|
+
const axios = await this.context.ready;
|
|
789
|
+
return axios.put(`/api/v3/device/usage/${deviceId}`, usageData)
|
|
790
|
+
.then((res) => {
|
|
791
|
+
if (res.data.code !== 200) {
|
|
792
|
+
throw new Error(res.data.message || '更新设备使用情况失败');
|
|
793
|
+
}
|
|
794
|
+
return res.data;
|
|
795
|
+
});
|
|
625
796
|
}
|
|
626
797
|
};
|
|
627
798
|
}
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,8 @@ const mobile_platform_1 = require("./mobile_platform");
|
|
|
53
53
|
const web_platform_1 = require("./web_platform");
|
|
54
54
|
const production_gateway_1 = require("./production_gateway");
|
|
55
55
|
const purchase_gateway_1 = require("./purchase_gateway");
|
|
56
|
+
const warehouse_gateway_1 = require("./warehouse_gateway");
|
|
57
|
+
const sparepart_gateway_1 = require("./sparepart_gateway");
|
|
56
58
|
class Cpzxrobot {
|
|
57
59
|
constructor(appCode, baseUrl, initSelectedFactory, initSelectedUnit) {
|
|
58
60
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -91,6 +93,8 @@ class Cpzxrobot {
|
|
|
91
93
|
this.energy = new energy_gateway_1.EnergyGateway(this);
|
|
92
94
|
this.camera = new camera_gateway_1.CameraGateway(this);
|
|
93
95
|
this.purchase = new purchase_gateway_1.PurchaseGateway(this);
|
|
96
|
+
this.warehouse = new warehouse_gateway_1.WarehouseGateway(this);
|
|
97
|
+
this.sparepart = new sparepart_gateway_1.SparePartGateway(this);
|
|
94
98
|
}
|
|
95
99
|
exit() {
|
|
96
100
|
if (this.mode === "miniapp_in_app") {
|
package/dist/project_gateway.js
CHANGED
|
@@ -472,5 +472,73 @@ class ProjectGateway extends Object {
|
|
|
472
472
|
},
|
|
473
473
|
};
|
|
474
474
|
}
|
|
475
|
+
get principal() {
|
|
476
|
+
return {
|
|
477
|
+
// 分配负责人
|
|
478
|
+
assign: (args) => {
|
|
479
|
+
return this.context.ready.then((axios) => {
|
|
480
|
+
return axios.post(`/api/v2/coremde-sale/project/principal/assign`, args);
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
get stages() {
|
|
486
|
+
return {
|
|
487
|
+
// 根据项目类型获取配置的阶段
|
|
488
|
+
byType: (projectTypeId) => {
|
|
489
|
+
return this.context.ready.then((axios) => {
|
|
490
|
+
return axios.get(`/api/v2/coremde-sale/project/type/template/${projectTypeId}`);
|
|
491
|
+
});
|
|
492
|
+
},
|
|
493
|
+
// 批量新增阶段模板
|
|
494
|
+
addBatch: (args) => {
|
|
495
|
+
return this.context.ready.then((axios) => {
|
|
496
|
+
return axios.post(`/api/v2/coremde-sale/project/type/template/batchAdd`, args);
|
|
497
|
+
});
|
|
498
|
+
},
|
|
499
|
+
// 批量更新阶段模板
|
|
500
|
+
updateBatch: (args) => {
|
|
501
|
+
return this.context.ready.then((axios) => {
|
|
502
|
+
return axios.post(`/api/v2/coremde-sale/project/type/template/batchUpdate`, args);
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
// 删除项目类型下的所有阶段
|
|
506
|
+
deleteAll: (projectTypeId) => {
|
|
507
|
+
return this.context.ready.then((axios) => {
|
|
508
|
+
return axios.get(`/api/v2/coremde-sale/project/type/template/deleteAll/${projectTypeId}`);
|
|
509
|
+
});
|
|
510
|
+
},
|
|
511
|
+
// 获取模板列表
|
|
512
|
+
list: (args) => {
|
|
513
|
+
return this.context.ready.then((axios) => {
|
|
514
|
+
return axios.post(`/api/v2/coremde-sale/project/stage/template/list`, args);
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
// 获取模板详情
|
|
518
|
+
get: (id) => {
|
|
519
|
+
return this.context.ready.then((axios) => {
|
|
520
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/template/get/${id}`);
|
|
521
|
+
});
|
|
522
|
+
},
|
|
523
|
+
// 添加模板
|
|
524
|
+
add: (args) => {
|
|
525
|
+
return this.context.ready.then((axios) => {
|
|
526
|
+
return axios.post(`/api/v2/coremde-sale/project/stage/template/add`, args);
|
|
527
|
+
});
|
|
528
|
+
},
|
|
529
|
+
// 修改模板
|
|
530
|
+
update: (args) => {
|
|
531
|
+
return this.context.ready.then((axios) => {
|
|
532
|
+
return axios.post(`/api/v2/coremde-sale/project/stage/template/update`, args);
|
|
533
|
+
});
|
|
534
|
+
},
|
|
535
|
+
// 删除模板
|
|
536
|
+
delete: (id) => {
|
|
537
|
+
return this.context.ready.then((axios) => {
|
|
538
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/template/delete/${id}`);
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
}
|
|
475
543
|
}
|
|
476
544
|
exports.ProjectGateway = ProjectGateway;
|
package/dist/purchase_gateway.js
CHANGED
|
@@ -45,5 +45,58 @@ class PurchaseGateway {
|
|
|
45
45
|
params: { id }
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 创建采购配置单
|
|
50
|
+
* @param params 配置单参数
|
|
51
|
+
*/
|
|
52
|
+
async createBomConfig(params) {
|
|
53
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/create", params);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 获取采购配置单列表
|
|
57
|
+
* @param params 查询参数
|
|
58
|
+
*/
|
|
59
|
+
async listBomConfig(params) {
|
|
60
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/list", params);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 获取采购配置单详情
|
|
64
|
+
* @param id 配置单ID
|
|
65
|
+
*/
|
|
66
|
+
async getBomConfig(id) {
|
|
67
|
+
return this.axios.get("/api/v2/coremde-sale/purchase/bom-config/get", {
|
|
68
|
+
params: { id }
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 提交采购配置单变更申请
|
|
73
|
+
* @param params 变更参数
|
|
74
|
+
*/
|
|
75
|
+
async applyBomConfigAdjust(params) {
|
|
76
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply", params);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 审核采购配置单变更申请
|
|
80
|
+
* @param params 审核参数
|
|
81
|
+
*/
|
|
82
|
+
async approveBomConfigAdjust(params) {
|
|
83
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/approve", params);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 获取采购配置单变更记录列表
|
|
87
|
+
* @param params 查询参数
|
|
88
|
+
*/
|
|
89
|
+
async listBomConfigAdjust(params) {
|
|
90
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/list", params);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 获取采购配置单变更记录详情
|
|
94
|
+
* @param id 变更记录ID
|
|
95
|
+
*/
|
|
96
|
+
async getBomConfigAdjust(id) {
|
|
97
|
+
return this.axios.get("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/get", {
|
|
98
|
+
params: { id }
|
|
99
|
+
});
|
|
100
|
+
}
|
|
48
101
|
}
|
|
49
102
|
exports.PurchaseGateway = PurchaseGateway;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SparePartGateway = void 0;
|
|
4
|
+
class SparePartGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
get inventory() {
|
|
10
|
+
return {
|
|
11
|
+
list: async (args) => {
|
|
12
|
+
var axios = await this.context.ready;
|
|
13
|
+
return axios.get('/api/v3/spare-part/inventories', {
|
|
14
|
+
params: args,
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
detail: async (id) => {
|
|
18
|
+
var axios = await this.context.ready;
|
|
19
|
+
return axios.get(`/api/v3/spare-part/inventories/${id}`);
|
|
20
|
+
},
|
|
21
|
+
create: async (data) => {
|
|
22
|
+
var axios = await this.context.ready;
|
|
23
|
+
return axios.post('/api/v3/spare-part/inventories', data);
|
|
24
|
+
},
|
|
25
|
+
update: async (id, data) => {
|
|
26
|
+
var axios = await this.context.ready;
|
|
27
|
+
return axios.put(`/api/v3/spare-part/inventories/${id}`, data);
|
|
28
|
+
},
|
|
29
|
+
delete: async (id) => {
|
|
30
|
+
var axios = await this.context.ready;
|
|
31
|
+
return axios.delete(`/api/v3/spare-part/inventories/${id}`);
|
|
32
|
+
},
|
|
33
|
+
adjust: async (id, quantity) => {
|
|
34
|
+
var axios = await this.context.ready;
|
|
35
|
+
return axios.post(`/api/v3/spare-part/inventories/${id}/adjust`, { quantity });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.SparePartGateway = SparePartGateway;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StageTemplateService = void 0;
|
|
4
|
+
class StageTemplateService {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
this.context = context;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.StageTemplateService = StageTemplateService;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WarehouseGateway = void 0;
|
|
4
|
+
class WarehouseGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
async list() {
|
|
10
|
+
var axios = await this.context.ready;
|
|
11
|
+
return axios.get('/api/v3/warehouses');
|
|
12
|
+
}
|
|
13
|
+
async detail(code) {
|
|
14
|
+
var axios = await this.context.ready;
|
|
15
|
+
return axios.get(`/api/v3/warehouses/${code}`);
|
|
16
|
+
}
|
|
17
|
+
async create(data) {
|
|
18
|
+
var axios = await this.context.ready;
|
|
19
|
+
return axios.post('/api/v3/warehouses', data);
|
|
20
|
+
}
|
|
21
|
+
async update(code, data) {
|
|
22
|
+
var axios = await this.context.ready;
|
|
23
|
+
return axios.put(`/api/v3/warehouses/${code}`, data);
|
|
24
|
+
}
|
|
25
|
+
async toggleStatus(code) {
|
|
26
|
+
var axios = await this.context.ready;
|
|
27
|
+
return axios.put(`/api/v3/warehouses/${code}/toggle-status`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.WarehouseGateway = WarehouseGateway;
|
package/dist/web_platform.js
CHANGED
|
@@ -129,7 +129,8 @@ class WebPlatform {
|
|
|
129
129
|
delete: async (url, data, config) => {
|
|
130
130
|
const response = await this.fetchWithAuth(url, {
|
|
131
131
|
method: 'DELETE',
|
|
132
|
-
headers: config === null || config === void 0 ? void 0 : config.headers
|
|
132
|
+
headers: Object.assign({ 'Content-Type': 'application/json' }, config === null || config === void 0 ? void 0 : config.headers),
|
|
133
|
+
body: JSON.stringify(data)
|
|
133
134
|
});
|
|
134
135
|
return { data: await response.json() };
|
|
135
136
|
},
|
package/index.ts
CHANGED
|
@@ -28,6 +28,8 @@ import { MobilePlatform } from "./mobile_platform";
|
|
|
28
28
|
import { WebPlatform } from "./web_platform";
|
|
29
29
|
import { ProductionGateway } from "./production_gateway";
|
|
30
30
|
import { PurchaseGateway } from "./purchase_gateway";
|
|
31
|
+
import { WarehouseGateway } from "./warehouse_gateway";
|
|
32
|
+
import { SparePartGateway } from "./sparepart_gateway";
|
|
31
33
|
|
|
32
34
|
export class Cpzxrobot {
|
|
33
35
|
private static factorySelectorLoaded = false;
|
|
@@ -70,6 +72,8 @@ export class Cpzxrobot {
|
|
|
70
72
|
system: SystemGateway = new SystemGateway(this);
|
|
71
73
|
production: ProductionGateway = new ProductionGateway(this);
|
|
72
74
|
purchase!: PurchaseGateway;
|
|
75
|
+
warehouse!: WarehouseGateway;
|
|
76
|
+
sparepart!: SparePartGateway;
|
|
73
77
|
sseCallbacks: {
|
|
74
78
|
[key: string]: (data: any) => void;
|
|
75
79
|
} = {};
|
|
@@ -92,6 +96,8 @@ export class Cpzxrobot {
|
|
|
92
96
|
this.energy = new EnergyGateway(this);
|
|
93
97
|
this.camera = new CameraGateway(this);
|
|
94
98
|
this.purchase = new PurchaseGateway(this);
|
|
99
|
+
this.warehouse = new WarehouseGateway(this);
|
|
100
|
+
this.sparepart = new SparePartGateway(this);
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
exit() {
|
package/package.json
CHANGED
package/project_gateway.ts
CHANGED
|
@@ -567,7 +567,7 @@ export class ProjectGateway extends Object {
|
|
|
567
567
|
)
|
|
568
568
|
})
|
|
569
569
|
},
|
|
570
|
-
|
|
570
|
+
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
|
|
@@ -707,4 +707,108 @@ export class ProjectGateway extends Object {
|
|
|
707
707
|
},
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
|
+
|
|
711
|
+
get principal() {
|
|
712
|
+
return {
|
|
713
|
+
// 分配负责人
|
|
714
|
+
assign: (args: {id: number, principalId: number, principalName: string}) => {
|
|
715
|
+
return this.context.ready.then((axios) => {
|
|
716
|
+
return axios.post(
|
|
717
|
+
`/api/v2/coremde-sale/project/principal/assign`,
|
|
718
|
+
args
|
|
719
|
+
)
|
|
720
|
+
})
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
get stages() {
|
|
726
|
+
return {
|
|
727
|
+
// 根据项目类型获取配置的阶段
|
|
728
|
+
byType: (projectTypeId: number) => {
|
|
729
|
+
return this.context.ready.then((axios) => {
|
|
730
|
+
return axios.get(
|
|
731
|
+
`/api/v2/coremde-sale/project/type/template/${projectTypeId}`
|
|
732
|
+
)
|
|
733
|
+
})
|
|
734
|
+
},
|
|
735
|
+
|
|
736
|
+
// 批量新增阶段模板
|
|
737
|
+
addBatch: (args: any) => {
|
|
738
|
+
return this.context.ready.then((axios) => {
|
|
739
|
+
return axios.post(
|
|
740
|
+
`/api/v2/coremde-sale/project/type/template/batchAdd`,
|
|
741
|
+
args
|
|
742
|
+
)
|
|
743
|
+
})
|
|
744
|
+
},
|
|
745
|
+
|
|
746
|
+
// 批量更新阶段模板
|
|
747
|
+
updateBatch: (args: any) => {
|
|
748
|
+
return this.context.ready.then((axios) => {
|
|
749
|
+
return axios.post(
|
|
750
|
+
`/api/v2/coremde-sale/project/type/template/batchUpdate`,
|
|
751
|
+
args
|
|
752
|
+
)
|
|
753
|
+
})
|
|
754
|
+
},
|
|
755
|
+
|
|
756
|
+
// 删除项目类型下的所有阶段
|
|
757
|
+
deleteAll: (projectTypeId: number) => {
|
|
758
|
+
return this.context.ready.then((axios) => {
|
|
759
|
+
return axios.get(
|
|
760
|
+
`/api/v2/coremde-sale/project/type/template/deleteAll/${projectTypeId}`
|
|
761
|
+
)
|
|
762
|
+
})
|
|
763
|
+
},
|
|
764
|
+
|
|
765
|
+
// 获取模板列表
|
|
766
|
+
list: (args: { pageNo: number, pageSize: number, companyId: number }) => {
|
|
767
|
+
return this.context.ready.then((axios) => {
|
|
768
|
+
return axios.post(
|
|
769
|
+
`/api/v2/coremde-sale/project/stage/template/list`,
|
|
770
|
+
args
|
|
771
|
+
)
|
|
772
|
+
})
|
|
773
|
+
},
|
|
774
|
+
|
|
775
|
+
// 获取模板详情
|
|
776
|
+
get: (id: number) => {
|
|
777
|
+
return this.context.ready.then((axios) => {
|
|
778
|
+
return axios.get(
|
|
779
|
+
`/api/v2/coremde-sale/project/stage/template/get/${id}`
|
|
780
|
+
)
|
|
781
|
+
})
|
|
782
|
+
},
|
|
783
|
+
|
|
784
|
+
// 添加模板
|
|
785
|
+
add: (args: { templateName: string, companyId: number, remark?: string }) => {
|
|
786
|
+
return this.context.ready.then((axios) => {
|
|
787
|
+
return axios.post(
|
|
788
|
+
`/api/v2/coremde-sale/project/stage/template/add`,
|
|
789
|
+
args
|
|
790
|
+
)
|
|
791
|
+
})
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
// 修改模板
|
|
795
|
+
update: (args: { id: number, templateName: string, companyId: number, remark?: string }) => {
|
|
796
|
+
return this.context.ready.then((axios) => {
|
|
797
|
+
return axios.post(
|
|
798
|
+
`/api/v2/coremde-sale/project/stage/template/update`,
|
|
799
|
+
args
|
|
800
|
+
)
|
|
801
|
+
})
|
|
802
|
+
},
|
|
803
|
+
|
|
804
|
+
// 删除模板
|
|
805
|
+
delete: (id: number) => {
|
|
806
|
+
return this.context.ready.then((axios) => {
|
|
807
|
+
return axios.get(
|
|
808
|
+
`/api/v2/coremde-sale/project/stage/template/delete/${id}`
|
|
809
|
+
)
|
|
810
|
+
})
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
710
814
|
}
|