Files
PriceForge/MEMORY.md

3.0 KiB

PriceForge Memory

LOT Page Refactoring (2026-02-10)

What was done:

  • Created new dedicated /lot page with two tabs:

    1. LOT tab: Component/article management (table with search, sort, create LOT)
    2. Сопоставления tab: partnumber ↔ LOT mappings management
  • Removed LOT tab from "Администратор цен" (Pricing Admin)

  • Removed "Сопоставление partnumber → LOT" section from Warehouse tab

  • Updated main menu navigation:

    • LOT link → /lot (new page)
    • Администратор цен → /admin/pricing (Estimate, Склад, Конкуренты)
    • Настройки (unchanged)

Files changed:

  • web/templates/lot.html (NEW) - Complete page with LOT and stock mappings tabs
  • web/templates/base.html - Updated menu to link LOT to /lot
  • web/templates/admin_pricing.html - Removed LOT tab, changed default to Estimate
  • internal/handlers/web.go - Added lot.html to template list, added Lot() handler
  • cmd/pfs/main.go - Added /lot route

Technical notes:

  • lot.html uses same API endpoints as admin_pricing for data loading
  • Stock mappings functions copied from admin_pricing.html but adapted for new page
  • Default tab for Pricing Admin is now 'estimate' instead of 'lots'

Data Rules (2026-02-18)

  • Never derive category from item name (lot name). Always use category from PricelistItem (lot_category / JSON category).

Vendor Partnumber Global Mapping (2026-02-18)

Decision Summary

  • lot_partnumbers remains the canonical integration table for external configurator.
  • Mapping is strict 1:1 by key (vendor, partnumber) (fallback to empty vendor is allowed).
  • Composite mappings are represented via internal virtual LOT bundles:
    • partnumber -> bundle_lot in lot_partnumbers
    • bundle composition in qt_lot_bundle_items with qty.
  • Ignore logic is moved from stock_ignore_rules to qt_vendor_partnumber_seen.is_ignored.
  • Warehouse pricing stays client-compatible: published by LOT, bundle expansion happens inside PriceForge.

Rationale

  • Preserves external/client contracts (lot_partnumbers, LOT-based pricelists).
  • Avoids multi-row ambiguity in lot_partnumbers.
  • Supports complex assembled vendor SKUs without client changes.
  • Centralizes ignore behavior across all sources via seen-registry.

Constraints

  • Bundle LOT is internal and must stay hidden in regular LOT list by default.
  • Resolver order is mandatory: exact vendor+partnumber then fallback vendor=''.
  • Bundle allocation for missing estimate uses fallback from previous active warehouse pricelist; if absent then 0.

Implementation References

  • Migration: migrations/023_vendor_partnumber_global_mapping.sql
  • Models: internal/models/lot.go, internal/models/configuration.go
  • Resolver: internal/lotmatch/matcher.go
  • Warehouse allocation: internal/warehouse/snapshot.go
  • Vendor mapping service: internal/services/vendor_mapping.go
  • Stock import seen/ignore integration: internal/services/stock_import.go
  • API wiring: internal/handlers/pricing.go, cmd/pfs/main.go