commit 06bd3c6b77072cc9f6cf1bdf53f99ea0c01b7c3a Author: MH.Dmitrii Date: Mon Oct 27 18:50:07 2025 +0300 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0e2306e --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# виртуальное окружение +venv/ +.venv/ + +# кэш питона +__pycache__/ +*.pyc +*.pyo +*.pyd +*.pytest_cache + +# IDE и редакторы +.vscode/ +.idea/ + +# OS мусор +.DS_Store +Thumbs.db + +#Подсказки +hint.py + +#env +*.env +#db +*.db + +#Примеры документов +document_examples/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/excel.py b/backend/excel.py new file mode 100644 index 0000000..bcc22cf --- /dev/null +++ b/backend/excel.py @@ -0,0 +1,14 @@ +import pandas as pd +def read_excel(dir, sheet1, sheet2): + if sheet1 and sheet2: + dfs = pd.read_excel(dir, sheet_name=[sheet1, sheet2]) + df1 = dfs[sheet1] + df2 = dfs[sheet2] + cols1 = df1[["Артикул поставщика", "Кол-во", "Вайлдберриз реализовал Товар (Пр)"]] + print(df1.head(), df2.head(), cols1.head()) + elif sheet1: + dfs = pd.read_excel(dir, sheet_name=[sheet1]) + df1 = dfs[sheet1] + cols1 = df1[["Артикул поставщика", "Кол-во", "Вайлдберриз реализовал Товар (Пр)"]] + print(cols1.head()) + diff --git a/backend/pydantic.py b/backend/pydantic.py new file mode 100644 index 0000000..fa0ff2b --- /dev/null +++ b/backend/pydantic.py @@ -0,0 +1,11 @@ +from pydantic import BaseModel, Field, field_validator +class ExcelInfo(BaseModel): + arti:str = Field(..., min_length=6, max_length=12, description="arti of the clothes") + counts:int = Field(..., ge=0, description="the quantity of the clothes") + price:int = Field(..., ge=0, description="the price of the clothes") +class ExcelRealization(BaseModel): + pass +class ExcelReturning(BaseModel): + pass +class ExcelOut(BaseModel): + pass \ No newline at end of file diff --git a/backend/validating_files.py b/backend/validating_files.py new file mode 100644 index 0000000..a93b402 --- /dev/null +++ b/backend/validating_files.py @@ -0,0 +1,27 @@ +from dotenv import load_dotenv #Работа с env +import os +from pathlib import Path +load_dotenv() +dir = Path(os.getenv("DIR")) +#Проход по всем файлам в директории +def validating(): + for file in dir.rglob("*.xlsx"): + name = file.stem + match file: + case _ if "period_closure_income" in name.lower(): + print("Реализация Яндекс ", name) + + case _ if name == "0": + print("Реализация ВБ", name) + + case _ if "отчет о реализации товара" in name.lower(): + print("Реализация ОЗОН", name) + + case _ if "вб" in name.lower() or "озон" in name.lower() or "яндекс" in name.lower(): + print("Товары, переданные на комиссию", name) + + case _ if "realizationreportcis" in name.lower(): + print("Выкупы озон ", name) + + case _ if "уведомление о выкупе" in name.lower(): + print("Выкупы вб ", name) \ No newline at end of file diff --git a/env_example b/env_example new file mode 100644 index 0000000..b36ef0a --- /dev/null +++ b/env_example @@ -0,0 +1 @@ +DIR="/dir/dir/dir" \ No newline at end of file diff --git a/frontend/__init__.py b/frontend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/makefile b/makefile new file mode 100644 index 0000000..c24ca7f --- /dev/null +++ b/makefile @@ -0,0 +1,4 @@ +VENV=source ./.venv/bin/activate; +.PHONY: run +run: + $(VENV) python run.py \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f7c87c7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pandas==2.3.3 +openpyxl==3.1.5 +pydantic==2.12.3 +dotenv==0.9.9 \ No newline at end of file diff --git a/run.py b/run.py new file mode 100644 index 0000000..ff29912 --- /dev/null +++ b/run.py @@ -0,0 +1,3 @@ +import backend.excel as excel +from backend.validating_files import validating +print(validating()) \ No newline at end of file