Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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_inventory_count", "库存盘点单据表").
  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().Default("'INVENTORY_CHECK'").Comment("单据类型 (INVENTORY_CHECK盘点)").ChineseName("单据类型").End().
  14. String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/COUNTING盘点中/REVIEWED已复核/APPROVED已审核/ADJUSTED已调整/CANCELLED已取消)").ChineseName("单据状态").End().
  15. Int("check_type").NotNull().Comment("盘点类型:1:盘赢;2:盘亏").ChineseName("盘点类型:1:盘赢;2:盘亏").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("product_id", 50).NotNull().Comment("商品ID").ChineseName("商品ID").End().
  27. String("product_code", 50).NotNull().Comment("商品编码").ChineseName("商品编码").Aliases("编码").End().
  28. String("product_name", 200).NotNull().Comment("商品名称").ChineseName("商品名称").Aliases("名称").End().
  29. String("size_code", 10).Comment("尺码代码").ChineseName("尺码代码").End().
  30. String("color_code", 10).Comment("颜色代码").ChineseName("颜色代码").End().
  31. Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").ChineseName("结算数量").End().
  32. Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").ChineseName("结算单价").End().
  33. Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").ChineseName("结算金额").End().
  34. Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").ChineseName("折扣率").End().
  35. String("check_person_id", 50).Comment("盘点人ID").ChineseName("盘点人ID").End().
  36. String("check_person_name", 100).Comment("盘点人姓名").ChineseName("盘点人姓名").End().
  37. String("reviewer_id", 50).Comment("复核人ID").ChineseName("复核人ID").End().
  38. String("reviewer_name", 100).Comment("复核人姓名").ChineseName("复核人姓名").End().
  39. DateTime("reviewed_time").Comment("复核时间").ChineseName("复核时间").Aliases("时间").End().
  40. String("approver_id", 50).Comment("审核人ID").ChineseName("审核人ID").End().
  41. String("approver_name", 100).Comment("审核人姓名").ChineseName("审核人姓名").End().
  42. DateTime("approved_time").Comment("审核时间").ChineseName("审核时间").Aliases("时间").End().
  43. String("remark", 500).Comment("备注").ChineseName("备注").End().
  44. String("creator", 32).NotNull().Comment("创建人").ChineseName("创建人").End().
  45. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").ChineseName("创建时间").Aliases("时间").End().
  46. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").ChineseName("更新时间").Aliases("时间").End().
  47. Date("data_date").NotNull().Comment("数据日期 (数据仓库快照)").ChineseName("数据日期").End()
  48. tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
  49. tb.AddIndex("idx_tenant_id", "tenant_id")
  50. tb.AddIndex("idx_bill_status", "bill_status")
  51. tb.AddIndex("idx_store_id", "store_id")
  52. tb.AddIndex("idx_product_id", "product_id")
  53. tb.AddIndex("idx_company_id", "company_id")
  54. tb.AddIndex("idx_sure_status", "sure_status")
  55. tb.AddIndex("idx_tenant_id_bill_status", "tenant_id", "bill_status")
  56. tb.AddIndex("idx_tenant_id_sure_status", "tenant_id", "sure_status")
  57. r.RegisterTable(tb.Build())
  58. })
  59. }
  60. type BillInventoryCount struct {
  61. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  62. TenantID string `gorm:"column:tenant_id;type:varchar(50);not null;comment:租户ID"`
  63. BillID string `gorm:"column:bill_id;type:varchar(50);not null;comment:单据编号"`
  64. BillType string `gorm:"column:bill_type;type:varchar(20);not null;default:INVENTORY_CHECK;comment:单据类型 (INVENTORY_CHECK盘点)"`
  65. BillStatus string `gorm:"column:bill_status;type:varchar(20);not null;comment:单据状态 (DRAFT草稿/COUNTING盘点中/REVIEWED已复核/APPROVED已审核/ADJUSTED已调整/CANCELLED已取消)"`
  66. CheckType int32 `gorm:"column:check_type;type:int;not null;comment:盘点类型:1:盘赢;2:盘亏"`
  67. StoreID string `gorm:"column:store_id;type:varchar(50);not null;comment:店铺ID"`
  68. CompanyID string `gorm:"column:company_id;type:varchar(50);comment:公司ID"`
  69. BusinessTypeID string `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
  70. BusinessTypeName string `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
  71. PriceTypeID string `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
  72. PriceTypeName string `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
  73. FinanceTypeID string `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
  74. FinanceTypeName string `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
  75. SureStatus int32 `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
  76. SureDate *time.Time `gorm:"column:sure_date;comment:登账日期"`
  77. ProductID string `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
  78. ProductCode string `gorm:"column:product_code;type:varchar(50);not null;comment:商品编码"`
  79. ProductName string `gorm:"column:product_name;type:varchar(200);not null;comment:商品名称"`
  80. SizeCode string `gorm:"column:size_code;type:varchar(10);comment:尺码代码"`
  81. ColorCode string `gorm:"column:color_code;type:varchar(10);comment:颜色代码"`
  82. SettlementQty float64 `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
  83. SettlementPrice float64 `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
  84. SettlementAmount float64 `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
  85. DiscountRate float64 `gorm:"column:discount_rate;type:decimal(5,4);not null;default:0;comment:折扣率"`
  86. CheckPersonID string `gorm:"column:check_person_id;type:varchar(50);comment:盘点人ID"`
  87. CheckPersonName string `gorm:"column:check_person_name;type:varchar(100);comment:盘点人姓名"`
  88. ReviewerID string `gorm:"column:reviewer_id;type:varchar(50);comment:复核人ID"`
  89. ReviewerName string `gorm:"column:reviewer_name;type:varchar(100);comment:复核人姓名"`
  90. ReviewedTime *time.Time `gorm:"column:reviewed_time;comment:复核时间"`
  91. ApproverID string `gorm:"column:approver_id;type:varchar(50);comment:审核人ID"`
  92. ApproverName string `gorm:"column:approver_name;type:varchar(100);comment:审核人姓名"`
  93. ApprovedTime *time.Time `gorm:"column:approved_time;comment:审核时间"`
  94. Remark string `gorm:"column:remark;type:varchar(500);comment:备注"`
  95. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  96. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  97. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  98. DataDate time.Time `gorm:"column:data_date;type:date;not null;comment:数据日期 (数据仓库快照)"`
  99. }
  100. type BillInventoryCountDB struct {
  101. ID string `db:"id" json:"id"`
  102. TenantID string `db:"tenant_id" json:"tenantID"`
  103. BillID string `db:"bill_id" json:"billID"`
  104. BillType string `db:"bill_type" json:"billType"`
  105. BillStatus string `db:"bill_status" json:"billStatus"`
  106. CheckType int32 `db:"check_type" json:"checkType"`
  107. StoreID string `db:"store_id" json:"storeID"`
  108. CompanyID string `db:"company_id" json:"companyID"`
  109. BusinessTypeID string `db:"business_type_id" json:"businessTypeID"`
  110. BusinessTypeName string `db:"business_type_name" json:"businessTypeName"`
  111. PriceTypeID string `db:"price_type_id" json:"priceTypeID"`
  112. PriceTypeName string `db:"price_type_name" json:"priceTypeName"`
  113. FinanceTypeID string `db:"finance_type_id" json:"financeTypeID"`
  114. FinanceTypeName string `db:"finance_type_name" json:"financeTypeName"`
  115. SureStatus int32 `db:"sure_status" json:"sureStatus"`
  116. SureDate *time.Time `db:"sure_date" json:"sureDate"`
  117. ProductID string `db:"product_id" json:"productID"`
  118. ProductCode string `db:"product_code" json:"productCode"`
  119. ProductName string `db:"product_name" json:"productName"`
  120. SizeCode string `db:"size_code" json:"sizeCode"`
  121. ColorCode string `db:"color_code" json:"colorCode"`
  122. SettlementQty float64 `db:"settlement_qty" json:"settlementQty"`
  123. SettlementPrice float64 `db:"settlement_price" json:"settlementPrice"`
  124. SettlementAmount float64 `db:"settlement_amount" json:"settlementAmount"`
  125. DiscountRate float64 `db:"discount_rate" json:"discountRate"`
  126. CheckPersonID string `db:"check_person_id" json:"checkPersonID"`
  127. CheckPersonName string `db:"check_person_name" json:"checkPersonName"`
  128. ReviewerID string `db:"reviewer_id" json:"reviewerID"`
  129. ReviewerName string `db:"reviewer_name" json:"reviewerName"`
  130. ReviewedTime *time.Time `db:"reviewed_time" json:"reviewedTime"`
  131. ApproverID string `db:"approver_id" json:"approverID"`
  132. ApproverName string `db:"approver_name" json:"approverName"`
  133. ApprovedTime *time.Time `db:"approved_time" json:"approvedTime"`
  134. Remark string `db:"remark" json:"remark"`
  135. Creator string `db:"creator" json:"creator"`
  136. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  137. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  138. DataDate time.Time `db:"data_date" json:"dataDate"`
  139. }
  140. func (BillInventoryCount) TableName() string {
  141. return "bill_inventory_count"
  142. }