feat: импорт человекочитаемого текстового BOM (формат "<описание> - N шт.")
Новый формат vendor-import: опциональный заголовок "Сервер <модель>, в составе:" и строки вида "<описание> - <кол-во> шт." (дефис/тире, пробел перед "шт" и точка опциональны). Количество якорится в конце строки, поэтому дефисы и цифры внутри описания (8-GPU-2304GB) сохраняются. Описание пишется и в vendor_partnumber, и в description: строки резолвятся через активную книгу партномеров, иначе остаются нерезолвленными и редактируемыми. Весь файл — одна конфигурация. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -80,3 +80,31 @@ Rules:
|
||||
- configuration `name` is derived from the uploaded filename (without extension);
|
||||
- lines that do not contain `*<digits>` are skipped;
|
||||
- no price data is present in the format; `unit_price` and `total_price` are left nil.
|
||||
|
||||
## Text BOM import
|
||||
|
||||
The same endpoint `POST /api/projects/:uuid/vendor-import` also accepts a human-readable Russian text BOM.
|
||||
|
||||
Format: an optional header line `Сервер <model>, в составе:` followed by one component per line as
|
||||
`<description> - <quantity> шт.`. The separator may be a hyphen, en-dash, or em-dash; the space before
|
||||
`шт` is optional; a trailing `.` after `шт` is optional. Quantities are anchored to the end of the line,
|
||||
so hyphens and digits inside the description (e.g. `8-GPU-2304GB`) are preserved.
|
||||
|
||||
Example:
|
||||
```
|
||||
Сервер KR9288X3, в составе:
|
||||
GPU-NVIDIA HGX B300 8-GPU-2304GB HBM3E - 1 шт.
|
||||
CPU Intel 6760P Xeon 2.2GHz 64C 320M 330W - 2 шт.
|
||||
Mem 128G DDR5-6400MHz ECC-RDIMM - 16 шт.
|
||||
NVIDIA twin port transceiver, 800Gbps, OSFP - 8шт.
|
||||
```
|
||||
|
||||
Rules:
|
||||
- the entire file becomes a single configuration (`server_count = 1`);
|
||||
- the `Сервер <model>, в составе:` header supplies the configuration `name` and `server_model`;
|
||||
- without a header, `name` falls back to the uploaded filename (without extension) and `server_model` is empty;
|
||||
- the format carries no partnumbers — each line's description is stored as both `vendor_partnumber` and
|
||||
`description`, so rows resolve through the active partnumber book when matched and otherwise stay
|
||||
unresolved and editable in the UI;
|
||||
- lines that do not match `<description> - <quantity> шт.` are skipped;
|
||||
- no price data is present in the format; `unit_price` and `total_price` are left nil.
|
||||
|
||||
Reference in New Issue
Block a user