wms-be/database/entities/m_product_entity.go

60 lines
3.5 KiB
Go

package entities
import (
"github.com/google/uuid"
)
type MProductEntity struct {
ID uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4()" json:"id"`
Name string `gorm:"type:varchar(255);not null" json:"name"`
RefNumber string `gorm:"type:varchar(100);not null;uniqueIndex:idx_product_refnumber_client,priority:1" json:"ref_number"`
SKU string `gorm:"type:varchar(100);not null;uniqueIndex:idx_product_sku_client,priority:1" json:"sku"`
Description string `gorm:"type:text" json:"description"`
Status string `gorm:"type:varchar(50);not null" json:"status"`
IsReturnable bool `gorm:"type:boolean;default:false" json:"is_returnable"`
DimLength float64 `gorm:"type:decimal(10,2);" json:"dim_length"`
DimWidth float64 `gorm:"type:decimal(10,2);" json:"dim_width"`
DimHeight float64 `gorm:"type:decimal(10,2);" json:"dim_height"`
Weight float64 `gorm:"type:decimal(10,2);" json:"weight"`
Volume float64 `gorm:"type:decimal(10,2);" json:"volume"`
MaxStackHeight int `gorm:"type:int;" json:"max_stack_height"`
Temperature string `gorm:"type:varchar(50)" json:"temperature"`
IsHazardous bool `gorm:"type:boolean;default:false" json:"is_hazardous"`
MinStock int `gorm:"type:int;default:0" json:"min_stock"`
MaxStock int `gorm:"type:int;default:0" json:"max_stock"`
ReplenishType string `gorm:"type:varchar(50)" json:"replenish_type"`
CycleCount string `gorm:"type:varchar(50);default:0" json:"cycle_count"`
LotRules string `gorm:"type:varchar(100)" json:"lot_rules"`
LeadTime int `gorm:"type:int;default:0" json:"lead_time"`
MultiplyRate string `gorm:"type:varchar(50)" json:"multiply_rate"`
DivideRate float64 `gorm:"type:decimal(10,2)" json:"divide_rate"`
ClientID uuid.UUID `gorm:"type:uuid;index;uniqueIndex:idx_product_refnumber_client,priority:2;uniqueIndex:idx_product_sku_client,priority:2" json:"client_id"`
CategoryID uuid.UUID `gorm:"type:uuid;index" json:"category_id"`
UomID uuid.UUID `gorm:"type:uuid;index" json:"uom_id"`
DimUomID uuid.UUID `gorm:"type:uuid;index" json:"dim_uom_id"`
WeightUomID uuid.UUID `gorm:"type:uuid;index" json:"weight_uom_id"`
VolumeUomID uuid.UUID `gorm:"type:uuid;index" json:"volume_uom_id"`
MinStockUomID uuid.UUID `gorm:"type:uuid;index" json:"min_stock_uom_id"`
MaxStockUomID uuid.UUID `gorm:"type:uuid;index" json:"max_stock_uom_id"`
LeadTimeUomID uuid.UUID `gorm:"type:uuid;index" json:"lead_time_uom_id"`
UomToUomID uuid.UUID `gorm:"type:uuid;index" json:"uom_to_uom_id"`
Client M_Client `gorm:"foreignKey:ClientID;references:ID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
Category MCategoryEntity `gorm:"foreignKey:CategoryID;references:ID"`
Uom MUomEntity `gorm:"foreignKey:UomID;references:ID"`
DimUom MUomEntity `gorm:"foreignKey:DimUomID;references:ID"`
WeightUom MUomEntity `gorm:"foreignKey:WeightUomID;references:ID"`
VolumeUom MUomEntity `gorm:"foreignKey:VolumeUomID;references:ID"`
MinStockUom MUomEntity `gorm:"foreignKey:MinStockUomID;references:ID"`
MaxStockUom MUomEntity `gorm:"foreignKey:MaxStockUomID;references:ID"`
LeadTimeUom MUomEntity `gorm:"foreignKey:LeadTimeUomID;references:ID"`
UomToUom MUomEntity `gorm:"foreignKey:UomToUomID;references:ID"`
FullAuditTrail
}
func (MProductEntity) TableName() string {
return "m_products"
}