提交1 bmad搭建与项目启动 - ok

This commit is contained in:
2025-10-17 17:24:56 +08:00
commit ec58562661
686 changed files with 149750 additions and 0 deletions

241
src/types/equipment.ts Normal file
View File

@@ -0,0 +1,241 @@
// 农机负载设备数据类型定义
export interface MountedDevice {
id: string;
machineryId: string; // 所属农机ID
deviceTypeId: string; // 设备类型ID
// 设备信息
deviceName: string;
serialNumber: string; // 设备序列号
// 挂载信息
mountedAt: string; // 挂载时间
unmountedAt?: string; // 拆卸时间
status: 'mounted' | 'unmounted';
// 设备参数配置
parameters: Record<string, any>;
// 备注
remarks?: string;
// 操作记录
operator: string;
createdAt: string;
updatedAt: string;
}
export interface DeviceType {
id: string;
name: string;
category: DeviceCategory;
// 元数据
manufacturer?: string; // 品牌
model?: string; // 型号
communicationProtocol?: string; // 通信协议MQTT, HTTP, RS485等
dataFormat?: string; // 数据格式JSON, XML, Binary等
// 参数定义
parameterDefinitions: ParameterDefinition[];
// 其他
description?: string;
icon?: string;
createdAt: string;
updatedAt: string;
}
export type DeviceCategory =
| '摄像头'
| '北斗终端'
| 'GPS终端'
| '转速传感器'
| '油耗传感器'
| '温度传感器'
| '湿度传感器'
| '深度传感器'
| '流量传感器'
| '其他';
export interface ParameterDefinition {
key: string;
label: string;
type: 'string' | 'number' | 'boolean' | 'select';
required?: boolean;
defaultValue?: any;
options?: { label: string; value: any }[];
unit?: string;
min?: number;
max?: number;
description?: string;
}
// 设备监控数据
export interface DeviceMonitoringData {
deviceId: string;
machineryId: string;
timestamp: string;
data: Record<string, any>;
}
// 实时位置数据
export interface LocationData {
machineryId: string;
latitude: number;
longitude: number;
altitude?: number;
speed?: number; // km/h
heading?: number; // 方位角0-360度
accuracy?: number; // 定位精度,米
timestamp: string;
}
// 工作状态
export interface MachineryWorkState {
machineryId: string;
state: WorkState;
// 工况数据
ignition: boolean; // 点火状态
speed: number; // 行驶速度 km/h
ptoStatus: boolean; // PTO动力输出状态
engineRpm?: number; // 发动机转速
fuelLevel?: number; // 油量百分比
// 作业数据
workingArea?: number; // 作业面积(亩)
workingRate?: number; // 作业速率(亩/小时)
timestamp: string;
}
export type WorkState = '熄火' | '行驶中' | '作业中' | '故障' | '待机';
// 作业轨迹
export interface WorkTrack {
id: string;
machineryId: string;
taskId?: string;
startTime: string;
endTime?: string;
points: LocationData[];
totalDistance?: number; // 总距离,公里
totalArea?: number; // 总作业面积,亩
averageSpeed?: number; // 平均速度 km/h
}
// 故障诊断
export interface FaultDiagnosis {
id: string;
machineryId: string;
machineryName?: string;
// 故障信息
faultCode: string;
faultName: string;
faultLevel: 'info' | 'warning' | 'error' | 'critical';
description: string;
// 诊断结果
diagnosis?: string;
predictedCause?: string;
solution?: string;
knowledgeBaseIds?: string[]; // 关联的知识库
// 时间
detectedAt: string;
resolvedAt?: string;
// 状态
status: '待处理' | '处理中' | '已解决' | '已忽略';
// 处理信息
handler?: string;
handleNotes?: string;
}
// 健康评估
export interface HealthAssessment {
machineryId: string;
machineryName?: string;
// 评估结果
score: number; // 0-100
level: '优秀' | '良好' | '注意' | '警告';
// 评估指标
metrics: {
runningHours: number; // 运行小时数
faultCount: number; // 故障次数
maintenanceScore: number; // 维保得分
workloadScore: number; // 作业负荷得分
};
// 趋势分析
trend: 'improving' | 'stable' | 'declining';
// 建议
recommendations: string[];
assessedAt: string;
assessedBy: string;
}
// 地理坐标点
export interface GeoPoint {
latitude: number;
longitude: number;
}
// 电子围栏
export interface GeoFence {
id: string;
name: string;
type: 'circle' | 'polygon';
// 圆形围栏
center?: GeoPoint;
radius?: number; // 米
// 多边形围栏
points?: GeoPoint[];
// 关联农机
machineryIds: string[];
// 规则
alertOnExit: boolean; // 离开围栏时报警
alertOnEnter: boolean; // 进入围栏时报警
// 工时核算
countWorkHours: boolean; // 是否计算围栏内工时
// 状态
enabled: boolean;
createdAt: string;
updatedAt: string;
createdBy: string;
updatedBy?: string;
}
// 围栏报警记录
export interface GeoFenceAlert {
id: string;
fenceId: string;
fenceName: string;
machineryId: string;
machineryName?: string;
alertType: 'enter' | 'exit';
location: GeoPoint;
alertedAt: string;
// 处理状态
acknowledged: boolean;
acknowledgedBy?: string;
acknowledgedAt?: string;
}