@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/purchase_gateway.ts
CHANGED
|
@@ -32,7 +32,7 @@ export class PurchaseGateway {
|
|
|
32
32
|
}) {
|
|
33
33
|
return this.axios.post("/api/v2/coremde-sale/purchase/order/create", params);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
/**
|
|
37
37
|
* 商务部审核采购单
|
|
38
38
|
* @param params 审核参数
|
|
@@ -87,4 +87,104 @@ export class PurchaseGateway {
|
|
|
87
87
|
params: { id }
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 创建采购配置单
|
|
93
|
+
* @param params 配置单参数
|
|
94
|
+
*/
|
|
95
|
+
async createBomConfig(params: {
|
|
96
|
+
taskId: number;
|
|
97
|
+
projectId: number;
|
|
98
|
+
quotationBomConfigId?: number;
|
|
99
|
+
contractId?: number;
|
|
100
|
+
productsInfo: Array<{
|
|
101
|
+
productId: number;
|
|
102
|
+
name: string;
|
|
103
|
+
model: string;
|
|
104
|
+
materialCode: string;
|
|
105
|
+
price: number;
|
|
106
|
+
qty: number;
|
|
107
|
+
unit: string;
|
|
108
|
+
remark?: string;
|
|
109
|
+
}>;
|
|
110
|
+
}) {
|
|
111
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/create", params);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 获取采购配置单列表
|
|
116
|
+
* @param params 查询参数
|
|
117
|
+
*/
|
|
118
|
+
async listBomConfig(params: {
|
|
119
|
+
projectId?: number;
|
|
120
|
+
createTimeStart?: string;
|
|
121
|
+
createTimeEnd?: string;
|
|
122
|
+
pageNo?: number;
|
|
123
|
+
pageSize?: number;
|
|
124
|
+
}) {
|
|
125
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/list", params);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 获取采购配置单详情
|
|
130
|
+
* @param id 配置单ID
|
|
131
|
+
*/
|
|
132
|
+
async getBomConfig(id: number) {
|
|
133
|
+
return this.axios.get("/api/v2/coremde-sale/purchase/bom-config/get", {
|
|
134
|
+
params: { id }
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 提交采购配置单变更申请
|
|
140
|
+
* @param params 变更参数
|
|
141
|
+
*/
|
|
142
|
+
async applyBomConfigAdjust(params: {
|
|
143
|
+
id: number;
|
|
144
|
+
productsInfo: Array<{
|
|
145
|
+
productId: number;
|
|
146
|
+
name: string;
|
|
147
|
+
model: string;
|
|
148
|
+
materialCode: string;
|
|
149
|
+
qty: number;
|
|
150
|
+
unit: string;
|
|
151
|
+
remark?: string;
|
|
152
|
+
}>;
|
|
153
|
+
}) {
|
|
154
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply", params);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 审核采购配置单变更申请
|
|
159
|
+
* @param params 审核参数
|
|
160
|
+
*/
|
|
161
|
+
async approveBomConfigAdjust(params: {
|
|
162
|
+
id: number;
|
|
163
|
+
approveResult: number;
|
|
164
|
+
approveNotes?: string;
|
|
165
|
+
}) {
|
|
166
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/approve", params);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 获取采购配置单变更记录列表
|
|
171
|
+
* @param params 查询参数
|
|
172
|
+
*/
|
|
173
|
+
async listBomConfigAdjust(params: {
|
|
174
|
+
id: number;
|
|
175
|
+
pageNo?: number;
|
|
176
|
+
pageSize?: number;
|
|
177
|
+
}) {
|
|
178
|
+
return this.axios.post("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/list", params);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* 获取采购配置单变更记录详情
|
|
183
|
+
* @param id 变更记录ID
|
|
184
|
+
*/
|
|
185
|
+
async getBomConfigAdjust(id: number) {
|
|
186
|
+
return this.axios.get("/api/v2/coremde-sale/purchase/bom-config/adjust/apply/get", {
|
|
187
|
+
params: { id }
|
|
188
|
+
});
|
|
189
|
+
}
|
|
90
190
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Cpzxrobot } from "./types";
|
|
2
|
+
|
|
3
|
+
export class SparePartGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get inventory() {
|
|
12
|
+
return {
|
|
13
|
+
list: async (args: {
|
|
14
|
+
warehouseId?: string;
|
|
15
|
+
partId?: string;
|
|
16
|
+
}) => {
|
|
17
|
+
var axios = await this.context.ready;
|
|
18
|
+
return axios.get('/api/v3/spare-part/inventories',{
|
|
19
|
+
params: args,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
detail: async (id: string) => {
|
|
23
|
+
var axios = await this.context.ready;
|
|
24
|
+
return axios.get(`/api/v3/spare-part/inventories/${id}`);
|
|
25
|
+
},
|
|
26
|
+
create: async (data: any) => {
|
|
27
|
+
var axios = await this.context.ready;
|
|
28
|
+
return axios.post('/api/v3/spare-part/inventories', data);
|
|
29
|
+
},
|
|
30
|
+
update: async (id: string, data: any) => {
|
|
31
|
+
var axios = await this.context.ready;
|
|
32
|
+
return axios.put(`/api/v3/spare-part/inventories/${id}`, data);
|
|
33
|
+
},
|
|
34
|
+
delete: async (id: string) => {
|
|
35
|
+
var axios = await this.context.ready;
|
|
36
|
+
return axios.delete(`/api/v3/spare-part/inventories/${id}`);
|
|
37
|
+
},
|
|
38
|
+
adjust: async (id: string, quantity: number) => {
|
|
39
|
+
var axios = await this.context.ready;
|
|
40
|
+
return axios.post(`/api/v3/spare-part/inventories/${id}/adjust`, { quantity });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { type ElectricMeterRate } from "./energy_types/electric_meter_gateway";
|
|
|
22
22
|
import { ConstructionGateway } from "./construction_gateway";
|
|
23
23
|
import { SystemGateway } from "./system_gateway";
|
|
24
24
|
import { PlatformInterface } from "./platform_interface";
|
|
25
|
+
import { WarehouseGateway } from "./warehouse_gateway";
|
|
25
26
|
|
|
26
27
|
type Device = {
|
|
27
28
|
id: number;
|
|
@@ -311,6 +312,19 @@ interface MyAxiosInstance {
|
|
|
311
312
|
delete: (url: string, data?: any, config?: any) => Promise<any>;
|
|
312
313
|
}
|
|
313
314
|
|
|
315
|
+
interface Supplier {
|
|
316
|
+
id?: number;
|
|
317
|
+
type?: string; // supplier/customer/outsourcing
|
|
318
|
+
code?: string;
|
|
319
|
+
name: string;
|
|
320
|
+
contact?: string;
|
|
321
|
+
phone?: string;
|
|
322
|
+
address?: string;
|
|
323
|
+
remark?: string;
|
|
324
|
+
createdAt?: Date;
|
|
325
|
+
updatedAt?: Date;
|
|
326
|
+
}
|
|
327
|
+
|
|
314
328
|
interface Assistant {
|
|
315
329
|
info: String;
|
|
316
330
|
status: Number;
|
|
@@ -369,7 +383,7 @@ interface DataQueryArgs {
|
|
|
369
383
|
| "max"
|
|
370
384
|
| "raw"
|
|
371
385
|
| "difference";
|
|
372
|
-
period?: "1mo" | "1d" | "1h" | null; // 统计周期,默认为1d
|
|
386
|
+
period?: "1mo" | "1d" | "1h" | "30m" | "5m" | null; // 统计周期,默认为1d
|
|
373
387
|
offset?: string; // 可以设置统计偏移量,比如设置18h, 则统计从当天晚上6点开始
|
|
374
388
|
[key: string]: any;
|
|
375
389
|
aggerate?: string;
|
|
@@ -404,6 +418,8 @@ class Cpzxrobot {
|
|
|
404
418
|
platform: PlatformInterface;
|
|
405
419
|
production: ProductionGateway;
|
|
406
420
|
purchase: PurchaseGateway;
|
|
421
|
+
warehouse: WarehouseGateway;
|
|
422
|
+
sparepart: SparePartGateway;
|
|
407
423
|
// _getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
408
424
|
// _getSelectedUnitFromMiniApp: () => Promise<Unit>;
|
|
409
425
|
openMiniApp: (url: string) => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Cpzxrobot } from "./types";
|
|
2
|
+
|
|
3
|
+
export class WarehouseGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async list() {
|
|
12
|
+
var axios = await this.context.ready;
|
|
13
|
+
return axios.get('/api/v3/warehouses');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async detail(code: string) {
|
|
17
|
+
var axios = await this.context.ready;
|
|
18
|
+
return axios.get(`/api/v3/warehouses/${code}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async create(data: any) {
|
|
22
|
+
var axios = await this.context.ready;
|
|
23
|
+
return axios.post('/api/v3/warehouses', data);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async update(code: string, data: any) {
|
|
27
|
+
var axios = await this.context.ready;
|
|
28
|
+
return axios.put(`/api/v3/warehouses/${code}`, data);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async toggleStatus(code: string) {
|
|
32
|
+
var axios = await this.context.ready;
|
|
33
|
+
return axios.put(`/api/v3/warehouses/${code}/toggle-status`);
|
|
34
|
+
}
|
|
35
|
+
}
|
package/web_platform.ts
CHANGED
|
@@ -135,7 +135,11 @@ export class WebPlatform implements PlatformInterface {
|
|
|
135
135
|
delete: async (url: string, data?: any, config?: any) => {
|
|
136
136
|
const response = await this.fetchWithAuth(url, {
|
|
137
137
|
method: 'DELETE',
|
|
138
|
-
headers:
|
|
138
|
+
headers: {
|
|
139
|
+
'Content-Type': 'application/json',
|
|
140
|
+
...config?.headers
|
|
141
|
+
},
|
|
142
|
+
body: JSON.stringify(data)
|
|
139
143
|
});
|
|
140
144
|
return { data: await response.json() };
|
|
141
145
|
},
|