Возврат поставщику
Возврат товара поставщику со списанием со склада. Возврат — это списание с source_type = supplier: товар уходит из партий этого поставщика на складах пользователя (сначала самые новые), а в журнал поставщика пишется расход на сумму по приходной цене партий — по строке на валюту. Он уменьшает наш долг, а если поставщику уже заплатили — становится долгом поставщика перед нами.
| Метод | Адрес | Назначение |
|---|---|---|
| GET | /company/supplier/supplier-return/stats | Карточки возвратов |
| GET | /company/supplier/supplier-return/products | Товары для возврата |
| GET | /company/supplier/supplier-return/{model}/excel | Excel документа возврата |
| GET | /company/supplier/supplier-return | История возвратов |
| GET | /company/supplier/supplier-return/{model} | Возврат поставщику |
| POST | /company/supplier/supplier-return | Оформить возврат |
Карточки возвратов
Итоги раздела без кэша: count — проведённых возвратов, amount — сумма по валютам, amount_uzs — та же сумма в сумах по курсам компании, quantity — возвращено штук, suppliers_count — разных поставщиков. Без возвратов везде 0.
/company/supplier/supplier-return/statsЗаголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Ответ · 200
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
count | integer | Количество |
amount | object | Сумма |
amount.uzs | integer | |
amount_uzs | integer | |
quantity | integer | Количество |
suppliers_count | integer | |
products_count | integer | |
average_amount_uzs | integer | |
max_return | object | |
max_return.id | integer | ID |
max_return.supplier_id | integer | Поставщик |
max_return.created_at | string | Создано |
max_return.amount_uzs | integer | |
max_return.supplier_name | string | |
by_reason | object[] | |
by_reason[].reason | string | Причина |
by_reason[].returns_count | integer | Возвраты (шт.) |
by_reason[].quantity | integer | Количество |
by_reason[].amount_uzs | integer | |
by_supplier | object[] | |
by_supplier[].supplier_id | integer | Поставщик |
by_supplier[].name | string | Название |
by_supplier[].returns_count | integer | Возвраты (шт.) |
by_supplier[].quantity | integer | Количество |
by_supplier[].amount_uzs | integer | |
top_products | object[] | |
top_products[].product_id | integer | Продукт |
top_products[].name | string | Название |
top_products[].returns_count | integer | Возвраты (шт.) |
top_products[].quantity | integer | Количество |
top_products[].amount_uzs | integer |
{
"count": 1,
"amount": {
"uzs": 3000
},
"amount_uzs": 3000,
"quantity": 3,
"suppliers_count": 1,
"products_count": 1,
"average_amount_uzs": 3000,
"max_return": {
"id": 157,
"supplier_id": 2,
"created_at": "2026-11-25 16:49:18",
"amount_uzs": 3000,
"supplier_name": "Supplier 2"
},
"by_reason": [
{
"reason": "stock_defect",
"returns_count": 1,
"quantity": 3,
"amount_uzs": 3000
}
],
"by_supplier": [
{
"supplier_id": 2,
"name": "Supplier 2",
"returns_count": 1,
"quantity": 3,
"amount_uzs": 3000
}
],
"top_products": [
{
"product_id": 3,
"name": "Product 2",
"returns_count": 1,
"quantity": 3,
"amount_uzs": 3000
}
]
}Товары для возврата
Товары, которые приходили от поставщика filter[supplier_id] (проведённые приходы), по названию, постранично (page-size до 100). quantity — сколько штук этого поставщика лежит на складах пользователя (0 — вернуть нельзя), last_purchase_price / last_purchase_currency — цена последнего прихода, sale_price / sale_currency — цена продажи. Поиск — filter[search].
/company/supplier/supplier-return/productsЗаголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Параметры запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
filter.supplier_id | integer | Да | Поставщик. ID существующей записи, доступной пользователю |
filter.search | string | Нет | Поиск. Макс. 255 символов |
page | integer | Нет | Страница. Не меньше 1 |
page-size | integer | Нет | Не меньше 1. Не больше 100 |
Ответ · 200
Постраничный ответ: записи в data[], пагинация в links и meta.
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
data | object[] | Данные |
data[].id | integer | ID |
data[].name | string | Название |
data[].images_list_thumbs | array | |
data[].unit | object | Единица измерения |
data[].unit.id | integer | ID |
data[].unit.name | object | Название |
data[].unit.name.oz | string | |
data[].unit.name.ru | string | |
data[].unit.name.uz | string | |
data[].quantity | integer | Количество |
data[].last_purchase_price | integer | |
data[].last_purchase_currency | string | |
data[].sale_price | integer | Цена при продаже |
data[].sale_currency | string | Валюта при продаже |
{
"data": [
{
"id": 3,
"name": "Product 2",
"images_list_thumbs": [],
"unit": {
"id": 2,
"name": {
"oz": "Unit 2 oz",
"ru": "Unit 2 ru",
"uz": "Unit 2 uz"
}
},
"quantity": 5,
"last_purchase_price": 1300,
"last_purchase_currency": "uzs",
"sale_price": 1800,
"sale_currency": "uzs"
}
],
"links": {
"first": "https://api.wasyt.uz/company/supplier/supplier-return/products?page=1",
"last": "https://api.wasyt.uz/company/supplier/supplier-return/products?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [],
"path": "https://api.wasyt.uz/company/supplier/supplier-return/products",
"per_page": 50,
"to": 1,
"total": 1
}
}Excel документа возврата
Строки одного возврата поставщику в Excel (как выгрузка строк списания).
/company/supplier/supplier-return/{model}/excelЗаголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Параметры пути
| Параметр | Описание |
|---|---|
model | ID записи |
Ответ · 200
Ответ — файл или текст, не JSON.
История возвратов
Проведённые возвраты поставщикам доступных компаний, по умолчанию новые сверху. В каждой строке: supplier (id, название), products_count (видов товара), quantity (штук), amount (сумма по валютам), reason / reason_label, comment и stocks — склады, с которых списан товар. Фильтры: filter[source_id] (поставщик), filter[created_at].
/company/supplier/supplier-returnЗаголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Параметры запроса
| Параметр | Описание |
|---|---|
filter[id] | ID — точное значение |
filter[source_id] | Источник — точное значение |
filter[created_at] | Создано — период: [0] — с, [1] — по (Y-m-d) |
sort[] | Сортировка, - — по убыванию: id, -id, created_at, -created_at |
with[] | Подгрузить связи: creator.profile |
page | Номер страницы, с 1 |
page-size | Записей на странице, не больше 20 |
Ответ · 200
Постраничный ответ: записи в data[], пагинация в links и meta.
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
data | object[] | Данные |
data[].id | integer | ID |
data[].creator_id | integer | Создатель |
data[].company_id | integer | Компания |
data[].source_type | string | Источник |
data[].source_id | integer | Источник |
data[].name | string | Название |
data[].status | string | Статус |
data[].created_at | string | Создано |
data[].updated_at | string | Обновлено |
data[].supplier | object | |
data[].supplier.id | integer | ID |
data[].supplier.name | string | Название |
data[].products_count | integer | |
data[].quantity | integer | Количество |
data[].amount | object | Сумма |
data[].amount.uzs | integer | |
data[].reason | string | Причина |
data[].reason_label | string | |
data[].comment | string | Комментарий |
data[].stocks | object[] | |
data[].stocks[].id | integer | ID |
data[].stocks[].name | string | Название |
{
"data": [
{
"id": 149,
"creator_id": 2,
"company_id": 1,
"source_type": "supplier",
"source_id": 2,
"name": "Возврат поставщику",
"status": "completed",
"created_at": "2026-11-25 16:49:12",
"updated_at": "2026-11-25 16:49:12",
"supplier": {
"id": 2,
"name": "Supplier 2"
},
"products_count": 1,
"quantity": 1,
"amount": {
"uzs": 1000
},
"reason": "stock_defect",
"reason_label": "Брак",
"comment": "Упаковка повреждена",
"stocks": [
{
"id": 1,
"name": "Stock 1"
}
]
}
],
"links": {
"first": "https://api.wasyt.uz/company/supplier/supplier-return?page=1",
"last": "https://api.wasyt.uz/company/supplier/supplier-return?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [],
"path": "https://api.wasyt.uz/company/supplier/supplier-return",
"per_page": 20,
"to": 1,
"total": 1
}
}Возврат поставщику
Один проведённый возврат по ID с теми же полями, что и строка истории — для окна «Возврат оформлен».
/company/supplier/supplier-return/{model}Заголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Параметры пути
| Параметр | Описание |
|---|---|
model | ID записи |
Ответ · 200
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
id | integer | ID |
creator_id | integer | Создатель |
company_id | integer | Компания |
source_type | string | Источник |
source_id | integer | Источник |
name | string | Название |
status | string | Статус |
created_at | string | Создано |
updated_at | string | Обновлено |
supplier | object | |
supplier.id | integer | ID |
supplier.name | string | Название |
products_count | integer | |
quantity | integer | Количество |
amount | object | Сумма |
amount.uzs | integer | |
reason | string | Причина |
reason_label | string | |
comment | string | Комментарий |
stocks | object[] | |
stocks[].id | integer | ID |
stocks[].name | string | Название |
items | object[] | Состав |
items[].product_id | integer | Продукт |
items[].name | string | Название |
items[].images_list_thumbs | array | |
items[].unit | object | Единица измерения |
items[].unit.id | integer | ID |
items[].unit.name | object | Название |
items[].unit.name.oz | string | |
items[].unit.name.ru | string | |
items[].unit.name.uz | string | |
items[].quantity | integer | Количество |
items[].purchase_price | integer | Цена при покупке |
items[].currency | string | Валюта |
items[].amount | integer | Сумма |
employee | object | |
employee.id | integer | ID |
employee.name | null | Название |
creator | object | |
creator.id | integer | ID |
creator.type | string | Тип |
creator.role_id | integer | Роль |
creator.company_id | integer | Компания |
creator.partner_id | null | Партнёр |
creator.username | string | Логин |
creator.pinfl | null | ПИНФЛ |
creator.phone | string | Телефон |
creator.sipuni_sip_number | string | VoIP - Sipuni (SIP-номер) |
creator.is_confirmed | boolean | |
creator.are_all_companies_available | boolean | |
creator.last_login_at | null | Последний вход |
creator.created_at | string | Создано |
creator.updated_at | string | Обновлено |
creator.is_deleted | boolean | Удалена |
creator.profile | object | |
creator.profile.first_name | null | Имя |
creator.profile.last_name | null | Фамилия |
creator.profile.position | null | Должность |
creator.profile.birth_date | null | Дата рождения |
creator.profile.gender | null | Пол |
creator.profile.is_discount_limited | boolean | |
creator.profile.max_item_discount_percent | null | |
creator.profile.max_check_discount_percent | null | |
creator.profile.is_device_limited | boolean | |
creator.profile.max_devices | integer | |
creator.profile.is_mobile_login_allowed | boolean | |
creator.profile.last_device_number | integer | |
creator.profile.full_name | string | ФИО |
{
"id": 151,
"creator_id": 2,
"company_id": 1,
"source_type": "supplier",
"source_id": 2,
"name": "Возврат поставщику",
"status": "completed",
"created_at": "2026-11-25 16:49:14",
"updated_at": "2026-11-25 16:49:14",
"supplier": {
"id": 2,
"name": "Supplier 2"
},
"products_count": 1,
"quantity": 2,
"amount": {
"uzs": 2000
},
"reason": "stock_defect",
"reason_label": "Брак",
"comment": "Упаковка повреждена",
"stocks": [
{
"id": 1,
"name": "Stock 1"
}
],
"items": [
{
"product_id": 3,
"name": "Product 2",
"images_list_thumbs": [],
"unit": {
"id": 2,
"name": {
"oz": "Unit 2 oz",
"ru": "Unit 2 ru",
"uz": "Unit 2 uz"
}
},
"quantity": 2,
"purchase_price": 1000,
"currency": "uzs",
"amount": 2000
}
],
"employee": {
"id": 2,
"name": null
},
"creator": {
"id": 2,
"type": "director",
"role_id": 2,
"company_id": 1,
"partner_id": null,
"username": "director_1@local.host",
"pinfl": null,
"phone": "998020000001",
"sipuni_sip_number": "210",
"is_confirmed": true,
"are_all_companies_available": false,
"last_login_at": null,
"created_at": "2026-11-25 16:42:00",
"updated_at": "2026-11-25 16:42:00",
"is_deleted": false,
"profile": {
"first_name": null,
"last_name": null,
"position": null,
"birth_date": null,
"gender": null,
"is_discount_limited": false,
"max_item_discount_percent": null,
"max_check_discount_percent": null,
"is_device_limited": true,
"max_devices": 2,
"is_mobile_login_allowed": true,
"last_device_number": 0,
"full_name": " "
}
}
}Оформить возврат
Проводит возврат сразу: supplier_id, reason (stock_defect — брак, stock_damage — повреждён, stock_overdue — истёк срок, purchase_incorrect_description — не соответствует заказу, common_other — другое), comment (обязателен при common_other) и products[] с product_id и quantity. Количество распределяется по партиям поставщика на складах (сначала новые) и не может превышать остаток — иначе 422. Остаток уменьшается, в журнал поставщика пишется расход. Ответ — возврат с полями строки истории.
/company/supplier/supplier-returnЗаголовки
| Заголовок | Значение | Описание |
|---|---|---|
Authorization | Bearer {token} | Токен из POST /common/auth/login |
Accept | application/json | Ответ в JSON |
Accept-Language | ru | Язык сообщений и названий: ru, uz, oz |
Тело запроса
| Поле | Тип | Обязательно | Описание |
|---|---|---|---|
supplier_id | integer | Да | Поставщик. ID существующей записи, доступной пользователю |
reason | string | Да | Причина. Допустимые значения: stock_defect, stock_damage, stock_overdue, purchase_incorrect_description, common_other |
comment | string | Нет | Комментарий. Макс. 1000 символов |
products | object[] | Да | Продукты. Макс. 1000 элементов |
products[].product_id | integer | Да | Продукт. Без повторов |
products[].quantity | number | Да | Количество. До 4 знаков после запятой. Не меньше 0.0001 |
{
"supplier_id": 2,
"reason": "stock_defect",
"comment": "Упаковка повреждена",
"products": [
{
"product_id": 3,
"quantity": 4
}
]
}curl -X POST "https://api.wasyt.uz/company/supplier/supplier-return" \
-H "Accept: application/json" \
-H "Accept-Language: ru" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{"supplier_id":2,"reason":"stock_defect","comment":"Упаковка повреждена","products":[{"product_id":3,"quantity":4}]}'Ответ · 200
Поля ответа
| Поле | Тип | Описание |
|---|---|---|
source_type | string | Источник |
source_id | integer | Источник |
name | string | Название |
status | string | Статус |
creator_id | integer | Создатель |
company_id | integer | Компания |
updated_at | string | Обновлено |
created_at | string | Создано |
id | integer | ID |
supplier | object | |
supplier.id | integer | ID |
supplier.name | string | Название |
products_count | integer | |
quantity | integer | Количество |
amount | object | Сумма |
amount.uzs | integer | |
reason | string | Причина |
reason_label | string | |
comment | string | Комментарий |
stocks | object[] | |
stocks[].id | integer | ID |
stocks[].name | string | Название |
{
"source_type": "supplier",
"source_id": 2,
"name": "Возврат поставщику",
"status": "completed",
"creator_id": 2,
"company_id": 1,
"updated_at": "2026-11-25 16:49:09",
"created_at": "2026-11-25 16:49:09",
"id": 146,
"supplier": {
"id": 2,
"name": "Supplier 2"
},
"products_count": 1,
"quantity": 4,
"amount": {
"uzs": 4600
},
"reason": "stock_defect",
"reason_label": "Брак",
"comment": "Упаковка повреждена",
"stocks": [
{
"id": 1,
"name": "Stock 1"
}
]
}
