webapp/src/types/task.ts

72 lines
1.8 KiB
TypeScript
Raw Normal View History

// 机器人的具体动作,可以定义为枚举或联合类型
export type RobotAction =
| 'PICKUP'
| 'DROPOFF'
| 'TRANSPORT'
| 'WAIT'
| 'CHARGE'
| 'CLEAN';
// 参数选项接口
export interface ParameterOption {
label: string;
value: string;
}
// 动态参数配置接口
export interface DynamicParameter {
label: string;
type: 'Simple' | 'Select' | 'MultiSelect' | 'Text' | 'Number';
value: string | string[] | number;
required: boolean;
options?: ParameterOption[];
placeholder?: string;
min?: number;
max?: number;
}
// 任务参数 - 支持动态配置
export interface TaskParameters {
startLocation: DynamicParameter; // 起点
endLocation: DynamicParameter; // 终点
waypoint?: DynamicParameter; // 途经点 (可选)
robotAction: DynamicParameter; // 机器人动作
payload: DynamicParameter; // 载荷,比如 '空料架' 或具体的物料ID
locationBay?: DynamicParameter; // 库位 (可选)
[key: string]: DynamicParameter | undefined; // 支持扩展参数
}
// 核心任务对象
export interface Task {
id: string; // 唯一ID例如使用 uuid
name: string; // 任务名称, e.g., "炉前缓存区到热处理上料交接区运输"
label: string;
version: number;
templateName: string;
periodicTask: boolean;
ifEnable: number;
status: number; // 任务当前状态
createDate: string; // 创建时间
remark: string;
parameters: TaskParameters; // 任务的具体执行参数
detail?: TaskDetail; // 任务详情
}
// 任务详情
export interface TaskDetail {
inputParams: InputParam[];
outputParams: any[]; // 根据需要定义
rootBlock: any; // 根据需要定义
}
// 输入参数
export interface InputParam {
name: string;
type: string;
label: string;
required: boolean;
defaultValue: string;
remark: string;
}