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>
This commit is contained in:
Mikhail Chusavitin
2026-03-13 12:58:41 +03:00
parent 9b9b343f0c
commit c53c484bde
15 changed files with 456 additions and 86 deletions

View File

@@ -20,7 +20,7 @@
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Название</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Базис</th>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Валюта</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Скидка %</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase" title="Делитель цены: цена_без_НДС = цена / аплифт">Аплифт</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase" title="Уникальных партномеров в системе">Уник. p/n</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase" title="Всего котировок исторически">Всего</th>
<th class="px-4 py-2 text-center text-xs font-medium text-gray-500 uppercase">Активен</th>
@@ -62,8 +62,8 @@
</div>
<div class="col-span-2 grid grid-cols-2 gap-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Ожидаемая скидка %</label>
<input id="comp-discount" type="number" step="0.01" min="0" max="100" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring-2 focus:ring-orange-500" value="0">
<label class="block text-sm font-medium text-gray-700 mb-1" title="Делитель: цена_без_НДС = ценаонкурента / аплифт">Аплифт (делитель цены)</label>
<input id="comp-uplift" type="number" step="0.0001" min="0.0001" class="w-full px-3 py-2 border rounded focus:outline-none focus:ring-2 focus:ring-orange-500" value="1.3" placeholder="1.3">
</div>
</div>
</div>