예제 #1
0
파일: webapp.py 프로젝트: yh2642/SPC_system
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())
예제 #2
0
파일: webapp.py 프로젝트: yh2642/SPC_system
def add_new_test():
	new_record = request.args.get('new_record', '')
	worker = request.args.get('workerID', '')
	delete = request.args.get('pop', '')
	drop = request.args.get('drop', '')
	print delete
	print worker
	print len(new_record)
	current_batch = spc_list.load_records(worker)
	if len(new_record) > 0:
		current_batch.add_record(new_record)
	if delete == '1':
		print 'here'
		current_batch.pop_record()
	if drop == 1:
		pass
	
	spc_list.new_batch(current_batch, worker)



	#redirect('/process_control?batchtype=%s'%current_batch.get_batchtype())
	return redirect('/process_control?batchtype=%s'%current_batch.get_batchtype())