first commit
This commit is contained in:
29
.gitignore
vendored
Normal file
29
.gitignore
vendored
Normal file
@@ -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/
|
||||
0
backend/__init__.py
Normal file
0
backend/__init__.py
Normal file
14
backend/excel.py
Normal file
14
backend/excel.py
Normal file
@@ -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())
|
||||
|
||||
11
backend/pydantic.py
Normal file
11
backend/pydantic.py
Normal file
@@ -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
|
||||
27
backend/validating_files.py
Normal file
27
backend/validating_files.py
Normal file
@@ -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)
|
||||
1
env_example
Normal file
1
env_example
Normal file
@@ -0,0 +1 @@
|
||||
DIR="/dir/dir/dir"
|
||||
0
frontend/__init__.py
Normal file
0
frontend/__init__.py
Normal file
4
makefile
Normal file
4
makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
VENV=source ./.venv/bin/activate;
|
||||
.PHONY: run
|
||||
run:
|
||||
$(VENV) python run.py
|
||||
4
requirements.txt
Normal file
4
requirements.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
pandas==2.3.3
|
||||
openpyxl==3.1.5
|
||||
pydantic==2.12.3
|
||||
dotenv==0.9.9
|
||||
Reference in New Issue
Block a user