当前位置:   article > 正文

Python仓库管理系统源代码,库存管理系统源码,基于flask,内含数据库文件,已实现出入库、库存预警,库存搜索等功能_python出入库管理系统软件

python出入库管理系统软件

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()

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125

在这里插入图片描述
完整代码下载地址:Python仓库管理系统源代码,库存管理系统源码

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/170100
推荐阅读
相关标签
  

闽ICP备14008679号