Ejemplo n.º 1
0
def new_batch():
	batchID = request.args.get('batchID', '')
	date = request.args.get('date', '')
	outpressure = request.args.get('outpressure', '')
	optional_records = request.args.get('optional_records', '')
	new_model = request.args.get('new_model', '')

	new_ele_str = ' '.join([date, batchID, outpressure, optional_records])
	donels = clean_line(new_ele_str, datesep = '-')
	
	# 处理模具名问题
	if new_model == 'n':
		modelname = 'm' + donels[1]
		donels.insert(3, modelname)
		donels.insert(4, 1)
		batch = Batch(donels)
	else:
		print donels
		batch = Batch(donels)
		
		batchtype = batch.get_batchtype()
		modelname, modeltimes = sql.query_modelinfo(batchtype)
		batch.update_modelinfo(modelname, modeltimes)
	print 'batchtype is ', batch.get_batchtype()
	if spc_list.new_batch(batch, batch.get_batchtype()):
		flash(u'成功创建新批次!')
	else:
		flash(u'无法创建新批次!')
	return redirect('/process_control?batchtype=%s'%batch.get_batchtype())
Ejemplo n.º 2
0
def batch_analysis():
	#create Batch class
	batchinfo = request.args['batchinfo']
	donels = clean_line(batchinfo)
	batch = Batch(donels)
	# plot production process records	
	records_plot = batch.process_plot()
	test_hist = batch.history_test_hist()
	scatter_plot = batch.history_scatter_subplot()
	hist_plot = batch.history_hist_subplot()
	# make the stat summary table
	col1 = [u'生产日期', u'机床压力', u'平均爆破压力(Mpa)', u'标准偏差值', u'波动范围', u'平均移动极差', u'工序能力指数Cp', u'上限不合格率(>3.6)', u'下限不合格率(<3.0)', u'批次不合格率']
	stat_data = batch.stat_info()
	
	return render_template('show_batch.html', hist_plot = hist_plot, scatter_plot = scatter_plot, test_hist = test_hist, stat_data = stat_data, records_plot = records_plot, col1 = col1, donels = donels, batch = batch, info = info, nav_list = nav_list, nav_url = nav_url)