Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

purchase_receipt.go 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package tables
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-db/sqldef"
  5. )
  6. func init() {
  7. sqldef.AddRegistration(func(r *sqldef.Registry) {
  8. tb := sqldef.NewTable("purchase_receipt", "采购入库表").
  9. ID("receipt_id", 32).Comment("入库单ID,主键").End().
  10. String("erp_receipt_id", 64).NotNull().Comment("ERP原始入库单号").End().
  11. String("sku_id", 32).NotNull().Comment("商品SKU").End().
  12. String("channel_id", 32).NotNull().Comment("入库渠道/仓库").End().
  13. Int("quantity").NotNull().Default("0").Comment("入库数量").End().
  14. String("tenant_id", 8).NotNull().Comment("租户ID").End().
  15. DateTime("receipt_time").NotNull().Comment("实际入库时间").End().
  16. DateTime("expected_arrival_date").Comment("预计到货日期").End().
  17. DateTime("extracted_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("数据抽取时间").End()
  18. r.RegisterTable(tb.Build())
  19. })
  20. }
  21. // PurchaseReceipt 采购入库表结构体
  22. type PurchaseReceipt struct {
  23. ReceiptID string `gorm:"column:receipt_id;type:varchar(32);primaryKey;not null;comment:入库单ID,主键"`
  24. ErpReceiptID string `gorm:"column:erp_receipt_id;type:varchar(64);not null;comment:ERP原始入库单号;index"`
  25. SkuID string `gorm:"column:sku_id;type:varchar(32);not null;comment:商品SKU;index"`
  26. ChannelID string `gorm:"column:channel_id;type:varchar(32);not null;comment:入库渠道/仓库"`
  27. Quantity int `gorm:"column:quantity;not null;default:0;comment:入库数量"`
  28. ReceiptTime time.Time `gorm:"column:receipt_time;not null;comment:实际入库时间"`
  29. ExpectedArrivalDate time.Time `gorm:"column:expected_arrival_date;comment:预计到货日期"`
  30. ExtractedAt time.Time `gorm:"column:extracted_at;not null;default:CURRENT_TIMESTAMP;comment:数据抽取时间"`
  31. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  32. }
  33. func (PurchaseReceipt) TableName() string {
  34. return "purchase_receipt"
  35. }