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

bill_presale_settlement.go 10.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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("bill_presale_settlement", "预售核销单据表").
  9. ChineseName("预售核销单据表").Aliases("预售核销单据").
  10. ID("id", 50).NotNull().Comment("主键ID").ChineseName("主键ID").End().
  11. String("tenant_id", 50).NotNull().Comment("租户ID").ChineseName("租户ID").End().
  12. String("bill_id", 50).NotNull().Comment("单据编号").ChineseName("单据编号").End().
  13. String("bill_type", 20).NotNull().Comment("单据类型").ChineseName("单据类型").End().
  14. String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/COMPLETED已完成/CANCELLED已取消)").ChineseName("单据状态").End().
  15. String("pre_sale_bill_id", 50).NotNull().Comment("原预售单据编号").ChineseName("原预售单据编号").End().
  16. String("store_id", 50).NotNull().Comment("店铺ID").ChineseName("店铺ID").End().
  17. String("company_id", 50).Comment("所属公司ID").ChineseName("所属公司ID").End().
  18. String("business_type_id", 50).Comment("业务类型ID").ChineseName("业务类型ID").End().
  19. String("business_type_name", 100).Comment("业务类型名称").ChineseName("业务类型名称").End().
  20. String("price_type_id", 50).Comment("价格类型ID").ChineseName("价格类型ID").End().
  21. String("price_type_name", 100).Comment("价格类型名称").ChineseName("价格类型名称").End().
  22. String("finance_type_id", 50).Comment("财务类型ID").ChineseName("财务类型ID").End().
  23. String("finance_type_name", 100).Comment("财务类型名称").ChineseName("财务类型名称").End().
  24. Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").ChineseName("登账标识").Aliases("ID").End().
  25. Date("sure_date").Comment("登账日期").ChineseName("登账日期").Aliases("时间").End().
  26. String("verifier", 32).Comment("核销人").ChineseName("核销人").End().
  27. String("product_id", 50).NotNull().Comment("商品ID").ChineseName("商品ID").End().
  28. String("product_code", 50).NotNull().Comment("商品编码").ChineseName("商品编码").Aliases("编码").End().
  29. String("product_name", 200).NotNull().Comment("商品名称").ChineseName("商品名称").Aliases("名称").End().
  30. String("size_code", 10).Comment("尺码代码").ChineseName("尺码代码").End().
  31. String("color_code", 10).Comment("颜色代码").ChineseName("颜色代码").End().
  32. Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").ChineseName("结算数量").End().
  33. Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").ChineseName("折扣率").End().
  34. Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").ChineseName("结算单价").End().
  35. Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").ChineseName("结算金额").End().
  36. String("customer_id", 50).Comment("客户ID").ChineseName("客户ID").End().
  37. String("customer_name", 200).Comment("客户姓名").ChineseName("客户姓名").End().
  38. String("customer_phone", 20).Comment("客户电话").ChineseName("客户电话").End().
  39. String("remark", 500).Comment("备注").ChineseName("备注").End().
  40. String("creator", 32).NotNull().Comment("创建人").ChineseName("创建人").End().
  41. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").ChineseName("创建时间").Aliases("时间").End().
  42. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").ChineseName("更新时间").Aliases("时间").End()
  43. tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
  44. tb.AddIndex("idx_tenant_id", "tenant_id")
  45. tb.AddIndex("idx_bill_type", "bill_type")
  46. tb.AddIndex("idx_bill_status", "bill_status")
  47. tb.AddIndex("idx_pre_sale_bill_id", "pre_sale_bill_id")
  48. tb.AddIndex("idx_store_id", "store_id")
  49. tb.AddIndex("idx_customer_id", "customer_id")
  50. tb.AddIndex("idx_product_id", "product_id")
  51. tb.AddIndex("idx_company_id", "company_id")
  52. tb.AddIndex("idx_sure_status", "sure_status")
  53. r.RegisterTable(tb.Build())
  54. })
  55. }
  56. type BillPresaleSettlement struct {
  57. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  58. TenantID string `gorm:"column:tenant_id;type:varchar(50);not null;comment:租户ID"`
  59. BillID string `gorm:"column:bill_id;type:varchar(50);not null;comment:单据编号"`
  60. BillType string `gorm:"column:bill_type;type:varchar(20);not null;comment:单据类型"`
  61. BillStatus string `gorm:"column:bill_status;type:varchar(20);not null;comment:单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/COMPLETED已完成/CANCELLED已取消)"`
  62. PreSaleBillID string `gorm:"column:pre_sale_bill_id;type:varchar(50);not null;comment:原预售单据编号"`
  63. StoreID string `gorm:"column:store_id;type:varchar(50);not null;comment:店铺ID"`
  64. CompanyID string `gorm:"column:company_id;type:varchar(50);comment:所属公司ID"`
  65. BusinessTypeID string `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
  66. BusinessTypeName string `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
  67. PriceTypeID string `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
  68. PriceTypeName string `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
  69. FinanceTypeID string `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
  70. FinanceTypeName string `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
  71. SureStatus int32 `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
  72. SureDate *time.Time `gorm:"column:sure_date;comment:登账日期"`
  73. Verifier string `gorm:"column:verifier;type:varchar(32);comment:核销人"`
  74. ProductID string `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
  75. ProductCode string `gorm:"column:product_code;type:varchar(50);not null;comment:商品编码"`
  76. ProductName string `gorm:"column:product_name;type:varchar(200);not null;comment:商品名称"`
  77. SizeCode string `gorm:"column:size_code;type:varchar(10);comment:尺码代码"`
  78. ColorCode string `gorm:"column:color_code;type:varchar(10);comment:颜色代码"`
  79. SettlementQty float64 `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
  80. DiscountRate float64 `gorm:"column:discount_rate;type:decimal(5,4);not null;default:0;comment:折扣率"`
  81. SettlementPrice float64 `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
  82. SettlementAmount float64 `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
  83. CustomerID string `gorm:"column:customer_id;type:varchar(50);comment:客户ID"`
  84. CustomerName string `gorm:"column:customer_name;type:varchar(200);comment:客户姓名"`
  85. CustomerPhone string `gorm:"column:customer_phone;type:varchar(20);comment:客户电话"`
  86. Remark string `gorm:"column:remark;type:varchar(500);comment:备注"`
  87. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  88. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  89. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  90. }
  91. type BillPresaleSettlementDB struct {
  92. ID string `db:"id" json:"id"`
  93. TenantID string `db:"tenant_id" json:"tenantID"`
  94. BillID string `db:"bill_id" json:"billID"`
  95. BillType string `db:"bill_type" json:"billType"`
  96. BillStatus string `db:"bill_status" json:"billStatus"`
  97. PreSaleBillID string `db:"pre_sale_bill_id" json:"preSaleBillID"`
  98. StoreID string `db:"store_id" json:"storeID"`
  99. CompanyID string `db:"company_id" json:"companyID"`
  100. BusinessTypeID string `db:"business_type_id" json:"businessTypeID"`
  101. BusinessTypeName string `db:"business_type_name" json:"businessTypeName"`
  102. PriceTypeID string `db:"price_type_id" json:"priceTypeID"`
  103. PriceTypeName string `db:"price_type_name" json:"priceTypeName"`
  104. FinanceTypeID string `db:"finance_type_id" json:"financeTypeID"`
  105. FinanceTypeName string `db:"finance_type_name" json:"financeTypeName"`
  106. SureStatus int32 `db:"sure_status" json:"sureStatus"`
  107. SureDate *time.Time `db:"sure_date" json:"sureDate"`
  108. Verifier string `db:"verifier" json:"verifier"`
  109. ProductID string `db:"product_id" json:"productID"`
  110. ProductCode string `db:"product_code" json:"productCode"`
  111. ProductName string `db:"product_name" json:"productName"`
  112. SizeCode string `db:"size_code" json:"sizeCode"`
  113. ColorCode string `db:"color_code" json:"colorCode"`
  114. SettlementQty float64 `db:"settlement_qty" json:"settlementQty"`
  115. DiscountRate float64 `db:"discount_rate" json:"discountRate"`
  116. SettlementPrice float64 `db:"settlement_price" json:"settlementPrice"`
  117. SettlementAmount float64 `db:"settlement_amount" json:"settlementAmount"`
  118. CustomerID string `db:"customer_id" json:"customerID"`
  119. CustomerName string `db:"customer_name" json:"customerName"`
  120. CustomerPhone string `db:"customer_phone" json:"customerPhone"`
  121. Remark string `db:"remark" json:"remark"`
  122. Creator string `db:"creator" json:"creator"`
  123. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  124. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  125. }
  126. func (BillPresaleSettlement) TableName() string {
  127. return "bill_presale_settlement"
  128. }