first commit
This commit is contained in:
@ -47,10 +47,11 @@ import {
|
||||
GET_SUPPLY_MOVEMENTS, // Движения товаров (прибыло/убыло)
|
||||
} from '@/graphql/queries'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useSidebar } from '@/hooks/useSidebar'
|
||||
import { useRealtime } from '@/hooks/useRealtime'
|
||||
import { useSidebar } from '@/hooks/useSidebar'
|
||||
|
||||
import { WbReturnClaims } from '../wb-return-claims'
|
||||
|
||||
import { StatCard } from './blocks/StatCard'
|
||||
|
||||
// Типы данных для 3-уровневой иерархии
|
||||
@ -284,37 +285,37 @@ export function FulfillmentWarehouseDashboard() {
|
||||
current: stats.products?.current || 0,
|
||||
change: stats.products?.change || 0,
|
||||
arrived: movements?.arrived?.products || 0,
|
||||
departed: movements?.departed?.products || 0
|
||||
departed: movements?.departed?.products || 0,
|
||||
},
|
||||
goods: {
|
||||
current: stats.goods?.current || 0,
|
||||
change: stats.goods?.change || 0,
|
||||
arrived: movements?.arrived?.goods || 0,
|
||||
departed: movements?.departed?.goods || 0
|
||||
departed: movements?.departed?.goods || 0,
|
||||
},
|
||||
defects: {
|
||||
current: stats.defects?.current || 0,
|
||||
change: stats.defects?.change || 0,
|
||||
arrived: movements?.arrived?.defects || 0,
|
||||
departed: movements?.departed?.defects || 0
|
||||
departed: movements?.departed?.defects || 0,
|
||||
},
|
||||
pvzReturns: {
|
||||
current: stats.pvzReturns?.current || 0,
|
||||
change: stats.pvzReturns?.change || 0,
|
||||
arrived: movements?.arrived?.pvzReturns || 0,
|
||||
departed: movements?.departed?.pvzReturns || 0
|
||||
departed: movements?.departed?.pvzReturns || 0,
|
||||
},
|
||||
fulfillmentSupplies: {
|
||||
current: stats.fulfillmentSupplies?.current || 0,
|
||||
change: stats.fulfillmentSupplies?.change || 0,
|
||||
arrived: movements?.arrived?.fulfillmentSupplies || 0,
|
||||
departed: movements?.departed?.fulfillmentSupplies || 0
|
||||
departed: movements?.departed?.fulfillmentSupplies || 0,
|
||||
},
|
||||
sellerSupplies: {
|
||||
current: stats.sellerSupplies?.current || 0,
|
||||
change: stats.sellerSupplies?.change || 0,
|
||||
arrived: movements?.arrived?.sellerSupplies || 0,
|
||||
departed: movements?.departed?.sellerSupplies || 0
|
||||
departed: movements?.departed?.sellerSupplies || 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -329,37 +330,37 @@ export function FulfillmentWarehouseDashboard() {
|
||||
current: warehouseProducts.filter((p: any) => p.type === 'PRODUCT').length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.products || 0,
|
||||
departed: movements?.departed?.products || 0
|
||||
departed: movements?.departed?.products || 0,
|
||||
},
|
||||
goods: {
|
||||
current: warehouseProducts.filter((p: any) => p.type === 'GOODS').length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.goods || 0,
|
||||
departed: movements?.departed?.goods || 0
|
||||
departed: movements?.departed?.goods || 0,
|
||||
},
|
||||
defects: {
|
||||
current: warehouseProducts.filter((p: any) => p.type === 'DEFECTS').length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.defects || 0,
|
||||
departed: movements?.departed?.defects || 0
|
||||
departed: movements?.departed?.defects || 0,
|
||||
},
|
||||
pvzReturns: {
|
||||
current: warehouseProducts.filter((p: any) => p.type === 'PVZ_RETURNS').length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.pvzReturns || 0,
|
||||
departed: movements?.departed?.pvzReturns || 0
|
||||
departed: movements?.departed?.pvzReturns || 0,
|
||||
},
|
||||
fulfillmentSupplies: {
|
||||
current: fulfillmentSupplies.length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.fulfillmentSupplies || 0,
|
||||
departed: movements?.departed?.fulfillmentSupplies || 0
|
||||
departed: movements?.departed?.fulfillmentSupplies || 0,
|
||||
},
|
||||
sellerSupplies: {
|
||||
current: sellerSupplies.length,
|
||||
change: 0,
|
||||
arrived: movements?.arrived?.sellerSupplies || 0,
|
||||
departed: movements?.departed?.sellerSupplies || 0
|
||||
departed: movements?.departed?.sellerSupplies || 0,
|
||||
},
|
||||
}
|
||||
}, [warehouseStatsData, warehouseData, sellerSuppliesData, fulfillmentSuppliesData, supplyMovementsData])
|
||||
@ -448,7 +449,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
sellerSuppliesQuantity: 0,
|
||||
pvzReturnsQuantity: 0,
|
||||
sellerSuppliesOwners: [],
|
||||
variants: []
|
||||
variants: [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,7 +465,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
// КРИТИЧНО: Группировка расходников селлера по ВЛАДЕЛЬЦУ (не по названию!)
|
||||
const sellerSuppliesForThisSeller = sellerSupplies.filter((supply: any) =>
|
||||
supply.type === 'SELLER_CONSUMABLES' &&
|
||||
supply.sellerId === sellerId
|
||||
supply.sellerId === sellerId,
|
||||
)
|
||||
|
||||
console.warn(`📦 Расходники для селлера ${sellerName}:`, sellerSuppliesForThisSeller.length)
|
||||
@ -484,7 +485,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
sellerSuppliesQuantity: 0,
|
||||
pvzReturnsQuantity: 0,
|
||||
sellerSuppliesOwners: [ownerKey],
|
||||
variants: []
|
||||
variants: [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,7 +505,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
sellerSupplies: acc.sellerSupplies + (item.sellerSuppliesQuantity || 0),
|
||||
pvzReturns: acc.pvzReturns + (item.pvzReturnsQuantity || 0),
|
||||
}),
|
||||
{ products: 0, goods: 0, defects: 0, sellerSupplies: 0, pvzReturns: 0 }
|
||||
{ products: 0, goods: 0, defects: 0, sellerSupplies: 0, pvzReturns: 0 },
|
||||
)
|
||||
|
||||
console.warn(`📊 Итоги для ${sellerName}:`, totals)
|
||||
@ -541,7 +542,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
|
||||
if (searchTerm) {
|
||||
filtered = filtered.filter((store) =>
|
||||
store.name.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
store.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
)
|
||||
}
|
||||
|
||||
@ -573,7 +574,7 @@ export function FulfillmentWarehouseDashboard() {
|
||||
sellerSupplies: acc.sellerSupplies + store.sellerSupplies,
|
||||
pvzReturns: acc.pvzReturns + store.pvzReturns,
|
||||
}),
|
||||
{ products: 0, goods: 0, defects: 0, sellerSupplies: 0, pvzReturns: 0 }
|
||||
{ products: 0, goods: 0, defects: 0, sellerSupplies: 0, pvzReturns: 0 },
|
||||
)
|
||||
}, [filteredAndSortedStores])
|
||||
|
||||
|
Reference in New Issue
Block a user