81 lines
2.9 KiB
Go
81 lines
2.9 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
// Lot represents existing lot table
|
|
type Lot struct {
|
|
LotName string `gorm:"column:lot_name;primaryKey;size:255" json:"lot_name"`
|
|
LotDescription string `gorm:"column:lot_description;size:10000" json:"lot_description"`
|
|
LotCategory *string `gorm:"column:lot_category;size:50" json:"lot_category"`
|
|
}
|
|
|
|
func (Lot) TableName() string {
|
|
return "lot"
|
|
}
|
|
|
|
// LotLog represents existing lot_log table (READ-ONLY)
|
|
type LotLog struct {
|
|
LotLogID uint `gorm:"column:lot_log_id;primaryKey;autoIncrement"`
|
|
Lot string `gorm:"column:lot;size:255;not null"`
|
|
Supplier string `gorm:"column:supplier;size:255;not null"`
|
|
Date time.Time `gorm:"column:date;type:date;not null"`
|
|
Price float64 `gorm:"column:price;not null"`
|
|
Quality string `gorm:"column:quality;size:255"`
|
|
Comments string `gorm:"column:comments;size:15000"`
|
|
}
|
|
|
|
func (LotLog) TableName() string {
|
|
return "lot_log"
|
|
}
|
|
|
|
// Supplier represents existing supplier table (READ-ONLY)
|
|
type Supplier struct {
|
|
SupplierName string `gorm:"column:supplier_name;primaryKey;size:255"`
|
|
SupplierComment string `gorm:"column:supplier_comment;size:10000"`
|
|
}
|
|
|
|
func (Supplier) TableName() string {
|
|
return "supplier"
|
|
}
|
|
|
|
// StockLog stores warehouse stock snapshots imported from external files.
|
|
type StockLog struct {
|
|
StockLogID uint `gorm:"column:stock_log_id;primaryKey;autoIncrement"`
|
|
Partnumber string `gorm:"column:partnumber;size:255;not null"`
|
|
Supplier *string `gorm:"column:supplier;size:255"`
|
|
Date time.Time `gorm:"column:date;type:date;not null"`
|
|
Price float64 `gorm:"column:price;not null"`
|
|
Quality *string `gorm:"column:quality;size:255"`
|
|
Comments *string `gorm:"column:comments;size:15000"`
|
|
Vendor *string `gorm:"column:vendor;size:255"`
|
|
Qty *float64 `gorm:"column:qty"`
|
|
}
|
|
|
|
func (StockLog) TableName() string {
|
|
return "stock_log"
|
|
}
|
|
|
|
// LotPartnumber maps external part numbers to internal lots.
|
|
type LotPartnumber struct {
|
|
Partnumber string `gorm:"column:partnumber;size:255;primaryKey" json:"partnumber"`
|
|
LotName string `gorm:"column:lot_name;size:255;primaryKey" json:"lot_name"`
|
|
Description *string `gorm:"column:description;size:10000" json:"description,omitempty"`
|
|
}
|
|
|
|
func (LotPartnumber) TableName() string {
|
|
return "lot_partnumbers"
|
|
}
|
|
|
|
// StockIgnoreRule contains import ignore pattern rules.
|
|
type StockIgnoreRule struct {
|
|
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
|
|
Target string `gorm:"column:target;size:20;not null" json:"target"` // partnumber|description
|
|
MatchType string `gorm:"column:match_type;size:20;not null" json:"match_type"` // exact|prefix|suffix
|
|
Pattern string `gorm:"column:pattern;size:500;not null" json:"pattern"`
|
|
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime" json:"created_at"`
|
|
}
|
|
|
|
func (StockIgnoreRule) TableName() string {
|
|
return "stock_ignore_rules"
|
|
}
|