db-connect-tools 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- db_connect_tools-0.1.0/MANIFEST.in +3 -0
- db_connect_tools-0.1.0/PKG-INFO +41 -0
- db_connect_tools-0.1.0/README.md +32 -0
- db_connect_tools-0.1.0/database/__init__.py +0 -0
- db_connect_tools-0.1.0/database/database.py +180 -0
- db_connect_tools-0.1.0/database/img.png +0 -0
- db_connect_tools-0.1.0/database/script.sql +142 -0
- db_connect_tools-0.1.0/db_connect_tools.egg-info/PKG-INFO +41 -0
- db_connect_tools-0.1.0/db_connect_tools.egg-info/SOURCES.txt +33 -0
- db_connect_tools-0.1.0/db_connect_tools.egg-info/dependency_links.txt +1 -0
- db_connect_tools-0.1.0/db_connect_tools.egg-info/requires.txt +2 -0
- db_connect_tools-0.1.0/db_connect_tools.egg-info/top_level.txt +4 -0
- db_connect_tools-0.1.0/pyproject.toml +25 -0
- db_connect_tools-0.1.0/setup.cfg +4 -0
- db_connect_tools-0.1.0/ui/__init__.py +0 -0
- db_connect_tools-0.1.0/ui/dialog_products.ui +172 -0
- db_connect_tools-0.1.0/ui/frame_prod.ui +276 -0
- db_connect_tools-0.1.0/ui/login.ui +45 -0
- db_connect_tools-0.1.0/ui/main_window_demo.ui +250 -0
- db_connect_tools-0.1.0/ui/order_dialog.ui +152 -0
- db_connect_tools-0.1.0/ui/orders_frame.ui +193 -0
- db_connect_tools-0.1.0/ui_to_py/__init__.py +0 -0
- db_connect_tools-0.1.0/ui_to_py/dialog_products.py +116 -0
- db_connect_tools-0.1.0/ui_to_py/frame_prod.py +176 -0
- db_connect_tools-0.1.0/ui_to_py/login.py +52 -0
- db_connect_tools-0.1.0/ui_to_py/main_win.py +168 -0
- db_connect_tools-0.1.0/ui_to_py/order_dialog.py +100 -0
- db_connect_tools-0.1.0/ui_to_py/orders_frame.py +128 -0
- db_connect_tools-0.1.0/windows/__init__.py +0 -0
- db_connect_tools-0.1.0/windows/auth.py +39 -0
- db_connect_tools-0.1.0/windows/dialog_product.py +80 -0
- db_connect_tools-0.1.0/windows/main_win.py +300 -0
- db_connect_tools-0.1.0/windows/order_card.py +28 -0
- db_connect_tools-0.1.0/windows/order_dialog.py +128 -0
- db_connect_tools-0.1.0/windows/product_card.py +60 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: db-connect-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Database connector tools packaged for PyPI
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: PyQt6
|
|
8
|
+
Requires-Dist: pymysql
|
|
9
|
+
|
|
10
|
+
# ОПИСАНИЕ КОНСОЛЬНОЙ ПРОГРАММЫ ДЛЯ
|
|
11
|
+
## Перед запуском:
|
|
12
|
+
|
|
13
|
+
1. Создать базу данных: выполнить скрипт database/database.sql в MySQL.
|
|
14
|
+
2. В main.py указать верные host, user, password, database.
|
|
15
|
+
3. Установить библиотеки: PyQt6, pymysql
|
|
16
|
+
|
|
17
|
+
## Запуск через команду: python main.py
|
|
18
|
+
|
|
19
|
+
## Учётные записи: ##
|
|
20
|
+
- admin / 123
|
|
21
|
+
- manager / 123
|
|
22
|
+
- client / 123
|
|
23
|
+
- кнопка "Войти как гость"
|
|
24
|
+
|
|
25
|
+
## Состав проекта: ##
|
|
26
|
+
- main.py - команда для запуска
|
|
27
|
+
- readme.md - описание проекта
|
|
28
|
+
- schemas/er_model.pdf - ER-модель базы данных
|
|
29
|
+
- database/database.sql - дамп базы данных
|
|
30
|
+
- images - фото для проекта
|
|
31
|
+
- ui - файлы интерфейсов
|
|
32
|
+
- converted_ui - конвертированные .ui в .py
|
|
33
|
+
- windows - файлы .py с функционалом
|
|
34
|
+
|
|
35
|
+
## Описание ролей программы: ##
|
|
36
|
+
- гость - просмотр товаров
|
|
37
|
+
- авторизированный клиент - просмотр товаров
|
|
38
|
+
- менеджер - просмотр товаров и заказов, поиск/фильтрация/сорт товаров
|
|
39
|
+
- администратор - просмотр товаров, заказов + добавление/редактирование/удаление товаров и заказов
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ОПИСАНИЕ КОНСОЛЬНОЙ ПРОГРАММЫ ДЛЯ
|
|
2
|
+
## Перед запуском:
|
|
3
|
+
|
|
4
|
+
1. Создать базу данных: выполнить скрипт database/database.sql в MySQL.
|
|
5
|
+
2. В main.py указать верные host, user, password, database.
|
|
6
|
+
3. Установить библиотеки: PyQt6, pymysql
|
|
7
|
+
|
|
8
|
+
## Запуск через команду: python main.py
|
|
9
|
+
|
|
10
|
+
## Учётные записи: ##
|
|
11
|
+
- admin / 123
|
|
12
|
+
- manager / 123
|
|
13
|
+
- client / 123
|
|
14
|
+
- кнопка "Войти как гость"
|
|
15
|
+
|
|
16
|
+
## Состав проекта: ##
|
|
17
|
+
- main.py - команда для запуска
|
|
18
|
+
- readme.md - описание проекта
|
|
19
|
+
- schemas/er_model.pdf - ER-модель базы данных
|
|
20
|
+
- database/database.sql - дамп базы данных
|
|
21
|
+
- images - фото для проекта
|
|
22
|
+
- ui - файлы интерфейсов
|
|
23
|
+
- converted_ui - конвертированные .ui в .py
|
|
24
|
+
- windows - файлы .py с функционалом
|
|
25
|
+
|
|
26
|
+
## Описание ролей программы: ##
|
|
27
|
+
- гость - просмотр товаров
|
|
28
|
+
- авторизированный клиент - просмотр товаров
|
|
29
|
+
- менеджер - просмотр товаров и заказов, поиск/фильтрация/сорт товаров
|
|
30
|
+
- администратор - просмотр товаров, заказов + добавление/редактирование/удаление товаров и заказов
|
|
31
|
+
|
|
32
|
+
|
|
File without changes
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import pymysql
|
|
2
|
+
from pymysql import cursors
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class Database:
|
|
6
|
+
def __init__(self):
|
|
7
|
+
self.connection=pymysql.connect(
|
|
8
|
+
host='localhost',
|
|
9
|
+
user='root',
|
|
10
|
+
password='',
|
|
11
|
+
database='demo',
|
|
12
|
+
cursorclass=pymysql.cursors.DictCursor
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
def check_auth(self, log, passw):
|
|
16
|
+
with self.connection.cursor() as cursor:
|
|
17
|
+
sql="SELECT * FROM users WHERE login=%s AND password=%s"
|
|
18
|
+
cursor.execute(sql, (log, passw))
|
|
19
|
+
return cursor.fetchone()
|
|
20
|
+
|
|
21
|
+
# id_pr | name | description | category_id | supplier_id | manufacturer_id | price | quantity | discount | img
|
|
22
|
+
def get_products(self):
|
|
23
|
+
with self.connection.cursor() as cursor:
|
|
24
|
+
sql = """
|
|
25
|
+
SELECT products.id_pr,
|
|
26
|
+
products.name AS pr_name,
|
|
27
|
+
products.description,
|
|
28
|
+
products.price,
|
|
29
|
+
products.quantity,
|
|
30
|
+
products.discount,
|
|
31
|
+
products.img,
|
|
32
|
+
categories.name AS cat_name,
|
|
33
|
+
manufacturers.name AS man_name,
|
|
34
|
+
suppliers.name AS sup_name
|
|
35
|
+
FROM products
|
|
36
|
+
JOIN categories ON products.category_id = categories.id_cat
|
|
37
|
+
JOIN manufacturers ON products.manufacturer_id = manufacturers.id_man
|
|
38
|
+
JOIN suppliers ON products.supplier_id = suppliers.id_supl
|
|
39
|
+
"""
|
|
40
|
+
cursor.execute(sql)
|
|
41
|
+
return cursor.fetchall()
|
|
42
|
+
|
|
43
|
+
def add_product(self, name, descr, categ, supp, man, price, quant, disc, image):
|
|
44
|
+
with self.connection.cursor() as cursor:
|
|
45
|
+
sql = """
|
|
46
|
+
INSERT INTO products(name, description, category_id, supplier_id, manufacturer_id, price, quantity, discount, img)
|
|
47
|
+
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
48
|
+
"""
|
|
49
|
+
cursor.execute(sql, (name, descr, categ, supp, man, price, quant, disc, image))
|
|
50
|
+
self.connection.commit()
|
|
51
|
+
return True
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def update_product(self, id_pr, name, description, category_id, supplier_id, manufacturer_id, price, quantity, discount, img):
|
|
55
|
+
with self.connection.cursor() as cursor:
|
|
56
|
+
sql = """
|
|
57
|
+
UPDATE products
|
|
58
|
+
SET name=%s, description=%s, category_id=%s, supplier_id=%s,
|
|
59
|
+
manufacturer_id=%s, price=%s, quantity=%s, discount=%s, img=%s
|
|
60
|
+
WHERE id_pr=%s
|
|
61
|
+
"""
|
|
62
|
+
cursor.execute(sql, (name, description, category_id, supplier_id, manufacturer_id, price, quantity, discount, img, id_pr))
|
|
63
|
+
self.connection.commit()
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def delete_product(self, get_id):
|
|
68
|
+
with self.connection.cursor() as cursor:
|
|
69
|
+
sql="DELETE FROM products WHERE id_pr=%s"
|
|
70
|
+
cursor.execute(sql, (get_id))
|
|
71
|
+
self.connection.commit()
|
|
72
|
+
return True
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_orders(self):
|
|
76
|
+
with self.connection.cursor() as cursor:
|
|
77
|
+
self.connection.commit()
|
|
78
|
+
sql="""
|
|
79
|
+
SELECT orders.id_ord,
|
|
80
|
+
orders.article,
|
|
81
|
+
users.full_name,
|
|
82
|
+
pickup_points.address,
|
|
83
|
+
orders.order_date,
|
|
84
|
+
orders.delivery_date,
|
|
85
|
+
statuses.name AS stat_name
|
|
86
|
+
FROM orders
|
|
87
|
+
JOIN users ON orders.client_id=users.id_user
|
|
88
|
+
JOIN pickup_points ON orders.address_pick=pickup_points.id_pick
|
|
89
|
+
JOIN statuses ON orders.status_id=statuses.id_stat
|
|
90
|
+
ORDER BY orders.order_date DESC
|
|
91
|
+
"""
|
|
92
|
+
cursor.execute(sql)
|
|
93
|
+
return cursor.fetchall()
|
|
94
|
+
|
|
95
|
+
def update_order(self, order_id, status_id, address_pick, delivery_date):
|
|
96
|
+
with self.connection.cursor() as cursor:
|
|
97
|
+
sql = "UPDATE orders SET status_id=%s, address_pick=%s, delivery_date=%s WHERE id_ord=%s"
|
|
98
|
+
cursor.execute(sql, (status_id, address_pick, delivery_date, order_id))
|
|
99
|
+
self.connection.commit()
|
|
100
|
+
return True
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def delete_order(self, order_id):
|
|
104
|
+
with self.connection.cursor() as cursor:
|
|
105
|
+
|
|
106
|
+
sql_items = "DELETE FROM order_items WHERE order_id=%s"
|
|
107
|
+
cursor.execute(sql_items, (order_id,))
|
|
108
|
+
|
|
109
|
+
sql_order="DELETE FROM orders WHERE id_ord=%s"
|
|
110
|
+
cursor.execute(sql_order, (order_id,))
|
|
111
|
+
|
|
112
|
+
self.connection.commit()
|
|
113
|
+
return True
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
# ---------------------------------МЕТОДЫ ДЛЯ ЗАКАЗОВ---------------------------------
|
|
117
|
+
|
|
118
|
+
def get_pickup_points(self):
|
|
119
|
+
with self.connection.cursor() as cursor:
|
|
120
|
+
cursor.execute("SELECT * FROM pickup_points")
|
|
121
|
+
return cursor.fetchall()
|
|
122
|
+
|
|
123
|
+
def get_statuses(self):
|
|
124
|
+
with self.connection.cursor() as cursor:
|
|
125
|
+
cursor.execute("SELECT * FROM statuses")
|
|
126
|
+
return cursor.fetchall()
|
|
127
|
+
|
|
128
|
+
def get_next_article(self):
|
|
129
|
+
with self.connection.cursor() as cursor:
|
|
130
|
+
cursor.execute("SELECT MAX(article) as max_article FROM orders")
|
|
131
|
+
result = cursor.fetchone()
|
|
132
|
+
max_art = result['max_article'] if result['max_article'] else 1000
|
|
133
|
+
return max_art + 1
|
|
134
|
+
|
|
135
|
+
def create_order(self, order_data, items):
|
|
136
|
+
# id_ord | client_id | article | status_id | address_pick | order_date | delivery_date | overall_price
|
|
137
|
+
with self.connection.cursor() as cursor:
|
|
138
|
+
cursor_order="""
|
|
139
|
+
INSERT INTO orders (client_id, article, status_id, address_pick, order_date, delivery_date, overall_price)
|
|
140
|
+
VALUES (%s, %s, %s, %s, NOW(), %s, %s)"""
|
|
141
|
+
cursor.execute(cursor_order, (
|
|
142
|
+
order_data['client_id'],
|
|
143
|
+
order_data['article'],
|
|
144
|
+
order_data['status_id'],
|
|
145
|
+
order_data['address_pick'],
|
|
146
|
+
order_data['delivery_data'],
|
|
147
|
+
order_data['overall_price']
|
|
148
|
+
))
|
|
149
|
+
last_id=cursor.lastrowid
|
|
150
|
+
sql_item = "INSERT INTO order_items (order_id, product_id, quantity) VALUES (%s, %s, %s)"
|
|
151
|
+
for item in items:
|
|
152
|
+
cursor.execute(sql_item, (last_id, item['product_id'], item['quantity']))
|
|
153
|
+
|
|
154
|
+
cursor_update="""UPDATE products
|
|
155
|
+
SET quantity=quantity-%s
|
|
156
|
+
WHERE id_pr = %s"""
|
|
157
|
+
cursor.execute(cursor_update, (item['quantity'], item['product_id']))
|
|
158
|
+
|
|
159
|
+
self.connection.commit()
|
|
160
|
+
return last_id
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def get_categories(self):
|
|
165
|
+
with self.connection.cursor() as cursor:
|
|
166
|
+
sql="SELECT * FROM categories"
|
|
167
|
+
cursor.execute(sql)
|
|
168
|
+
return cursor.fetchall()
|
|
169
|
+
|
|
170
|
+
def get_suppliers(self):
|
|
171
|
+
with self.connection.cursor() as cursor:
|
|
172
|
+
sql = "SELECT * FROM suppliers"
|
|
173
|
+
cursor.execute(sql)
|
|
174
|
+
return cursor.fetchall()
|
|
175
|
+
|
|
176
|
+
def get_manu(self):
|
|
177
|
+
with self.connection.cursor() as cursor:
|
|
178
|
+
sql="SELECT * FROM manufacturers"
|
|
179
|
+
cursor.execute(sql)
|
|
180
|
+
return cursor.fetchall()
|
|
Binary file
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
|
|
2
|
+
CREATE DATABASE IF NOT EXISTS demo;
|
|
3
|
+
USE demo;
|
|
4
|
+
|
|
5
|
+
CREATE TABLE roles (
|
|
6
|
+
id_role INT AUTO_INCREMENT PRIMARY KEY,
|
|
7
|
+
name VARCHAR(50) NOT NULL UNIQUE
|
|
8
|
+
);
|
|
9
|
+
CREATE TABLE users (
|
|
10
|
+
id_user INT AUTO_INCREMENT PRIMARY KEY,
|
|
11
|
+
full_name VARCHAR(150) NOT NULL,
|
|
12
|
+
login VARCHAR(100) NOT NULL UNIQUE,
|
|
13
|
+
password VARCHAR(100) NOT NULL,
|
|
14
|
+
role_id INT NOT NULL,
|
|
15
|
+
FOREIGN KEY (role_id) REFERENCES roles(id_role)
|
|
16
|
+
);
|
|
17
|
+
INSERT INTO roles (name) VALUES ('Клиент'), ('Менеджер'), ('Администратор');
|
|
18
|
+
INSERT INTO users (full_name, login, password, role_id) VALUES
|
|
19
|
+
('Иванов Иван Иванович', 'client', '123', 1),
|
|
20
|
+
('Петрова Мария Сергеевна', 'manager', '123', 2),
|
|
21
|
+
('Сидоров Алексей Петрович','admin', '123', 3);
|
|
22
|
+
|
|
23
|
+
CREATE TABLE categories(
|
|
24
|
+
id_cat INT AUTO_INCREMENT PRIMARY KEY,
|
|
25
|
+
name VARCHAR(255) NOT NULL UNIQUE
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
INSERT INTO categories (name) VALUES
|
|
29
|
+
('Кроссовки'), ('Ботинки'), ('Туфли'), ('Сапоги'), ('Сандалии');
|
|
30
|
+
|
|
31
|
+
CREATE TABLE suppliers (
|
|
32
|
+
id_supl INT AUTO_INCREMENT PRIMARY KEY,
|
|
33
|
+
name VARCHAR(150) NOT NULL UNIQUE
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
INSERT INTO suppliers (name) VALUES
|
|
37
|
+
('ООО СпортТрейд'), ('ИП Краснов'), ('ООО ЕвроОбувь');
|
|
38
|
+
|
|
39
|
+
CREATE TABLE manufacturers(
|
|
40
|
+
id_man INT AUTO_INCREMENT PRIMARY KEY,
|
|
41
|
+
name VARCHAR(150) NOT NULL UNIQUE
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
INSERT INTO manufacturers(name) VALUES
|
|
45
|
+
('Nike'),
|
|
46
|
+
('Adidas'),
|
|
47
|
+
('Ecco'),
|
|
48
|
+
('Respect'),
|
|
49
|
+
('Zara Shoes');
|
|
50
|
+
|
|
51
|
+
CREATE TABLE products (
|
|
52
|
+
id_pr INT AUTO_INCREMENT PRIMARY KEY,
|
|
53
|
+
name VARCHAR(200) NOT NULL,
|
|
54
|
+
description VARCHAR(255),
|
|
55
|
+
category_id INT NOT NULL,
|
|
56
|
+
supplier_id INT NOT NULL,
|
|
57
|
+
manufacturer_id INT NOT NULL,
|
|
58
|
+
price DECIMAL(10,2) NOT NULL,
|
|
59
|
+
quantity INT NOT NULL DEFAULT 0,
|
|
60
|
+
discount INT NOT NULL DEFAULT 0,
|
|
61
|
+
img VARCHAR(300) DEFAULT NULL,
|
|
62
|
+
FOREIGN KEY (category_id) REFERENCES categories(id_cat),
|
|
63
|
+
FOREIGN KEY (supplier_id) REFERENCES suppliers(id_supl),
|
|
64
|
+
FOREIGN KEY (manufacturer_id) REFERENCES manufacturers(id_man)
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
INSERT INTO products(name, description, category_id, supplier_id, manufacturer_id, price, quantity, discount, img) VALUES
|
|
68
|
+
('Nike Air Max 90', 'Для бега', 1, 1, 1, 8990.00, 15, 0, 'nikeair.png'),
|
|
69
|
+
('Adidas Ultraboost', 'Для ходьбы', 1, 1, 1, 12500.00, 8, 20, 'adidasultra.png'),
|
|
70
|
+
('Ecco Track 25', 'Зимние ботинки', 2, 3, 3, 9800.00, 5, 10, 'ecco.png'),
|
|
71
|
+
('Ralf Ringer Classic', 'Праздничные туфли', 3, 2, 4, 6500.00, 0, 0, 'ralf.png'),
|
|
72
|
+
('Rieker Ankle Boot', 'Весенние ботинки', 2, 3, 5, 7200.00, 12, 5, 'rieker.png'),
|
|
73
|
+
('Nike Tanjun', 'Ультратонкие', 1, 1, 1, 5490.00, 20, 25, 'niketan.png'),
|
|
74
|
+
('Adidas Gazelle', 'Редкие', 1, 1, 2, 7800.00, 3, 0, 'gazelle.png');
|
|
75
|
+
|
|
76
|
+
INSERT INTO products (name, description, category_id, supplier_id, manufacturer_id, price, quantity, discount, img)
|
|
77
|
+
VALUES
|
|
78
|
+
('Кроссовки 1', 'Тестик 1', 1, 1, 1, 8990.00, 15, 0, 'test1.png'),
|
|
79
|
+
('Кроссовки 2', 'Тестик 2', 1, 1, 1, 12500.00, 20, 20, 'test2.png');
|
|
80
|
+
|
|
81
|
+
CREATE TABLE pickup_points(
|
|
82
|
+
id_pick INT AUTO_INCREMENT PRIMARY KEY,
|
|
83
|
+
address VARCHAR(255) NOT NULL
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
INSERT INTO pickup_points(address)
|
|
87
|
+
VALUES
|
|
88
|
+
('ул. Сосновая 1'),
|
|
89
|
+
('ул. Березовая 2'),
|
|
90
|
+
('ул. Лесная 3');
|
|
91
|
+
|
|
92
|
+
CREATE TABLE statuses(
|
|
93
|
+
id_stat INT AUTO_INCREMENT PRIMARY KEY,
|
|
94
|
+
name VARCHAR(255)
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
INSERT INTO statuses(name) VALUES
|
|
98
|
+
('Новый'),
|
|
99
|
+
('Отменен'),
|
|
100
|
+
('В обработке'),
|
|
101
|
+
('Отправлен'),
|
|
102
|
+
('В доставке'),
|
|
103
|
+
('Доставлен');
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
CREATE TABLE orders(
|
|
107
|
+
id_ord INT AUTO_INCREMENT PRIMARY KEY,
|
|
108
|
+
client_id INT,
|
|
109
|
+
article INT NOT NULL,
|
|
110
|
+
status_id INT,
|
|
111
|
+
address_pick INT NOT NULL,
|
|
112
|
+
order_date DATETIME NOT NULL DEFAULT NOW(),
|
|
113
|
+
delivery_date DATETIME NOT NULL,
|
|
114
|
+
overall_price DECIMAL(10, 2),
|
|
115
|
+
FOREIGN KEY (client_id) REFERENCES users(id_user),
|
|
116
|
+
FOREIGN KEY (address_pick) REFERENCES pickup_points(id_pick),
|
|
117
|
+
FOREIGN KEY (status_id) REFERENCES statuses(id_stat)
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
INSERT INTO orders (client_id, article, status_id, address_pick, order_date, delivery_date) VALUES
|
|
121
|
+
(1, 1001, 1, 1, '2025-03-01 10:00:00', '2025-03-05 12:00:00'),
|
|
122
|
+
(1, 1002, 1, 1, '2025-03-10 09:00:00', '2025-03-15 12:00:00'),
|
|
123
|
+
(2, 1003, 2, 2, '2025-03-18 14:00:00', '2025-03-25 12:00:00'),
|
|
124
|
+
(3, 1004, 4, 3, '2025-03-20 11:00:00', '2025-03-26 12:00:00'),
|
|
125
|
+
(2, 1005, 5, 2, '2025-03-22 16:00:00', '2025-03-30 12:00:00');
|
|
126
|
+
|
|
127
|
+
CREATE TABLE order_items(
|
|
128
|
+
id_order_item INT AUTO_INCREMENT PRIMARY KEY,
|
|
129
|
+
order_id INT NOT NULL,
|
|
130
|
+
product_id INT NOT NULL,
|
|
131
|
+
quantity INT,
|
|
132
|
+
FOREIGN KEY (order_id) REFERENCES orders(id_ord),
|
|
133
|
+
FOREIGN KEY (product_id) REFERENCES products(id_pr)
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
INSERT INTO order_items(order_id, product_id, quantity) VALUES
|
|
137
|
+
(1, 1, 1),
|
|
138
|
+
(1, 3, 1),
|
|
139
|
+
(2, 6, 2),
|
|
140
|
+
(3, 3, 1),
|
|
141
|
+
(4, 1, 1),
|
|
142
|
+
(5, 6, 3);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: db-connect-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Database connector tools packaged for PyPI
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: PyQt6
|
|
8
|
+
Requires-Dist: pymysql
|
|
9
|
+
|
|
10
|
+
# ОПИСАНИЕ КОНСОЛЬНОЙ ПРОГРАММЫ ДЛЯ
|
|
11
|
+
## Перед запуском:
|
|
12
|
+
|
|
13
|
+
1. Создать базу данных: выполнить скрипт database/database.sql в MySQL.
|
|
14
|
+
2. В main.py указать верные host, user, password, database.
|
|
15
|
+
3. Установить библиотеки: PyQt6, pymysql
|
|
16
|
+
|
|
17
|
+
## Запуск через команду: python main.py
|
|
18
|
+
|
|
19
|
+
## Учётные записи: ##
|
|
20
|
+
- admin / 123
|
|
21
|
+
- manager / 123
|
|
22
|
+
- client / 123
|
|
23
|
+
- кнопка "Войти как гость"
|
|
24
|
+
|
|
25
|
+
## Состав проекта: ##
|
|
26
|
+
- main.py - команда для запуска
|
|
27
|
+
- readme.md - описание проекта
|
|
28
|
+
- schemas/er_model.pdf - ER-модель базы данных
|
|
29
|
+
- database/database.sql - дамп базы данных
|
|
30
|
+
- images - фото для проекта
|
|
31
|
+
- ui - файлы интерфейсов
|
|
32
|
+
- converted_ui - конвертированные .ui в .py
|
|
33
|
+
- windows - файлы .py с функционалом
|
|
34
|
+
|
|
35
|
+
## Описание ролей программы: ##
|
|
36
|
+
- гость - просмотр товаров
|
|
37
|
+
- авторизированный клиент - просмотр товаров
|
|
38
|
+
- менеджер - просмотр товаров и заказов, поиск/фильтрация/сорт товаров
|
|
39
|
+
- администратор - просмотр товаров, заказов + добавление/редактирование/удаление товаров и заказов
|
|
40
|
+
|
|
41
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
database/__init__.py
|
|
5
|
+
database/database.py
|
|
6
|
+
database/img.png
|
|
7
|
+
database/script.sql
|
|
8
|
+
db_connect_tools.egg-info/PKG-INFO
|
|
9
|
+
db_connect_tools.egg-info/SOURCES.txt
|
|
10
|
+
db_connect_tools.egg-info/dependency_links.txt
|
|
11
|
+
db_connect_tools.egg-info/requires.txt
|
|
12
|
+
db_connect_tools.egg-info/top_level.txt
|
|
13
|
+
ui/__init__.py
|
|
14
|
+
ui/dialog_products.ui
|
|
15
|
+
ui/frame_prod.ui
|
|
16
|
+
ui/login.ui
|
|
17
|
+
ui/main_window_demo.ui
|
|
18
|
+
ui/order_dialog.ui
|
|
19
|
+
ui/orders_frame.ui
|
|
20
|
+
ui_to_py/__init__.py
|
|
21
|
+
ui_to_py/dialog_products.py
|
|
22
|
+
ui_to_py/frame_prod.py
|
|
23
|
+
ui_to_py/login.py
|
|
24
|
+
ui_to_py/main_win.py
|
|
25
|
+
ui_to_py/order_dialog.py
|
|
26
|
+
ui_to_py/orders_frame.py
|
|
27
|
+
windows/__init__.py
|
|
28
|
+
windows/auth.py
|
|
29
|
+
windows/dialog_product.py
|
|
30
|
+
windows/main_win.py
|
|
31
|
+
windows/order_card.py
|
|
32
|
+
windows/order_dialog.py
|
|
33
|
+
windows/product_card.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "db-connect-tools"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Database connector tools packaged for PyPI"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"PyQt6",
|
|
13
|
+
"pymysql",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[tool.setuptools]
|
|
17
|
+
include-package-data = true
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.packages.find]
|
|
20
|
+
where = ["."]
|
|
21
|
+
include = ["database*", "ui*", "ui_to_py*", "windows*"]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.package-data]
|
|
24
|
+
database = ["*.sql", "*.png"]
|
|
25
|
+
ui = ["*.ui"]
|
|
File without changes
|