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:
136
scripts/check-fulfillment-warehouse.cjs
Normal file
136
scripts/check-fulfillment-warehouse.cjs
Normal file
@ -0,0 +1,136 @@
|
||||
const { PrismaClient } = require('@prisma/client')
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
async function checkFulfillmentWarehouse() {
|
||||
try {
|
||||
console.log('🔍 ПРОВЕРЯЕМ СКЛАД ФУЛФИЛМЕНТА ДЛЯ ПОЛЬЗОВАТЕЛЯ 79999999999...')
|
||||
|
||||
// Найдем пользователя и его организацию
|
||||
const user = await prisma.user.findFirst({
|
||||
where: { phone: '79999999999' },
|
||||
include: {
|
||||
organization: true
|
||||
}
|
||||
})
|
||||
|
||||
if (!user || user.organization?.type !== 'FULFILLMENT') {
|
||||
console.log('❌ Пользователь не является фулфилментом')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('🏢 ОРГАНИЗАЦИЯ ФУЛФИЛМЕНТА:')
|
||||
console.log(' Название:', user.organization.name)
|
||||
console.log(' ID:', user.organization.id)
|
||||
console.log(' Тип:', user.organization.type)
|
||||
|
||||
console.log('\n📦 ПРОВЕРЯЕМ РАСХОДНИКИ ФУЛФИЛМЕНТА:')
|
||||
|
||||
// Supply записи для фулфилмента
|
||||
const supplies = await prisma.supply.findMany({
|
||||
where: {
|
||||
organizationId: user.organization.id,
|
||||
type: 'FULFILLMENT_CONSUMABLES'
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
article: true,
|
||||
currentStock: true,
|
||||
quantity: true,
|
||||
usedStock: true,
|
||||
status: true,
|
||||
supplier: true,
|
||||
category: true,
|
||||
price: true,
|
||||
unit: true,
|
||||
createdAt: true,
|
||||
updatedAt: true
|
||||
},
|
||||
orderBy: { updatedAt: 'desc' }
|
||||
})
|
||||
|
||||
console.log(`\n📋 РАСХОДНИКИ НА СКЛАДЕ: ${supplies.length} позиций`)
|
||||
|
||||
if (supplies.length === 0) {
|
||||
console.log(' 📭 Склад пуст - нет расходников фулфилмента')
|
||||
} else {
|
||||
let totalCurrent = 0
|
||||
let totalUsed = 0
|
||||
|
||||
supplies.forEach((supply, index) => {
|
||||
console.log(`\n ${index + 1}. "${supply.name}"`)
|
||||
console.log(` 📋 ID: ${supply.id}`)
|
||||
console.log(` 🏷️ Артикул: ${supply.article || 'Нет'}`)
|
||||
console.log(` 📦 Текущий остаток: ${supply.currentStock} ${supply.unit || 'шт'}`)
|
||||
console.log(` 📊 Общее количество: ${supply.quantity} ${supply.unit || 'шт'}`)
|
||||
console.log(` ✅ Использовано: ${supply.usedStock} ${supply.unit || 'шт'}`)
|
||||
console.log(` 💰 Цена: ${supply.price || 0} руб`)
|
||||
console.log(` 📂 Категория: ${supply.category || 'Не указана'}`)
|
||||
console.log(` 🏪 Поставщик: ${supply.supplier || 'Не указан'}`)
|
||||
console.log(` 🔖 Статус: ${supply.status}`)
|
||||
console.log(` 📅 Создан: ${supply.createdAt.toISOString().split('T')[0]}`)
|
||||
console.log(` 🔄 Обновлен: ${supply.updatedAt.toISOString().split('T')[0]}`)
|
||||
|
||||
totalCurrent += supply.currentStock
|
||||
totalUsed += supply.usedStock
|
||||
})
|
||||
|
||||
console.log(`\n📊 ИТОГОВАЯ СТАТИСТИКА:`)
|
||||
console.log(` 📦 Общий остаток: ${totalCurrent} единиц`)
|
||||
console.log(` ✅ Всего использовано: ${totalUsed} единиц`)
|
||||
console.log(` 🏷️ Всего позиций: ${supplies.length}`)
|
||||
|
||||
// Статистика по статусам
|
||||
const statusStats = supplies.reduce((acc, supply) => {
|
||||
acc[supply.status] = (acc[supply.status] || 0) + 1
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
console.log(`\n📈 СТАТИСТИКА ПО СТАТУСАМ:`)
|
||||
Object.entries(statusStats).forEach(([status, count]) => {
|
||||
console.log(` ${status}: ${count} позиций`)
|
||||
})
|
||||
}
|
||||
|
||||
// Проверяем заказы поставок
|
||||
console.log('\n📋 ПРОВЕРЯЕМ ЗАКАЗЫ ПОСТАВОК:')
|
||||
const supplyOrders = await prisma.supplyOrder.findMany({
|
||||
where: {
|
||||
fulfillmentCenterId: user.organization.id
|
||||
},
|
||||
include: {
|
||||
items: {
|
||||
include: {
|
||||
product: {
|
||||
select: {
|
||||
name: true,
|
||||
article: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: { updatedAt: 'desc' },
|
||||
take: 5
|
||||
})
|
||||
|
||||
console.log(` 📦 Заказов поставок: ${supplyOrders.length} (последние 5)`)
|
||||
supplyOrders.forEach((order, index) => {
|
||||
console.log(`\n ${index + 1}. Заказ ${order.id}`)
|
||||
console.log(` 📋 Статус: ${order.status}`)
|
||||
console.log(` 📅 Дата доставки: ${order.deliveryDate.toISOString().split('T')[0]}`)
|
||||
console.log(` 📦 Элементов: ${order.items.length}`)
|
||||
order.items.forEach((item, itemIndex) => {
|
||||
console.log(` ${itemIndex + 1}. ${item.product.name} x${item.quantity} (арт: ${item.product.article})`)
|
||||
})
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Ошибка:', error.message)
|
||||
} finally {
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
}
|
||||
|
||||
checkFulfillmentWarehouse()
|
Reference in New Issue
Block a user