调整文档,改进设计

This commit is contained in:
xief 2025-07-04 16:47:14 +08:00
parent fd68920e01
commit 92b49c7035
6 changed files with 54 additions and 50 deletions

View File

@ -2,15 +2,15 @@
本项目使用typescript编写IDE推荐使用vscode。
### 术语表
| 中文 | CAD | MES | IMES | 接口 | 备注 |
| --- | --- | --- | ---| --- | --- |
| 房名 | RoomName | RoomName | roomName |
| 柜名 | CabinetName | BoxName | bodyName |
| 小板名 | BoardName | BlockName | blockName |
| 材质 | Material | Material | material | |
| 大板名 | 无 | BoardName | goodsName | |
| 余料 | 无 | remain/scrap | remain |
| 排单 | 无 | PlanOrder |planOrder |
| 中文 | CAD | MES | IMES | 备注 |
| --- | --- | --- | --- | --- |
| 房名 | RoomName | roomName | roomName | |
| 柜名 | CabinetName | boxName | bodyName | |
| 小板名 | BoardName | blockName | blockName | |
| 材质 | Material | material | material | |
| 大板名 | 无 | boardName | goodsName | |
| 余料 | 无 | scrap | remain | |
| 排单 | 无 | planOrder |planOrder | |
### 编译与发布
@ -21,5 +21,5 @@ pnpm build
pnpm release
```
### 开发
先继承处理器跟参数类型,功能稳定后把参数提交给接口
### 开发建议
MES与IMES存在不少命名上的差异可以考虑 接口类型独立, 参数与配置单独创建类型

View File

@ -1,31 +1,5 @@
/**
* ,线
*/
export class ConfigBase {
name: string = '';
version:string = '1.0.0';
[key: string]: any;
import { ConfigBase } from "./models/config";
/**
*
* @param data
*/
load(data:Record<string,unknown>){
for (const key of Object.getOwnPropertyNames(this).filter(i=>i[0]!=='_')) {
if(data[key]!=undefined){
this[key] = data[key];
}
}
}
/**
* json方法
* @returns
*/
toJson(){
return JSON.stringify(this,(k,v)=>k[0]=='_'?undefined:v);
}
}
/**
*
@ -52,13 +26,4 @@ export abstract class ProcessorBase<TInput,TOutput,TConfig extends ConfigBase> {
public readonly name: string = '';
public readonly version: string = '1.0.0';
public abstract exec(context:ProcessorContext<TInput,TOutput,TConfig>):Promise<void>|void
}
export interface FileOptions {
encode?: string;
addBOM?: boolean;
}
export interface FileInfo extends FileOptions {
name: string,
content: string | Blob | Uint8Array,
}

View File

@ -1,3 +1,4 @@
export * from './base';
export * from './processors';
export * from './parsers';
export * from './parsers';
export * from './models/config';
export * from './models/file';

28
src/models/config.ts Normal file
View File

@ -0,0 +1,28 @@
/**
* ,线
*/
export class ConfigBase {
name: string = '';
version:string = '1.0.0';
[key: string]: any;
/**
*
* @param data
*/
load(data:Record<string,unknown>){
for (const key of Object.getOwnPropertyNames(this).filter(i=>i[0]!=='_')) {
if(data[key]!=undefined){
this[key] = data[key];
}
}
}
/**
* json方法
* @returns
*/
toJson(){
return JSON.stringify(this,(k,v)=>k[0]=='_'?undefined:v);
}
}

8
src/models/file.ts Normal file
View File

@ -0,0 +1,8 @@
export interface FileOptions {
encode?: string;
addBOM?: boolean;
}
export interface FileInfo extends FileOptions {
name: string,
content: string | Blob | Uint8Array,
}

View File

@ -1,4 +1,6 @@
import { ConfigBase, FileInfo, ProcessorBase } from "./base";
import { ProcessorBase } from "./base";
import { ConfigBase } from "./models/config";
import { FileInfo } from "./models/file";
// todo: 类型参数待补完