
## Структурные изменения: ### 📁 Организация архивных файлов: - Перенос всех устаревших правил в 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>
134 lines
4.6 KiB
JavaScript
134 lines
4.6 KiB
JavaScript
const { PrismaClient } = require('@prisma/client')
|
||
|
||
const prisma = new PrismaClient()
|
||
|
||
async function checkSupplyOrderTypes() {
|
||
try {
|
||
console.log('🔍 ПРОВЕРЯЕМ ТИПЫ ЗАКАЗОВ ПОСТАВОК...')
|
||
|
||
// Найдем пользователя фулфилмента
|
||
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)
|
||
|
||
// Проверяем все заказы поставок для этого фулфилмента
|
||
const supplyOrders = await prisma.supplyOrder.findMany({
|
||
where: {
|
||
fulfillmentCenterId: user.organization.id
|
||
},
|
||
include: {
|
||
items: {
|
||
include: {
|
||
product: {
|
||
select: {
|
||
name: true,
|
||
article: true,
|
||
type: true
|
||
}
|
||
}
|
||
}
|
||
},
|
||
organization: {
|
||
select: {
|
||
name: true,
|
||
type: true
|
||
}
|
||
},
|
||
partner: {
|
||
select: {
|
||
name: true,
|
||
type: true
|
||
}
|
||
}
|
||
},
|
||
orderBy: { updatedAt: 'desc' }
|
||
})
|
||
|
||
console.log(`\n📋 НАЙДЕНО ЗАКАЗОВ ПОСТАВОК: ${supplyOrders.length}`)
|
||
|
||
supplyOrders.forEach((order, index) => {
|
||
console.log(`\n${index + 1}. ЗАКАЗ ${order.id}`)
|
||
console.log(` 📅 Статус: ${order.status}`)
|
||
console.log(` 🏷️ Тип расходников (consumableType): ${order.consumableType || 'НЕ УКАЗАН'}`)
|
||
console.log(` 👤 Заказчик: ${order.organization?.name} (${order.organization?.type})`)
|
||
console.log(` 🏪 Поставщик: ${order.partner?.name} (${order.partner?.type})`)
|
||
console.log(` 📦 Элементов в заказе: ${order.items.length}`)
|
||
|
||
order.items.forEach((item, itemIndex) => {
|
||
console.log(` ${itemIndex + 1}. "${item.product.name}"`)
|
||
console.log(` Артикул: ${item.product.article}`)
|
||
console.log(` Тип товара: ${item.product.type}`)
|
||
console.log(` Количество: ${item.quantity}`)
|
||
})
|
||
console.log(' ---')
|
||
})
|
||
|
||
// Анализируем проблемы
|
||
console.log('\n🔍 АНАЛИЗ ПРОБЛЕМ:')
|
||
|
||
const problemOrders = supplyOrders.filter(order => {
|
||
// Проверяем заказы с неправильным consumableType
|
||
if (order.organization?.type === 'FULFILLMENT' && order.consumableType === 'SELLER_CONSUMABLES') {
|
||
return true
|
||
}
|
||
if (order.organization?.type === 'SELLER' && order.consumableType === 'FULFILLMENT_CONSUMABLES') {
|
||
return true
|
||
}
|
||
return false
|
||
})
|
||
|
||
if (problemOrders.length > 0) {
|
||
console.log(`❌ НАЙДЕНО ПРОБЛЕМНЫХ ЗАКАЗОВ: ${problemOrders.length}`)
|
||
problemOrders.forEach(order => {
|
||
console.log(` Заказ ${order.id}: заказчик ${order.organization?.type}, тип расходников ${order.consumableType}`)
|
||
})
|
||
} else {
|
||
console.log('✅ Все заказы имеют корректные типы расходников')
|
||
}
|
||
|
||
// Проверяем созданные Supply записи
|
||
console.log('\n📦 ПРОВЕРЯЕМ СОЗДАННЫЕ SUPPLY ЗАПИСИ:')
|
||
const supplies = await prisma.supply.findMany({
|
||
where: {
|
||
organizationId: user.organization.id
|
||
},
|
||
select: {
|
||
id: true,
|
||
name: true,
|
||
article: true,
|
||
type: true,
|
||
sellerOwnerId: true,
|
||
currentStock: true,
|
||
createdAt: true
|
||
},
|
||
orderBy: { updatedAt: 'desc' }
|
||
})
|
||
|
||
supplies.forEach((supply, index) => {
|
||
console.log(` ${index + 1}. "${supply.name}" (${supply.article})`)
|
||
console.log(` Тип: ${supply.type}`)
|
||
console.log(` Владелец-селлер: ${supply.sellerOwnerId || 'НЕТ'}`)
|
||
console.log(` Остаток: ${supply.currentStock}`)
|
||
console.log(` Создан: ${supply.createdAt.toISOString().split('T')[0]}`)
|
||
})
|
||
|
||
} catch (error) {
|
||
console.error('❌ Ошибка:', error.message)
|
||
} finally {
|
||
await prisma.$disconnect()
|
||
}
|
||
}
|
||
|
||
checkSupplyOrderTypes() |