Merge branch 'main' of https://git.danamir.su/danamir/asuinventory
This commit is contained in:
86
app.py
86
app.py
@@ -129,25 +129,35 @@ def alloborud():
|
||||
|
||||
@app.route('/getall')
|
||||
def getall():
|
||||
oboruds = Oboruds.query.all()
|
||||
oboruds_json = [{
|
||||
|
||||
'invNumber': oborud.invNumber,
|
||||
'nazvanie': oborud.nazvanie,
|
||||
'raspologenie': oborud.raspologenie,
|
||||
'balancenumber': oborud.balancenumber,
|
||||
'kolichestvo': oborud.kolichestvo,
|
||||
'balancenumber': oborud.balancenumber,
|
||||
'aud_id': oborud.aud_id
|
||||
} for oborud in oboruds]
|
||||
oborud = db.session.query(Oboruds).order_by(Oboruds.invNumber).all()
|
||||
|
||||
results = []
|
||||
for oboruds in oborud :
|
||||
if oboruds.aud_id is None:
|
||||
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:
|
||||
aud = db.session.query(Auditory).filter_by(id=oboruds.aud_id).first()
|
||||
results.append({
|
||||
'invNumber': oboruds.invNumber,
|
||||
'nazvanie': oboruds.nazvanie,
|
||||
'raspologenie': oboruds.raspologenie,
|
||||
'balancenumber': oboruds.balancenumber,
|
||||
'kolichestvo': oboruds.kolichestvo,
|
||||
'numberppasu': oboruds.numberppasu,
|
||||
'numberved': oboruds.numberved,
|
||||
'aud': aud.audnazvanie })
|
||||
|
||||
|
||||
|
||||
return jsonify(oboruds_json)
|
||||
|
||||
@app.route('/updateduplicate', methods=['GET', 'POST'])
|
||||
def updateduplicate():
|
||||
if request.method == 'POST':
|
||||
aud = request.form.get('auditory_dubl')
|
||||
return jsonify(results)
|
||||
|
||||
|
||||
@app.route('/vneaud', methods=['GET', 'POST'])
|
||||
@@ -204,21 +214,45 @@ def addraspved():
|
||||
|
||||
query_string = request.data.decode()
|
||||
|
||||
print(query_string)
|
||||
un_query_string = unquote(unquote(query_string)).split(',')
|
||||
|
||||
|
||||
print(un_query_string)
|
||||
|
||||
|
||||
|
||||
ob = db.session.query(Oboruds).filter_by(invNumber=un_query_string[0]).first()
|
||||
ob.raspologenie=un_query_string[2]
|
||||
ob.numberved = un_query_string[1]
|
||||
|
||||
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'})
|
||||
|
||||
|
||||
# ==================================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user