赞
踩
Python仓库管理系统源代码,库存管理系统源码,基于flask,内含数据库文件,已实现出入库、库存预警,库存搜索等功能
已实现三大功能:库存管理(出库、入库、低库存预警、物品搜索),预算统计,出入库记录导出。
完整代码下载地址:Python仓库管理系统源代码,库存管理系统源码
app.py
from flask import Flask, render_template, request, jsonify import webbrowser import sqldb app = Flask(__name__) #进入首页 @app.route('/') # def hei(): # return render_template('test.html') # #进入'index'页面 @app.route('/index/') #进入后自动运行下面函数 def index(): return render_template('goods.html') @app.route('/other/') def other(): return render_template('records.html') @app.route('/count/') def count(): return render_template('count.html') @app.route('/data/goods/') def getgoods(): #data数据要以这种方式命名是为了LAYUI的数据要求 data = {"code": 0, "msg": ""} name = request.args.get('search_name') or '' model = request.args.get('search_model') or '' process = request.args.get('search_process') or '' lst = sqldb.select_goods(name, model, process) for i in lst: i['needbuy'] = int(i['safenumber']) - int(i['number']) data['count'] = len(lst) data['data'] = lst return data @app.route('/data/records/') def getrecords(): data = {"code": 0, "msg": ""} lst = sqldb.select_records() data['count'] = len(lst) data['data'] = lst return data @app.route('/data/counts/') def getcounts(): process = request.args.get('process') inorout = request.args.get('inorout') date1 = request.args.get('date1') date2 = request.args.get('date2') + " 23:59:59" data = {"code": 0, "msg": ""} lst = sqldb.count_goods(process, inorout, date1, date2) data['count'] = len(lst) data['data'] = lst return data @app.route('/op/<kind>') def op(kind): if kind == 'in': id = request.args.get('in_id') change = request.args.get('in_change') people = request.args.get('in_people'); sqldb.insert_records(id, 1, change, people) elif kind == 'out': id = request.args.get('out_id') change = request.args.get('out_change') people = request.args.get('out_people'); sqldb.insert_records(id, 0, change, people) elif kind == 'add': name = request.args.get('add_name') model = request.args.get('add_model') factory = request.args.get('add_factory') or '' process = request.args.get('add_process') price = request.args.get('add_price') or 0 sqldb.insert_goods(name, model, factory, process, price) elif kind == 'del': id = request.args.get('del_id') sqldb.del_goods(id) elif kind == 'edit': # 更新物品信息 id = request.args.get('edit_id') name = request.args.get('edit_name') model = request.args.get('edit_model') process = request.args.get('edit_process') factory = request.args.get('edit_factory') or '' price = request.args.get('edit_price') or 0 safe_number = request.args.get('edit_safenumber') or 0 sqldb.update_goods(id, name, model, process, factory, price,safe_number) return jsonify() @app.route('/data/<kind>') def get_names(kind): data = {"code": 0, "msg": ""} lst = sqldb.get_names(kind) # print(lst) for i in list(lst): if i[kind] is None: lst.pop(lst.index(i)) data['count'] = len(lst) data['data'] = lst return data @app.route('/error/') def error(): return "500" if __name__ == '__main__': webbrowser.open("http://127.0.0.1:5000/") app.run()
完整代码下载地址:Python仓库管理系统源代码,库存管理系统源码
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。