68 lines
2.2 KiB
TypeScript
68 lines
2.2 KiB
TypeScript
|
||
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";
|
||
/**
|
||
* demo 开料机处理器
|
||
*
|
||
*
|
||
*/
|
||
export class demoHandleGroupCutting {
|
||
processorName = "cutting"
|
||
processor: StepControllerProcessor<any, any>
|
||
constructor() {
|
||
const demoCallbackModule: ProcessorModule<any, any> = {
|
||
moduleName: "callbackStyle",
|
||
process(input, next, context) {
|
||
|
||
console.log("做优化");
|
||
const _input = input
|
||
const _next = next
|
||
const _context = context
|
||
// 可以在这里调用异步操作
|
||
|
||
Reflect.set(context, 'CallBack', callBack1)
|
||
// 决定是否调用 next
|
||
this.onMessage('测试传消息给处理器');
|
||
|
||
function callBack1(v) {
|
||
console.log('接收到其它模块回传的数据');
|
||
}
|
||
|
||
// 调用 next 继续流程
|
||
return next(input);
|
||
}
|
||
};
|
||
|
||
|
||
this.processor = new StepControllerProcessor<any, any>();
|
||
this.processor.setOnMessageFunc(this.getMessageByModules)
|
||
this.processor.use([
|
||
demoCallbackModule,
|
||
ToolsModule, // 刀库
|
||
CheckMaterial,
|
||
CheckBlocks,
|
||
ResetModelContour,
|
||
Init2VModel,
|
||
RectOptimizeMachineModule, // 优化
|
||
{
|
||
moduleName: "final",
|
||
process(input, next) {
|
||
// 不调用 next,终止流程
|
||
console.log('结束了')
|
||
return next(input);
|
||
}
|
||
}
|
||
])
|
||
|
||
|
||
}
|
||
|
||
getMessageByModules(data) {
|
||
console.log('getMessageByModules', data);
|
||
}
|
||
} |