Compare commits
71 Commits
6edb0b2601
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d686b26465 | ||
|
|
08e979ecb2 | ||
|
|
72f1d53051 | ||
|
|
b1e0693131 | ||
|
|
86713fc75f | ||
|
|
c24a1fa8c6 | ||
|
|
f108e013c2 | ||
| 1c33775f92 | |||
| 43ab114e1a | |||
| 946ad5c31f | |||
|
|
7b956d89bf | ||
| 0891abc0e1 | |||
| 08393f6685 | |||
| 9cde4e2c7d | |||
|
|
0a60a16344 | ||
|
|
496ef3fa9d | ||
|
|
3494e5d17c | ||
|
|
29b0070260 | ||
|
|
2e9cc918d5 | ||
|
|
d943894ae8 | ||
|
|
1c901ddb00 | ||
|
|
f9a188c927 | ||
|
|
1fce4b41c0 | ||
|
|
7ccbba06c1 | ||
|
|
63115f0328 | ||
| cb862c63a6 | |||
| 927d8d75a9 | |||
| 509a3ee913 | |||
| 86f0f9d977 | |||
| 0c4bf4b9fd | |||
| d71945ecb2 | |||
| 3cd5fe63b5 | |||
| 0c6001b297 | |||
| 682b6c4ffd | |||
| 9c859d4660 | |||
|
|
f6b720e4eb | ||
|
|
2fda39a449 | ||
| 291e5d0e25 | |||
| 45d8dfd870 | |||
|
|
4c6166c907 | ||
|
|
2c51bdc695 | ||
|
|
c2f3f10c9b | ||
|
|
f1c755c6ec | ||
| d2b01f56ec | |||
| 34ea972560 | |||
| 87c4ebe33e | |||
|
|
3a3e62a375 | ||
|
|
bf93bf0fdb | ||
|
|
027b1dc855 | ||
| 4a47746e9d | |||
| 12a63278f7 | |||
| 294d646bb6 | |||
| e464960fe5 | |||
| 1b472f4fee | |||
| 54c61b9756 | |||
| 68e50ee4a8 | |||
|
|
965695a693 | ||
|
|
b47e9391ba | ||
|
|
5259dc5292 | ||
|
|
a6eea28071 | ||
| 6a76d36c46 | |||
| a8d286e428 | |||
| 53cbf96439 | |||
| 70431a42ea | |||
|
|
c345bc6da5 | ||
|
|
d4a4332991 | ||
|
|
34a7b3e5c6 | ||
|
|
5f15ce9088 | ||
|
|
da82c8fe74 | ||
|
|
2da2956358 | ||
|
|
4f141d962d |
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,14 +1,21 @@
|
|||||||
*.csv
|
|
||||||
.vscode
|
.vscode
|
||||||
instance
|
.idea
|
||||||
venv/
|
venv/
|
||||||
|
instance/
|
||||||
|
|
||||||
__pychache__/
|
# Ignore Python bytecode caches everywhere
|
||||||
123
|
__pycache__/
|
||||||
|
**/__pycache__/
|
||||||
|
|
||||||
zabalans.csv
|
|
||||||
project.db
|
|
||||||
|
|
||||||
|
# Migrations and DB files
|
||||||
|
migrations/
|
||||||
|
*.db
|
||||||
|
|
||||||
|
# Data and temp files
|
||||||
|
*.csv
|
||||||
c*.txt
|
c*.txt
|
||||||
|
|
||||||
|
# Legacy specific ignores (if present)
|
||||||
|
backend/venv
|
||||||
|
backend/__pycache__
|
||||||
|
backend/routeres/__pycache__
|
||||||
|
|||||||
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.
0
addoborudtodb
Normal file
0
addoborudtodb
Normal file
212
app.py
212
app.py
@@ -6,7 +6,7 @@ from flask_migrate import Migrate
|
|||||||
from datetime import *
|
from datetime import *
|
||||||
import csv
|
import csv
|
||||||
import random
|
import random
|
||||||
|
from urllib.parse import unquote
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -21,6 +21,12 @@ db.init_app(app)
|
|||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/login", methods=['GET', 'POST'])
|
||||||
|
def login():
|
||||||
|
return render_template('login.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", methods=['GET', 'POST'])
|
@app.route("/", methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
results = []
|
results = []
|
||||||
@@ -77,10 +83,12 @@ def searchonaud():
|
|||||||
results = []
|
results = []
|
||||||
for auditory, oboruds in q:
|
for auditory, oboruds in q:
|
||||||
results.append({
|
results.append({
|
||||||
|
'num_ved': oboruds.numberved,
|
||||||
'auditory_id': auditory.id,
|
'auditory_id': auditory.id,
|
||||||
'auditory_name': auditory.audnazvanie,
|
'auditory_name': auditory.audnazvanie,
|
||||||
'inv_number': oboruds.invNumber,
|
'inv_number': oboruds.invNumber,
|
||||||
'oboruds_id': oboruds.nazvanie,
|
'oboruds_id': oboruds.nazvanie,
|
||||||
|
'raspolog': oboruds.raspologenie,
|
||||||
})
|
})
|
||||||
return jsonify(results)
|
return jsonify(results)
|
||||||
|
|
||||||
@@ -111,27 +119,38 @@ def addoborudtodb():
|
|||||||
|
|
||||||
@app.route('/all')
|
@app.route('/all')
|
||||||
def alloborud():
|
def alloborud():
|
||||||
|
return render_template('all.html')
|
||||||
|
|
||||||
result = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
|
||||||
|
|
||||||
res = []
|
@app.route('/getall')
|
||||||
|
def getall():
|
||||||
|
oborud = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
||||||
|
|
||||||
for ob in result:
|
results = []
|
||||||
if ob.aud_id is not None:
|
for oboruds in oborud:
|
||||||
aud = db.session.query(Auditory).filter_by(id=ob.aud_id).first()
|
if oboruds.aud_id is None:
|
||||||
res.append([ob.invNumber, ob.nazvanie, aud.audnazvanie])
|
results.append({
|
||||||
|
'invNumber': oboruds.invNumber,
|
||||||
|
'nazvanie': oboruds.nazvanie,
|
||||||
|
'raspologenie': oboruds.raspologenie,
|
||||||
|
'balancenumber': oboruds.balancenumber,
|
||||||
|
'kolichestvo': oboruds.kolichestvo,
|
||||||
|
'numberppasu': oboruds.numberppasu,
|
||||||
|
'numberved': oboruds.numberved,
|
||||||
|
'aud': ""})
|
||||||
else:
|
else:
|
||||||
res.append([ob.invNumber, ob.nazvanie])
|
aud = db.session.query(Auditory).filter_by(id=oboruds.aud_id).first()
|
||||||
|
results.append({
|
||||||
return render_template('all.html', res=res)
|
'invNumber': oboruds.invNumber,
|
||||||
|
'nazvanie': oboruds.nazvanie,
|
||||||
|
'raspologenie': oboruds.raspologenie,
|
||||||
@app.route('/updateduplicate', methods=['GET', 'POST'])
|
'balancenumber': oboruds.balancenumber,
|
||||||
def updateduplicate():
|
'kolichestvo': oboruds.kolichestvo,
|
||||||
if request.method == 'POST':
|
'numberppasu': oboruds.numberppasu,
|
||||||
aud = request.form.get('auditory_dubl')
|
'numberved': oboruds.numberved,
|
||||||
|
'aud': aud.audnazvanie})
|
||||||
|
|
||||||
|
return jsonify(results)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/vneaud', methods=['GET', 'POST'])
|
@app.route('/vneaud', methods=['GET', 'POST'])
|
||||||
@@ -142,7 +161,7 @@ def vneaud():
|
|||||||
ak = db.session.query(Oboruds).all()
|
ak = db.session.query(Oboruds).all()
|
||||||
|
|
||||||
for dt in data:
|
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))
|
return render_template('vneaud.html', res=res, kolvo=len(data), all_kol=len(ak))
|
||||||
|
|
||||||
@@ -175,44 +194,66 @@ def zamsearch():
|
|||||||
p = request.form.get('srch')
|
p = request.form.get('srch')
|
||||||
|
|
||||||
searchedZam = db.session.query(Zametki).filter(
|
searchedZam = db.session.query(Zametki).filter(
|
||||||
Zametki.txtzam.contains(p)).all()
|
Zametki.txtzam.contains(p)).ll()
|
||||||
|
|
||||||
zam = []
|
zam = []
|
||||||
|
|
||||||
for item in searchedZam:
|
for item in searchedZam:
|
||||||
zam.append([item.txtzam, item.created_date])
|
zam.append([item.txtzam, item.created_date])
|
||||||
|
|
||||||
return render_template('zametki.html', zam=zam)
|
return render_template('zametki.html', zam=zam)
|
||||||
|
|
||||||
# ==================================================================================
|
|
||||||
|
|
||||||
# Выгрузка в пдф
|
@app.route('/addraspved', methods=['GET', 'POST'])
|
||||||
|
def addraspved():
|
||||||
|
if request.method == 'POST':
|
||||||
|
query_string = request.data.decode()
|
||||||
|
|
||||||
@app.route('/pdfexport')
|
un_query_string = unquote(unquote(query_string)).split(',')
|
||||||
def pdfexport():
|
|
||||||
auds = db.session.query(Auditory).all()
|
|
||||||
print(auds)
|
|
||||||
for aud in auds:
|
|
||||||
q = db.session.query(Auditory, Oboruds).filter(
|
|
||||||
Auditory.id == Oboruds.aud_id
|
|
||||||
).filter(Auditory.id == aud.id
|
|
||||||
).order_by(Oboruds.invNumber).all()
|
|
||||||
print(q)
|
|
||||||
|
|
||||||
results = []
|
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||||
for auditory, oboruds in q:
|
|
||||||
results.append({
|
|
||||||
'auditory_id': auditory.id,
|
|
||||||
'auditory_name': auditory.audnazvanie,
|
|
||||||
'inv_number': oboruds.invNumber,
|
|
||||||
'oboruds_id': oboruds.nazvanie,
|
|
||||||
})
|
|
||||||
html = render_template('searchonaud.html', aud=auds, res=results)
|
|
||||||
|
|
||||||
return render_pdf(HTML(string=html))
|
ob.numberved = un_query_string[1]
|
||||||
|
ob.kolichestvo = un_query_string[2]
|
||||||
|
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(',')
|
||||||
|
db.session.add(
|
||||||
|
Oboruds(invNumber=un_query_string[0],
|
||||||
|
nazvanie=un_query_string[5],
|
||||||
|
raspologenie=un_query_string[4],
|
||||||
|
numberved=un_query_string[1],
|
||||||
|
kolichestvo=un_query_string[2],
|
||||||
|
balancenumber=un_query_string[3]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
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 is None).all()) > 0:
|
||||||
|
audid = random.choice(db.session.query(Auditory).all())
|
||||||
|
oborud = random.choice(db.session.query(Oboruds).filter(Oboruds.aud_id is None).all())
|
||||||
|
oborud.aud_id = audid.id
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def createdb():
|
def createdb():
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
db.create_all()
|
db.create_all()
|
||||||
@@ -247,66 +288,57 @@ def createdb():
|
|||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
#with open('inventMavrin.csv', encoding='cp1251') as csv_file:
|
with open('inventMavrin.csv', encoding='cp1251') as csv_file:
|
||||||
# csv_reader = csv.reader(csv_file, delimiter=';')
|
|
||||||
# for row in csv_reader:
|
|
||||||
# db.session.add(
|
|
||||||
# Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse='баланс'))
|
|
||||||
#db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
def updateOborud():
|
|
||||||
with app.app_context():
|
|
||||||
db.session.query(Oboruds).update({Oboruds.typeBalanse: 'баланс'})
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
|
|
||||||
def addZabalans():
|
|
||||||
with app.app_context():
|
|
||||||
with open('zabalans.csv', encoding='utf-8') as csv_file:
|
|
||||||
csv_reader = csv.reader(csv_file, delimiter=';')
|
csv_reader = csv.reader(csv_file, delimiter=';')
|
||||||
for row in csv_reader:
|
for row in csv_reader:
|
||||||
print(row)
|
|
||||||
db.session.add(
|
db.session.add(
|
||||||
Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse="забаланс"))
|
Oboruds(invNumber=row[0], nazvanie=row[1], typeBalanse='баланс'))
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def randomraspr():
|
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():
|
with app.app_context():
|
||||||
while db.session.query(Oboruds).filter(Oboruds.aud_id == None).all():
|
auditory_obj = db.session.query(Auditory).join(Oboruds, Oboruds.aud_id == Auditory.id).filter(
|
||||||
audid = random.choice(db.session.query(Auditory).all())
|
Oboruds.invNumber == inv_number).first()
|
||||||
oborud = random.choice(db.session.query(
|
|
||||||
Oboruds).filter(Oboruds.aud_id == None).all())
|
|
||||||
oborud.aud_id = audid.id
|
|
||||||
|
|
||||||
db.session.commit()
|
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,))
|
||||||
|
|
||||||
|
|
||||||
def randomzam():
|
except:
|
||||||
files = ['cf.txt', 'ci.txt', 'co.txt']
|
pass
|
||||||
|
|
||||||
fio = []
|
"""
|
||||||
for i in range(20):
|
else:
|
||||||
tmp = []
|
#newSheet.write(row_idx, invNomerColum, "Нет инв номера")
|
||||||
for file in files:
|
pass
|
||||||
f = open(file, "r", encoding="utf-8").readlines()
|
newFile.save("Ved31.xls")
|
||||||
tmp.append(random.choice(f))
|
"""
|
||||||
|
|
||||||
fio.append((''.join(tmp)).replace('\n', ' ').replace('\t', ''))
|
|
||||||
|
|
||||||
print(fio)
|
|
||||||
|
|
||||||
for item in fio:
|
|
||||||
timeadd = datetime.now(timezone.utc)
|
|
||||||
with app.app_context():
|
|
||||||
db.session.add(Zametki(txtzam=item, created_date=timeadd))
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
# ==================================
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
#write2excell()
|
||||||
|
|
||||||
app.run(debug=True, host='0.0.0.0', port='3800')
|
app.run(debug=True, host='0.0.0.0', port='3800')
|
||||||
|
|||||||
2
backend/__init__.py
Normal file
2
backend/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Backend package initializer."""
|
||||||
|
|
||||||
5
backend/create_new_db.py
Normal file
5
backend/create_new_db.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
from backend.models import Base
|
||||||
|
from backend.database import engine
|
||||||
|
|
||||||
|
Base.metadata.drop_all(bind=engine) # Опционально, если вдруг есть
|
||||||
|
Base.metadata.create_all(bind=engine)
|
||||||
15
backend/database.py
Normal file
15
backend/database.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# backend/database.py
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import sessionmaker, scoped_session
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URL = "sqlite:///./app.db" # или PostgreSQL URL
|
||||||
|
|
||||||
|
engine = create_engine(SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False})
|
||||||
|
SessionLocal = scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
|
||||||
|
|
||||||
|
def get_db():
|
||||||
|
db = SessionLocal()
|
||||||
|
try:
|
||||||
|
yield db
|
||||||
|
finally:
|
||||||
|
db.close()
|
||||||
43
backend/main.py
Normal file
43
backend/main.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# backend/main.py
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from fastapi.responses import RedirectResponse
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
|
from backend.routers.equipment_types import equipment_types
|
||||||
|
from backend.routers.auditories import auditories
|
||||||
|
from backend.routers.oboruds import oboruds
|
||||||
|
from backend.routers.components import components
|
||||||
|
from backend.routers.rashodniki import consumables
|
||||||
|
from backend.routers.zametki import zametki
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
# Для фронтенда Vue.js
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"], # заменить на ['http://localhost:5173'] для безопасности
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
|
@app.get("/ping")
|
||||||
|
def ping():
|
||||||
|
return {"message": "pong"}
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/")
|
||||||
|
def root():
|
||||||
|
return RedirectResponse(url="/docs")
|
||||||
|
|
||||||
|
|
||||||
|
# Подключение роутов
|
||||||
|
app.include_router(equipment_types)
|
||||||
|
app.include_router(auditories)
|
||||||
|
app.include_router(oboruds)
|
||||||
|
app.include_router(components)
|
||||||
|
app.include_router(consumables)
|
||||||
|
app.include_router(zametki)
|
||||||
69
backend/migrate_data.py
Normal file
69
backend/migrate_data.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
import sys
|
||||||
|
from sqlalchemy import create_engine, text
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
from backend.database import SessionLocal as NewSession
|
||||||
|
from backend import models
|
||||||
|
|
||||||
|
OLD_DB_URL = "sqlite:///./backend/old_app.db"
|
||||||
|
old_engine = create_engine(OLD_DB_URL, connect_args={"check_same_thread": False})
|
||||||
|
OldSession = sessionmaker(bind=old_engine)
|
||||||
|
old_db = OldSession()
|
||||||
|
|
||||||
|
new_db = NewSession()
|
||||||
|
|
||||||
|
def log(msg: str):
|
||||||
|
print(f"[INFO] {msg}", file=sys.stderr)
|
||||||
|
|
||||||
|
def migrate():
|
||||||
|
log("Запуск переноса данных из old_app.db → app.db")
|
||||||
|
|
||||||
|
# Тип оборудования по умолчанию
|
||||||
|
log("Добавление типа оборудования по умолчанию: 'Неизвестно'")
|
||||||
|
default_type = models.EquipmentType(name="Неизвестно")
|
||||||
|
new_db.add(default_type)
|
||||||
|
new_db.commit()
|
||||||
|
|
||||||
|
# Перенос аудиторий
|
||||||
|
log("Перенос аудиторий...")
|
||||||
|
auditory_map = {}
|
||||||
|
aud_rows = old_db.execute(text("SELECT id, audnazvanie FROM auditory")).fetchall()
|
||||||
|
for aud in aud_rows:
|
||||||
|
new_aud = models.Auditory(audnazvanie=aud.audnazvanie)
|
||||||
|
new_db.add(new_aud)
|
||||||
|
new_db.flush()
|
||||||
|
auditory_map[aud.id] = new_aud.id
|
||||||
|
log(f" → перенесено: {len(aud_rows)}")
|
||||||
|
|
||||||
|
# Перенос оборудования
|
||||||
|
log("Перенос оборудования...")
|
||||||
|
ob_rows = old_db.execute(text("SELECT * FROM oboruds")).fetchall()
|
||||||
|
for ob in ob_rows:
|
||||||
|
new_ob = models.Oboruds(
|
||||||
|
invNumber=ob.invNumber,
|
||||||
|
nazvanie=ob.nazvanie,
|
||||||
|
raspologenie=ob.raspologenie,
|
||||||
|
numberppasu=ob.numberppasu,
|
||||||
|
kolichestvo=ob.kolichestvo,
|
||||||
|
aud_id=auditory_map.get(ob.aud_id),
|
||||||
|
type_id=default_type.id
|
||||||
|
)
|
||||||
|
new_db.add(new_ob)
|
||||||
|
log(f" → перенесено: {len(ob_rows)}")
|
||||||
|
|
||||||
|
# Перенос заметок
|
||||||
|
log("Перенос заметок...")
|
||||||
|
z_rows = old_db.execute(text("SELECT * FROM zametki")).fetchall()
|
||||||
|
for z in z_rows:
|
||||||
|
new_z = models.Zametki(
|
||||||
|
txtzam=z.txtzam,
|
||||||
|
created_date=z.created_date,
|
||||||
|
rmdt=z.rmdt
|
||||||
|
)
|
||||||
|
new_db.add(new_z)
|
||||||
|
log(f" → перенесено: {len(z_rows)}")
|
||||||
|
|
||||||
|
new_db.commit()
|
||||||
|
log("✅ Перенос завершён успешно.")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
migrate()
|
||||||
80
backend/models.py
Normal file
80
backend/models.py
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
# backend/models.py
|
||||||
|
|
||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Auditory(Base):
|
||||||
|
__tablename__ = 'auditories'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
audnazvanie = Column(String)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="auditory")
|
||||||
|
|
||||||
|
|
||||||
|
class EquipmentType(Base):
|
||||||
|
__tablename__ = 'equipment_types'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, unique=True, nullable=False)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="type")
|
||||||
|
|
||||||
|
|
||||||
|
class Oboruds(Base):
|
||||||
|
__tablename__ = 'oboruds'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
invNumber = Column(Integer)
|
||||||
|
nazvanie = Column(String(500))
|
||||||
|
raspologenie = Column(String(200))
|
||||||
|
numberppasu = Column(String(100))
|
||||||
|
kolichestvo = Column(Integer)
|
||||||
|
|
||||||
|
aud_id = Column(Integer, ForeignKey("auditories.id"))
|
||||||
|
auditory = relationship("Auditory", back_populates="oboruds")
|
||||||
|
|
||||||
|
type_id = Column(Integer, ForeignKey("equipment_types.id"))
|
||||||
|
type = relationship("EquipmentType", back_populates="oboruds")
|
||||||
|
|
||||||
|
components = relationship("Component", back_populates="oborud")
|
||||||
|
consumables = relationship("Consumable", back_populates="oborud")
|
||||||
|
|
||||||
|
|
||||||
|
class Component(Base):
|
||||||
|
__tablename__ = 'components'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="components")
|
||||||
|
|
||||||
|
|
||||||
|
class Consumable(Base):
|
||||||
|
__tablename__ = 'consumables'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="consumables")
|
||||||
|
|
||||||
|
|
||||||
|
class Zametki(Base):
|
||||||
|
__tablename__ = 'zametki'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
txtzam = Column(String(10000))
|
||||||
|
created_date = Column(DateTime, default=datetime.datetime.utcnow)
|
||||||
|
rmdt = Column(DateTime)
|
||||||
BIN
backend/requirements.txt
Normal file
BIN
backend/requirements.txt
Normal file
Binary file not shown.
2
backend/routers/__init__.py
Normal file
2
backend/routers/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
"""Routers package initializer."""
|
||||||
|
|
||||||
18
backend/routers/auditories.py
Normal file
18
backend/routers/auditories.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
auditories = APIRouter(prefix="/auditories", tags=["auditories"])
|
||||||
|
|
||||||
|
@auditories.post("/", response_model=schemas.AuditoryRead)
|
||||||
|
def create_auditory(item: schemas.AuditoryCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Auditory(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@auditories.get("/", response_model=list[schemas.AuditoryRead])
|
||||||
|
def list_auditories(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Auditory).all()
|
||||||
|
|
||||||
18
backend/routers/components.py
Normal file
18
backend/routers/components.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
|
||||||
|
components = APIRouter(prefix="/components", tags=["components"])
|
||||||
|
|
||||||
|
@components.post("/", response_model=schemas.ComponentRead)
|
||||||
|
def create_component(item: schemas.ComponentCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Component(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@components.get("/", response_model=list[schemas.ComponentRead])
|
||||||
|
def list_components(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Component).all()
|
||||||
17
backend/routers/equipment_types.py
Normal file
17
backend/routers/equipment_types.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
equipment_types = APIRouter(prefix="/equipment-types", tags=["equipment_types"])
|
||||||
|
|
||||||
|
@equipment_types.post("/", response_model=schemas.EquipmentTypeRead)
|
||||||
|
def create_equipment_type(item: schemas.EquipmentTypeCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.EquipmentType(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@equipment_types.get("/", response_model=list[schemas.EquipmentTypeRead])
|
||||||
|
def list_equipment_types(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.EquipmentType).all()
|
||||||
28
backend/routers/oboruds.py
Normal file
28
backend/routers/oboruds.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from typing import Optional
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
oboruds = APIRouter(prefix="/oboruds", tags=["oboruds"])
|
||||||
|
|
||||||
|
@oboruds.post("/", response_model=schemas.OborudRead)
|
||||||
|
def create_oborud(item: schemas.OborudCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Oboruds(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@oboruds.get("/", response_model=list[schemas.OborudRead])
|
||||||
|
def list_oboruds(aud_id: Optional[int] = None, db: Session = Depends(database.get_db)):
|
||||||
|
query = db.query(models.Oboruds)
|
||||||
|
if aud_id is not None:
|
||||||
|
query = query.filter(models.Oboruds.aud_id == aud_id)
|
||||||
|
return query.all()
|
||||||
|
|
||||||
|
@oboruds.get("/{oborud_id}", response_model=schemas.OborudRead)
|
||||||
|
def get_oborud(oborud_id: int, db: Session = Depends(database.get_db)):
|
||||||
|
obj = db.query(models.Oboruds).filter(models.Oboruds.id == oborud_id).first()
|
||||||
|
if not obj:
|
||||||
|
raise HTTPException(status_code=404, detail="Oborud not found")
|
||||||
|
return obj
|
||||||
17
backend/routers/rashodniki.py
Normal file
17
backend/routers/rashodniki.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
consumables = APIRouter(prefix="/consumables", tags=["consumables"])
|
||||||
|
|
||||||
|
@consumables.post("/", response_model=schemas.ConsumableRead)
|
||||||
|
def create_consumable(item: schemas.ConsumableCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Consumable(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@consumables.get("/", response_model=list[schemas.ConsumableRead])
|
||||||
|
def list_consumables(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Consumable).all()
|
||||||
17
backend/routers/zametki.py
Normal file
17
backend/routers/zametki.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from fastapi import APIRouter, Depends
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from .. import models, schemas, database
|
||||||
|
|
||||||
|
zametki = APIRouter(prefix="/zametki", tags=["zametki"])
|
||||||
|
|
||||||
|
@zametki.post("/", response_model=schemas.ZametkaRead)
|
||||||
|
def create_zametka(item: schemas.ZametkaCreate, db: Session = Depends(database.get_db)):
|
||||||
|
obj = models.Zametki(**item.dict())
|
||||||
|
db.add(obj)
|
||||||
|
db.commit()
|
||||||
|
db.refresh(obj)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
@zametki.get("/", response_model=list[schemas.ZametkaRead])
|
||||||
|
def list_zametki(db: Session = Depends(database.get_db)):
|
||||||
|
return db.query(models.Zametki).all()
|
||||||
102
backend/schemas.py
Normal file
102
backend/schemas.py
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# backend/schemas.py
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional, List
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
# === Equipment Type ===
|
||||||
|
class EquipmentTypeBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
|
||||||
|
class EquipmentTypeCreate(EquipmentTypeBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class EquipmentTypeRead(EquipmentTypeBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Component ===
|
||||||
|
class ComponentBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
description: Optional[str] = None
|
||||||
|
|
||||||
|
class ComponentCreate(ComponentBase):
|
||||||
|
oborud_id: int
|
||||||
|
|
||||||
|
class ComponentRead(ComponentBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Consumable ===
|
||||||
|
class ConsumableBase(BaseModel):
|
||||||
|
name: str
|
||||||
|
description: Optional[str] = None
|
||||||
|
|
||||||
|
class ConsumableCreate(ConsumableBase):
|
||||||
|
oborud_id: int
|
||||||
|
|
||||||
|
class ConsumableRead(ConsumableBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Oborud ===
|
||||||
|
class OborudBase(BaseModel):
|
||||||
|
invNumber: Optional[int]
|
||||||
|
nazvanie: str
|
||||||
|
raspologenie: Optional[str] = None
|
||||||
|
numberppasu: Optional[str] = None
|
||||||
|
kolichestvo: Optional[int] = None
|
||||||
|
aud_id: int
|
||||||
|
type_id: int
|
||||||
|
|
||||||
|
class OborudCreate(OborudBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class OborudRead(OborudBase):
|
||||||
|
id: int
|
||||||
|
type: EquipmentTypeRead
|
||||||
|
components: List[ComponentRead] = []
|
||||||
|
consumables: List[ConsumableRead] = []
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Auditory ===
|
||||||
|
class AuditoryBase(BaseModel):
|
||||||
|
audnazvanie: str
|
||||||
|
|
||||||
|
class AuditoryCreate(AuditoryBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class AuditoryRead(AuditoryBase):
|
||||||
|
id: int
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
|
|
||||||
|
|
||||||
|
# === Zametka ===
|
||||||
|
class ZametkaBase(BaseModel):
|
||||||
|
txtzam: str
|
||||||
|
rmdt: Optional[datetime] = None
|
||||||
|
|
||||||
|
class ZametkaCreate(ZametkaBase):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class ZametkaRead(ZametkaBase):
|
||||||
|
id: int
|
||||||
|
created_date: datetime
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
orm_mode = True
|
||||||
@@ -8,6 +8,8 @@
|
|||||||
# the 'revision' command, regardless of autogenerate
|
# the 'revision' command, regardless of autogenerate
|
||||||
# revision_environment = false
|
# revision_environment = false
|
||||||
|
|
||||||
|
script_location = .
|
||||||
|
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
[loggers]
|
[loggers]
|
||||||
|
|||||||
32
migrations/versions/10da3140ab2e_.py
Normal file
32
migrations/versions/10da3140ab2e_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 10da3140ab2e
|
||||||
|
Revises: 4eacd6dcd461
|
||||||
|
Create Date: 2024-04-05 01:25:48.931573
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '10da3140ab2e'
|
||||||
|
down_revision = '4eacd6dcd461'
|
||||||
|
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('kolichestvo', sa.Integer(), nullable=True))
|
||||||
|
|
||||||
|
# ### 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.drop_column('kolichestvo')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
32
migrations/versions/256c3a3e91a2_.py
Normal file
32
migrations/versions/256c3a3e91a2_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 256c3a3e91a2
|
||||||
|
Revises: 4f95d12a8352
|
||||||
|
Create Date: 2024-03-13 16:01:01.559719
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '256c3a3e91a2'
|
||||||
|
down_revision = '4f95d12a8352'
|
||||||
|
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.drop_column('somepl')
|
||||||
|
|
||||||
|
# ### 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('somepl', sa.VARCHAR(length=10), nullable=True))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
54
migrations/versions/4eacd6dcd461_.py
Normal file
54
migrations/versions/4eacd6dcd461_.py
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 4eacd6dcd461
|
||||||
|
Revises: c208cbc25232
|
||||||
|
Create Date: 2024-04-03 23:25:42.271936
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '4eacd6dcd461'
|
||||||
|
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.VARCHAR(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 ###
|
||||||
32
migrations/versions/4f95d12a8352_.py
Normal file
32
migrations/versions/4f95d12a8352_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 4f95d12a8352
|
||||||
|
Revises: 50f85881169e
|
||||||
|
Create Date: 2024-03-13 15:57:33.119683
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '4f95d12a8352'
|
||||||
|
down_revision = '50f85881169e'
|
||||||
|
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('somepl', sa.String(length=10), nullable=True))
|
||||||
|
|
||||||
|
# ### 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.drop_column('somepl')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
24
migrations/versions/50f85881169e_.py
Normal file
24
migrations/versions/50f85881169e_.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 50f85881169e
|
||||||
|
Revises: b24baa0d98e6
|
||||||
|
Create Date: 2024-03-13 15:55:03.770084
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '50f85881169e'
|
||||||
|
down_revision = 'b24baa0d98e6'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
pass
|
||||||
34
migrations/versions/6fc3d1adb061_.py
Normal file
34
migrations/versions/6fc3d1adb061_.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 6fc3d1adb061
|
||||||
|
Revises: be7c94c549e5
|
||||||
|
Create Date: 2024-04-02 16:32:23.180273
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '6fc3d1adb061'
|
||||||
|
down_revision = 'be7c94c549e5'
|
||||||
|
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('buhnumberpp', sa.String(length=100), nullable=True))
|
||||||
|
batch_op.add_column(sa.Column('kolichestvo', sa.Integer(), nullable=True))
|
||||||
|
|
||||||
|
# ### 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.drop_column('kolichestvo')
|
||||||
|
batch_op.drop_column('buhnumberpp')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
32
migrations/versions/873defe09f22_.py
Normal file
32
migrations/versions/873defe09f22_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 873defe09f22
|
||||||
|
Revises: ec6bbcd361bd
|
||||||
|
Create Date: 2024-03-13 22:34:36.718676
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '873defe09f22'
|
||||||
|
down_revision = 'ec6bbcd361bd'
|
||||||
|
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('raspologenie', sa.String(length=200), nullable=True))
|
||||||
|
|
||||||
|
# ### 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.drop_column('raspologenie')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
32
migrations/versions/885bdd7b5161_.py
Normal file
32
migrations/versions/885bdd7b5161_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 885bdd7b5161
|
||||||
|
Revises: be7c94c549e5
|
||||||
|
Create Date: 2024-04-02 23:03:59.401369
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '885bdd7b5161'
|
||||||
|
down_revision = 'be7c94c549e5'
|
||||||
|
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('kolichestvo', sa.Integer(), nullable=True))
|
||||||
|
|
||||||
|
# ### 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.drop_column('kolichestvo')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
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 ###
|
||||||
32
migrations/versions/8e838956713f_.py
Normal file
32
migrations/versions/8e838956713f_.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 8e838956713f
|
||||||
|
Revises: 256c3a3e91a2
|
||||||
|
Create Date: 2024-03-20 19:03:51.112016
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '8e838956713f'
|
||||||
|
down_revision = '256c3a3e91a2'
|
||||||
|
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))
|
||||||
|
|
||||||
|
# ### 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.drop_column('numberved')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
24
migrations/versions/b24baa0d98e6_.py
Normal file
24
migrations/versions/b24baa0d98e6_.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: b24baa0d98e6
|
||||||
|
Revises: 873defe09f22, b2a61aef79e9
|
||||||
|
Create Date: 2024-03-13 15:42:47.733687
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'b24baa0d98e6'
|
||||||
|
down_revision = ('873defe09f22', 'b2a61aef79e9')
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
pass
|
||||||
24
migrations/versions/b2a61aef79e9_.py
Normal file
24
migrations/versions/b2a61aef79e9_.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: b2a61aef79e9
|
||||||
|
Revises: ec6bbcd361bd
|
||||||
|
Create Date: 2024-03-13 01:48:30.093937
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'b2a61aef79e9'
|
||||||
|
down_revision = 'ec6bbcd361bd'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
pass
|
||||||
34
migrations/versions/be7c94c549e5_.py
Normal file
34
migrations/versions/be7c94c549e5_.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: be7c94c549e5
|
||||||
|
Revises: 8e838956713f
|
||||||
|
Create Date: 2024-04-01 15:09:52.082987
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'be7c94c549e5'
|
||||||
|
down_revision = '8e838956713f'
|
||||||
|
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('balancenumber', sa.String(length=30), nullable=True))
|
||||||
|
batch_op.drop_column('typeBalanse')
|
||||||
|
|
||||||
|
# ### 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('typeBalanse', sa.VARCHAR(length=30), nullable=True))
|
||||||
|
batch_op.drop_column('balancenumber')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
24
migrations/versions/c208cbc25232_.py
Normal file
24
migrations/versions/c208cbc25232_.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: c208cbc25232
|
||||||
|
Revises: 6fc3d1adb061, 885bdd7b5161
|
||||||
|
Create Date: 2024-04-03 22:11:15.008480
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'c208cbc25232'
|
||||||
|
down_revision = ('6fc3d1adb061', '885bdd7b5161')
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
pass
|
||||||
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
|
||||||
44
migrations/versions/ec6bbcd361bd_.py
Normal file
44
migrations/versions/ec6bbcd361bd_.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: ec6bbcd361bd
|
||||||
|
Revises:
|
||||||
|
Create Date: 2024-03-13 08:22:23.761783
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = 'ec6bbcd361bd'
|
||||||
|
down_revision = None
|
||||||
|
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.drop_column('duplicate')
|
||||||
|
|
||||||
|
with op.batch_alter_table('zametki', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column('txtzam',
|
||||||
|
existing_type=sa.TEXT(length=10000),
|
||||||
|
type_=sa.String(length=10000),
|
||||||
|
existing_nullable=True)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('zametki', schema=None) as batch_op:
|
||||||
|
batch_op.alter_column('txtzam',
|
||||||
|
existing_type=sa.String(length=10000),
|
||||||
|
type_=sa.TEXT(length=10000),
|
||||||
|
existing_nullable=True)
|
||||||
|
|
||||||
|
with op.batch_alter_table('oboruds', schema=None) as batch_op:
|
||||||
|
batch_op.add_column(sa.Column('duplicate', sa.BOOLEAN(), nullable=True))
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
83
models.py
83
models.py
@@ -1,35 +1,76 @@
|
|||||||
|
# backend/models.py
|
||||||
|
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||||
|
from sqlalchemy.orm import relationship, declarative_base
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
db = SQLAlchemy()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
|
||||||
class Auditory(db.Model):
|
class Auditory(Base):
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
__tablename__ = 'auditories'
|
||||||
audnazvanie=db.Column(db.String)
|
|
||||||
oboruds = db.relationship('Oboruds')
|
id = Column(Integer, primary_key=True)
|
||||||
|
audnazvanie = Column(String)
|
||||||
|
|
||||||
|
oboruds = relationship("Oboruds", back_populates="auditory")
|
||||||
|
|
||||||
|
|
||||||
|
class EquipmentType(Base):
|
||||||
|
__tablename__ = 'equipment_types'
|
||||||
|
|
||||||
class Oboruds(db.Model):
|
id = Column(Integer, primary_key=True)
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
name = Column(String, unique=True, nullable=False)
|
||||||
invNumber=db.Column(db.Integer)
|
|
||||||
nazvanie=db.Column(db.String(500))
|
|
||||||
raspologenie = db.Column(db.String(200))
|
|
||||||
|
|
||||||
duplicate=db.Column(db.Boolean, unique=False, default=False)
|
oboruds = relationship("Oboruds", back_populates="type")
|
||||||
typeBalanse = db.Column(db.String(30))
|
|
||||||
|
|
||||||
aud_id = db.Column(db.Integer, db.ForeignKey(Auditory.id))
|
|
||||||
duplicate_aud_id = (db.Integer, db.ForeignKey(Auditory.id))
|
|
||||||
|
|
||||||
|
|
||||||
|
class Oboruds(Base):
|
||||||
|
__tablename__ = 'oboruds'
|
||||||
|
|
||||||
class Zametki(db.Model):
|
id = Column(Integer, primary_key=True)
|
||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
invNumber = Column(Integer)
|
||||||
txtzam=db.Column(db.String(10000))
|
nazvanie = Column(String(500))
|
||||||
created_date = db.Column(db.DateTime, default=datetime.datetime.utcnow)
|
raspologenie = Column(String(200))
|
||||||
rmdt = db.Column(db.DateTime)
|
numberppasu = Column(String(100))
|
||||||
|
kolichestvo = Column(Integer)
|
||||||
|
|
||||||
|
aud_id = Column(Integer, ForeignKey("auditories.id"))
|
||||||
|
auditory = relationship("Auditory", back_populates="oboruds")
|
||||||
|
|
||||||
|
type_id = Column(Integer, ForeignKey("equipment_types.id"))
|
||||||
|
type = relationship("EquipmentType", back_populates="oboruds")
|
||||||
|
|
||||||
|
components = relationship("Component", back_populates="oborud")
|
||||||
|
consumables = relationship("Consumable", back_populates="oborud")
|
||||||
|
|
||||||
|
|
||||||
|
class Component(Base):
|
||||||
|
__tablename__ = 'components'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="components")
|
||||||
|
|
||||||
|
|
||||||
|
class Consumable(Base):
|
||||||
|
__tablename__ = 'consumables'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String, nullable=False)
|
||||||
|
description = Column(String)
|
||||||
|
|
||||||
|
oborud_id = Column(Integer, ForeignKey("oboruds.id"))
|
||||||
|
oborud = relationship("Oboruds", back_populates="consumables")
|
||||||
|
|
||||||
|
|
||||||
|
class Zametki(Base):
|
||||||
|
__tablename__ = 'zametki'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
txtzam = Column(String(10000))
|
||||||
|
created_date = Column(DateTime, default=datetime.datetime.utcnow)
|
||||||
|
rmdt = Column(DateTime)
|
||||||
|
|||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
6
serve.py
Normal file
6
serve.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from waitress import serve
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
serve(app, port='3800')
|
||||||
@@ -18,6 +18,7 @@ body {
|
|||||||
|
|
||||||
border: 1px;
|
border: 1px;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
@@ -53,7 +54,7 @@ button {
|
|||||||
|
|
||||||
.card {
|
.card {
|
||||||
|
|
||||||
width: 200px;
|
/*width: 200px; */
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
border-radius: 15px;
|
border-radius: 15px;
|
||||||
border-color: #E07D54;
|
border-color: #E07D54;
|
||||||
@@ -66,7 +67,6 @@ h5 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.hidden-column {
|
.hidden-column {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -77,6 +77,49 @@ nav{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
word-break: break-all;
|
||||||
|
border-collapse: separate !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table td {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 0;
|
||||||
|
max-width: 10rem;
|
||||||
|
word-break: break-all;
|
||||||
|
border-collapse: separate !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aud {
|
||||||
|
width: 110px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inv {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rasp {
|
||||||
|
width: 200px;
|
||||||
|
word-break: break-word;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
#modal_matcenn {
|
||||||
|
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.datatable {
|
||||||
|
background-color: whitesmoke;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.datatable th:nth-child(7) {
|
||||||
|
width: 200px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@@ -107,6 +150,7 @@ nav{
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-print {
|
.no-print {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
@@ -117,11 +161,13 @@ nav{
|
|||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table.rs-table-bordered > thead > tr > th {
|
table.rs-table-bordered > thead > tr > th {
|
||||||
border: 1px solid #000000;
|
border: 1px solid #000000;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
font-size: 14pt;
|
font-size: 14pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.rs-table-bordered > tbody > tr > td {
|
table.rs-table-bordered > tbody > tr > td {
|
||||||
border: 1px solid #000000;
|
border: 1px solid #000000;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -130,6 +176,4 @@ nav{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
282
static/js/allmatc.js
Normal file
282
static/js/allmatc.js
Normal file
@@ -0,0 +1,282 @@
|
|||||||
|
function clearTable() {
|
||||||
|
var table = document.getElementById("alldatatable");
|
||||||
|
var rowCount = table.rows.length;
|
||||||
|
|
||||||
|
// Iterate through each row and remove it
|
||||||
|
for (var i = rowCount - 1; i > 0; i--) {
|
||||||
|
table.deleteRow(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getAllData() {
|
||||||
|
|
||||||
|
clearTable();
|
||||||
|
|
||||||
|
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||||
|
i = 0;
|
||||||
|
$.getJSON("/getall", function (data) {
|
||||||
|
$.each(data, function (index, item) {
|
||||||
|
let newRow = tableBody.insertRow(tableBody.rows.length);
|
||||||
|
let cell1 = newRow.insertCell(0);
|
||||||
|
let cell2 = newRow.insertCell(1);
|
||||||
|
let cell3 = newRow.insertCell(2);
|
||||||
|
let cell4 = newRow.insertCell(3);
|
||||||
|
let cell5 = newRow.insertCell(4);
|
||||||
|
let cell6 = newRow.insertCell(5);
|
||||||
|
let cell7 = newRow.insertCell(6);
|
||||||
|
let cell8 = newRow.insertCell(7);
|
||||||
|
|
||||||
|
i++;
|
||||||
|
|
||||||
|
cell1.innerText = i;
|
||||||
|
cell2.innerText = item.numberved;
|
||||||
|
cell3.innerText = item.invNumber;
|
||||||
|
cell4.innerText = item.nazvanie;
|
||||||
|
cell5.innerText = item.kolichestvo;
|
||||||
|
cell6.innerText = item.balancenumber;
|
||||||
|
cell7.innerText = item.aud;
|
||||||
|
cell8.innerText = item.raspologenie;
|
||||||
|
|
||||||
|
|
||||||
|
$(newRow).data('itemData', i);
|
||||||
|
|
||||||
|
|
||||||
|
$(newRow).on("click", function () {
|
||||||
|
|
||||||
|
let vednumbertxt = newRow.cells[1].innerText;
|
||||||
|
let invnomertxt = newRow.cells[2].innerText;
|
||||||
|
let nazvanietxt = newRow.cells[3].innerText;
|
||||||
|
let kolvotxt = newRow.cells[4].innerText;
|
||||||
|
let schettxt = newRow.cells[5].innerText;
|
||||||
|
let raspologtxt = newRow.cells[7].innerText;
|
||||||
|
|
||||||
|
|
||||||
|
$('#getmodal').modal('show');
|
||||||
|
|
||||||
|
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
|
invnom.innerText = invnomertxt
|
||||||
|
matcen.innerText = nazvanietxt.substring(0, 20)
|
||||||
|
|
||||||
|
if (vednumbertxt.length > 0) {
|
||||||
|
vedomost.value = vednumbertxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kolvotxt.length > 0) {
|
||||||
|
kolvo.value = kolvotxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (schettxt.length > 0) {
|
||||||
|
balancenumber.value = schettxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raspologtxt.length > 0) {
|
||||||
|
rasp.value = raspologtxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
getAllData();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#modalclose').click(function () {
|
||||||
|
|
||||||
|
|
||||||
|
let vednumber = document.getElementById('modal_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
|
|
||||||
|
vednumber.value = '';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modalsavetodb').click(function () {
|
||||||
|
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let vednumber = document.getElementById('modal_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let nazv = document.getElementById('modal_nazvanie')
|
||||||
|
|
||||||
|
|
||||||
|
let changeddata = new Array()
|
||||||
|
|
||||||
|
changeddata[0] = invnom.text;
|
||||||
|
changeddata[1] = vednumber.value;
|
||||||
|
changeddata[2] = kolvo.value;
|
||||||
|
changeddata[3] = balancenumber.value;
|
||||||
|
changeddata[4] = rasp.value;
|
||||||
|
|
||||||
|
|
||||||
|
let sendData = changeddata.join(',')
|
||||||
|
console.log(sendData)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: sendData,
|
||||||
|
|
||||||
|
success: function () {
|
||||||
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
|
vednumber.value = '';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
changeddata = [];
|
||||||
|
window.location.reload();
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$('#addoborud').click(function () {
|
||||||
|
|
||||||
|
$('#addmodal').modal('show');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modal2savetodb').click(function () {
|
||||||
|
|
||||||
|
let invnomer = document.getElementById('modal2_invnom')
|
||||||
|
let vednumber = document.getElementById('modal2_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal2_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal2_balance')
|
||||||
|
let matcen = document.getElementById('modal2_matcenn')
|
||||||
|
let rasp = document.getElementById('modal2_rapolog')
|
||||||
|
let nazv = document.getElementById('modal2_nazvanie')
|
||||||
|
|
||||||
|
|
||||||
|
let changeddata = new Array()
|
||||||
|
|
||||||
|
changeddata[0] = invnomer.value;
|
||||||
|
changeddata[1] = vednumber.value;
|
||||||
|
changeddata[2] = kolvo.value;
|
||||||
|
changeddata[3] = balancenumber.value;
|
||||||
|
changeddata[4] = rasp.value;
|
||||||
|
changeddata[5] = nazv.value;
|
||||||
|
|
||||||
|
|
||||||
|
let sendData = changeddata.join(',')
|
||||||
|
console.log(sendData)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addoborudasu",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: sendData,
|
||||||
|
|
||||||
|
success: function () {
|
||||||
|
vednumber.value = '';
|
||||||
|
invnomer.value = '';
|
||||||
|
nazvanie.value = '';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
|
||||||
|
$('#addmodal').modal('hide')
|
||||||
|
window.location.reload()
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modal2close').click(function () {
|
||||||
|
|
||||||
|
|
||||||
|
let vednumber = document.getElementById('modal2_vednumber')
|
||||||
|
let invnomer = document.getElementById('modal2_invnom')
|
||||||
|
let nazvanie = document.getElementById('modal2_nazvanie')
|
||||||
|
let kolvo = document.getElementById('modal2_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal2_balance')
|
||||||
|
let matcen = document.getElementById('modal2_matcenn')
|
||||||
|
let rasp = document.getElementById('modal2_rapolog')
|
||||||
|
|
||||||
|
|
||||||
|
vednumber.value = '';
|
||||||
|
invnomer.value = '';
|
||||||
|
nazvanie.value = '';
|
||||||
|
kolvo.value = '';
|
||||||
|
balancenumber.value = '';
|
||||||
|
matcen.value = '';
|
||||||
|
rasp.value = '';
|
||||||
|
|
||||||
|
$('#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');
|
||||||
|
});
|
||||||
|
});
|
||||||
35
static/js/allmatcen.js
Normal file
35
static/js/allmatcen.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
function getData(){
|
||||||
|
|
||||||
|
const audid = document.getElementById('auditory')
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/getall",
|
||||||
|
type: "get",
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
|
||||||
|
success: function(response){
|
||||||
|
|
||||||
|
var data = response;
|
||||||
|
const table = document.getElementById('datatable')
|
||||||
|
table.innerHTML = ''
|
||||||
|
var headTable = '<tr> <td >Номер в Инв. вед</td> <td id="invnomer">Инв. номер</td><td>Название</td><td class="no-print aud">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
||||||
|
table.innerHTML += headTable
|
||||||
|
var tr =""
|
||||||
|
|
||||||
|
|
||||||
|
data.forEach(element => {
|
||||||
|
tr += '<tr onclick="tableclick(this)">'
|
||||||
|
tr += '<td>' + element.num_ved + '</td>'
|
||||||
|
tr += '<td clas="inv">' + element.inv_number + '</td>'
|
||||||
|
tr += '<td>' + element.oboruds_id + '</td>'
|
||||||
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
||||||
|
tr += '<td class="rasp">' +element.raspolog + '</td>'
|
||||||
|
tr += '<td>' + '\n' + '</td>'
|
||||||
|
|
||||||
|
tr += '</tr>'
|
||||||
|
});
|
||||||
|
table.innerHTML += tr
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
0
static/js/modal.js
Normal file
0
static/js/modal.js
Normal file
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
$("#searchbutton").click(function(){
|
function getData(){
|
||||||
|
|
||||||
const audid = document.getElementById('auditory')
|
const audid = document.getElementById('auditory')
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
url: "/searchonaud",
|
url: "/searchonaud",
|
||||||
@@ -18,27 +16,110 @@
|
|||||||
|
|
||||||
var data = response;
|
var data = response;
|
||||||
const table = document.getElementById('datatable')
|
const table = document.getElementById('datatable')
|
||||||
table.innerHTML = ''
|
|
||||||
var headTable = '<tr> <td>Инв. номер</td><td>Название</td><td class="no-print">Аудитория</td><td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
var headTable = '<tr> <td >Номер в Инв. вед</td> <td id="invnomer">Инв. номер</td><td>Название</td><td class="no-print aud">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
||||||
table.innerHTML += headTable
|
|
||||||
var tr =""
|
var tr =""
|
||||||
|
|
||||||
data.forEach(element => {
|
|
||||||
|
|
||||||
tr += '<td>' + element.inv_number + '</td>'
|
data.forEach(element => {
|
||||||
|
tr += '<tr onclick="tableclick(this)">'
|
||||||
|
tr += '<td>' + element.num_ved + '</td>'
|
||||||
|
tr += '<td clas="inv">' + element.inv_number + '</td>'
|
||||||
tr += '<td>' + element.oboruds_id + '</td>'
|
tr += '<td>' + element.oboruds_id + '</td>'
|
||||||
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
||||||
|
tr += '<td class="rasp">' +element.raspolog + '</td>'
|
||||||
tr += '<td>' + '\n' + '</td>'
|
tr += '<td>' + '\n' + '</td>'
|
||||||
|
|
||||||
tr += '</tr>'
|
tr += '</tr>'
|
||||||
|
|
||||||
});
|
});
|
||||||
|
table.innerHTML = headTable + tr
|
||||||
table.innerHTML += tr
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$("#searchbutton").click(function(){
|
||||||
|
getData();
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#modalsavetodb').click(function(){
|
||||||
|
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
|
||||||
|
let changeddata = new Array()
|
||||||
|
|
||||||
|
changeddata[0] = invnom.text
|
||||||
|
changeddata[1] = vedomost.value
|
||||||
|
changeddata[2] = rasp.value
|
||||||
|
|
||||||
|
let sendData = changeddata.join(',')
|
||||||
|
|
||||||
|
changeddata = []
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: sendData,
|
||||||
|
|
||||||
|
success: function(){
|
||||||
|
/*
|
||||||
|
rasp='',
|
||||||
|
vedomost = '',
|
||||||
|
invnom = '',
|
||||||
|
matcen = '',
|
||||||
|
|
||||||
|
changeddata = []
|
||||||
|
*/
|
||||||
|
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
function tableclick(tableRow){
|
||||||
|
|
||||||
|
let nomved = tableRow.childNodes[0].innerHTML;
|
||||||
|
let invnomer = tableRow.childNodes[1].innerHTML;
|
||||||
|
let nazvanie = tableRow.childNodes[2].innerHTML;
|
||||||
|
let raspolog = tableRow.childNodes[4].innerHTML;
|
||||||
|
|
||||||
|
$('#getmodal').modal('show')
|
||||||
|
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
|
||||||
|
invnom.innerText = invnomer
|
||||||
|
matcen.innerText = nazvanie.substring(0,15)
|
||||||
|
|
||||||
|
if (nomved.length >0){
|
||||||
|
|
||||||
|
vedomost.value = nomved
|
||||||
|
}
|
||||||
|
|
||||||
|
if(raspolog.length>0){
|
||||||
|
rasp.value = raspolog
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#mimodal").on('hidden.bs.modal', function () {
|
||||||
|
$(this).data('bs.modal', null);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide').data( 'bs.modal', null );
|
||||||
|
|
||||||
} )
|
} )
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
47
static/js/tmp.js
Normal file
47
static/js/tmp.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
function tableclick(x){
|
||||||
|
// let data = document.getElementById(x.rowIndex)
|
||||||
|
|
||||||
|
let datas = x.innerText.split('\t')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
invnom.innerText=datas[1]+"\t"
|
||||||
|
matcen.innerText=datas[2]
|
||||||
|
|
||||||
|
|
||||||
|
if (datas[4].length>0){
|
||||||
|
rasp.value=datas[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datas[0].length>0){
|
||||||
|
vedomost.value=datas[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
|
||||||
|
} )
|
||||||
|
|
||||||
|
$('#modalsavetodb').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
rasp: rasp.value,
|
||||||
|
ved: vedomost.value,
|
||||||
|
inv: invnomer
|
||||||
|
},
|
||||||
|
success:function() {
|
||||||
|
rasp.value = '';
|
||||||
|
vedomost.value= '';
|
||||||
|
data=[];
|
||||||
|
rasp
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})}
|
||||||
@@ -3,38 +3,145 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="row">
|
<!-- Modal -->
|
||||||
<div class="card col-md-10 col-10">
|
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
<div class="card-body">
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
<form>
|
<div class="row">
|
||||||
<h3 class=" no-print card-title"> Все мат. ценности </h3>
|
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||||
<button id="printallbutton"> Печать </button>
|
</div>
|
||||||
<table class="table pagebreak" col-md-10>
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal2 -->
|
||||||
|
<div class="modal fade" id="addmodal" 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">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal2_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Инвентарный номер
|
||||||
|
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Название
|
||||||
|
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||||
|
|
||||||
|
|
||||||
|
</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 class="row">
|
||||||
|
<div class="card col-md-11 table-responsive">
|
||||||
|
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||||
|
<th scope="col">№ п/п <br>вед</th>
|
||||||
<th scope="col">Инв. номер</th>
|
<th scope="col">Инв. номер</th>
|
||||||
<th scope="col">Название</th>
|
<th scope="col">Название</th>
|
||||||
<th scope="col">Аудитория</th>
|
<th scope="col">Кол-во</th>
|
||||||
|
<th scope="col">Счёт</th>
|
||||||
|
<th scope="col">Ауд - я</th>
|
||||||
|
<th scope="col">Расположение</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
{% for item in res: %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td> <input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
|
||||||
<td> {{ item[1] }} </td>
|
|
||||||
|
|
||||||
|
|
||||||
<td>
|
|
||||||
{{ item[2] }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
147
templates/all_OLD.html
Normal file
147
templates/all_OLD.html
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<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">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal2 -->
|
||||||
|
<div class="modal fade" id="addmodal" 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">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<a id="modal_invnom"> </a><a id="modal2_matcenn"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<input type="text" class="form-control" id ='modal2_vednumber' placeholder="Номер из ведомости">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Инвентарный номер
|
||||||
|
<input type="text" class="form-control" id ='modal2_invnom' placeholder="Инвентарный номер">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Название
|
||||||
|
<input type="text" class="form-control" id ='modal2_nazvanie' placeholder="Название">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Количество
|
||||||
|
<input type="text" class="form-control" id ='modal2_kolvo' placeholder="Количество">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal2_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal2_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modal2close">Закрыть</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="modal2savetodb" >Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||||
|
|
||||||
|
|
||||||
|
</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 class="row">
|
||||||
|
<div class="card col-md-11 table-responsive">
|
||||||
|
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||||
|
<th scope="col">№ п/п <br>вед</th>
|
||||||
|
<th scope="col">Инв. номер</th>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col">Кол-во</th>
|
||||||
|
<th scope="col">Счёт</th>
|
||||||
|
<th scope="col">Ауд - я</th>
|
||||||
|
<th scope="col">Расположение</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -9,3 +9,5 @@
|
|||||||
<script src="{{url_for('static', filename='js/zametki.js') }}"></script>
|
<script src="{{url_for('static', filename='js/zametki.js') }}"></script>
|
||||||
<script src="{{url_for('static', filename='js/searchonaud.js') }}"></script>
|
<script src="{{url_for('static', filename='js/searchonaud.js') }}"></script>
|
||||||
<script src="{{url_for('static', filename='js/print.js') }}"></script>
|
<script src="{{url_for('static', filename='js/print.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/modal.js') }}"></script>
|
||||||
|
<script src="{{url_for('static', filename='js/allmatc.js') }}"></script>
|
||||||
|
|||||||
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 %}
|
||||||
|
|
||||||
@@ -2,6 +2,52 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action="/addraspved">
|
||||||
|
<div class="row">
|
||||||
|
№ из ведомости
|
||||||
|
<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="Введите расположение">
|
||||||
|
</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-primary" id="modalsavetodb">Сохранить изменения</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row no-print">
|
<div class="row no-print">
|
||||||
<div class="card col-md-10 col-10">
|
<div class="card col-md-10 col-10">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@@ -20,31 +66,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="card col-md-10 col-10">
|
<div class="card col-md-10 col-10">
|
||||||
<form method="POST" action="/addoborudtodb">
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h3 class="card-title no-print"> Поаудиторно </h3>
|
<h3 class="card-title no-print"> Поаудиторно </h3>
|
||||||
|
|
||||||
<table class="table" id="datatable" col-md-10>
|
<table class="table " id="datatable">
|
||||||
|
|
||||||
<td >Инв. номер</td>
|
<th>Номер в Инв. вед</th>
|
||||||
<td >Название</td>
|
<th>Инв. номер</th>
|
||||||
<td class="no-print">Аудитория</td>
|
<th>Название</th>
|
||||||
|
<th class="no-print">Аудитория</th>
|
||||||
|
<th>Расположение</th>
|
||||||
|
|
||||||
{% for item in res: %}
|
|
||||||
|
{% for item in res %}
|
||||||
|
|
||||||
<td><input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
<td><input type="hidden" name="invnomer" value="{{ item[0] }}"> {{ item[0] }} </td>
|
||||||
<td> {{ item[1] }} </td>
|
<td> {{ item[1] }} </td>
|
||||||
<td class="no-print"> {{ item[2] }} </td>
|
<td class="no-print"> {{ item[2] }} </td>
|
||||||
<td id="proverka"> Проверено</td>
|
<td id="proverka"> Проверено</td>
|
||||||
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user