Files
massive-cloud/server/assemblyInspectionJobRunner.ts

37 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 子进程入口:装配检测(STEP + 最近零件 + 统计 / 可选顶点热力)
*/
import 'dotenv/config';
import { runAssemblyInspectionJob, type AssemblyInspectionOptions } from './assemblyInspectionJob.js';
const resultId = Number(process.argv[2]);
const taskId = Number(process.argv[3]);
const raw = process.argv[4] ?? '{}';
if (!Number.isFinite(resultId) || !Number.isFinite(taskId) || resultId <= 0 || taskId <= 0) {
console.error('[AssemblyInspectionJobRunner] 参数: <resultId> <taskId> <jsonOptions>');
process.exit(1);
}
let options: AssemblyInspectionOptions;
try {
options = JSON.parse(raw) as AssemblyInspectionOptions;
} catch {
options = {
samplePoints: 100_000,
toleranceMm: 0.3,
includeVertexHeatmap: false,
};
}
if (options.samplePoints == null) options.samplePoints = 100_000;
if (options.toleranceMm == null) options.toleranceMm = 0.3;
if (options.includeVertexHeatmap == null) options.includeVertexHeatmap = false;
runAssemblyInspectionJob(resultId, taskId, options)
.then(() => process.exit(0))
.catch((e) => {
console.error('[AssemblyInspectionJobRunner]', e);
process.exit(1);
});