Sin descripción
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_shipment_receive.go 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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_shipment_receive", "发货收货单据表 - 记录公司间发货的收货信息,与bill_shipment表对应").
  9. ID("id", 50).NotNull().Comment("主键ID").End().
  10. String("tenant_id", 50).NotNull().Comment("租户ID").End().
  11. String("bill_id", 50).NotNull().Comment("单据编号").End().
  12. String("bill_type", 20).NotNull().Default("'SHIPMENT_RECEIVE'").Comment("单据类型 (SHIPMENT_RECEIVE发货收货)").End().
  13. String("bill_status", 20).NotNull().Comment("单据状态 (DRAFT草稿/EXPECTED待收货/PARTIAL部分收货/COMPLETED已完成/CANCELLED已取消)").End().
  14. String("from_store_id", 50).NotNull().Comment("发货门店ID").End().
  15. String("to_store_id", 50).NotNull().Comment("收货门店ID").End().
  16. String("from_company_id", 50).Comment("发货方公司ID").End().
  17. String("to_company_id", 50).Comment("收货方公司ID").End().
  18. String("business_type_id", 50).Comment("业务类型ID").End().
  19. String("business_type_name", 100).Comment("业务类型名称").End().
  20. String("price_type_id", 50).Comment("价格类型ID").End().
  21. String("price_type_name", 100).Comment("价格类型名称").End().
  22. String("finance_type_id", 50).Comment("财务类型ID").End().
  23. String("finance_type_name", 100).Comment("财务类型名称").End().
  24. Int("sure_status").NotNull().Default("0").Comment("登账标识 (0:草稿, 1:已登账)").End().
  25. Date("sure_date").Comment("登账日期").End().
  26. DateTime("expected_receive_date").Comment("预计收货日期").End().
  27. DateTime("actual_receive_date").Comment("实际收货日期").End().
  28. String("product_id", 50).NotNull().Comment("商品ID").End().
  29. String("product_code", 50).NotNull().Comment("商品编码").End().
  30. String("product_name", 200).NotNull().Comment("商品名称").End().
  31. String("size_code", 10).Comment("尺码代码").End().
  32. String("color_code", 10).Comment("颜色代码").End().
  33. Decimal("settlement_qty", 12, 4).NotNull().Default("0").Comment("结算数量").End().
  34. String("shipping_method", 20).Comment("运输方式 (EXPRESS快递/SELF自提/COURIER快递员)").End().
  35. String("tracking_no", 100).Comment("物流单号").End().
  36. String("carrier_name", 100).Comment("承运商名称").End().
  37. Decimal("shipping_fee", 10, 2).NotNull().Default("0").Comment("运费").End().
  38. Decimal("settlement_price", 12, 2).NotNull().Default("0").Comment("结算单价").End().
  39. Decimal("settlement_amount", 12, 2).NotNull().Default("0").Comment("结算金额").End().
  40. String("settlement_status", 20).Comment("结算状态 (UNSETTLED未结算/PARTIAL部分结算/SETTLED已结算)").End().
  41. DateTime("settlement_date").Comment("结算日期").End().
  42. String("receiver_name", 100).Comment("收货人姓名").End().
  43. String("inspector_name", 100).Comment("质检人姓名").End().
  44. String("quality_status", 20).Comment("质检状态 (PENDING待检/PASSED合格/FAILED不合格/PARTIAL部分合格)").End().
  45. String("related_ship_document_no", 50).NotNull().Comment("关联发货单号").End().
  46. String("remark", 500).Comment("备注").End().
  47. String("creator", 32).NotNull().Comment("创建人").End().
  48. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  49. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End().
  50. Date("data_date").NotNull().Comment("数据日期 (数据仓库快照)").End()
  51. tb.AddUniqueIndex("idx_bill_id_product", "bill_id", "product_id", "size_code", "color_code")
  52. tb.AddIndex("idx_bill_status", "bill_status")
  53. tb.AddIndex("idx_from_store_id", "from_store_id")
  54. tb.AddIndex("idx_to_store_id", "to_store_id")
  55. tb.AddIndex("idx_product_id", "product_id")
  56. tb.AddIndex("idx_tracking_no", "tracking_no")
  57. tb.AddIndex("idx_tenant_id", "tenant_id")
  58. tb.AddIndex("idx_from_company_id", "from_company_id")
  59. tb.AddIndex("idx_to_company_id", "to_company_id")
  60. tb.AddIndex("idx_sure_status", "sure_status")
  61. tb.AddIndex("idx_settlement_status", "settlement_status")
  62. r.RegisterTable(tb.Build())
  63. })
  64. }
  65. type BillShipmentReceive struct {
  66. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  67. TenantID string `gorm:"column:tenant_id;type:varchar(50);not null;comment:租户ID"`
  68. BillID string `gorm:"column:bill_id;type:varchar(50);not null;comment:单据编号"`
  69. BillType string `gorm:"column:bill_type;type:varchar(20);not null;default:SHIPMENT_RECEIVE;comment:单据类型 (SHIPMENT_RECEIVE发货收货)"`
  70. BillStatus string `gorm:"column:bill_status;type:varchar(20);not null;comment:单据状态 (DRAFT草稿/EXPECTED待收货/PARTIAL部分收货/COMPLETED已完成/CANCELLED已取消)"`
  71. FromStoreID string `gorm:"column:from_store_id;type:varchar(50);not null;comment:发货门店ID"`
  72. ToStoreID string `gorm:"column:to_store_id;type:varchar(50);not null;comment:收货门店ID"`
  73. FromCompanyID string `gorm:"column:from_company_id;type:varchar(50);comment:发货方公司ID"`
  74. ToCompanyID string `gorm:"column:to_company_id;type:varchar(50);comment:收货方公司ID"`
  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. ExpectedReceiveDate *time.Time `gorm:"column:expected_receive_date;comment:预计收货日期"`
  84. ActualReceiveDate *time.Time `gorm:"column:actual_receive_date;comment:实际收货日期"`
  85. ProductID string `gorm:"column:product_id;type:varchar(50);not null;comment:商品ID"`
  86. ProductCode string `gorm:"column:product_code;type:varchar(50);not null;comment:商品编码"`
  87. ProductName string `gorm:"column:product_name;type:varchar(200);not null;comment:商品名称"`
  88. SizeCode string `gorm:"column:size_code;type:varchar(10);comment:尺码代码"`
  89. ColorCode string `gorm:"column:color_code;type:varchar(10);comment:颜色代码"`
  90. SettlementQty float64 `gorm:"column:settlement_qty;type:decimal(12,4);not null;default:0;comment:结算数量"`
  91. ShippingMethod string `gorm:"column:shipping_method;type:varchar(20);comment:运输方式 (EXPRESS快递/SELF自提/COURIER快递员)"`
  92. TrackingNo string `gorm:"column:tracking_no;type:varchar(100);comment:物流单号"`
  93. CarrierName string `gorm:"column:carrier_name;type:varchar(100);comment:承运商名称"`
  94. ShippingFee float64 `gorm:"column:shipping_fee;type:decimal(10,2);not null;default:0;comment:运费"`
  95. SettlementPrice float64 `gorm:"column:settlement_price;type:decimal(12,2);not null;default:0;comment:结算单价"`
  96. SettlementAmount float64 `gorm:"column:settlement_amount;type:decimal(12,2);not null;default:0;comment:结算金额"`
  97. SettlementStatus string `gorm:"column:settlement_status;type:varchar(20);comment:结算状态 (UNSETTLED未结算/PARTIAL部分结算/SETTLED已结算)"`
  98. SettlementDate *time.Time `gorm:"column:settlement_date;comment:结算日期"`
  99. ReceiverName string `gorm:"column:receiver_name;type:varchar(100);comment:收货人姓名"`
  100. InspectorName string `gorm:"column:inspector_name;type:varchar(100);comment:质检人姓名"`
  101. QualityStatus string `gorm:"column:quality_status;type:varchar(20);comment:质检状态 (PENDING待检/PASSED合格/FAILED不合格/PARTIAL部分合格)"`
  102. RelatedShipDocumentNo string `gorm:"column:related_ship_document_no;type:varchar(50);not null;comment:关联发货单号"`
  103. Remark string `gorm:"column:remark;type:varchar(500);comment:备注"`
  104. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  105. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  106. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  107. DataDate time.Time `gorm:"column:data_date;type:date;not null;comment:数据日期 (数据仓库快照)"`
  108. }
  109. type BillShipmentReceiveDB struct {
  110. ID string `db:"id" json:"id"`
  111. TenantID string `db:"tenant_id" json:"tenantID"`
  112. BillID string `db:"bill_id" json:"billID"`
  113. BillType string `db:"bill_type" json:"billType"`
  114. BillStatus string `db:"bill_status" json:"billStatus"`
  115. FromStoreID string `db:"from_store_id" json:"fromStoreID"`
  116. ToStoreID string `db:"to_store_id" json:"toStoreID"`
  117. FromCompanyID string `db:"from_company_id" json:"fromCompanyID"`
  118. ToCompanyID string `db:"to_company_id" json:"toCompanyID"`
  119. BusinessTypeID string `db:"business_type_id" json:"businessTypeID"`
  120. BusinessTypeName string `db:"business_type_name" json:"businessTypeName"`
  121. PriceTypeID string `db:"price_type_id" json:"priceTypeID"`
  122. PriceTypeName string `db:"price_type_name" json:"priceTypeName"`
  123. FinanceTypeID string `db:"finance_type_id" json:"financeTypeID"`
  124. FinanceTypeName string `db:"finance_type_name" json:"financeTypeName"`
  125. SureStatus int32 `db:"sure_status" json:"sureStatus"`
  126. SureDate *time.Time `db:"sure_date" json:"sureDate"`
  127. ExpectedReceiveDate *time.Time `db:"expected_receive_date" json:"expectedReceiveDate"`
  128. ActualReceiveDate *time.Time `db:"actual_receive_date" json:"actualReceiveDate"`
  129. ProductID string `db:"product_id" json:"productID"`
  130. ProductCode string `db:"product_code" json:"productCode"`
  131. ProductName string `db:"product_name" json:"productName"`
  132. SizeCode string `db:"size_code" json:"sizeCode"`
  133. ColorCode string `db:"color_code" json:"colorCode"`
  134. SettlementQty float64 `db:"settlement_qty" json:"settlementQty"`
  135. ShippingMethod string `db:"shipping_method" json:"shippingMethod"`
  136. TrackingNo string `db:"tracking_no" json:"trackingNo"`
  137. CarrierName string `db:"carrier_name" json:"carrierName"`
  138. ShippingFee float64 `db:"shipping_fee" json:"shippingFee"`
  139. SettlementPrice float64 `db:"settlement_price" json:"settlementPrice"`
  140. SettlementAmount float64 `db:"settlement_amount" json:"settlementAmount"`
  141. SettlementStatus string `db:"settlement_status" json:"settlementStatus"`
  142. SettlementDate *time.Time `db:"settlement_date" json:"settlementDate"`
  143. ReceiverName string `db:"receiver_name" json:"receiverName"`
  144. InspectorName string `db:"inspector_name" json:"inspectorName"`
  145. QualityStatus string `db:"quality_status" json:"qualityStatus"`
  146. RelatedShipDocumentNo string `db:"related_ship_document_no" json:"relatedShipDocumentNo"`
  147. Remark string `db:"remark" json:"remark"`
  148. Creator string `db:"creator" json:"creator"`
  149. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  150. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  151. DataDate time.Time `db:"data_date" json:"dataDate"`
  152. }
  153. func (BillShipmentReceive) TableName() string {
  154. return "bill_shipment_receive"
  155. }