32 lines
2.1 KiB
Go
32 lines
2.1 KiB
Go
package models
|
||
|
||
import "gorm.io/datatypes"
|
||
|
||
// PrintTask 打印任务表
|
||
type PrintTask struct {
|
||
ID int64 `json:"id" gorm:"primarykey;comment:打印任务ID"`
|
||
TaskNo string `json:"task_no" gorm:"size:100;not null;default:'';uniqueIndex;comment:打印任务编号"`
|
||
BusinessType int8 `json:"business_type" gorm:"not null;default:1;comment:业务类型(1:物流面单/shipment_label,2:拣货单/pick_list,3:装箱单/packing_list,4:发票/invoice)"`
|
||
RelatedID int64 `json:"related_id" gorm:"not null;default:0;index;comment:关联业务ID(如出库单ID)"`
|
||
RelatedNo string `json:"related_no" gorm:"size:100;not null;default:'';comment:关联业务单号"`
|
||
PrinterName string `json:"printer_name" gorm:"size:100;not null;default:'';comment:指定打印机"`
|
||
TemplateCode string `json:"template_code" gorm:"size:50;not null;default:'';comment:打印模板编码"`
|
||
PrintData datatypes.JSON `json:"print_data" gorm:"type:json;comment:打印数据快照(JSON格式)"`
|
||
Status int8 `json:"status" gorm:"not null;default:1;index;comment:状态(1:待打印/pending,2:打印中/printing,3:成功/success,4:失败/failed)"`
|
||
RetryCount int `json:"retry_count" gorm:"not null;default:0;comment:重试次数"`
|
||
ErrorMessage string `json:"error_message" gorm:"size:255;not null;default:'';comment:失败原因"`
|
||
Operator string `json:"operator" gorm:"size:100;not null;default:'';comment:操作人"`
|
||
OperatorID int64 `json:"operator_id" gorm:"not null;default:0;comment:操作人ID"`
|
||
CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;index;comment:创建时间戳(秒)"`
|
||
UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"`
|
||
IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"`
|
||
}
|
||
|
||
func (PrintTask) TableName() string {
|
||
return "print_task"
|
||
}
|
||
|
||
func (PrintTask) TableOptions() string {
|
||
return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='打印任务表'"
|
||
}
|