2025-07-09 16:36:26 +08:00
|
|
|
|
|
2025-07-14 16:04:08 +08:00
|
|
|
|
import { ProcessorModule, StepControllerProcessor, Processor } from "../../src/device";
|
|
|
|
|
import { RectOptimizeMachineModule } from "../moduleManager/module_RectOptimizeMachine";
|
|
|
|
|
import { ToolsModule } from "../moduleManager/module_tools";
|
|
|
|
|
import { CheckMaterial } from "../moduleManager/module_checkMaterial";
|
|
|
|
|
import { CheckBlocks } from "../moduleManager/module_checkBlocks";
|
|
|
|
|
import { ResetModelContour } from "../moduleManager/module_resetModelContour";
|
|
|
|
|
import { Init2VModel } from "../moduleManager/module_init2VModel";
|
2025-07-09 16:36:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* demo 开料机处理器
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
export class demoHandleGroupCutting {
|
|
|
|
|
processorName = "cutting"
|
|
|
|
|
processor: StepControllerProcessor<any, any>
|
|
|
|
|
constructor() {
|
2025-07-14 16:04:08 +08:00
|
|
|
|
const demoCallbackModule: ProcessorModule<any, any> = {
|
2025-07-09 16:36:26 +08:00
|
|
|
|
moduleName: "callbackStyle",
|
|
|
|
|
process(input, next, context) {
|
|
|
|
|
|
|
|
|
|
console.log("做优化");
|
|
|
|
|
const _input = input
|
2025-07-14 16:04:08 +08:00
|
|
|
|
const _next = next
|
2025-07-09 16:36:26 +08:00
|
|
|
|
const _context = context
|
|
|
|
|
// 可以在这里调用异步操作
|
2025-07-14 16:04:08 +08:00
|
|
|
|
|
2025-07-09 16:36:26 +08:00
|
|
|
|
Reflect.set(context, 'CallBack', callBack1)
|
|
|
|
|
// 决定是否调用 next
|
2025-07-14 16:04:08 +08:00
|
|
|
|
this.onMessage('测试传消息给处理器');
|
|
|
|
|
|
2025-07-09 16:36:26 +08:00
|
|
|
|
function callBack1(v) {
|
2025-07-14 16:04:08 +08:00
|
|
|
|
console.log('接收到其它模块回传的数据');
|
2025-07-09 16:36:26 +08:00
|
|
|
|
}
|
2025-07-14 16:04:08 +08:00
|
|
|
|
|
2025-07-09 16:36:26 +08:00
|
|
|
|
// 调用 next 继续流程
|
|
|
|
|
return next(input);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.processor = new StepControllerProcessor<any, any>();
|
2025-07-14 16:04:08 +08:00
|
|
|
|
this.processor.setOnMessageFunc(this.getMessageByModules)
|
2025-07-09 16:36:26 +08:00
|
|
|
|
this.processor.use([
|
2025-07-14 16:04:08 +08:00
|
|
|
|
demoCallbackModule,
|
|
|
|
|
ToolsModule, // 刀库
|
|
|
|
|
CheckMaterial,
|
|
|
|
|
CheckBlocks,
|
|
|
|
|
ResetModelContour,
|
|
|
|
|
Init2VModel,
|
|
|
|
|
RectOptimizeMachineModule, // 优化
|
2025-07-09 16:36:26 +08:00
|
|
|
|
{
|
|
|
|
|
moduleName: "final",
|
|
|
|
|
process(input, next) {
|
|
|
|
|
// 不调用 next,终止流程
|
|
|
|
|
console.log('结束了')
|
|
|
|
|
return next(input);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
])
|
2025-07-14 16:04:08 +08:00
|
|
|
|
|
|
|
|
|
|
2025-07-09 16:36:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-07-14 16:04:08 +08:00
|
|
|
|
getMessageByModules(data) {
|
|
|
|
|
console.log('getMessageByModules', data);
|
|
|
|
|
}
|
2025-07-09 16:36:26 +08:00
|
|
|
|
}
|