Merge branch 'CI/CD' of ParkSuMin/Cursovaya into main
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
SELECT
|
SELECT
|
||||||
s.name AS Поставщик,
|
s.name AS Поставщик,
|
||||||
reports.sum AS 'Сумма в рублях',
|
reports.sum AS 'Сумма (в ₽)',
|
||||||
reports.count AS 'Количество поставок'
|
reports.count AS 'Количество поставок'
|
||||||
FROM reports
|
FROM reports
|
||||||
JOIN sellers s ON reports.item_id = s.sel_id
|
JOIN sellers s ON reports.item_id = s.sel_id
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
SELECT w.name AS Наименование,
|
SELECT w.name AS Наименование,
|
||||||
reports.sum AS 'Сумма в рублях',
|
reports.sum AS 'Сумма (в ₽)',
|
||||||
reports.count AS 'Количество поставленных заготовок'
|
reports.count AS 'Количество поставленных заготовок (в шт.)'
|
||||||
from reports
|
from reports
|
||||||
JOIN workpiece w ON reports.item_id = w.work_id
|
JOIN workpiece w ON reports.item_id = w.work_id
|
||||||
WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year')
|
WHERE report_category_id = '$id' AND (month = '$month' AND year = '$year')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SELECT DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
|
SELECT DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
|
||||||
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
|
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
|
||||||
SUM(w.total) AS 'Общая сумма (в рублях)',
|
SUM(w.total) AS 'Общая сумма (в ₽)',
|
||||||
SUM(wl.amount) as 'Общее количество заготовок'
|
SUM(wl.amount) as 'Общее количество заготовок (в шт.)'
|
||||||
FROM waybill w
|
FROM waybill w
|
||||||
|
|
||||||
JOIN (SELECT waybill_id, SUM(amount) AS amount FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id)
|
JOIN (SELECT waybill_id, SUM(amount) AS amount FROM waybill_lines wl GROUP BY waybill_id)wl USING (waybill_id)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ SELECT
|
|||||||
DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
|
DATE_FORMAT(w.waybill_date, '%Y-%m-%d') AS 'Дата поставки',
|
||||||
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
|
TIME_FORMAT(w.waybill_date, '%H:%i') AS 'Время поставки',
|
||||||
s.name AS 'Поставщик',
|
s.name AS 'Поставщик',
|
||||||
wl.amount AS 'Количество'
|
wl.amount AS 'Количество (в шт.)'
|
||||||
FROM waybill w
|
FROM waybill w
|
||||||
|
|
||||||
JOIN (SELECT waybill_id, work_id, amount FROM waybill_lines) wl USING(waybill_id)
|
JOIN (SELECT waybill_id, work_id, amount FROM waybill_lines) wl USING(waybill_id)
|
||||||
|
|||||||
@@ -74,12 +74,12 @@ def button_click(request):
|
|||||||
session["total"] = str(int(session["total"]) + price)
|
session["total"] = str(int(session["total"]) + price)
|
||||||
session.modified = True
|
session.modified = True
|
||||||
else:
|
else:
|
||||||
print("NEW WORKPIECE")
|
# print("NEW WORKPIECE")
|
||||||
pr_id = product["work_id"]
|
pr_id = product["work_id"]
|
||||||
price = product["price"]
|
price = product["price"]
|
||||||
session["waybill"][str(pr_id)] = "1"
|
session["waybill"][str(pr_id)] = "1"
|
||||||
session["total"] = str(int(session["total"]) + price)
|
session["total"] = str(int(session["total"]) + price)
|
||||||
print(session["waybill"])
|
# print(session["waybill"])
|
||||||
session.modified = True
|
session.modified = True
|
||||||
|
|
||||||
elif request.form.get("product_display_minus"):
|
elif request.form.get("product_display_minus"):
|
||||||
@@ -121,7 +121,7 @@ def transaction_order_model(user_id: int, current_date: date) -> InfoRespronse:
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
cursor.execute(_sql)
|
cursor.execute(_sql)
|
||||||
result = tuple([order_id])
|
result = tuple([order_id])
|
||||||
if result is None:
|
if result is None:
|
||||||
return InfoRespronse((), error_message="Заказ не был создан", status=False)
|
return InfoRespronse((), error_message="Заказ не был создан", status=False)
|
||||||
clear()
|
clear()
|
||||||
|
|||||||
@@ -39,22 +39,34 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<h4>Накладная</h4>
|
<h4>Накладная</h4>
|
||||||
{% if waybill %}
|
{% if waybill %}
|
||||||
{% for item in waybill %}
|
<div class="row">
|
||||||
{{ card.render_item(item, show_form = False, show_amount = True) }}
|
<div class="col-8">
|
||||||
{% endfor %}
|
<div class="row row-cols-1 g-3">
|
||||||
<div class="mt-3">
|
{% for item in waybill %}
|
||||||
<h5>Итого: {{ session.get('total', '0') }} ₽</h5>
|
<div class="col">
|
||||||
|
{{ card.render_item(item, show_form = False, show_amount = True) }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 d-flex flex-column">
|
||||||
|
<h5 class="mb-3">Итого: {{ session.get('total', '0') }} ₽</h5>
|
||||||
|
<div class="d-flex flex-column gap-2">
|
||||||
|
<a href="{{url_for('waybill_bp.save_order')}}"><button class="btn btn-primary">Оформить накладную</button></a>
|
||||||
|
<a href="{{url_for('waybill_bp.clear_waybill')}}"><button class="btn btn-danger">Очистить накладную</button></a>
|
||||||
|
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-grid gap-2 mt-3">
|
|
||||||
<a href="{{url_for('waybill_bp.save_order')}}"><button class="btn btn-primary">Оформить накладную</button></a>
|
|
||||||
<a href="{{url_for('waybill_bp.clear_waybill')}}"><button class="btn btn-danger">Очистить накладную</button></a>
|
|
||||||
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span>Ваша накладная пуста</span>
|
<div class="row">
|
||||||
<div class="d-grid gap-2 mt-3">
|
<div class="col-8">
|
||||||
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
<span>Ваша накладная пуста</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<a href="{{url_for('index')}}"><button class="btn btn-secondary">На главную</button></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from Auth import auth_bp
|
from Auth import auth_bp
|
||||||
from flask import Flask, render_template, session
|
from flask import Flask, redirect, render_template, session
|
||||||
from Report import report_bp
|
from Report import report_bp
|
||||||
from Requests import requests_bp
|
from Requests import requests_bp
|
||||||
from Waybill import waybill_bp
|
from Waybill import waybill_bp
|
||||||
@@ -45,7 +45,7 @@ def index():
|
|||||||
@app.route("/logout")
|
@app.route("/logout")
|
||||||
def logout():
|
def logout():
|
||||||
session.clear()
|
session.clear()
|
||||||
return render_template("main_menu.html", ses=session)
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
2
App/cache/wrapper.py
vendored
2
App/cache/wrapper.py
vendored
@@ -17,7 +17,7 @@ def fetch_from_cache(cache_name: str, cache_config: dict):
|
|||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
cached_value = cache_conn.get_value(cache_name)
|
cached_value = cache_conn.get_value(cache_name)
|
||||||
print("cached_value=", cached_value)
|
# print("cached_value=", cached_value)
|
||||||
if cached_value:
|
if cached_value:
|
||||||
return cached_value
|
return cached_value
|
||||||
response = f(*args, **kwargs)
|
response = f(*args, **kwargs)
|
||||||
|
|||||||
18
Dockerfile
Normal file
18
Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Use the official Python image as a base
|
||||||
|
FROM python:3.9.20-alpine3.19
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the contents of the 'App' folder to the working directory
|
||||||
|
COPY App/ /app
|
||||||
|
|
||||||
|
# Copy the requirements file to the working directory
|
||||||
|
COPY requirements.txt /app
|
||||||
|
|
||||||
|
# Install the dependencies from the requirements file
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
EXPOSE 5001
|
||||||
|
# Command to run the application
|
||||||
|
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "app:app"]
|
||||||
4
build.sh
Executable file
4
build.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
docker build -t tsettaro/kursovaya-ris:latest .
|
||||||
|
docker push tsettaro/kursovaya-ris:latest
|
||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user