feat:处理器初步实现---有接上了新优化,回显需要再看下
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { test } from '@jest/globals'
|
||||
import { DemoParser } from '../samples/demoParser';
|
||||
import { ProcessorModule, StepControllerProcessor } from '../src/device';
|
||||
import { ProcessorManager } from '../samples/demoDataHandleServer';
|
||||
import { demoHandleGroupCutting } from '../samples/demoDatahandle/demoDataHandle1';
|
||||
import testJson from "./test.json"
|
||||
test('demoParser', () => {
|
||||
const text = `FSTART
|
||||
TD 5
|
||||
@@ -13,4 +17,23 @@ FEND
|
||||
const demoParser = new DemoParser();
|
||||
const result = demoParser.execTest(text);
|
||||
console.log(result);
|
||||
|
||||
|
||||
})
|
||||
|
||||
test('data', async () => {
|
||||
const json = testJson
|
||||
// 创建处理器集合
|
||||
const processorManager = new ProcessorManager<any, any>();
|
||||
// 这里省略了 选择处理器的环节 --这里选了demo开料机
|
||||
const cuttingHandle = new demoHandleGroupCutting()
|
||||
// 注册处理器
|
||||
processorManager.registerProcessor(cuttingHandle.processorName, cuttingHandle.processor)
|
||||
// 使用XX处理器 会返回激活【正在使用】的 处理器
|
||||
const processor = processorManager.useProcessor(cuttingHandle.processorName)
|
||||
|
||||
const res = await processor.process(json)
|
||||
console.log('处理器所有流程都结束了', res);
|
||||
|
||||
|
||||
})
|
29439
tests/test.json
Normal file
29439
tests/test.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user