def process_control(): batchtype = request.args.get('batchtype', '') worker = batchtype try: current_batch = spc_list.load_records(batchtype) process_plot = current_batch.process_plot() col1 = [u'刻槽压力', u'抽检序号', u'抽检1 (Mpa)', u'复检', u'抽检2 (Mpa)', u'复检', u'抽检3 (Mpa)', u'复检', u'抽检4 (Mpa)', u'复检', u'抽检5 (Mpa)', u'复检'] tt_value = current_batch.get_raw_records() ct_value = current_batch.get_check_records() nof = range(1, len(tt_value), 5) nol = range(5, len(tt_value) + 5, 5) no = [(str(nof[indx]) + '~'+ str(nol[indx])) for indx in range(0,len(nof))] outpressure = current_batch.update_outpressure() return render_template('process_control.html', ct_value = ct_value, col1 = col1, current_batch = current_batch, outpressure = outpressure, no = no, tt_value = tt_value, process_plot = process_plot, worker = worker, info = info, nav_list = nav_list, nav_url = nav_url) except IOError: flash(u'无先前数据记录, 请先创建批次!') return render_template('new_batch.html', worker = worker, info = info, nav_list = nav_list, nav_url = nav_url)
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())