fix: завершение модуляризации системы и финальная организация проекта

## Структурные изменения:

### 📁 Организация архивных файлов:
- Перенос всех устаревших правил в legacy-rules/
- Создание структуры docs-and-reports/ для отчетов
- Архивация backup файлов в legacy-rules/backups/

### 🔧 Критические компоненты:
- src/components/supplies/multilevel-supplies-table.tsx - многоуровневая таблица поставок
- src/components/supplies/components/recipe-display.tsx - отображение рецептур
- src/components/fulfillment-supplies/fulfillment-goods-orders-tab.tsx - вкладка товарных заказов

### 🎯 GraphQL обновления:
- Обновление mutations.ts, queries.ts, resolvers.ts, typedefs.ts
- Синхронизация с Prisma schema.prisma
- Backup файлы для истории изменений

### 🛠️ Утилитарные скрипты:
- 12 новых скриптов в scripts/ для анализа данных
- Скрипты проверки фулфилмент-пользователей
- Утилиты очистки и фиксации данных поставок

### 📊 Тестирование:
- test-fulfillment-filtering.js - тестирование фильтрации фулфилмента
- test-full-workflow.js - полный workflow тестирование

### 📝 Документация:
- logistics-statistics-warehouse-rules.md - объединенные правила модулей
- Обновление журналов модуляризации и разработки

###  Исправления ESLint:
- Исправлены критические ошибки в sidebar.tsx
- Исправлены ошибки типизации в multilevel-supplies-table.tsx
- Исправлены неиспользуемые переменные в goods-supplies-table.tsx
- Заменены типы any на строгую типизацию
- Исправлены console.log на console.warn

## Результат:
- Завершена полная модуляризация системы
- Организована архитектура legacy файлов
- Добавлены критически важные компоненты таблиц
- Создана полная инфраструктура тестирования
- Исправлены все критические ESLint ошибки
- Сохранены 103 незакоммиченных изменения

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Veronika Smirnova
2025-08-22 10:31:43 +03:00
parent 621770e765
commit 89257c75b5
86 changed files with 25406 additions and 942 deletions

View File

@ -0,0 +1,284 @@
const { PrismaClient } = require('@prisma/client')
const prisma = new PrismaClient()
async function showAllSupplyData() {
try {
console.log('📊 ВСЕ ДАННЫЕ О ПОСТАВКАХ В СИСТЕМЕ\n')
console.log('=' .repeat(80))
// 1. SUPPLY ORDERS - Заказы поставок
console.log('\n📦 1. SUPPLY ORDERS (Заказы поставок):')
console.log('-' .repeat(80))
const supplyOrders = await prisma.supplyOrder.findMany({
include: {
organization: {
select: {
id: true,
name: true,
fullName: true,
type: true,
inn: true
}
},
partner: {
select: {
id: true,
name: true,
fullName: true,
type: true,
inn: true
}
},
fulfillmentCenter: {
select: {
id: true,
name: true,
fullName: true,
type: true
}
},
logisticsPartner: {
select: {
id: true,
name: true,
fullName: true,
type: true
}
},
items: {
include: {
product: {
select: {
id: true,
name: true,
article: true,
category: true
}
},
}
}
},
orderBy: {
createdAt: 'desc'
}
})
console.log(`Найдено заказов: ${supplyOrders.length}`)
supplyOrders.forEach((order, index) => {
console.log(`\n${index + 1}. Заказ #${order.id.slice(-8)}:`)
console.log(` 📅 Дата поставки: ${order.deliveryDate.toLocaleDateString('ru-RU')}`)
console.log(` 📊 Статус: ${order.status}`)
console.log(` 🏷️ Тип расходников: ${order.consumableType || 'НЕ УКАЗАН'}`)
console.log(` 💰 Сумма: ${order.totalAmount} руб.`)
console.log(` 📦 Позиций: ${order.totalItems}`)
console.log(` 👤 Создатель (${order.organization?.type}): ${order.organization?.name || order.organization?.fullName} (ИНН: ${order.organization?.inn})`)
console.log(` 🏭 Поставщик (${order.partner?.type}): ${order.partner?.name || order.partner?.fullName} (ИНН: ${order.partner?.inn})`)
if (order.fulfillmentCenter) {
console.log(` 🏢 Фулфилмент: ${order.fulfillmentCenter.name || order.fulfillmentCenter.fullName}`)
}
if (order.logisticsPartner) {
console.log(` 🚚 Логистика: ${order.logisticsPartner.name || order.logisticsPartner.fullName}`)
}
console.log(` 📋 Товары (${order.items.length}):`)
order.items.forEach((item, i) => {
console.log(` ${i + 1}. ${item.product.name} (Арт: ${item.product.article})`)
console.log(` Кол-во: ${item.quantity}, Цена: ${item.price} руб., Сумма: ${item.totalPrice} руб.`)
if (item.services?.length > 0) {
console.log(` 🔧 Услуги (ID): ${item.services.join(', ')}`)
}
if (item.fulfillmentConsumables?.length > 0) {
console.log(` 📦 Расходники ФФ (ID): ${item.fulfillmentConsumables.join(', ')}`)
}
if (item.sellerConsumables?.length > 0) {
console.log(` 🛍️ Расходники селлера (ID): ${item.sellerConsumables.join(', ')}`)
}
})
console.log(` 🕐 Создан: ${order.createdAt.toLocaleString('ru-RU')}`)
})
// 2. SUPPLY SUPPLIERS - Поставщики расходников
console.log('\n\n🏭 2. SUPPLY SUPPLIERS (Поставщики расходников):')
console.log('-' .repeat(80))
const supplySuppliers = await prisma.supplySupplier.findMany({
include: {
organization: {
select: {
id: true,
name: true,
type: true
}
}
}
})
console.log(`Найдено поставщиков: ${supplySuppliers.length}`)
supplySuppliers.forEach((supplier, index) => {
console.log(`\n${index + 1}. ${supplier.name}`)
console.log(` 📞 Контакт: ${supplier.contactName}`)
console.log(` ☎️ Телефон: ${supplier.phone}`)
console.log(` 📍 Адрес: ${supplier.address}`)
console.log(` 🏪 Рынок: ${supplier.market}`)
console.log(` 🏢 Организация: ${supplier.organization?.name} (${supplier.organization?.type})`)
})
// 3. PRODUCTS - Товары на складах
console.log('\n\n📦 3. PRODUCTS (Товары на складах):')
console.log('-' .repeat(80))
const products = await prisma.product.findMany({
include: {
category: true,
organization: {
select: {
id: true,
name: true,
type: true
}
}
},
where: {
organization: {
type: {
in: ['WHOLESALE', 'FULFILLMENT']
}
}
}
})
console.log(`Найдено товаров: ${products.length}`)
const productsByOrg = {}
products.forEach(product => {
const orgName = product.organization.name || 'Без названия'
const orgType = product.organization.type
const key = `${orgName} (${orgType})`
if (!productsByOrg[key]) {
productsByOrg[key] = []
}
productsByOrg[key].push(product)
})
Object.entries(productsByOrg).forEach(([orgKey, orgProducts]) => {
console.log(`\n${orgKey}: ${orgProducts.length} товаров`)
orgProducts.slice(0, 5).forEach((product, i) => {
console.log(` ${i + 1}. ${product.name} (Арт: ${product.article})`)
console.log(` Категория: ${product.category?.name || 'Без категории'}`)
console.log(` Цена: ${product.price} руб., Остаток: ${product.quantity}`)
})
if (orgProducts.length > 5) {
console.log(` ... и еще ${orgProducts.length - 5} товаров`)
}
})
// 4. SUPPLIES - Все расходники в системе
console.log('\n\n🔧 4. SUPPLIES (Все расходники в системе):')
console.log('-' .repeat(80))
const supplies = await prisma.supply.findMany({
include: {
organization: {
select: {
id: true,
name: true,
type: true
}
},
sellerOwner: {
select: {
id: true,
name: true,
type: true
}
}
}
})
console.log(`Найдено расходников: ${supplies.length}`)
// Группируем по типам
const suppliesByType = {}
supplies.forEach(supply => {
if (!suppliesByType[supply.type]) {
suppliesByType[supply.type] = []
}
suppliesByType[supply.type].push(supply)
})
Object.entries(suppliesByType).forEach(([type, typeSupplies]) => {
console.log(`\n${type}: ${typeSupplies.length} расходников`)
typeSupplies.forEach((supply, index) => {
console.log(` ${index + 1}. ${supply.name} (Арт: ${supply.article})`)
console.log(` 💰 Цена: ${supply.price} руб. за ${supply.unit}`)
console.log(` 📦 Остаток: ${supply.currentStock} из ${supply.minStock} мин.`)
console.log(` 🏢 Организация: ${supply.organization?.name} (${supply.organization?.type})`)
if (supply.sellerOwner) {
console.log(` 👤 Владелец-селлер: ${supply.sellerOwner.name}`)
}
})
})
// 5. СТАТИСТИКА
console.log('\n\n📊 5. СТАТИСТИКА:')
console.log('-' .repeat(80))
// Статистика по статусам
const statusStats = {}
supplyOrders.forEach(order => {
statusStats[order.status] = (statusStats[order.status] || 0) + 1
})
console.log('\nПо статусам:')
Object.entries(statusStats).forEach(([status, count]) => {
console.log(` ${status}: ${count} заказов`)
})
// Статистика по типам расходников
const typeStats = {}
supplyOrders.forEach(order => {
const type = order.consumableType || 'НЕ УКАЗАН'
typeStats[type] = (typeStats[type] || 0) + 1
})
console.log('\nПо типам расходников:')
Object.entries(typeStats).forEach(([type, count]) => {
console.log(` ${type}: ${count} заказов`)
})
// Статистика по организациям
const orgStats = {}
supplyOrders.forEach(order => {
const orgType = order.organization?.type || 'UNKNOWN'
orgStats[orgType] = (orgStats[orgType] || 0) + 1
})
console.log('\nПо типам организаций-создателей:')
Object.entries(orgStats).forEach(([type, count]) => {
console.log(` ${type}: ${count} заказов`)
})
// Общая сумма
const totalSum = supplyOrders.reduce((sum, order) => sum + (order.totalAmount || 0), 0)
console.log(`\n💰 Общая сумма всех заказов: ${totalSum.toLocaleString('ru-RU')} руб.`)
} catch (error) {
console.error('❌ Ошибка:', error.message)
console.error(error)
} finally {
await prisma.$disconnect()
}
}
// Запуск
showAllSupplyData()