Compare commits
10 Commits
3494e5d17c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c24a1fa8c6 | ||
| 1c33775f92 | |||
| 43ab114e1a | |||
| 946ad5c31f | |||
|
|
7b956d89bf | ||
| 0891abc0e1 | |||
| 08393f6685 | |||
| 9cde4e2c7d | |||
|
|
0a60a16344 | ||
|
|
496ef3fa9d |
12
.gitignore
vendored
12
.gitignore
vendored
@@ -2,16 +2,10 @@
|
||||
.vscode
|
||||
instance
|
||||
venv/
|
||||
|
||||
123
|
||||
*.csv
|
||||
project.db
|
||||
*.db
|
||||
c*.txt
|
||||
migrations/__pycache__/*
|
||||
migrations/versions/__pycache__/*
|
||||
migrations
|
||||
__pycache__
|
||||
migrations/versions/__pycache__
|
||||
migrations/__pycache__
|
||||
migrations/versions/__pycache__/6fc3d1adb061_.cpython-312.pyc
|
||||
migrations/versions/__pycache__/6fc3d1adb061_.cpython-312.pyc
|
||||
migrations/versions/__pycache__/885bdd7b5161_.cpython-312.pyc
|
||||
.idea
|
||||
|
||||
BIN
VedomostMOL.xls
Normal file
BIN
VedomostMOL.xls
Normal file
Binary file not shown.
BIN
VedomostMOL.xlsx
Normal file
BIN
VedomostMOL.xlsx
Normal file
Binary file not shown.
65
app.py
65
app.py
@@ -8,7 +8,6 @@ import csv
|
||||
import random
|
||||
from urllib.parse import unquote
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///project.db"
|
||||
@@ -22,6 +21,12 @@ db.init_app(app)
|
||||
migrate = Migrate(app, db)
|
||||
|
||||
|
||||
|
||||
@app.route("/login", methods=['GET', 'POST'])
|
||||
def login():
|
||||
return render_template('login.html')
|
||||
|
||||
|
||||
@app.route("/", methods=['GET', 'POST'])
|
||||
def index():
|
||||
results = []
|
||||
@@ -145,8 +150,6 @@ def getall():
|
||||
'numberved': oboruds.numberved,
|
||||
'aud': aud.audnazvanie})
|
||||
|
||||
|
||||
|
||||
return jsonify(results)
|
||||
|
||||
|
||||
@@ -158,7 +161,7 @@ def vneaud():
|
||||
ak = db.session.query(Oboruds).all()
|
||||
|
||||
for dt in data:
|
||||
res.append([dt.invNumber, dt.nazvanie, dt.typeBalanse])
|
||||
res.append([dt.invNumber, dt.nazvanie])
|
||||
|
||||
return render_template('vneaud.html', res=res, kolvo=len(data), all_kol=len(ak))
|
||||
|
||||
@@ -201,12 +204,10 @@ def zamsearch():
|
||||
@app.route('/addraspved', methods=['GET', 'POST'])
|
||||
def addraspved():
|
||||
if request.method == 'POST':
|
||||
|
||||
query_string = request.data.decode()
|
||||
|
||||
un_query_string = unquote(unquote(query_string)).split(',')
|
||||
|
||||
|
||||
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||
|
||||
ob.numberved = un_query_string[1]
|
||||
@@ -214,18 +215,15 @@ def addraspved():
|
||||
ob.balancenumber = un_query_string[3]
|
||||
ob.raspologenie = un_query_string[4]
|
||||
|
||||
|
||||
db.session.commit()
|
||||
db.session.close()
|
||||
|
||||
|
||||
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||
|
||||
|
||||
@app.route('/addoborudasu', methods=['GET', 'POST'])
|
||||
def addoborud():
|
||||
if request.method == 'POST':
|
||||
|
||||
query_string = request.data.decode()
|
||||
|
||||
un_query_string = unquote(unquote(query_string)).split(',')
|
||||
@@ -241,17 +239,17 @@ def addoborud():
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||
|
||||
|
||||
# ==================================================================================
|
||||
|
||||
|
||||
def ranomraspr():
|
||||
with app.app_context():
|
||||
while len(db.session.query(Oboruds).filter(Oboruds.aud_id == None).all()) > 0:
|
||||
while len(db.session.query(Oboruds).filter(Oboruds.aud_id is None).all()) > 0:
|
||||
audid = random.choice(db.session.query(Auditory).all())
|
||||
oborud = random.choice(db.session.query(Oboruds).filter(Oboruds.aud_id == None).all())
|
||||
oborud = random.choice(db.session.query(Oboruds).filter(Oboruds.aud_id is None).all())
|
||||
oborud.aud_id = audid.id
|
||||
db.session.commit()
|
||||
|
||||
@@ -299,9 +297,48 @@ def createdb():
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def write2excell():
|
||||
wb = xlrd.open_workbook("VedIsh.xls")
|
||||
sheet = wb.sheet_by_index(0)
|
||||
|
||||
newFile = copy(wb)
|
||||
newSheet = newFile.get_sheet(0)
|
||||
invNomerColum = 6
|
||||
|
||||
column_index = 1
|
||||
for row_idx in range(sheet.nrows):
|
||||
cell_value = sheet.cell(row_idx, column_index)
|
||||
|
||||
if cell_value:
|
||||
|
||||
tmp_inv_number = str(cell_value).split(':')[1]
|
||||
|
||||
try:
|
||||
a = tmp_inv_number[1:-1]
|
||||
|
||||
inv_number = int(tmp_inv_number[1:-1])
|
||||
|
||||
with app.app_context():
|
||||
auditory_obj = db.session.query(Auditory).join(Oboruds, Oboruds.aud_id == Auditory.id).filter(
|
||||
Oboruds.invNumber == inv_number).first()
|
||||
|
||||
print(auditory_obj.audnazvanie)
|
||||
|
||||
# cur.execute("SELECT aud.audnazvanie FROM oboruds AS ob JOIN auditory AS aud ON ob.aud_id = aud.id WHERE ob.invNumber = ?", (inv_number,))
|
||||
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
"""
|
||||
else:
|
||||
#newSheet.write(row_idx, invNomerColum, "Нет инв номера")
|
||||
pass
|
||||
newFile.save("Ved31.xls")
|
||||
"""
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#write2excell()
|
||||
|
||||
#ranomraspr()
|
||||
#createdb()
|
||||
app.run(debug=True, host='0.0.0.0', port='3800')
|
||||
|
||||
54
migrations/versions/8e5efc4de919_.py
Normal file
54
migrations/versions/8e5efc4de919_.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 8e5efc4de919
|
||||
Revises: c208cbc25232
|
||||
Create Date: 2024-04-03 22:36:46.208266
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8e5efc4de919'
|
||||
down_revision = 'c208cbc25232'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('oboruds', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('numberved', sa.String(length=100), nullable=True))
|
||||
batch_op.add_column(sa.Column('numberppasu', sa.String(length=100), nullable=True))
|
||||
batch_op.add_column(sa.Column('balancenumber', sa.Integer(), nullable=True))
|
||||
batch_op.alter_column('nazvanie',
|
||||
existing_type=sa.TEXT(length=500),
|
||||
type_=sa.String(length=500),
|
||||
existing_nullable=True)
|
||||
batch_op.alter_column('raspologenie',
|
||||
existing_type=sa.TEXT(length=200),
|
||||
type_=sa.String(length=200),
|
||||
existing_nullable=True)
|
||||
batch_op.drop_column('buhnumberpp')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('oboruds', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('buhnumberpp', sa.TEXT(length=100), nullable=True))
|
||||
batch_op.alter_column('raspologenie',
|
||||
existing_type=sa.String(length=200),
|
||||
type_=sa.TEXT(length=200),
|
||||
existing_nullable=True)
|
||||
batch_op.alter_column('nazvanie',
|
||||
existing_type=sa.String(length=500),
|
||||
type_=sa.TEXT(length=500),
|
||||
existing_nullable=True)
|
||||
batch_op.drop_column('balancenumber')
|
||||
batch_op.drop_column('numberppasu')
|
||||
batch_op.drop_column('numberved')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Binary file not shown.
Binary file not shown.
24
migrations/versions/d4a8e4c9e65a_.py
Normal file
24
migrations/versions/d4a8e4c9e65a_.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: d4a8e4c9e65a
|
||||
Revises: 10da3140ab2e, 8e5efc4de919
|
||||
Create Date: 2024-05-06 08:27:39.088982
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd4a8e4c9e65a'
|
||||
down_revision = ('10da3140ab2e', '8e5efc4de919')
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
Submodule release-05-04-24/asuinventory deleted from 2e9cc918d5
@@ -54,7 +54,7 @@ button {
|
||||
|
||||
.card {
|
||||
|
||||
width: 200px;
|
||||
/*width: 200px; */
|
||||
margin: 10px;
|
||||
border-radius: 15px;
|
||||
border-color: #E07D54;
|
||||
@@ -67,7 +67,6 @@ h5 {
|
||||
}
|
||||
|
||||
|
||||
|
||||
.hidden-column {
|
||||
display: none;
|
||||
}
|
||||
@@ -82,9 +81,15 @@ table{
|
||||
word-break: break-all;
|
||||
border-collapse: separate !important;
|
||||
}
|
||||
td{
|
||||
|
||||
.table td {
|
||||
font-size: 14px;
|
||||
padding: 0;
|
||||
max-width: 10rem;
|
||||
word-break: break-all;
|
||||
border-collapse: separate !important;
|
||||
}
|
||||
|
||||
.aud {
|
||||
width: 110px;
|
||||
}
|
||||
@@ -94,8 +99,9 @@ td{
|
||||
}
|
||||
|
||||
.rasp {
|
||||
max-width: 200px;
|
||||
width: 200px;
|
||||
word-break: break-word;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#modal_matcenn {
|
||||
@@ -108,8 +114,10 @@ td{
|
||||
}
|
||||
|
||||
|
||||
.datatable th:nth-child(7) {
|
||||
width: 200px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@media print {
|
||||
@@ -142,6 +150,7 @@ td{
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
.no-print {
|
||||
display: none;
|
||||
}
|
||||
@@ -152,11 +161,13 @@ td{
|
||||
font-size: 14pt;
|
||||
|
||||
}
|
||||
|
||||
table.rs-table-bordered > thead > tr > th {
|
||||
border: 1px solid #000000;
|
||||
padding: 2px;
|
||||
font-size: 14pt;
|
||||
}
|
||||
|
||||
table.rs-table-bordered > tbody > tr > td {
|
||||
border: 1px solid #000000;
|
||||
padding: 10px;
|
||||
@@ -165,6 +176,4 @@ td{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -10,8 +10,8 @@ function clearTable() {
|
||||
|
||||
|
||||
function getAllData() {
|
||||
console.log('12321321')
|
||||
///clearTable();
|
||||
|
||||
clearTable();
|
||||
|
||||
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||
i = 0;
|
||||
@@ -74,7 +74,7 @@ function getAllData(){
|
||||
}
|
||||
|
||||
if (schettxt.length > 0) {
|
||||
balancenumber.value = kolvotxt;
|
||||
balancenumber.value = schettxt;
|
||||
}
|
||||
|
||||
if (raspologtxt.length > 0) {
|
||||
@@ -105,7 +105,6 @@ $('#modalclose').click(function(){
|
||||
let rasp = document.getElementById('modal_rapolog')
|
||||
|
||||
|
||||
|
||||
vednumber.value = '';
|
||||
kolvo.value = '';
|
||||
balancenumber.value = '';
|
||||
@@ -114,7 +113,6 @@ $('#modalclose').click(function(){
|
||||
$('#getmodal').modal('hide')
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#modalsavetodb').click(function () {
|
||||
@@ -128,8 +126,6 @@ $('#modalsavetodb').click(function(){
|
||||
let nazv = document.getElementById('modal_nazvanie')
|
||||
|
||||
|
||||
|
||||
|
||||
let changeddata = new Array()
|
||||
|
||||
changeddata[0] = invnom.text;
|
||||
@@ -139,7 +135,6 @@ $('#modalsavetodb').click(function(){
|
||||
changeddata[4] = rasp.value;
|
||||
|
||||
|
||||
|
||||
let sendData = changeddata.join(',')
|
||||
console.log(sendData)
|
||||
|
||||
@@ -185,8 +180,6 @@ $('#modal2savetodb').click(function(){
|
||||
let nazv = document.getElementById('modal2_nazvanie')
|
||||
|
||||
|
||||
|
||||
|
||||
let changeddata = new Array()
|
||||
|
||||
changeddata[0] = invnomer.value;
|
||||
@@ -197,7 +190,6 @@ $('#modal2savetodb').click(function(){
|
||||
changeddata[5] = nazv.value;
|
||||
|
||||
|
||||
|
||||
let sendData = changeddata.join(',')
|
||||
console.log(sendData)
|
||||
|
||||
@@ -240,7 +232,6 @@ $('#modal2close').click(function(){
|
||||
let rasp = document.getElementById('modal2_rapolog')
|
||||
|
||||
|
||||
|
||||
vednumber.value = '';
|
||||
invnomer.value = '';
|
||||
nazvanie.value = '';
|
||||
@@ -252,9 +243,40 @@ $('#modal2close').click(function(){
|
||||
$('#addmodal').modal('hide')
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#modal2').on('hidden.bs.modal', function () {
|
||||
location.reload();
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
// Слушаем событие клика по заголовкам таблицы
|
||||
$('#alldatatable thead th').on('click', function () {
|
||||
var columnIndex = $(this).index(); // Индекс колонки
|
||||
var sortColumn = $(this).text().toLowerCase(); // Текст заголовка колонки
|
||||
|
||||
// Сортируем таблицу по выбранной колонке
|
||||
$('#alldatatable tbody tr').sort(function (a, b) {
|
||||
var valA;
|
||||
var valB;
|
||||
|
||||
if (isNaN(parseFloat($(a).find('td:eq(' + columnIndex + ')').text()))) {
|
||||
// если это текстовая колонка, то сортируем по алфавиту
|
||||
valA = $(a).find('td:eq(' + columnIndex + ')').text().toLowerCase();
|
||||
valB = $(b).find('td:eq(' + columnIndex + ')').text().toLowerCase();
|
||||
} else {
|
||||
// если это числовая колонка, то сортируем по числовому значению
|
||||
valA = parseFloat($(a).find('td:eq(' + columnIndex + ')').text());
|
||||
valB = parseFloat($(b).find('td:eq(' + columnIndex + ')').text());
|
||||
}
|
||||
|
||||
if (valA < valB) return -1;
|
||||
if (valA > valB) return 1;
|
||||
return 0;
|
||||
}).appendTo('#alldatatable tbody');
|
||||
|
||||
// Обновляем классы для активной колонки
|
||||
$('#alldatatable thead th').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
});
|
||||
});
|
||||
@@ -103,21 +103,21 @@
|
||||
|
||||
|
||||
|
||||
<div class="row col-12">
|
||||
<div class=" card col-11">
|
||||
<div class="row">
|
||||
|
||||
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
<button class="button" id="printallbutton"> Печать </button>
|
||||
</div>
|
||||
|
||||
<div class="row col-12">
|
||||
<button class="button" id="addoborud"> Добавить </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="card col-md-11 table-responsive">
|
||||
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||
|
||||
62
templates/login.html
Normal file
62
templates/login.html
Normal file
@@ -0,0 +1,62 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="card col-4" >
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
|
||||
<!-- Form Name -->
|
||||
<legend>Авторизация</legend>
|
||||
|
||||
<!-- Text input-->
|
||||
<div class="form-group">
|
||||
<label control-label" for="logininput">Логин</label>
|
||||
<div>
|
||||
<input id="logininput" name="logininput" type="text" placeholder="Введите логин" class="form-control input-md">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Password input-->
|
||||
<div class="form-group">
|
||||
<label class="control-label" for="passwordinput">Пароль</label>
|
||||
<input id="passwordinput" name="passwordinput" type="password" placeholder="Введите пароль" class="form-control input-md">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<button id="btn_login" name="btn_login" class="btn btn-primary">Войти</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,17 +4,16 @@
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="textarea">
|
||||
|
||||
|
||||
<input type="text" class="form-control" id='vednumber' placeholder="Номер из веломости">
|
||||
<input type="text" class="form-control" id='rapolog' placeholder="Введите расположение">
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
|
||||
@@ -23,18 +22,21 @@
|
||||
<form method="POST" action="/addraspved">
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" name="modal_vednumber" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||
<input type="text" class="form-control" name="modal_vednumber" id='modal_vednumber'
|
||||
placeholder="Номер из ведомости">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" name="modal_rapolog" id ='modal_rapolog' placeholder="Введите расположение">
|
||||
<input type="text" class="form-control" name="modal_rapolog" id='modal_rapolog'
|
||||
placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb">Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
@@ -78,7 +80,7 @@
|
||||
<th>Расположение</th>
|
||||
|
||||
|
||||
{% for item in res: %}
|
||||
{% for item in res %}
|
||||
|
||||
<td><input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||
<td> {{ item[1] }} </td>
|
||||
|
||||
Reference in New Issue
Block a user