Compare commits

...

7 Commits
0.1 ... main

Author SHA1 Message Date
xief
92b49c7035 调整文档,改进设计 2025-07-04 16:47:14 +08:00
xief
fd68920e01 更新术语表 2025-07-04 14:45:57 +08:00
xief
1954f8d612 新增处理器类型的定义 2025-07-03 10:26:03 +08:00
xief
4473a9af41 修复发布包引用问题 2025-06-24 15:27:09 +08:00
xief
d73c260fb8 文档更新 2025-06-24 14:45:53 +08:00
xief
79c3284ced 更新文档 2025-06-24 14:36:45 +08:00
xief
c43224ed4a 修复打包引用 2025-06-24 14:21:38 +08:00
8 changed files with 142 additions and 20 deletions

View File

@ -0,0 +1,25 @@
## 生产接口协议
本项目使用typescript编写IDE推荐使用vscode。
### 术语表
| 中文 | CAD | MES | IMES | 备注 |
| --- | --- | --- | --- | --- |
| 房名 | RoomName | roomName | roomName | |
| 柜名 | CabinetName | boxName | bodyName | |
| 小板名 | BoardName | blockName | blockName | |
| 材质 | Material | material | material | |
| 大板名 | 无 | boardName | goodsName | |
| 余料 | 无 | scrap | remain | |
| 排单 | 无 | planOrder |planOrder | |
### 编译与发布
更新 package.json 版本号
```shell
pnpm clean
pnpm build
pnpm release
```
### 开发建议
MES与IMES存在不少命名上的差异可以考虑 接口类型独立, 参数与配置单独创建类型

View File

@ -1,11 +1,13 @@
{ {
"name": "cut-abstractions", "name": "cut-abstractions",
"version": "0.1.1", "version": "0.1.4",
"description": "", "description": "",
"main": "index.ts",
"files": ["dist/**/*"], "files": ["dist/**/*"],
"main":"./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.js",
"exports": { "exports": {
".": "./dist/**/*" ".": "./dist/index.js"
}, },
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",

View File

@ -1,15 +1,29 @@
export class ConfigBase { import { ConfigBase } from "./models/config";
name: string = '';
version:string = '1.0.0';
enable:boolean = true; /**
[key: string]: any; *
*/
export abstract class ProcessorContext<TInput,TOutput,TConfig extends ConfigBase>{
/**
*
*/
public Input?:TInput;
/**
*
*/
public params?:TConfig;
/**
*
*/
public Ouput?:TOutput;
} }
export interface FileOptions { /**
encode?: string; *
addBOM?: boolean; */
} export abstract class ProcessorBase<TInput,TOutput,TConfig extends ConfigBase> {
export interface FileInfo extends FileOptions { public readonly name: string = '';
name: string, public readonly version: string = '1.0.0';
content: string | Blob | Uint8Array, public abstract exec(context:ProcessorContext<TInput,TOutput,TConfig>):Promise<void>|void
} }

4
src/index.ts Normal file
View File

@ -0,0 +1,4 @@
export * from './base';
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,7 +1,48 @@
export abstract class ProcessorBase { import { ProcessorBase } from "./base";
public readonly name: string = ''; import { ConfigBase } from "./models/config";
public readonly version: string = '1.0.0'; import { FileInfo } from "./models/file";
public abstract exec(...args: any[]): any
// todo: 类型参数待补完
export class BlockInfo{
}
export class BlockProcessorConfig extends ConfigBase{
} }
/**
*
*/
export abstract class BlockProcessor extends ProcessorBase<BlockInfo[],BlockInfo[],BlockProcessorConfig>{
}
export class LayoutInput {
}
export class LayoutOutput{
}
export class LyaoutProcessorConfig extends ConfigBase{
}
export abstract class LayoutProcessor extends ProcessorBase<LayoutInput,LayoutOutput,LyaoutProcessorConfig>{
}
export class ExporterInput{
}
export class ExporterProcessorConfig extends ConfigBase{
}
export abstract class ExporterProcessor extends ProcessorBase<ExporterInput,FileInfo,ExporterProcessorConfig>{
}

View File

@ -1,6 +1,6 @@
{ {
"include": ["src"], "include": ["src"],
"exclude": ["samples","tests"], "exclude": ["node_modules","samples","tests"],
"compilerOptions": { "compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */ /* Visit https://aka.ms/tsconfig to read more about this file */