Добавлено новое поле fulfillmentCenterId в модель SupplyOrder и соответствующий реляционный объект fulfillmentCenter для улучшения обработки заказов. Обновлены компоненты FulfillmentSuppliesTab и RealSupplyOrdersTab для интеграции нового функционала. Оптимизированы стили и структура кода для повышения удобства использования.

This commit is contained in:
Bivekich
2025-07-24 15:10:58 +03:00
parent 74fb071552
commit c6b1b15c80
11 changed files with 481 additions and 47 deletions

View File

@ -763,6 +763,7 @@ export const GET_SUPPLY_ORDERS = gql`
status
totalAmount
totalItems
fulfillmentCenterId
createdAt
updatedAt
partner {
@ -780,6 +781,12 @@ export const GET_SUPPLY_ORDERS = gql`
fullName
type
}
fulfillmentCenter {
id
name
fullName
type
}
items {
id
quantity

View File

@ -684,12 +684,13 @@ export const resolvers = {
throw new GraphQLError("У пользователя нет организации");
}
// Возвращаем заказы где текущая организация является заказчиком или поставщиком
// Возвращаем заказы где текущая организация является заказчиком, поставщиком или получателем
return await prisma.supplyOrder.findMany({
where: {
OR: [
{ organizationId: currentUser.organization.id }, // Заказы созданные организацией
{ partnerId: currentUser.organization.id }, // Заказы где организация - поставщик
{ fulfillmentCenterId: currentUser.organization.id }, // Заказы где организация - получатель (фулфилмент)
],
},
include: {
@ -703,6 +704,11 @@ export const resolvers = {
users: true,
},
},
fulfillmentCenter: {
include: {
users: true,
},
},
items: {
include: {
product: {
@ -3213,33 +3219,39 @@ export const resolvers = {
totalAmount: new Prisma.Decimal(totalAmount),
totalItems: totalItems,
organizationId: currentUser.organization.id,
fulfillmentCenterId: fulfillmentCenterId,
status: initialStatus as any,
items: {
create: orderItems,
},
},
include: {
partner: {
include: {
users: true,
},
include: {
partner: {
include: {
users: true,
},
organization: {
include: {
users: true,
},
},
organization: {
include: {
users: true,
},
items: {
include: {
product: {
include: {
category: true,
organization: true,
},
},
fulfillmentCenter: {
include: {
users: true,
},
},
items: {
include: {
product: {
include: {
category: true,
organization: true,
},
},
},
},
},
});
// Создаем расходники на основе заказанных товаров

View File

@ -519,6 +519,8 @@ export const typeDefs = gql`
status: SupplyOrderStatus!
totalAmount: Float!
totalItems: Int!
fulfillmentCenterId: ID
fulfillmentCenter: Organization
items: [SupplyOrderItem!]!
createdAt: DateTime!
updatedAt: DateTime!