feat RTK轨迹表

This commit is contained in:
Ironsp
2026-09-15 10:02:12 +08:00
parent 386b2742b9
commit 62b8779535
3 changed files with 13 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ const tableSqls = [
const expectedColumns: Record<string, string[]> = { const expectedColumns: Record<string, string[]> = {
project: ['id', 'project_name', 'stake_range', 'total_area', 'start_time', 'end_time', 'total_duration', 'total_compaction_area', 'total_pass_count', 'qualified_rate', 'progress', 'uncompacted_area', 'status', 'created_at', 'updated_at'], project: ['id', 'project_name', 'stake_range', 'total_area', 'start_time', 'end_time', 'total_duration', 'total_compaction_area', 'total_pass_count', 'qualified_rate', 'progress', 'uncompacted_area', 'status', 'created_at', 'updated_at'],
work_record: ['id', 'project_id', 'start_time', 'end_time', 'duration', 'compaction_area', 'pass_count', 'exception_count', 'created_at'], work_record: ['id', 'project_id', 'start_time', 'end_time', 'duration', 'compaction_area', 'pass_count', 'exception_count', 'created_at'],
rtk_track: ['id', 'work_record_id', 'latitude', 'longitude', 'speed', 'heading', 'steel_wheel_temp', 'compaction_value', 'created_at'], rtk_track: ['id', 'work_record_id', 'latitude', 'longitude', 'speed', 'heading', 'steel_wheel_temp', 'compaction_value', 'pass_count', 'qualified_rate', 'created_at'],
warning_record: ['id', 'project_id', 'device_name', 'exception_type', 'exception_level', 'occurred_at', 'site_description', 'disposal_record', 'disposal_type', 'is_read', 'created_at'], warning_record: ['id', 'project_id', 'device_name', 'exception_type', 'exception_level', 'occurred_at', 'site_description', 'disposal_record', 'disposal_type', 'is_read', 'created_at'],
history_report: ['id', 'project_id', 'report_name', 'device_id', 'construction_area', 'start_time', 'end_time', 'duration', 'compaction_area', 'pass_count', 'qualified_rate', 'avg_speed', 'avg_paving_temp', 'avg_compaction', 'exception_count', 'created_at'], history_report: ['id', 'project_id', 'report_name', 'device_id', 'construction_area', 'start_time', 'end_time', 'duration', 'compaction_area', 'pass_count', 'qualified_rate', 'avg_speed', 'avg_paving_temp', 'avg_compaction', 'exception_count', 'created_at'],
} }

View File

@@ -11,12 +11,14 @@ export const rtkTrackTableSql = `CREATE TABLE IF NOT EXISTS rtk_track (
heading REAL, heading REAL,
steel_wheel_temp REAL, steel_wheel_temp REAL,
compaction_value REAL, compaction_value REAL,
pass_count INTEGER DEFAULT 0,
qualified_rate REAL DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (work_record_id) REFERENCES work_record(id) FOREIGN KEY (work_record_id) REFERENCES work_record(id)
)` )`
export interface RtkTrack { export interface RtkTrack {
id?: number // 主键,自增 readonly id?: number // 主键,自增
work_record_id: number // 所属作业记录 ID,关联 work_record.id work_record_id: number // 所属作业记录 ID,关联 work_record.id
latitude?: number // 纬度 latitude?: number // 纬度
longitude?: number // 经度 longitude?: number // 经度
@@ -24,6 +26,8 @@ export interface RtkTrack {
heading?: number // 航向角度(度) heading?: number // 航向角度(度)
steel_wheel_temp?: number // 钢轮温度 steel_wheel_temp?: number // 钢轮温度
compaction_value?: number // 压实度 compaction_value?: number // 压实度
pass_count?: number // 压实遍数,默认 0
qualified_rate?: number // 压实合格率,默认 0
created_at?: string // 创建时间,默认当前时间 created_at?: string // 创建时间,默认当前时间
} }

View File

@@ -72,7 +72,7 @@ async function seedWorkRecord() {
/** /**
* 插入 RTK 轨迹假数据(3条) * 插入 RTK 轨迹假数据(3条)
* 字段:work_record_id / latitude / longitude / speed / heading / steel_wheel_temp / compaction_value * 字段:work_record_id / latitude / longitude / speed / heading / steel_wheel_temp / compaction_value / pass_count / qualified_rate
*/ */
async function seedRtkTrack() { async function seedRtkTrack() {
const data = [ const data = [
@@ -84,6 +84,8 @@ async function seedRtkTrack() {
heading: 90.0, heading: 90.0,
steel_wheel_temp: 65.2, steel_wheel_temp: 65.2,
compaction_value: 92.3, compaction_value: 92.3,
pass_count: 3,
qualified_rate: 92.3,
}, },
{ {
work_record_id: 1, work_record_id: 1,
@@ -93,6 +95,8 @@ async function seedRtkTrack() {
heading: 92.5, heading: 92.5,
steel_wheel_temp: 66.0, steel_wheel_temp: 66.0,
compaction_value: 93.1, compaction_value: 93.1,
pass_count: 4,
qualified_rate: 93.1,
}, },
{ {
work_record_id: 2, work_record_id: 2,
@@ -102,6 +106,8 @@ async function seedRtkTrack() {
heading: 180.0, heading: 180.0,
steel_wheel_temp: 68.5, steel_wheel_temp: 68.5,
compaction_value: 95.0, compaction_value: 95.0,
pass_count: 5,
qualified_rate: 95.0,
}, },
] ]