87 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

generator client {
provider = "prisma-client-js"
output = "../generated/prisma"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
/// 申请单(“易耗品临时申请”)
model v2_ConsumableTempRequest {
id String @id @default(cuid())
applicantName String? // 申请人姓名(可选)
applicantPhone String // 申请人手机号
department String? // 部门(可选)
reason String? // 申请事由(可选)
neededAt DateTime? // 期望领用时间(可选)
status v2_ConsumableTempRequestStatus @default(PENDING)
approverId String? // 审批人可选员工ID/账号)
approvedAt DateTime? // 审批时间(可选)
remark String? // 备注(可选)
// 一对多:申请单包含多条物料明细
items v2_ConsumableTempRequestItem[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([applicantPhone, createdAt])
@@index([status, createdAt])
// 如需将表名映射为中文(或你既有库的真实表名),取消下一行注释:
@@map("易耗品临时申请")
}
/// 申请明细(易耗品条目)
model v2_ConsumableTempRequestItem {
id String @id @default(cuid())
requestId String
request v2_ConsumableTempRequest @relation(fields: [requestId], references: [id], onDelete: Cascade)
name String // 物料名称(如“打印纸”)
spec String? // 规格/型号如“A4 70g”
quantity Int // 数量
unit String? // 单位(如“包/箱/个”)
estimatedUnitCost Decimal? // 预估单价(可选)
remark String? // 明细备注(可选)
// 如果你有物料目录表,可在此做可选关联(下面给了 Catalog 模型)
catalogId String?
catalog v2_ConsumableTempCatalog? @relation(fields: [catalogId], references: [id])
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([requestId])
@@index([name])
// 如需把表名映射为既有库命名,取消注释并替换:
@@map("易耗品临时申请_易耗品条目")
}
/// 可选:物料目录(如你已有标准物料清单,便于下拉选择)
model v2_ConsumableTempCatalog {
id String @id @default(cuid())
name String
spec String?
unit String?
isActive Boolean @default(true)
// 反向关系:哪些申请明细引用了该条目录
requestItems v2_ConsumableTempRequestItem[]
@@unique([name, spec, unit])
@@index([isActive])
@@map("易耗品目录")
}
enum v2_ConsumableTempRequestStatus {
PENDING // 待审批
APPROVED // 通过
REJECTED // 驳回
CANCELLED // 取消
COMPLETED // 已完成(已领用)
}