feat: 初始化星元智灵人脸识别回收箱项目
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export const people = sqliteTable("people", {
|
||||
id: text("id").primaryKey(),
|
||||
name: text("name").notNull(),
|
||||
workshop: text("workshop").notNull(),
|
||||
role: text("role").notNull(),
|
||||
faceStatus: text("face_status").notNull(),
|
||||
faceVersion: integer("face_version").notNull().default(1),
|
||||
syncStatus: text("sync_status").notNull(),
|
||||
active: integer("active", { mode: "boolean" }).notNull().default(true),
|
||||
updatedAt: integer("updated_at").notNull(),
|
||||
});
|
||||
|
||||
export const workshops = sqliteTable("workshops", {
|
||||
code: text("code").primaryKey(),
|
||||
name: text("name").notNull().unique(),
|
||||
location: text("location").notNull(),
|
||||
note: text("note").notNull(),
|
||||
});
|
||||
|
||||
export const devices = sqliteTable("devices", {
|
||||
id: text("id").primaryKey(),
|
||||
type: text("type").notNull(),
|
||||
ip: text("ip").notNull(),
|
||||
status: text("status").notNull(),
|
||||
lastSeen: integer("last_seen").notNull(),
|
||||
heartbeatSeconds: integer("heartbeat_seconds").notNull(),
|
||||
fillPercent: integer("fill_percent").notNull().default(0),
|
||||
category: text("category").notNull().default(""),
|
||||
});
|
||||
|
||||
export const weighings = sqliteTable("weighings", {
|
||||
id: text("id").primaryKey(),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
operator: text("operator").notNull(),
|
||||
machine: text("machine").notNull(),
|
||||
category: text("category").notNull(),
|
||||
source: text("source").notNull(),
|
||||
weight: real("weight").notNull(),
|
||||
eventId: text("event_id").notNull(),
|
||||
status: text("status").notNull(),
|
||||
});
|
||||
|
||||
export const events = sqliteTable("events", {
|
||||
id: text("id").primaryKey(),
|
||||
operator: text("operator").notNull(),
|
||||
enteredAt: integer("entered_at").notNull(),
|
||||
leftAt: integer("left_at").notNull(),
|
||||
atomicCount: integer("atomic_count").notNull(),
|
||||
scaleTotal: real("scale_total").notNull(),
|
||||
verdict: text("verdict").notNull(),
|
||||
});
|
||||
|
||||
export const reconciliations = sqliteTable("reconciliations", {
|
||||
id: text("id").primaryKey(),
|
||||
eventId: text("event_id").notNull(),
|
||||
category: text("category").notNull(),
|
||||
smallScale: real("small_scale").notNull(),
|
||||
floorScale: real("floor_scale").notNull(),
|
||||
difference: real("difference").notNull(),
|
||||
differenceRate: real("difference_rate").notNull(),
|
||||
verdict: text("verdict").notNull(),
|
||||
storageStatus: text("storage_status").notNull(),
|
||||
});
|
||||
|
||||
export const traces = sqliteTable("traces", {
|
||||
id: text("id").primaryKey(),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
workshop: text("workshop").notNull(),
|
||||
taskId: text("task_id").notNull(),
|
||||
rfid: text("rfid").notNull(),
|
||||
batch: text("batch").notNull(),
|
||||
tare: real("tare").notNull(),
|
||||
gross: real("gross").notNull(),
|
||||
net: real("net").notNull(),
|
||||
machine: text("machine").notNull(),
|
||||
operator: text("operator").notNull(),
|
||||
mesStatus: text("mes_status").notNull(),
|
||||
});
|
||||
|
||||
export const rfidTags = sqliteTable("rfid_tags", {
|
||||
id: text("id").primaryKey(),
|
||||
status: text("status").notNull(),
|
||||
name: text("name").notNull(),
|
||||
lastChecked: integer("last_checked"),
|
||||
});
|
||||
|
||||
export const alerts = sqliteTable("alerts", {
|
||||
id: text("id").primaryKey(),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
type: text("type").notNull(),
|
||||
severity: text("severity").notNull(),
|
||||
source: text("source").notNull(),
|
||||
reference: text("reference").notNull(),
|
||||
description: text("description").notNull(),
|
||||
status: text("status").notNull(),
|
||||
});
|
||||
|
||||
export const settings = sqliteTable("settings", {
|
||||
key: text("key").primaryKey(),
|
||||
value: text("value").notNull(),
|
||||
updatedAt: integer("updated_at").notNull(),
|
||||
});
|
||||
|
||||
export const auditLogs = sqliteTable("audit_logs", {
|
||||
id: text("id").primaryKey(),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
actor: text("actor").notNull(),
|
||||
action: text("action").notNull(),
|
||||
details: text("details").notNull(),
|
||||
level: text("level").notNull(),
|
||||
});
|
||||
|
||||
export const deliveries = sqliteTable("deliveries", {
|
||||
recordId: text("record_id").primaryKey(),
|
||||
deviceId: text("device_id").notNull(),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
employeeName: text("employee_name").notNull(),
|
||||
employeeNo: text("employee_no").notNull(),
|
||||
machineNo: text("machine_no").notNull(),
|
||||
productionBatch: text("production_batch").notNull(),
|
||||
garbageType: integer("garbage_type").notNull(),
|
||||
weight: real("weight").notNull(),
|
||||
payload: text("payload").notNull(),
|
||||
status: text("status").notNull(),
|
||||
});
|
||||
Reference in New Issue
Block a user