@cpzxrobot/sdk 1.2.61 → 1.2.63
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/construction_gateway.ts +51 -0
- package/contract_gateway.readme.md +193 -0
- package/contract_gateway.ts +22 -0
- package/dist/construction_gateway.js +35 -0
- package/dist/contract_gateway.js +10 -0
- package/dist/energy_gateway.js +1 -1
- package/dist/index.js +3 -1
- package/dist/project_gateway.js +31 -1
- package/energy_gateway.ts +1 -1
- package/index.ts +3 -1
- package/package.json +1 -1
- package/project_gateway.readme.md +86 -0
- package/project_gateway.ts +54 -1
- package/readme.md +2 -138
- package/types.d.ts +2 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Cpzxrobot } from "./types";
|
|
2
|
+
|
|
3
|
+
export class ConstructionGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 创建工程
|
|
13
|
+
* @param args 创建参数
|
|
14
|
+
* @returns Promise
|
|
15
|
+
*/
|
|
16
|
+
add(args: {
|
|
17
|
+
customerId: number;
|
|
18
|
+
name: string;
|
|
19
|
+
groupId: number;
|
|
20
|
+
}) {
|
|
21
|
+
return this.context.ready.then((axios) => {
|
|
22
|
+
return axios.post(`/api/v2/coremde-sale/construction/create`, args);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 分页获取工程列表
|
|
28
|
+
* @param args 查询参数
|
|
29
|
+
* @returns Promise
|
|
30
|
+
*/
|
|
31
|
+
list(args: {
|
|
32
|
+
pageNo: number;
|
|
33
|
+
pageSize: number;
|
|
34
|
+
createTimeStart?: string;
|
|
35
|
+
createTimeEnd?: string;
|
|
36
|
+
companyId?: number;
|
|
37
|
+
customerId?: number;
|
|
38
|
+
}) {
|
|
39
|
+
return this.context.ready.then((axios) => {
|
|
40
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
listAll(args: {
|
|
45
|
+
companyId?: number;
|
|
46
|
+
}) {
|
|
47
|
+
return this.context.ready.then((axios) => {
|
|
48
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# ContractGateway 类文档
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
ContractGateway 是合同管理系统的核心网关类,提供了与合同相关的各种API接口封装。
|
|
5
|
+
|
|
6
|
+
## 主要功能
|
|
7
|
+
|
|
8
|
+
### 基础合同操作
|
|
9
|
+
- `list()`: 获取合同列表
|
|
10
|
+
- `get()`: 获取单个合同详情
|
|
11
|
+
- `add()`: 创建新合同
|
|
12
|
+
- `export()`: 导出合同
|
|
13
|
+
- `approval()`: 合同审批
|
|
14
|
+
- `restart()`: 重新提交合同
|
|
15
|
+
- `types()`: 获取合同类型
|
|
16
|
+
- `confirm()`: 确认合同细节
|
|
17
|
+
|
|
18
|
+
### 子功能模块
|
|
19
|
+
- `project`: 项目合同相关操作
|
|
20
|
+
- `addContract()`: 添加项目合同
|
|
21
|
+
- `addPayment()`: 添加项目回款
|
|
22
|
+
- `listPayments()`: 获取项目回款列表
|
|
23
|
+
- `product`: 产品合同相关操作
|
|
24
|
+
- `addContract()`: 添加产品合同
|
|
25
|
+
- `addPayment()`: 添加产品回款
|
|
26
|
+
- `listPayments()`: 获取产品回款列表
|
|
27
|
+
|
|
28
|
+
## 详细接口说明
|
|
29
|
+
|
|
30
|
+
### 合同基础操作
|
|
31
|
+
```javascript
|
|
32
|
+
// 获取合同列表
|
|
33
|
+
cpzxrobot().contract.list({
|
|
34
|
+
factoryId: number,
|
|
35
|
+
page?: number,
|
|
36
|
+
size?: number
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// 获取合同详情
|
|
40
|
+
cpzxrobot().contract.get(contractId)
|
|
41
|
+
|
|
42
|
+
// 添加合同
|
|
43
|
+
cpzxrobot().contract.add({
|
|
44
|
+
projectId: number,
|
|
45
|
+
contractType: number,
|
|
46
|
+
amount: number,
|
|
47
|
+
startDate: string, // YYYY-MM-DD
|
|
48
|
+
endDate: string, // YYYY-MM-DD
|
|
49
|
+
content: string
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
// 导出合同
|
|
53
|
+
cpzxrobot().contract.export({
|
|
54
|
+
contractId: number,
|
|
55
|
+
fileName?: string
|
|
56
|
+
})
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 合同分组接口
|
|
60
|
+
```javascript
|
|
61
|
+
// 项目相关合同接口
|
|
62
|
+
cpzxrobot().contract.project = {
|
|
63
|
+
// 添加项目合同 (替代原addForProject)
|
|
64
|
+
addContract: (args: any) => Promise<any>
|
|
65
|
+
|
|
66
|
+
// 添加项目回款信息
|
|
67
|
+
addPayment: (args: {
|
|
68
|
+
createTime: string;
|
|
69
|
+
createUserId: number;
|
|
70
|
+
updateTime: string;
|
|
71
|
+
updateUserId: number;
|
|
72
|
+
companyId: number;
|
|
73
|
+
contractId: number;
|
|
74
|
+
receivedPayments: number;
|
|
75
|
+
receivedPerson: string;
|
|
76
|
+
receiveDate: string;
|
|
77
|
+
remark: string;
|
|
78
|
+
}) => Promise<any>
|
|
79
|
+
|
|
80
|
+
// 查看项目回款记录
|
|
81
|
+
listPayments: (id: number) => Promise<any>
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 产品相关合同接口
|
|
85
|
+
cpzxrobot().contract.product = {
|
|
86
|
+
// 添加产品合同 (替代原addForProduct)
|
|
87
|
+
addContract: (args: any) => Promise<any>
|
|
88
|
+
|
|
89
|
+
// 添加产品回款信息
|
|
90
|
+
addPayment: (args: {
|
|
91
|
+
createTime: string;
|
|
92
|
+
createUserId: number;
|
|
93
|
+
updateTime: string;
|
|
94
|
+
updateUserId: number;
|
|
95
|
+
companyId: number;
|
|
96
|
+
contractId: number;
|
|
97
|
+
receivedPayments: number;
|
|
98
|
+
receivedPerson: string;
|
|
99
|
+
receiveDate: string;
|
|
100
|
+
remark: string;
|
|
101
|
+
}) => Promise<any>
|
|
102
|
+
|
|
103
|
+
// 查看产品回款记录
|
|
104
|
+
listPayments: (id: number) => Promise<any>
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 合同审批流程
|
|
109
|
+
```javascript
|
|
110
|
+
// 提交合同审批
|
|
111
|
+
cpzxrobot().contract.approval({
|
|
112
|
+
contractId: number,
|
|
113
|
+
opinion: string
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// 重新提交审批
|
|
117
|
+
cpzxrobot().contract.restart({
|
|
118
|
+
contractId: number,
|
|
119
|
+
reason: string
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// 获取合同类型列表
|
|
123
|
+
cpzxrobot().contract.types(factoryId)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 合同确认接口
|
|
127
|
+
```javascript
|
|
128
|
+
/**
|
|
129
|
+
* 商务部确认合同细节
|
|
130
|
+
* @param args 合同确认参数
|
|
131
|
+
* @returns Promise
|
|
132
|
+
*/
|
|
133
|
+
confirm(args: {
|
|
134
|
+
contractAmount: number;
|
|
135
|
+
contractCost: number;
|
|
136
|
+
contractGrossProfit: number;
|
|
137
|
+
engineeringId: number;
|
|
138
|
+
notes: string;
|
|
139
|
+
projectId: number;
|
|
140
|
+
projectStageRecordId: number;
|
|
141
|
+
projectStageId: number;
|
|
142
|
+
groupId: number;
|
|
143
|
+
projectQuotationDetailIds: number[];
|
|
144
|
+
}) {
|
|
145
|
+
return this.context.ready.then((axios) => {
|
|
146
|
+
return axios.post(`/api/v2/coremde-sale/contract/confirm`, args);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 使用示例
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// 初始化
|
|
155
|
+
const contractGateway = new ContractGateway(context);
|
|
156
|
+
|
|
157
|
+
// 获取合同列表
|
|
158
|
+
contractGateway.list({
|
|
159
|
+
pageNo: 1,
|
|
160
|
+
pageSize: 10,
|
|
161
|
+
name: '测试合同',
|
|
162
|
+
companyId: 123
|
|
163
|
+
}).then(response => {
|
|
164
|
+
console.log(response.data);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// 确认合同细节
|
|
168
|
+
contractGateway.confirm({
|
|
169
|
+
contractAmount: 100000,
|
|
170
|
+
contractCost: 80000,
|
|
171
|
+
contractGrossProfit: 20000,
|
|
172
|
+
engineeringId: 123,
|
|
173
|
+
notes: "合同细节确认",
|
|
174
|
+
projectId: 456,
|
|
175
|
+
projectStageRecordId: 789,
|
|
176
|
+
projectStageId: 101,
|
|
177
|
+
groupId: 1,
|
|
178
|
+
projectQuotationDetailIds: [1, 2, 3]
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// 添加项目合同
|
|
182
|
+
contractGateway.project.addContract({
|
|
183
|
+
projectId: 123,
|
|
184
|
+
contractType: 1,
|
|
185
|
+
amount: 50000
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## 注意事项
|
|
190
|
+
- 所有方法返回Promise对象
|
|
191
|
+
- 需要先初始化context对象
|
|
192
|
+
- 金额参数单位为元
|
|
193
|
+
- 日期参数格式为YYYY-MM-DD
|
package/contract_gateway.ts
CHANGED
|
@@ -60,6 +60,28 @@ export class ContractGateway extends Object {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* 商务部确认合同细节
|
|
65
|
+
* @param args 合同确认参数
|
|
66
|
+
* @returns Promise
|
|
67
|
+
*/
|
|
68
|
+
confirm(args: {
|
|
69
|
+
contractAmount: number;
|
|
70
|
+
contractCost: number;
|
|
71
|
+
contractGrossProfit: number;
|
|
72
|
+
engineeringId: number;
|
|
73
|
+
notes: string;
|
|
74
|
+
projectId: number;
|
|
75
|
+
projectStageRecordId: number;
|
|
76
|
+
projectStageId: number;
|
|
77
|
+
groupId: number;
|
|
78
|
+
projectQuotationDetailIds: number[];
|
|
79
|
+
}) {
|
|
80
|
+
return this.context.ready.then((axios) => {
|
|
81
|
+
return axios.post(`/api/v2/coremde-sale/contract/confirm`, args);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
get project() {
|
|
64
86
|
return {
|
|
65
87
|
addContract: (args: any) => {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConstructionGateway = void 0;
|
|
4
|
+
class ConstructionGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 创建工程
|
|
11
|
+
* @param args 创建参数
|
|
12
|
+
* @returns Promise
|
|
13
|
+
*/
|
|
14
|
+
add(args) {
|
|
15
|
+
return this.context.ready.then((axios) => {
|
|
16
|
+
return axios.post(`/api/v2/coremde-sale/construction/create`, args);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 分页获取工程列表
|
|
21
|
+
* @param args 查询参数
|
|
22
|
+
* @returns Promise
|
|
23
|
+
*/
|
|
24
|
+
list(args) {
|
|
25
|
+
return this.context.ready.then((axios) => {
|
|
26
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
listAll(args) {
|
|
30
|
+
return this.context.ready.then((axios) => {
|
|
31
|
+
return axios.post(`/api/v2/coremde-sale/construction/list`, args);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.ConstructionGateway = ConstructionGateway;
|
package/dist/contract_gateway.js
CHANGED
|
@@ -45,6 +45,16 @@ class ContractGateway extends Object {
|
|
|
45
45
|
return axios.get(`/api/v2/coremde-sale/contract/types`);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 商务部确认合同细节
|
|
50
|
+
* @param args 合同确认参数
|
|
51
|
+
* @returns Promise
|
|
52
|
+
*/
|
|
53
|
+
confirm(args) {
|
|
54
|
+
return this.context.ready.then((axios) => {
|
|
55
|
+
return axios.post(`/api/v2/coremde-sale/contract/confirm`, args);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
48
58
|
get project() {
|
|
49
59
|
return {
|
|
50
60
|
addContract: (args) => {
|
package/dist/energy_gateway.js
CHANGED
|
@@ -20,7 +20,7 @@ class EnergyGateway extends Object {
|
|
|
20
20
|
* @param type 统计类型
|
|
21
21
|
* @param factoryId 工厂ID
|
|
22
22
|
*/
|
|
23
|
-
async stat(type, factoryId =
|
|
23
|
+
async stat(type, factoryId = undefined) {
|
|
24
24
|
if (!factoryId) {
|
|
25
25
|
var factory = await this.context.user.getSelectedFarm();
|
|
26
26
|
factoryId = factory.id;
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ const logs_gateway_1 = require("./logs_gateway");
|
|
|
46
46
|
const robot_gateway_1 = require("./robot_gateway");
|
|
47
47
|
const quotation_gateway_1 = require("./quotation_gateway");
|
|
48
48
|
const ai_gateway_1 = require("./ai_gateway");
|
|
49
|
+
const construction_gateway_1 = require("./construction_gateway");
|
|
49
50
|
class Cpzxrobot {
|
|
50
51
|
constructor(appCode) {
|
|
51
52
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -65,6 +66,7 @@ class Cpzxrobot {
|
|
|
65
66
|
this.robot = new robot_gateway_1.RobotGateway(this);
|
|
66
67
|
this.quotation = new quotation_gateway_1.QuotationGateway(this);
|
|
67
68
|
this.ai = new ai_gateway_1.AiGateway(this);
|
|
69
|
+
this.construction = new construction_gateway_1.ConstructionGateway(this);
|
|
68
70
|
//获取当前浏览器的域名
|
|
69
71
|
this.ready = new Promise((resolve, reject) => {
|
|
70
72
|
this.resolveReady = resolve;
|
|
@@ -106,7 +108,7 @@ class Cpzxrobot {
|
|
|
106
108
|
};
|
|
107
109
|
const instance = {
|
|
108
110
|
get: async (url, config) => {
|
|
109
|
-
if (config.params) {
|
|
111
|
+
if (config && config.params) {
|
|
110
112
|
url += "?" + new URLSearchParams(config.params).toString();
|
|
111
113
|
delete config.params;
|
|
112
114
|
}
|
package/dist/project_gateway.js
CHANGED
|
@@ -161,9 +161,10 @@ class ProjectGateway extends Object {
|
|
|
161
161
|
return axios.get(`/api/v2/coremde-sale/project/inquiry/get?id=${id}`);
|
|
162
162
|
});
|
|
163
163
|
},
|
|
164
|
+
//申请报价单
|
|
164
165
|
add: (args) => {
|
|
165
166
|
return this.context.ready.then((axios) => {
|
|
166
|
-
return axios.post(`/api/v2/coremde-sale/project/inquiry/
|
|
167
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/apply`, args);
|
|
167
168
|
});
|
|
168
169
|
},
|
|
169
170
|
//重新提交询价审核流程
|
|
@@ -193,6 +194,16 @@ class ProjectGateway extends Object {
|
|
|
193
194
|
params: args
|
|
194
195
|
});
|
|
195
196
|
});
|
|
197
|
+
},
|
|
198
|
+
/**
|
|
199
|
+
* 商务部响应报价申请,制作报价单
|
|
200
|
+
* @param args 报价单参数
|
|
201
|
+
* @returns Promise
|
|
202
|
+
*/
|
|
203
|
+
answer: (args) => {
|
|
204
|
+
return this.context.ready.then((axios) => {
|
|
205
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/answer`, args);
|
|
206
|
+
});
|
|
196
207
|
}
|
|
197
208
|
};
|
|
198
209
|
}
|
|
@@ -239,6 +250,25 @@ class ProjectGateway extends Object {
|
|
|
239
250
|
params: { groupId }
|
|
240
251
|
});
|
|
241
252
|
});
|
|
253
|
+
},
|
|
254
|
+
details: (projectId) => {
|
|
255
|
+
return this.context.ready.then((axios) => {
|
|
256
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
get bom() {
|
|
262
|
+
return {
|
|
263
|
+
/**
|
|
264
|
+
* 技术部制作BOM单
|
|
265
|
+
* @param args BOM配置参数
|
|
266
|
+
* @returns Promise
|
|
267
|
+
*/
|
|
268
|
+
add: (args) => {
|
|
269
|
+
return this.context.ready.then((axios) => {
|
|
270
|
+
return axios.post(`/api/v2/coremde-sale/project/bom-config/create`, args);
|
|
271
|
+
});
|
|
242
272
|
}
|
|
243
273
|
};
|
|
244
274
|
}
|
package/energy_gateway.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class EnergyGateway extends Object {
|
|
|
22
22
|
* @param type 统计类型
|
|
23
23
|
* @param factoryId 工厂ID
|
|
24
24
|
*/
|
|
25
|
-
async stat(type: string, factoryId: number |
|
|
25
|
+
async stat(type: string, factoryId: number | undefined = undefined): Promise<any> {
|
|
26
26
|
if (!factoryId) {
|
|
27
27
|
var factory = await this.context.user.getSelectedFarm();
|
|
28
28
|
factoryId = factory.id;
|
package/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { LogsGateway } from "./logs_gateway";
|
|
|
21
21
|
import { RobotGateway } from "./robot_gateway";
|
|
22
22
|
import { QuotationGateway } from "./quotation_gateway";
|
|
23
23
|
import { AiGateway } from "./ai_gateway";
|
|
24
|
+
import { ConstructionGateway } from "./construction_gateway";
|
|
24
25
|
|
|
25
26
|
export class Cpzxrobot {
|
|
26
27
|
private static factorySelectorLoaded = false;
|
|
@@ -74,6 +75,7 @@ export class Cpzxrobot {
|
|
|
74
75
|
robot: RobotGateway = new RobotGateway(this);
|
|
75
76
|
quotation: QuotationGateway = new QuotationGateway(this);
|
|
76
77
|
ai: AiGateway = new AiGateway(this);
|
|
78
|
+
construction: ConstructionGateway = new ConstructionGateway(this);
|
|
77
79
|
|
|
78
80
|
|
|
79
81
|
constructor(appCode: string) {
|
|
@@ -125,7 +127,7 @@ export class Cpzxrobot {
|
|
|
125
127
|
|
|
126
128
|
const instance = {
|
|
127
129
|
get: async (url: string, config?: any) => {
|
|
128
|
-
if (config.params) {
|
|
130
|
+
if (config && config.params) {
|
|
129
131
|
url += "?" + new URLSearchParams(config.params).toString();
|
|
130
132
|
delete config.params;
|
|
131
133
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# ProjectGateway 类文档
|
|
2
|
+
|
|
3
|
+
## 概述
|
|
4
|
+
ProjectGateway 是项目管理系统的核心网关类,提供了与项目相关的各种API接口封装。
|
|
5
|
+
|
|
6
|
+
## 主要功能模块
|
|
7
|
+
|
|
8
|
+
### 基础项目管理
|
|
9
|
+
- `list()`: 获取项目列表
|
|
10
|
+
- `get()`: 获取单个项目详情
|
|
11
|
+
- `add()`: 创建新项目
|
|
12
|
+
- `update()`: 更新项目信息
|
|
13
|
+
- `delete()`: 删除项目
|
|
14
|
+
|
|
15
|
+
### 子功能模块
|
|
16
|
+
- `feedback`: 项目反馈管理
|
|
17
|
+
- `inquiry`: 项目询盘管理
|
|
18
|
+
- `answer()`: 商务部响应报价申请
|
|
19
|
+
- `document`: 项目文档管理
|
|
20
|
+
- `material`: 项目物料管理
|
|
21
|
+
- `constructionTeam`: 施工队管理
|
|
22
|
+
- `codePrefix`: 项目编码前缀管理
|
|
23
|
+
- `stage`: 项目阶段管理
|
|
24
|
+
- `bom`: BOM单管理
|
|
25
|
+
- `plan`: 项目计划管理
|
|
26
|
+
|
|
27
|
+
## 详细接口说明
|
|
28
|
+
|
|
29
|
+
### inquiry.answer() 方法
|
|
30
|
+
```typescript
|
|
31
|
+
/**
|
|
32
|
+
* 商务部响应报价申请,制作报价单
|
|
33
|
+
* @param args 报价单参数
|
|
34
|
+
* @returns Promise
|
|
35
|
+
*
|
|
36
|
+
* 参数说明:
|
|
37
|
+
* - projectId: 项目ID
|
|
38
|
+
* - projectStageRecordId: 项目阶段记录ID
|
|
39
|
+
* - quotationContent: 报价内容
|
|
40
|
+
* - amount: 金额
|
|
41
|
+
* - quotationCost: 报价成本
|
|
42
|
+
* - quotationGrossProfit: 报价毛利
|
|
43
|
+
* - tax: 税额
|
|
44
|
+
* - taxRatio: 税率
|
|
45
|
+
* - validDay: 有效期天数
|
|
46
|
+
* - projectStageId: 项目阶段ID
|
|
47
|
+
* - groupId: 组ID
|
|
48
|
+
* - materialInfo: 材料信息
|
|
49
|
+
*
|
|
50
|
+
* 使用示例:
|
|
51
|
+
* await projectGateway.inquiry.answer({
|
|
52
|
+
* projectId: 123,
|
|
53
|
+
* projectStageRecordId: 456,
|
|
54
|
+
* quotationContent: "详细报价内容",
|
|
55
|
+
* amount: 10000,
|
|
56
|
+
* quotationCost: 8000,
|
|
57
|
+
* quotationGrossProfit: 2000,
|
|
58
|
+
* tax: 200,
|
|
59
|
+
* taxRatio: 0.02,
|
|
60
|
+
* validDay: 30,
|
|
61
|
+
* projectStageId: 789,
|
|
62
|
+
* groupId: 1,
|
|
63
|
+
* materialInfo: "钢材10吨"
|
|
64
|
+
* });
|
|
65
|
+
*/
|
|
66
|
+
answer: (args: {
|
|
67
|
+
projectId: number;
|
|
68
|
+
projectStageRecordId: number;
|
|
69
|
+
quotationContent: string;
|
|
70
|
+
amount: number;
|
|
71
|
+
quotationCost: number;
|
|
72
|
+
quotationGrossProfit: number;
|
|
73
|
+
tax: number;
|
|
74
|
+
taxRatio: number;
|
|
75
|
+
validDay: number;
|
|
76
|
+
projectStageId: number;
|
|
77
|
+
groupId: number;
|
|
78
|
+
materialInfo: string;
|
|
79
|
+
}) => Promise<any>;
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 注意事项
|
|
83
|
+
- 所有方法返回Promise对象
|
|
84
|
+
- 需要先初始化context对象
|
|
85
|
+
- 金额参数单位为元
|
|
86
|
+
- 日期参数格式为YYYY-MM-DD
|
package/project_gateway.ts
CHANGED
|
@@ -15,6 +15,9 @@ export class ProjectGateway extends Object {
|
|
|
15
15
|
companyId: number;
|
|
16
16
|
projectProgress?: string;
|
|
17
17
|
customerId?: number;
|
|
18
|
+
groupId?: string;
|
|
19
|
+
userId?: number;
|
|
20
|
+
status?: string;
|
|
18
21
|
}) {
|
|
19
22
|
return this.context.ready.then((axios) => {
|
|
20
23
|
return axios.post(`/api/v2/coremde-sale/project/list`, args);
|
|
@@ -205,9 +208,10 @@ export class ProjectGateway extends Object {
|
|
|
205
208
|
return axios.get(`/api/v2/coremde-sale/project/inquiry/get?id=${id}`);
|
|
206
209
|
});
|
|
207
210
|
},
|
|
211
|
+
//申请报价单
|
|
208
212
|
add: (args: any) => {
|
|
209
213
|
return this.context.ready.then((axios) => {
|
|
210
|
-
return axios.post(`/api/v2/coremde-sale/project/inquiry/
|
|
214
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/apply`, args);
|
|
211
215
|
});
|
|
212
216
|
},
|
|
213
217
|
//重新提交询价审核流程
|
|
@@ -237,6 +241,29 @@ export class ProjectGateway extends Object {
|
|
|
237
241
|
params: args
|
|
238
242
|
});
|
|
239
243
|
});
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* 商务部响应报价申请,制作报价单
|
|
247
|
+
* @param args 报价单参数
|
|
248
|
+
* @returns Promise
|
|
249
|
+
*/
|
|
250
|
+
answer: (args: {
|
|
251
|
+
projectId: number;
|
|
252
|
+
projectStageRecordId: number;
|
|
253
|
+
quotationContent: string;
|
|
254
|
+
amount: number;
|
|
255
|
+
quotationCost: number;
|
|
256
|
+
quotationGrossProfit: number;
|
|
257
|
+
tax: number;
|
|
258
|
+
taxRatio: number;
|
|
259
|
+
validDay: number;
|
|
260
|
+
projectStageId: number;
|
|
261
|
+
groupId: number;
|
|
262
|
+
materialInfo: string;
|
|
263
|
+
}) => {
|
|
264
|
+
return this.context.ready.then((axios) => {
|
|
265
|
+
return axios.post(`/api/v2/coremde-sale/project/inquiry/answer`, args);
|
|
266
|
+
});
|
|
240
267
|
}
|
|
241
268
|
};
|
|
242
269
|
}
|
|
@@ -291,6 +318,32 @@ export class ProjectGateway extends Object {
|
|
|
291
318
|
params: { groupId }
|
|
292
319
|
});
|
|
293
320
|
});
|
|
321
|
+
},
|
|
322
|
+
details: (projectId: number) => {
|
|
323
|
+
return this.context.ready.then((axios) => {
|
|
324
|
+
return axios.get(`/api/v2/coremde-sale/project/stage/details?projectId=${projectId}`);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
get bom() {
|
|
331
|
+
return {
|
|
332
|
+
/**
|
|
333
|
+
* 技术部制作BOM单
|
|
334
|
+
* @param args BOM配置参数
|
|
335
|
+
* @returns Promise
|
|
336
|
+
*/
|
|
337
|
+
add: (args: {
|
|
338
|
+
projectId: number;
|
|
339
|
+
projectStageRecordId: number;
|
|
340
|
+
projectStageId: number;
|
|
341
|
+
materialInfo: string;
|
|
342
|
+
groupId: number;
|
|
343
|
+
}) => {
|
|
344
|
+
return this.context.ready.then((axios) => {
|
|
345
|
+
return axios.post(`/api/v2/coremde-sale/project/bom-config/create`, args);
|
|
346
|
+
});
|
|
294
347
|
}
|
|
295
348
|
};
|
|
296
349
|
}
|
package/readme.md
CHANGED
|
@@ -474,6 +474,7 @@ cpzxrobot().user.position.team() // 获取下属团队
|
|
|
474
474
|
```
|
|
475
475
|
|
|
476
476
|
### 项目管理
|
|
477
|
+
- [ProjectGateway 类详细文档](./project_gateway.readme.md)
|
|
477
478
|
#### 项目基础信息
|
|
478
479
|
```javascript
|
|
479
480
|
// 获取项目列表
|
|
@@ -741,144 +742,7 @@ cpzxrobot().quotation.transform(id: number)
|
|
|
741
742
|
```
|
|
742
743
|
|
|
743
744
|
### 合同管理
|
|
744
|
-
|
|
745
|
-
```javascript
|
|
746
|
-
// 获取合同列表
|
|
747
|
-
cpzxrobot().contract.list({
|
|
748
|
-
factoryId: number,
|
|
749
|
-
page?: number,
|
|
750
|
-
size?: number
|
|
751
|
-
})
|
|
752
|
-
|
|
753
|
-
// 获取合同详情
|
|
754
|
-
cpzxrobot().contract.get(contractId)
|
|
755
|
-
|
|
756
|
-
// 添加合同
|
|
757
|
-
cpzxrobot().contract.add({
|
|
758
|
-
projectId: number,
|
|
759
|
-
contractType: number,
|
|
760
|
-
amount: number,
|
|
761
|
-
startDate: string, // YYYY-MM-DD
|
|
762
|
-
endDate: string, // YYYY-MM-DD
|
|
763
|
-
content: string
|
|
764
|
-
})
|
|
765
|
-
|
|
766
|
-
// 导出合同
|
|
767
|
-
cpzxrobot().contract.export({
|
|
768
|
-
contractId: number,
|
|
769
|
-
fileName?: string
|
|
770
|
-
})
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
#### 合同分组接口
|
|
774
|
-
```javascript
|
|
775
|
-
// 项目相关合同接口
|
|
776
|
-
cpzxrobot().contract.project = {
|
|
777
|
-
// 添加项目合同 (替代原addForProject)
|
|
778
|
-
addContract: (args: any) => Promise<any>
|
|
779
|
-
|
|
780
|
-
// 添加项目回款信息
|
|
781
|
-
addPayment: (args: {
|
|
782
|
-
createTime: string;
|
|
783
|
-
createUserId: number;
|
|
784
|
-
updateTime: string;
|
|
785
|
-
updateUserId: number;
|
|
786
|
-
companyId: number;
|
|
787
|
-
contractId: number;
|
|
788
|
-
receivedPayments: number;
|
|
789
|
-
receivedPerson: string;
|
|
790
|
-
receiveDate: string;
|
|
791
|
-
remark: string;
|
|
792
|
-
}) => Promise<any>
|
|
793
|
-
|
|
794
|
-
// 查看项目回款记录
|
|
795
|
-
listPayments: (id: number) => Promise<any>
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
// 产品相关合同接口
|
|
799
|
-
cpzxrobot().contract.product = {
|
|
800
|
-
// 添加产品合同 (替代原addForProduct)
|
|
801
|
-
addContract: (args: any) => Promise<any>
|
|
802
|
-
|
|
803
|
-
// 添加产品回款信息
|
|
804
|
-
addPayment: (args: {
|
|
805
|
-
createTime: string;
|
|
806
|
-
createUserId: number;
|
|
807
|
-
updateTime: string;
|
|
808
|
-
updateUserId: number;
|
|
809
|
-
companyId: number;
|
|
810
|
-
contractId: number;
|
|
811
|
-
receivedPayments: number;
|
|
812
|
-
receivedPerson: string;
|
|
813
|
-
receiveDate: string;
|
|
814
|
-
remark: string;
|
|
815
|
-
}) => Promise<any>
|
|
816
|
-
|
|
817
|
-
// 查看产品回款记录
|
|
818
|
-
listPayments: (id: number) => Promise<any>
|
|
819
|
-
}
|
|
820
|
-
```
|
|
821
|
-
|
|
822
|
-
#### 合同审批流程
|
|
823
|
-
```javascript
|
|
824
|
-
// 提交合同审批
|
|
825
|
-
cpzxrobot().contract.approval({
|
|
826
|
-
contractId: number,
|
|
827
|
-
opinion: string
|
|
828
|
-
})
|
|
829
|
-
|
|
830
|
-
// 重新提交审批
|
|
831
|
-
cpzxrobot().contract.restart({
|
|
832
|
-
contractId: number,
|
|
833
|
-
reason: string
|
|
834
|
-
})
|
|
835
|
-
|
|
836
|
-
// 获取合同类型列表
|
|
837
|
-
cpzxrobot().contract.types(factoryId)
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
#### Deprecated 接口
|
|
841
|
-
```javascript
|
|
842
|
-
// 已废弃 - 请使用contract.project.addContract
|
|
843
|
-
cpzxrobot().contract.addForProject(args: any)
|
|
844
|
-
|
|
845
|
-
// 已废弃 - 请使用contract.product.addContract
|
|
846
|
-
cpzxrobot().contract.addForProduct(args: any)
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
#### 合同关联信息
|
|
850
|
-
```javascript
|
|
851
|
-
// 获取客户列表
|
|
852
|
-
cpzxrobot().customer.list({
|
|
853
|
-
factoryId: number,
|
|
854
|
-
page?: number,
|
|
855
|
-
size?: number
|
|
856
|
-
})
|
|
857
|
-
|
|
858
|
-
// 获取客户详情
|
|
859
|
-
cpzxrobot().customer.get(customerId)
|
|
860
|
-
|
|
861
|
-
// 添加客户
|
|
862
|
-
cpzxrobot().customer.add({
|
|
863
|
-
name: string,
|
|
864
|
-
type: number,
|
|
865
|
-
contact: string,
|
|
866
|
-
mobile: string,
|
|
867
|
-
factoryId: number
|
|
868
|
-
})
|
|
869
|
-
|
|
870
|
-
// 客户拜访记录
|
|
871
|
-
cpzxrobot().customer.visit.add({
|
|
872
|
-
customerId: number,
|
|
873
|
-
content: string
|
|
874
|
-
})
|
|
875
|
-
|
|
876
|
-
// 获取客户拜访列表
|
|
877
|
-
cpzxrobot().customer.visit.list({
|
|
878
|
-
customerId: number,
|
|
879
|
-
page?: number
|
|
880
|
-
})
|
|
881
|
-
```
|
|
745
|
+
- [ContractGateway 类详细文档](./contract_gateway.readme.md) - 包含所有合同管理接口和使用方法
|
|
882
746
|
|
|
883
747
|
#### 公司管理
|
|
884
748
|
```javascript
|
package/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { QuotationGateway } from "./quotation_gateway";
|
|
|
19
19
|
import { AiGateway } from "./ai_gateway";
|
|
20
20
|
import { EnergyGateway } from "./energy_gateway";
|
|
21
21
|
import { type ElectricMeterRate } from "./energy_types/electric_meter_gateway";
|
|
22
|
+
import { ConstructionGateway } from "./construction_gateway";
|
|
22
23
|
|
|
23
24
|
type Device = {
|
|
24
25
|
id: number;
|
|
@@ -347,6 +348,7 @@ class Cpzxrobot {
|
|
|
347
348
|
quotation: QuotationGateway;
|
|
348
349
|
ai: AiGateway;
|
|
349
350
|
energy: EnergyGateway;
|
|
351
|
+
construction: ConstructionGateway;
|
|
350
352
|
dict: (key: string) => any;
|
|
351
353
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
352
354
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|