Добавлено новое поле fulfillmentCenterId в модель SupplyOrder и соответствующий реляционный объект fulfillmentCenter для улучшения обработки заказов. Обновлены компоненты FulfillmentSuppliesTab и RealSupplyOrdersTab для интеграции нового функционала. Оптимизированы стили и структура кода для повышения удобства использования.
This commit is contained in:
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Создаем расходники на основе заказанных товаров
|
||||
|
Reference in New Issue
Block a user