package models // PurchaseOrder 采购订单主表 type PurchaseOrder struct { ID int64 `json:"id" gorm:"primarykey;comment:采购单ID"` PoNo string `json:"po_no" gorm:"size:100;not null;default:'';uniqueIndex;comment:采购单号(唯一)"` SupplierID int64 `json:"supplier_id" gorm:"not null;default:0;index;comment:供应商ID"` WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;comment:预计入库仓库ID"` OrderDate int64 `json:"order_date" gorm:"not null;default:0;comment:订单日期时间戳(秒)"` ExpectedArrivalDate int64 `json:"expected_arrival_date" gorm:"not null;default:0;comment:预计到货日期时间戳(秒)"` TotalAmount int64 `json:"total_amount" gorm:"not null;default:0;comment:采购总金额(单位:分)"` Status int8 `json:"status" gorm:"not null;default:1;index;comment:状态(1:草稿/draft, 2:已提交/submitted, 3:已审核/approved, 4:部分收货/partial_received, 5:已收货/received, 6:已取消/cancelled)"` Creator string `json:"creator" gorm:"size:100;not null;default:'';comment:创建人"` CreatorID int64 `json:"creator_id" gorm:"not null;default:0;comment:创建人ID"` Remark string `json:"remark" gorm:"size:255;not null;default:'';comment:备注"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` IsDel int8 `json:"is_del" gorm:"not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` } func (PurchaseOrder) TableName() string { return "purchase_order" } func (PurchaseOrder) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='采购订单主表'" }