feat: add inspection object resource workflow
This commit is contained in:
@@ -50,6 +50,25 @@ export const vehicleModels = mysqlTable("vehicle_models", {
|
||||
export type VehicleModel = typeof vehicleModels.$inferSelect;
|
||||
export type InsertVehicleModel = typeof vehicleModels.$inferInsert;
|
||||
|
||||
// ─── 检测对象 ────────────────────────────────────────────────────────────────
|
||||
// 车型下真正执行检测的对象,例如头车、中间车。默认资源只影响新建任务。
|
||||
export const inspectionObjects = mysqlTable("inspection_objects", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
modelId: int("modelId").notNull(),
|
||||
name: varchar("name", { length: 100 }).notNull(),
|
||||
description: text("description"),
|
||||
status: mysqlEnum("status", ["draft", "active"]).default("draft").notNull(),
|
||||
defaultModelPointcloudId: int("defaultModelPointcloudId"),
|
||||
defaultModelCadFileId: int("defaultModelCadFileId"),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updatedAt").defaultNow().onUpdateNow().notNull(),
|
||||
}, (table) => ({
|
||||
modelNameUnique: uniqueIndex("uk_inspection_objects_model_name").on(table.modelId, table.name),
|
||||
}));
|
||||
|
||||
export type InspectionObject = typeof inspectionObjects.$inferSelect;
|
||||
export type InsertInspectionObject = typeof inspectionObjects.$inferInsert;
|
||||
|
||||
// ─── 车型 CAD 文件 ─────────────────────────────────────────────────────────────
|
||||
// 一个车型可关联多个 CAD 文件(车头、车身、转向架等),低频变更
|
||||
|
||||
@@ -60,12 +79,21 @@ export const modelCadFiles = mysqlTable("model_cad_files", {
|
||||
format: varchar("format", { length: 32 }).notNull(),
|
||||
fileSize: bigint("fileSize", { mode: "number" }).notNull(),
|
||||
filePath: varchar("filePath", { length: 512 }).notNull(),
|
||||
contentScope: mysqlEnum("contentScope", ["whole_vehicle"]).default("whole_vehicle").notNull(),
|
||||
status: mysqlEnum("status", ["available", "disabled"]).default("available").notNull(),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
});
|
||||
|
||||
export type ModelCadFile = typeof modelCadFiles.$inferSelect;
|
||||
export type InsertModelCadFile = typeof modelCadFiles.$inferInsert;
|
||||
|
||||
export const modelCadInspectionObjects = mysqlTable("model_cad_inspection_objects", {
|
||||
cadFileId: int("cadFileId").notNull(),
|
||||
inspectionObjectId: int("inspectionObjectId").notNull(),
|
||||
}, (table) => ({
|
||||
cadObjectUnique: uniqueIndex("uk_model_cad_inspection_object").on(table.cadFileId, table.inspectionObjectId),
|
||||
}));
|
||||
|
||||
// ─── 车型点云文件 ─────────────────────────────────────────────────────────────
|
||||
// 一个车型可维护多个通用点云文件,供任务按需关联复用
|
||||
|
||||
@@ -75,6 +103,8 @@ export const modelPointcloudFiles = mysqlTable("model_pointcloud_files", {
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
fileSize: bigint("fileSize", { mode: "number" }).notNull(),
|
||||
filePath: varchar("filePath", { length: 512 }).notNull(),
|
||||
inspectionObjectId: int("inspectionObjectId"),
|
||||
status: mysqlEnum("status", ["available", "disabled"]).default("available").notNull(),
|
||||
metadataStatus: mysqlEnum("metadataStatus", ["pending", "ready", "unsupported", "error"]).default("pending").notNull(),
|
||||
pointCount: bigint("pointCount", { mode: "number" }),
|
||||
pointAttributes: json("pointAttributes").$type<PointAttribute[]>(),
|
||||
@@ -113,6 +143,7 @@ export type InsertTaskCadFile = typeof taskCadFiles.$inferInsert;
|
||||
export const inspectionTasks = mysqlTable("inspection_tasks", {
|
||||
id: int("id").autoincrement().primaryKey(),
|
||||
modelId: int("modelId").notNull(),
|
||||
inspectionObjectId: int("inspectionObjectId"),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
inspector: varchar("inspector", { length: 100 }),
|
||||
notes: text("notes"),
|
||||
|
||||
Reference in New Issue
Block a user