Bläddra i källkod

增加订单,补货单,预售单

qdy 3 veckor sedan
förälder
incheckning
ea743cfc06

+ 124
- 0
internal/tables/bill_order.go Visa fil

@@ -0,0 +1,124 @@
1
+package tables
2
+
3
+import (
4
+	"time"
5
+
6
+	"git.x2erp.com/qdy/go-db/sqldef"
7
+)
8
+
9
+func init() {
10
+	sqldef.AddRegistration(func(r *sqldef.Registry) {
11
+		tb := sqldef.NewTable("bill_order", "订货单据表 - 记录店铺向总仓订货信息").
12
+			ID("id", 50).NotNull().Comment("主键ID").End().
13
+			String("tenant_id", 50).NotNull().Comment("租户ID").End().
14
+			String("bill_id", 50).NotNull().Comment("单据编号").End().
15
+			String("bill_type", 20).NotNull().Comment("单据类型").End().
16
+			String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)").End().
17
+			String("from_store_id", 50).NotNull().Comment("订货门店ID").End().
18
+			String("to_store_id", 50).NotNull().Comment("收货仓库/总仓ID").End().
19
+			String("from_company_id", 50).Comment("订货方公司ID").End().
20
+			String("to_company_id", 50).Comment("收货方公司ID").End().
21
+			String("product_id", 50).NotNull().Comment("商品ID").End().
22
+			String("product_code", 50).NotNull().Comment("商品编码").End().
23
+			String("product_name", 200).NotNull().Comment("商品名称").End().
24
+			String("size_code", 10).Comment("尺码代码").End().
25
+			String("color_code", 10).Comment("颜色代码").End().
26
+			Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").End().
27
+			Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").End().
28
+			Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").End().
29
+			Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").End().
30
+			String("business_type_id", 50).Comment("业务类型ID").End().
31
+			String("business_type_name", 100).Comment("业务类型名称").End().
32
+			String("price_type_id", 50).Comment("价格类型ID").End().
33
+			String("price_type_name", 100).Comment("价格类型名称").End().
34
+			String("finance_type_id", 50).Comment("财务类型ID").End().
35
+			String("finance_type_name", 100).Comment("财务类型名称").End().
36
+			Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").End().
37
+			Date("sure_date").Comment("登账日期").End().
38
+			String("remark", 500).Comment("备注").End().
39
+			String("creator", 32).NotNull().Comment("创建人").End().
40
+			DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
41
+			DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
42
+
43
+		tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
44
+		tb.AddIndex("idx_bill_status", "bill_status")
45
+		tb.AddIndex("idx_from_store_id", "from_store_id")
46
+		tb.AddIndex("idx_to_store_id", "to_store_id")
47
+		tb.AddIndex("idx_product_id", "product_id")
48
+		tb.AddIndex("idx_from_company_id", "from_company_id")
49
+		tb.AddIndex("idx_to_company_id", "to_company_id")
50
+		tb.AddIndex("idx_sure_status", "sure_status")
51
+
52
+		r.RegisterTable(tb.Build())
53
+	})
54
+}
55
+
56
+type BillOrder 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已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)"`
62
+	FromStoreID      string     `gorm:"column:from_store_id;type:varchar(50);not null;comment:订货门店ID"`
63
+	ToStoreID        string     `gorm:"column:to_store_id;type:varchar(50);not null;comment:收货仓库/总仓ID"`
64
+	FromCompanyID    string     `gorm:"column:from_company_id;type:varchar(50);comment:订货方公司ID"`
65
+	ToCompanyID      string     `gorm:"column:to_company_id;type:varchar(50);comment:收货方公司ID"`
66
+	ProductID        string     `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
67
+	ProductCode      string     `gorm:"column:product_code;type:varchar(50);not null;comment:商品编码"`
68
+	ProductName      string     `gorm:"column:product_name;type:varchar(200);not null;comment:商品名称"`
69
+	SizeCode         string     `gorm:"column:size_code;type:varchar(10);comment:尺码代码"`
70
+	ColorCode        string     `gorm:"column:color_code;type:varchar(10);comment:颜色代码"`
71
+	SettlementQty    float64    `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
72
+	SettlementPrice  float64    `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
73
+	DiscountRate     float64    `gorm:"column:discount_rate;type:decimal(5,4);not null;default:0;comment:折扣率"`
74
+	SettlementAmount float64    `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
75
+	BusinessTypeID   string     `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
76
+	BusinessTypeName string     `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
77
+	PriceTypeID      string     `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
78
+	PriceTypeName    string     `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
79
+	FinanceTypeID    string     `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
80
+	FinanceTypeName  string     `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
81
+	SureStatus       int32      `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
82
+	SureDate         *time.Time `gorm:"column:sure_date;comment:登账日期"`
83
+	Remark           string     `gorm:"column:remark;type:varchar(500);comment:备注"`
84
+	Creator          string     `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
85
+	CreatedAt        time.Time  `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
86
+	UpdatedAt        time.Time  `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
87
+}
88
+
89
+type BillOrderDB struct {
90
+	ID               string     `db:"id" json:"id"`
91
+	TenantID         string     `db:"tenant_id" json:"tenantID"`
92
+	BillID           string     `db:"bill_id" json:"billID"`
93
+	BillType         string     `db:"bill_type" json:"billType"`
94
+	BillStatus       string     `db:"bill_status" json:"billStatus"`
95
+	FromStoreID      string     `db:"from_store_id" json:"fromStoreID"`
96
+	ToStoreID        string     `db:"to_store_id" json:"toStoreID"`
97
+	FromCompanyID    string     `db:"from_company_id" json:"fromCompanyID"`
98
+	ToCompanyID      string     `db:"to_company_id" json:"toCompanyID"`
99
+	ProductID        string     `db:"product_id" json:"productID"`
100
+	ProductCode      string     `db:"product_code" json:"productCode"`
101
+	ProductName      string     `db:"product_name" json:"productName"`
102
+	SizeCode         string     `db:"size_code" json:"sizeCode"`
103
+	ColorCode        string     `db:"color_code" json:"colorCode"`
104
+	SettlementQty    float64    `db:"settlement_qty" json:"settlementQty"`
105
+	SettlementPrice  float64    `db:"settlement_price" json:"settlementPrice"`
106
+	DiscountRate     float64    `db:"discount_rate" json:"discountRate"`
107
+	SettlementAmount float64    `db:"settlement_amount" json:"settlementAmount"`
108
+	BusinessTypeID   string     `db:"business_type_id" json:"businessTypeID"`
109
+	BusinessTypeName string     `db:"business_type_name" json:"businessTypeName"`
110
+	PriceTypeID      string     `db:"price_type_id" json:"priceTypeID"`
111
+	PriceTypeName    string     `db:"price_type_name" json:"priceTypeName"`
112
+	FinanceTypeID    string     `db:"finance_type_id" json:"financeTypeID"`
113
+	FinanceTypeName  string     `db:"finance_type_name" json:"financeTypeName"`
114
+	SureStatus       int32      `db:"sure_status" json:"sureStatus"`
115
+	SureDate         *time.Time `db:"sure_date" json:"sureDate"`
116
+	Remark           string     `db:"remark" json:"remark"`
117
+	Creator          string     `db:"creator" json:"creator"`
118
+	CreatedAt        time.Time  `db:"created_at" json:"createdAt"`
119
+	UpdatedAt        time.Time  `db:"updated_at" json:"updatedAt"`
120
+}
121
+
122
+func (BillOrder) TableName() string {
123
+	return "bill_order"
124
+}

+ 124
- 0
internal/tables/bill_order_replenish.go Visa fil

@@ -0,0 +1,124 @@
1
+package tables
2
+
3
+import (
4
+	"time"
5
+
6
+	"git.x2erp.com/qdy/go-db/sqldef"
7
+)
8
+
9
+func init() {
10
+	sqldef.AddRegistration(func(r *sqldef.Registry) {
11
+		tb := sqldef.NewTable("bill_order_replenish", "补货单据表 - 记录店铺向总仓补货信息").
12
+			ID("id", 50).NotNull().Comment("主键ID").End().
13
+			String("tenant_id", 50).NotNull().Comment("租户ID").End().
14
+			String("bill_id", 50).NotNull().Comment("单据编号").End().
15
+			String("bill_type", 20).NotNull().Comment("单据类型").End().
16
+			String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)").End().
17
+			String("from_store_id", 50).NotNull().Comment("补货门店ID").End().
18
+			String("to_store_id", 50).NotNull().Comment("收货仓库/总仓ID").End().
19
+			String("from_company_id", 50).Comment("补货方公司ID").End().
20
+			String("to_company_id", 50).Comment("收货方公司ID").End().
21
+			String("product_id", 50).NotNull().Comment("商品ID").End().
22
+			String("product_code", 50).NotNull().Comment("商品编码").End().
23
+			String("product_name", 200).NotNull().Comment("商品名称").End().
24
+			String("size_code", 10).Comment("尺码代码").End().
25
+			String("color_code", 10).Comment("颜色代码").End().
26
+			Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").End().
27
+			Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").End().
28
+			Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").End().
29
+			Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").End().
30
+			String("business_type_id", 50).Comment("业务类型ID").End().
31
+			String("business_type_name", 100).Comment("业务类型名称").End().
32
+			String("price_type_id", 50).Comment("价格类型ID").End().
33
+			String("price_type_name", 100).Comment("价格类型名称").End().
34
+			String("finance_type_id", 50).Comment("财务类型ID").End().
35
+			String("finance_type_name", 100).Comment("财务类型名称").End().
36
+			Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").End().
37
+			Date("sure_date").Comment("登账日期").End().
38
+			String("remark", 500).Comment("备注").End().
39
+			String("creator", 32).NotNull().Comment("创建人").End().
40
+			DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
41
+			DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
42
+
43
+		tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
44
+		tb.AddIndex("idx_bill_status", "bill_status")
45
+		tb.AddIndex("idx_from_store_id", "from_store_id")
46
+		tb.AddIndex("idx_to_store_id", "to_store_id")
47
+		tb.AddIndex("idx_product_id", "product_id")
48
+		tb.AddIndex("idx_from_company_id", "from_company_id")
49
+		tb.AddIndex("idx_to_company_id", "to_company_id")
50
+		tb.AddIndex("idx_sure_status", "sure_status")
51
+
52
+		r.RegisterTable(tb.Build())
53
+	})
54
+}
55
+
56
+type BillOrderReplenish 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已审核/CONFIRMED已确认/CLOSED已关闭/CANCELLED已取消)"`
62
+	FromStoreID      string     `gorm:"column:from_store_id;type:varchar(50);not null;comment:补货门店ID"`
63
+	ToStoreID        string     `gorm:"column:to_store_id;type:varchar(50);not null;comment:收货仓库/总仓ID"`
64
+	FromCompanyID    string     `gorm:"column:from_company_id;type:varchar(50);comment:补货方公司ID"`
65
+	ToCompanyID      string     `gorm:"column:to_company_id;type:varchar(50);comment:收货方公司ID"`
66
+	ProductID        string     `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
67
+	ProductCode      string     `gorm:"column:product_code;type:varchar(50);not null;comment:商品编码"`
68
+	ProductName      string     `gorm:"column:product_name;type:varchar(200);not null;comment:商品名称"`
69
+	SizeCode         string     `gorm:"column:size_code;type:varchar(10);comment:尺码代码"`
70
+	ColorCode        string     `gorm:"column:color_code;type:varchar(10);comment:颜色代码"`
71
+	SettlementQty    float64    `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
72
+	SettlementPrice  float64    `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
73
+	DiscountRate     float64    `gorm:"column:discount_rate;type:decimal(5,4);not null;default:0;comment:折扣率"`
74
+	SettlementAmount float64    `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
75
+	BusinessTypeID   string     `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
76
+	BusinessTypeName string     `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
77
+	PriceTypeID      string     `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
78
+	PriceTypeName    string     `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
79
+	FinanceTypeID    string     `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
80
+	FinanceTypeName  string     `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
81
+	SureStatus       int32      `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
82
+	SureDate         *time.Time `gorm:"column:sure_date;comment:登账日期"`
83
+	Remark           string     `gorm:"column:remark;type:varchar(500);comment:备注"`
84
+	Creator          string     `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
85
+	CreatedAt        time.Time  `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
86
+	UpdatedAt        time.Time  `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
87
+}
88
+
89
+type BillOrderReplenishDB struct {
90
+	ID               string     `db:"id" json:"id"`
91
+	TenantID         string     `db:"tenant_id" json:"tenantID"`
92
+	BillID           string     `db:"bill_id" json:"billID"`
93
+	BillType         string     `db:"bill_type" json:"billType"`
94
+	BillStatus       string     `db:"bill_status" json:"billStatus"`
95
+	FromStoreID      string     `db:"from_store_id" json:"fromStoreID"`
96
+	ToStoreID        string     `db:"to_store_id" json:"toStoreID"`
97
+	FromCompanyID    string     `db:"from_company_id" json:"fromCompanyID"`
98
+	ToCompanyID      string     `db:"to_company_id" json:"toCompanyID"`
99
+	ProductID        string     `db:"product_id" json:"productID"`
100
+	ProductCode      string     `db:"product_code" json:"productCode"`
101
+	ProductName      string     `db:"product_name" json:"productName"`
102
+	SizeCode         string     `db:"size_code" json:"sizeCode"`
103
+	ColorCode        string     `db:"color_code" json:"colorCode"`
104
+	SettlementQty    float64    `db:"settlement_qty" json:"settlementQty"`
105
+	SettlementPrice  float64    `db:"settlement_price" json:"settlementPrice"`
106
+	DiscountRate     float64    `db:"discount_rate" json:"discountRate"`
107
+	SettlementAmount float64    `db:"settlement_amount" json:"settlementAmount"`
108
+	BusinessTypeID   string     `db:"business_type_id" json:"businessTypeID"`
109
+	BusinessTypeName string     `db:"business_type_name" json:"businessTypeName"`
110
+	PriceTypeID      string     `db:"price_type_id" json:"priceTypeID"`
111
+	PriceTypeName    string     `db:"price_type_name" json:"priceTypeName"`
112
+	FinanceTypeID    string     `db:"finance_type_id" json:"financeTypeID"`
113
+	FinanceTypeName  string     `db:"finance_type_name" json:"financeTypeName"`
114
+	SureStatus       int32      `db:"sure_status" json:"sureStatus"`
115
+	SureDate         *time.Time `db:"sure_date" json:"sureDate"`
116
+	Remark           string     `db:"remark" json:"remark"`
117
+	Creator          string     `db:"creator" json:"creator"`
118
+	CreatedAt        time.Time  `db:"created_at" json:"createdAt"`
119
+	UpdatedAt        time.Time  `db:"updated_at" json:"updatedAt"`
120
+}
121
+
122
+func (BillOrderReplenish) TableName() string {
123
+	return "bill_order_replenish"
124
+}

+ 128
- 0
internal/tables/bill_presale_retail.go Visa fil

@@ -0,0 +1,128 @@
1
+package tables
2
+
3
+import (
4
+	"time"
5
+
6
+	"git.x2erp.com/qdy/go-db/sqldef"
7
+)
8
+
9
+func init() {
10
+	sqldef.AddRegistration(func(r *sqldef.Registry) {
11
+		tb := sqldef.NewTable("bill_presale_retail", "零售预售单据表").
12
+			ID("id", 50).NotNull().Comment("主键ID").End().
13
+			String("tenant_id", 50).NotNull().Comment("租户ID").End().
14
+			String("bill_id", 50).NotNull().Comment("单据编号").End().
15
+			String("bill_type", 20).NotNull().Comment("单据类型").End().
16
+			String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/COMPLETED已完成/CANCELLED已取消)").End().
17
+			String("store_id", 50).NotNull().Comment("店铺ID").End().
18
+			String("company_id", 50).Comment("所属公司ID").End().
19
+			String("business_type_id", 50).Comment("业务类型ID").End().
20
+			String("business_type_name", 100).Comment("业务类型名称").End().
21
+			String("price_type_id", 50).Comment("价格类型ID").End().
22
+			String("price_type_name", 100).Comment("价格类型名称").End().
23
+			String("finance_type_id", 50).Comment("财务类型ID").End().
24
+			String("finance_type_name", 100).Comment("财务类型名称").End().
25
+			Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").End().
26
+			Date("sure_date").Comment("登账日期").End().
27
+			String("product_id", 50).NotNull().Comment("商品ID").End().
28
+			String("product_code", 50).NotNull().Comment("商品编码").End().
29
+			String("product_name", 200).NotNull().Comment("商品名称").End().
30
+			String("size_code", 10).Comment("尺码代码").End().
31
+			String("color_code", 10).Comment("颜色代码").End().
32
+			Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").End().
33
+			Decimal("discount_rate", 5, 4).NotNull().Default("0").Comment("折扣率").End().
34
+			Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").End().
35
+			Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").End().
36
+			String("customer_id", 50).Comment("客户ID").End().
37
+			String("customer_name", 200).Comment("客户姓名").End().
38
+			String("customer_phone", 20).Comment("客户电话").End().
39
+			String("remark", 500).Comment("备注").End().
40
+			String("creator", 32).NotNull().Comment("创建人").End().
41
+			DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
42
+			DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
43
+
44
+		tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
45
+		tb.AddIndex("idx_tenant_id", "tenant_id")
46
+		tb.AddIndex("idx_bill_type", "bill_type")
47
+		tb.AddIndex("idx_bill_status", "bill_status")
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
+
54
+		r.RegisterTable(tb.Build())
55
+	})
56
+}
57
+
58
+type BillPresaleRetail struct {
59
+	ID               string     `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
60
+	TenantID         string     `gorm:"column:tenant_id;type:varchar(50);not null;comment:租户ID"`
61
+	BillID           string     `gorm:"column:bill_id;type:varchar(50);not null;comment:单据编号"`
62
+	BillType         string     `gorm:"column:bill_type;type:varchar(20);not null;comment:单据类型"`
63
+	BillStatus       string     `gorm:"column:bill_status;type:varchar(20);not null;comment:单据状态 (DRAFT草稿/SUBMITTED已提交/APPROVED已审核/COMPLETED已完成/CANCELLED已取消)"`
64
+	StoreID          string     `gorm:"column:store_id;type:varchar(50);not null;comment:店铺ID"`
65
+	CompanyID        string     `gorm:"column:company_id;type:varchar(50);comment:所属公司ID"`
66
+	BusinessTypeID   string     `gorm:"column:business_type_id;type:varchar(50);comment:业务类型ID"`
67
+	BusinessTypeName string     `gorm:"column:business_type_name;type:varchar(100);comment:业务类型名称"`
68
+	PriceTypeID      string     `gorm:"column:price_type_id;type:varchar(50);comment:价格类型ID"`
69
+	PriceTypeName    string     `gorm:"column:price_type_name;type:varchar(100);comment:价格类型名称"`
70
+	FinanceTypeID    string     `gorm:"column:finance_type_id;type:varchar(50);comment:财务类型ID"`
71
+	FinanceTypeName  string     `gorm:"column:finance_type_name;type:varchar(100);comment:财务类型名称"`
72
+	SureStatus       int32      `gorm:"column:sure_status;type:int;not null;default:0;comment:登账标识 (0:草稿, 1:已登账)"`
73
+	SureDate         *time.Time `gorm:"column:sure_date;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
+
92
+type BillPresaleRetailDB struct {
93
+	ID               string     `db:"id" json:"id"`
94
+	TenantID         string     `db:"tenant_id" json:"tenantID"`
95
+	BillID           string     `db:"bill_id" json:"billID"`
96
+	BillType         string     `db:"bill_type" json:"billType"`
97
+	BillStatus       string     `db:"bill_status" json:"billStatus"`
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
+	ProductID        string     `db:"product_id" json:"productID"`
109
+	ProductCode      string     `db:"product_code" json:"productCode"`
110
+	ProductName      string     `db:"product_name" json:"productName"`
111
+	SizeCode         string     `db:"size_code" json:"sizeCode"`
112
+	ColorCode        string     `db:"color_code" json:"colorCode"`
113
+	SettlementQty    float64    `db:"settlement_qty" json:"settlementQty"`
114
+	DiscountRate     float64    `db:"discount_rate" json:"discountRate"`
115
+	SettlementPrice  float64    `db:"settlement_price" json:"settlementPrice"`
116
+	SettlementAmount float64    `db:"settlement_amount" json:"settlementAmount"`
117
+	CustomerID       string     `db:"customer_id" json:"customerID"`
118
+	CustomerName     string     `db:"customer_name" json:"customerName"`
119
+	CustomerPhone    string     `db:"customer_phone" json:"customerPhone"`
120
+	Remark           string     `db:"remark" json:"remark"`
121
+	Creator          string     `db:"creator" json:"creator"`
122
+	CreatedAt        time.Time  `db:"created_at" json:"createdAt"`
123
+	UpdatedAt        time.Time  `db:"updated_at" json:"updatedAt"`
124
+}
125
+
126
+func (BillPresaleRetail) TableName() string {
127
+	return "bill_presale_retail"
128
+}

+ 135
- 0
internal/tables/bill_presale_settlement.go Visa fil

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

Loading…
Avbryt
Spara