Mikhail Chusavitin
5f8aec456b
Unified Quote Journal (parts_log) v3
...
- New unified append-only quote log table parts_log replaces three
separate log tables (stock_log, partnumber_log_competitors, lot_log)
- Migrations 042-049: extend supplier, create parts_log/import_formats/
ignore_rules, rework qt_lot_metadata composite PK, add lead_time_weeks
to pricelist_items, backfill data, migrate ignore rules
- New services: PartsLogBackfillService, ImportFormatService,
UnifiedImportService; new world pricelist type (all supplier types)
- qt_lot_metadata PK changed to (lot_name, pricelist_type); all queries
now filter WHERE pricelist_type='estimate'
- Fix pre-existing bug: qt_component_usage_stats column names
quotes_last30d/quotes_last7d (no underscore) — added explicit gorm tags
- Bible: full table inventory, baseline schema snapshot, updated pricelist/
data-rules/api/history/architecture docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-21 17:25:54 +03:00
Mikhail Chusavitin
df5be91353
Improve performance on poor connections: local assets, gzip, caching
...
- Replace Tailwind CDN (~350KB) with purged local CSS (~22KB)
- Replace htmx unpkg CDN with local static file
- Add Gzip middleware (standard library, sync.Pool) for all responses
- Add Cache-Control: public, max-age=3600 for /static/* assets
- Reduce status polling interval from 5s to 30s
- Add scripts/build-css.sh for CSS regeneration after template changes
- Document in bible-local/operations.md and history.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-14 14:51:21 +03:00
Mikhail Chusavitin
c53c484bde
Replace competitor discount with price_uplift; stock pricelist detail UI
...
- Drop `expected_discount_pct`, add `price_uplift DECIMAL(8,4) DEFAULT 1.3`
to `qt_competitors` (migration 040); formula: effective_price = price / uplift
- Extend `LoadLotMetrics` to return per-PN qty map (`pnQtysByLot`)
- Add virtual fields `CompetitorNames`, `PriceSpreadPct`, `PartnumberQtys`
to `PricelistItem`; populate via `enrichWarehouseItems` / `enrichCompetitorItems`
- Competitor quotes filtered to qty > 0 before lot resolution
- New "stock layout" on pricelist detail page for warehouse/competitor:
Partnumbers column (PN + qty, only qty>0), Поставщик column, no Настройки/Доступно
- Spread badge ±N% shown next to price for competitor rows
- Bible updated: pricelist.md, history.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-13 12:58:41 +03:00
Mikhail Chusavitin
f48615e8a9
Modularize Go files, extract JS to static, implement competitor pricelists
...
Go refactoring:
- Split handlers/pricing.go (2446→291 lines) into 5 focused files
- Split services/stock_import.go (1334→~400 lines) into stock_mappings.go + stock_parse.go
- Split services/sync/service.go (1290→~250 lines) into 3 files
JS extraction:
- Move all inline <script> blocks to web/static/js/ (6 files)
- Templates reduced: admin_pricing 2873→521, lot 1531→304, vendor_mappings 1063→169, etc.
Competitor pricelists (migrations 033-039):
- qt_competitors + partnumber_log_competitors tables
- Excel import with column mapping, dedup, bulk insert
- p/n→lot resolution via weighted_median, discount applied
- Unmapped p/ns written to qt_vendor_partnumber_seen
- Quote counts (unique/total) shown on /admin/competitors
- price_method="weighted_median", price_period_days=0 stored explicitly
Fix price_method/price_period_days for warehouse items:
- warehouse: weighted_avg, period=0
- competitor: weighted_median, period=0
- Removes misleading DB defaults (was: median/90)
Update bible: architecture.md, pricelist.md, history.md
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-13 07:44:10 +03:00
Mikhail Chusavitin
3f26a2935a
Refactor vendor mappings to canonical PN catalog
2026-03-07 23:11:42 +03:00
Mikhail Chusavitin
08de9006ef
Refactor partnumber book catalog storage
2026-03-07 22:10:05 +03:00
Mikhail Chusavitin
b2b2f4774c
Refactor scheduler and settings UI
2026-03-07 21:10:20 +03:00
27e33db446
Restore previous bible/ content as bible-local/
...
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-03-01 22:26:50 +03:00