feat:提交
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import { test } from '@jest/globals'
|
||||
import { describe, it, expect, test } from 'vitest';
|
||||
import { DemoParser } from '../samples/demoParser';
|
||||
import { ProcessorModule, StepControllerProcessor } from '../src/device';
|
||||
import { ProcessorManager } from '../samples/demoDataHandleServer';
|
||||
import { ProcessorManager } from '../src/device';
|
||||
import { demoHandleGroupCutting } from '../samples/demoDatahandle/demoDataHandle1';
|
||||
import testJson from "./test.json"
|
||||
test('demoParser', () => {
|
||||
const text = `FSTART
|
||||
import { Worker, parentPort } from 'worker_threads';
|
||||
import { UniversalWorker } from '../samples/WorkerHelper';
|
||||
describe('demoParser', () => {
|
||||
const text = `FSTART
|
||||
TD 5
|
||||
G0 X100 Y100 Z10 F8000
|
||||
g0 x100 y100 z18 f8000
|
||||
@@ -14,26 +16,170 @@ g3 x100 y100 z18 i20 j0 f8000
|
||||
TN T2
|
||||
FEND
|
||||
`
|
||||
const demoParser = new DemoParser();
|
||||
const result = demoParser.execTest(text);
|
||||
console.log(result);
|
||||
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);
|
||||
describe('data', async () => {
|
||||
const sysConfig = {
|
||||
placeStyle: 1,
|
||||
boardWidth: 2440,
|
||||
boardLength: 1220,
|
||||
// 测试刀库数据
|
||||
knifeList: [knifeData, knifeData1, knifeData2]
|
||||
}
|
||||
const json = testJson
|
||||
// 创建处理器集合
|
||||
const processorManager = new ProcessorManager<any, any>();
|
||||
// 这里省略了 选择处理器的环节 --这里选了demo开料机
|
||||
const cuttingHandle = new demoHandleGroupCutting()
|
||||
// 注册处理器
|
||||
processorManager.registerProcessor(cuttingHandle.processorName, cuttingHandle.processor)
|
||||
// 使用XX处理器 会返回激活【正在使用】的 处理器
|
||||
let processor = processorManager.useProcessor(cuttingHandle.processorName)
|
||||
// 或者 这样 获取 正在使用的处理器 注:若未执行useProcessor 将会返回 undefind
|
||||
// processor = processorManager.getCurrentProcessor()
|
||||
/** 处理器配置加载 */
|
||||
processor.updateModuleConfig(sysConfig)
|
||||
const res = await processor.process(json)
|
||||
// console.log('处理器所有流程都结束了', res);
|
||||
})
|
||||
|
||||
/** demo 刀具数据 */
|
||||
export const knifeData = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T1",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 5,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T1\nG43 H1\n`,
|
||||
"drillGroupStartCode": "T1",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
export const knifeData1 = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T2",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 6,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
"drillGroupStartCode": "T2",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
export const knifeData2 = {
|
||||
"isEnabled": true,
|
||||
"axleId": 2,
|
||||
"knifeId": 2,
|
||||
"processFace": "",
|
||||
"knifeName": "T3",
|
||||
"knifeType": 3,
|
||||
"ability": [
|
||||
5
|
||||
],
|
||||
"diameter": 6,
|
||||
"length": 20,
|
||||
"sawThiness": 7,
|
||||
"sawDirection": 2,
|
||||
"processDirection": 4,
|
||||
"speed": 0,
|
||||
"stepDepth": 0,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"offsetZ": 0,
|
||||
"baseX": 0,
|
||||
"baseY": 0,
|
||||
"isModularDrill": false,
|
||||
"isPreStartEnabled": false,
|
||||
"preStartAheadActionCount": 5,
|
||||
"isPreStartToolChangeDelay": false,
|
||||
"preStartToolChangeDelayCode": "",
|
||||
"isAxisStartCodePostpost": false,
|
||||
"isAxisStopCodePrepose": false,
|
||||
"drillGroupCode": "",
|
||||
|
||||
})
|
||||
"axisStartCode": "M03 S18000\n",
|
||||
"knifeStartCode": `M06 T2\nG43 H2\n`,
|
||||
"drillGroupStartCode": "T3",
|
||||
"drillGroupEndCode": "",
|
||||
"knifeStopCode": "",
|
||||
"axisStopCode": "M05\n",
|
||||
|
||||
"preStartActionDeferCode": "",
|
||||
"useHolesGroupKnife": false,
|
||||
"preStartActionStepsLimit": "",
|
||||
"knifeNo": "",
|
||||
"editable": true,
|
||||
"isDefaultCutKnife": false,
|
||||
"isPreStartChangeKnifeDefer": false
|
||||
}
|
||||
|
Reference in New Issue
Block a user