2026-07-28 08:44:54 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ProductRepair 对应 product_repair,保存产品检修过程与结果。
|
|
|
|
|
|
type ProductRepair struct {
|
|
|
|
|
|
Entity // 公共实体字段
|
2026-07-29 14:03:10 +08:00
|
|
|
|
ProductInfoID uint64 `gorm:"column:product_info_id;not null;index;uniqueIndex:idx_pending_product_repair,where:result = 'pending'" json:"product_info_id"` // 产品档案自增主键
|
|
|
|
|
|
RepairNo string `gorm:"column:repair_no;type:varchar(64);not null;uniqueIndex" json:"repair_no"` // 检修单号
|
|
|
|
|
|
RepairType string `gorm:"column:repair_type;type:varchar(32);not null" json:"repair_type"` // 检修类型
|
|
|
|
|
|
StartedAt time.Time `gorm:"column:started_at;type:timestamptz;not null" json:"started_at"` // 开始时间
|
|
|
|
|
|
CompletedAt *time.Time `gorm:"column:completed_at;type:timestamptz" json:"completed_at"` // 完成时间
|
|
|
|
|
|
Result string `gorm:"column:result;type:varchar(32);not null;default:'pending'" json:"result"` // 检修结果
|
|
|
|
|
|
TargetStatus int `gorm:"column:target_status;not null;default:0" json:"target_status"` // 完成后的产品状态
|
|
|
|
|
|
Content string `gorm:"column:content;type:text;not null;default:''" json:"content"` // 检修内容
|
|
|
|
|
|
Operator string `gorm:"column:operator;type:varchar(64);not null;default:''" json:"operator"` // 检修人员
|
|
|
|
|
|
Remark string `gorm:"column:remark;type:text;not null;default:''" json:"remark"` // 备注
|
2026-07-28 08:44:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() { database.AppendMigrate(&ProductRepair{}) }
|
|
|
|
|
|
func (table *ProductRepair) TableName() string { return "product_repair" }
|