mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 21:41:55 +00:00
34 lines
1.4 KiB
Go
34 lines
1.4 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
const (
|
|
StockAllocationStatusPending = "PENDING"
|
|
StockAllocationStatusActive = "ACTIVE"
|
|
StockAllocationStatusReleased = "RELEASED"
|
|
)
|
|
|
|
// StockAllocation links a usable record (consumption) with an incoming stock record.
|
|
// The combination lets us trace FIFO deductions while keeping each module focused on its own fields.
|
|
type StockAllocation struct {
|
|
Id uint `gorm:"primaryKey"`
|
|
ProductWarehouseId uint `gorm:"not null;index"`
|
|
StockableType string `gorm:"size:100;not null;index:stock_allocations_lookup,priority:1"`
|
|
StockableId uint `gorm:"not null;index:stock_allocations_lookup,priority:2"`
|
|
UsableType string `gorm:"size:100;not null;index:stock_allocations_usage_lookup,priority:1"`
|
|
UsableId uint `gorm:"not null;index:stock_allocations_usage_lookup,priority:2"`
|
|
Qty float64 `gorm:"type:numeric(15,3);not null"`
|
|
Status string `gorm:"size:20;not null;default:ACTIVE"`
|
|
Note *string `gorm:"type:text"`
|
|
CreatedAt time.Time `gorm:"autoCreateTime"`
|
|
UpdatedAt time.Time `gorm:"autoUpdateTime"`
|
|
ReleasedAt *time.Time `gorm:"index"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index"`
|
|
|
|
ProductWarehouse *ProductWarehouse `gorm:"foreignKey:ProductWarehouseId;references:Id"`
|
|
}
|