package models import ( "database/sql" "ims/util/db/dts" "time" "gorm.io/gorm" ) // PurchaseExecution 采购执行 type PurchaseExecution struct { ID uint `json:"id" gorm:"primaryKey"` // 审核ID RequisitionID uint `json:"requisition_id"` // 采购单ID ExecutorID uint `json:"executor_id"` // 采购员ID(员工) DepartmentID uint `json:"department_id"` // 采购归属部门ID PurchasingDate dts.NullDate `json:"purchasing_date"` // 实际采购时间 EstimatedArrivalDate dts.NullDate `json:"estimated_arrival_date"` // 预计到货日期 Result sql.NullString `json:"purchased_result"` // 采购结果 - purchased已采购、sufficient库存充足 Requisition *PurchaseRequisition `json:"requisition,omitempty" gorm:"foreignKey:RequisitionID"` // 所属采购请求 Executor *Employee `json:"executor,omitempty" gorm:"foreignKey:ExecutorID"` // 采购员(员工) Department *Department `json:"department,omitempty" gorm:"foreignKey:DepartmentID"` // 采购归属部门 // 数据操作 CreatedBy uint `json:"created_by"` // 创建者(员工编号) CreatedAt time.Time `json:"created_at"` // 创建时间 UpdatedBy dts.NullUint `json:"updated_by"` // 创建者(员工编号) UpdatedAt dts.NullTime `json:"updated_at" gorm:"autoUpdateTime:false"` // 上次操作时间 DeletedBy dts.NullUint `json:"deleted_by"` // 删除者(员工编号) DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"` // 删除数据时间 Creator *Employee `json:"creator,omitempty" gorm:"foreignKey:CreatedBy"` // 创建数据的员工 Updater *Employee `json:"updater,omitempty" gorm:"foreignKey:UpdatedBy"` // 上次更新数据的员工 Deleter *Employee `json:"deleter,omitempty" gorm:"foreignKey:DeletedBy"` // 删除数据的员工 }