1.5 KiB
1.5 KiB
Data Rules
Component Categories (lot_category)
Source
Categories are always taken from lot.lot_category (table lot).
NOT from qt_lot_metadata.
NOT derived from the LOT name or article name.
When creating pricelists
- Estimate: include only components with
current_price > 0andis_hidden = 0, then loadlot.lot_category. - Warehouse: load
lot.lot_categoryfor all positions. - Persist into
lot_categorycolumn ofqt_pricelist_items.
Model
type PricelistItem struct {
LotCategory *string `gorm:"column:lot_category;size:50" json:"category,omitempty"`
// JSON field is "category" for the frontend
}
Rules
- Category is not a virtual field — it is persisted to DB when the pricelist is created.
- JOIN with
lotis only needed forlot_description; category is already inqt_pricelist_items. - Default value when category is absent in source or LOT row is missing:
PART_.
Price Method
- Warehouse pricelist:
price_method="weighted_avg"(quantity-weighted average). - Estimate pricelist: method determined by per-component settings.
Warehouse: Filtering by qt_partnumber_book_items
Rule (CRITICAL): only positions with a matching record in qt_partnumber_book_items are included in the warehouse pricelist. Unmapped partnumbers are completely excluded.
Component Data Source
- Source: MariaDB (not SQLite).
handlers/component.gousescomponentService.List()(MariaDB).