Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bill_purchase_plan.go 9.5KB

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_purchase_plan", "采购计划单据表 - 记录商品采购计划信息,用于指导采购活动").
  9. ID("id", 50).NotNull().Comment("主键ID").End().
  10. String("bill_id", 50).NotNull().Comment("单据编号").End().
  11. String("bill_type", 20).NotNull().Default("'PURCHASE_PLAN'").Comment("单据类型 (PURCHASE_PLAN采购计划)").End().
  12. String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/APPROVED已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)").End().
  13. String("from_store_id", 50).Comment("发货门店ID").End().
  14. String("to_store_id", 50).NotNull().Comment("收货门店ID").End().
  15. String("from_company_id", 50).Comment("发货方公司ID").End().
  16. String("to_company_id", 50).Comment("收货方公司ID").End().
  17. String("product_id", 50).NotNull().Comment("商品ID").End().
  18. Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").End().
  19. Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").End().
  20. Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").End().
  21. Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").End().
  22. Date("expected_delivery_date").Comment("预计交货日期").End().
  23. String("purpose", 20).Comment("采购用途 (STOCK补货/NEW_PRODUCT新品/REPLACEMENT替换/PROMOTION促销)").End().
  24. String("priority", 20).Comment("优先级 (HIGH高/MEDIUM中/LOW低)").End().
  25. String("business_type_id", 50).Comment("业务类型ID").End().
  26. String("business_type_name", 100).Comment("业务类型名称").End().
  27. String("price_type_id", 50).Comment("价格类型ID").End().
  28. String("price_type_name", 100).Comment("价格类型名称").End().
  29. String("finance_type_id", 50).Comment("财务类型ID").End().
  30. String("finance_type_name", 100).Comment("财务类型名称").End().
  31. Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").End().
  32. Date("sure_date").Comment("登账日期").End().
  33. String("remark", 500).Comment("备注").End().
  34. String("creator", 32).NotNull().Comment("创建人").End().
  35. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  36. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End().
  37. Date("data_date").NotNull().Comment("数据日期 (数据仓库快照)").End()
  38. tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
  39. tb.AddIndex("idx_bill_status", "bill_status")
  40. tb.AddIndex("idx_from_store_id", "from_store_id")
  41. tb.AddIndex("idx_to_store_id", "to_store_id")
  42. tb.AddIndex("idx_document_date", "document_date")
  43. tb.AddIndex("idx_product_id", "product_id")
  44. tb.AddIndex("idx_data_date", "data_date")
  45. tb.AddIndex("idx_from_company_id", "from_company_id")
  46. tb.AddIndex("idx_to_company_id", "to_company_id")
  47. tb.AddIndex("idx_sure_status", "sure_status")
  48. r.RegisterTable(tb.Build())
  49. })
  50. }
  51. type BillPurchasePlan struct {
  52. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  53. BillID string `gorm:"column:bill_id;type:varchar(50);not null;comment:单据编号"`
  54. BillType string `gorm:"column:bill_type;type:varchar(20);not null;default:PURCHASE_PLAN;comment:单据类型 (PURCHASE_PLAN采购计划)"`
  55. BillStatus string `gorm:"column:bill_status;type:varchar(20);not null;comment:单据状态 (DRAFT草稿/APPROVED已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)"`
  56. FromStoreID string `gorm:"column:from_store_id;type:varchar(50);comment:发货门店ID"`
  57. ToStoreID string `gorm:"column:to_store_id;type:varchar(50);not null;comment:收货门店ID"`
  58. FromCompanyID string `gorm:"column:from_company_id;type:varchar(50);comment:发货方公司ID"`
  59. ToCompanyID string `gorm:"column:to_company_id;type:varchar(50);comment:收货方公司ID"`
  60. ProductID string `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
  61. SettlementQty float64 `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
  62. SettlementPrice float64 `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
  63. DiscountRate float64 `gorm:"column:discount_rate;type:decimal(5,4);not null;default:0;comment:折扣率"`
  64. SettlementAmount float64 `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
  65. SupplierID string `gorm:"column:supplier_id;type:varchar(50);comment:建议供应商ID"`
  66. SupplierCode string `gorm:"column:supplier_code;type:varchar(50);comment:建议供应商编码"`
  67. SupplierName string `gorm:"column:supplier_name;type:varchar(200);comment:建议供应商名称"`
  68. ExpectedDeliveryDate *time.Time `gorm:"column:expected_delivery_date;type:date;comment:预计交货日期"`
  69. Purpose string `gorm:"column:purpose;type:varchar(20);comment:采购用途 (STOCK补货/NEW_PRODUCT新品/REPLACEMENT替换/PROMOTION促销)"`
  70. Priority string `gorm:"column:priority;type:varchar(20);comment:优先级 (HIGH高/MEDIUM中/LOW低)"`
  71. BusinessTypeID string `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
  72. BusinessTypeName string `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
  73. PriceTypeID string `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
  74. PriceTypeName string `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
  75. FinanceTypeID string `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
  76. FinanceTypeName string `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
  77. SureStatus int32 `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
  78. SureDate *time.Time `gorm:"column:sure_date;comment:登账日期"`
  79. Remark string `gorm:"column:remark;type:varchar(500);comment:备注"`
  80. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  81. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  82. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  83. DataDate time.Time `gorm:"column:data_date;type:date;not null;comment:数据日期 (数据仓库快照)"`
  84. }
  85. type BillPurchasePlanDB struct {
  86. ID string `db:"id" json:"id"`
  87. BillID string `db:"bill_id" json:"billID"`
  88. BillType string `db:"bill_type" json:"billType"`
  89. BillStatus string `db:"bill_status" json:"billStatus"`
  90. FromStoreID string `db:"from_store_id" json:"fromStoreID"`
  91. ToStoreID string `db:"to_store_id" json:"toStoreID"`
  92. FromCompanyID string `db:"from_company_id" json:"fromCompanyID"`
  93. ToCompanyID string `db:"to_company_id" json:"toCompanyID"`
  94. DocumentDate time.Time `db:"document_date" json:"documentDate"`
  95. DocumentTime time.Time `db:"document_time" json:"documentTime"`
  96. ProductID string `db:"product_id" json:"productID"`
  97. ProductCode string `db:"product_code" json:"productCode"`
  98. ProductName string `db:"product_name" json:"productName"`
  99. SizeCode string `db:"size_code" json:"sizeCode"`
  100. ColorCode string `db:"color_code" json:"colorCode"`
  101. SettlementQty float64 `db:"settlement_qty" json:"settlementQty"`
  102. SettlementPrice float64 `db:"settlement_price" json:"settlementPrice"`
  103. DiscountRate float64 `db:"discount_rate" json:"discountRate"`
  104. SettlementAmount float64 `db:"settlement_amount" json:"settlementAmount"`
  105. SupplierID string `db:"supplier_id" json:"supplierID"`
  106. SupplierCode string `db:"supplier_code" json:"supplierCode"`
  107. SupplierName string `db:"supplier_name" json:"supplierName"`
  108. ExpectedDeliveryDate *time.Time `db:"expected_delivery_date" json:"expectedDeliveryDate"`
  109. Purpose string `db:"purpose" json:"purpose"`
  110. Priority string `db:"priority" json:"priority"`
  111. BusinessTypeID string `db:"business_type_id" json:"businessTypeID"`
  112. BusinessTypeName string `db:"business_type_name" json:"businessTypeName"`
  113. PriceTypeID string `db:"price_type_id" json:"priceTypeID"`
  114. PriceTypeName string `db:"price_type_name" json:"priceTypeName"`
  115. FinanceTypeID string `db:"finance_type_id" json:"financeTypeID"`
  116. FinanceTypeName string `db:"finance_type_name" json:"financeTypeName"`
  117. SureStatus int32 `db:"sure_status" json:"sureStatus"`
  118. SureDate *time.Time `db:"sure_date" json:"sureDate"`
  119. Remark string `db:"remark" json:"remark"`
  120. Creator string `db:"creator" json:"creator"`
  121. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  122. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  123. DataDate time.Time `db:"data_date" json:"dataDate"`
  124. }
  125. func (BillPurchasePlan) TableName() string {
  126. return "bill_purchase_plan"
  127. }