def export_asset_info(): key = request.form['exportData'] from itdblib.common.xls_utils import writeExcel aiu = AssetInfoUtils() chlist = aiu.output_consume_excel_ch_list() enlist = aiu.output_consume_excel_en_list() params = AssetConsumeService().get_export_excel_data(key) save_file = writeExcel(params, '耗材类结果数据.xls', chlist, enlist) response = make_response(send_file(save_file, as_attachment=True )) filesize = os.path.getsize(save_file) response.headers['Content-Length'] = filesize os.remove(save_file) return response
def construct_out_oper_data(self, new_data, operator): assetInfo = AssetPhoneInfoDal().get_asset_phone_info_by_search_val_one(new_data['phone_no']) aic = AssetInfoIdToChName() params_o = {} params_o['in_out_reason'] = aic.get_in_out_reason_name_by_num( assetInfo.in_out_reason_id) params_o['store_state'] = aic.get_store_state_name_by_num( assetInfo.store_state_id) params_o['device_state'] = aic.get_device_state_name_by_num( assetInfo.device_state_id) params_o['user_name'] = assetInfo.user_name params_o['store_place'] = aic.get_store_place_name_by_num( assetInfo.store_place_id) params_o['phone_no'] = assetInfo.phone_no params_o['asset_type'] = aic.get_asset_type_name_by_num(assetInfo.asset_type_id) params_o['remark'] = assetInfo.remark params_n = {} params_n['store_place'] = new_data['store_place'] params_n['in_out_reason'] = new_data['in_out_reason'] params_n['store_state'] = '在用' params_n['remark'] = new_data['remark'] oper_data = {} oper_data['asset_id'] = params_o['phone_no'] oper_data['oper_type'] = '字段变更' oper_data['operator'] = operator oper_data['text'] = '' aiu = AssetInfoUtils() enlist = aiu.get_oper_phone_enlist() e_len = len(enlist) before_field = '' after_field = '' for i in range(e_len): before_field += enlist[i] + ":" + params_o[enlist[i]] + "," if params_n.has_key(enlist[i]): after_field += enlist[i] + ":" + params_n[enlist[i]] + "," else: after_field += enlist[i] + ":" + params_o[enlist[i]] + "," oper_data['before_field'] = before_field oper_data['after_field'] = after_field ais = AssetInfoService() ais.save_oper_info(oper_data)
def construct_out_oper_data(self, new_data, operator): oper_data = {} oper_data['asset_id'] = params_o['phone_no'] oper_data['oper_type'] = '字段变更' oper_data['operator'] = operator oper_data['text'] = '' aiu = AssetInfoUtils() enlist = aiu.get_oper_phone_enlist() e_len = len(enlist) before_field = '' after_field = '' for i in range(e_len): before_field += enlist[i] + ":" + params_o[enlist[i]] + "," if params_n.has_key(enlist[i]): after_field += enlist[i] + ":" + params_n[enlist[i]] + "," else: after_field += enlist[i] + ":" + params_o[enlist[i]] + "," oper_data['before_field'] = before_field oper_data['after_field'] = after_field ais = AssetInfoService() ais.save_oper_info(oper_data)
def format_phone_field_map(): aiu = AssetInfoUtils() chlist = aiu.input_phone_excel_ch_list() enlist = aiu.input_phone_excel_en_list() e_len = len(enlist) return dict([(chlist[i], enlist[i]) for i in range(e_len)])
def get_phone_en_ch_dict(self): aiu = AssetInfoUtils() enlist = aiu.get_phone_en_list() chlist = aiu.get_phone_ch_list() d_len = len(enlist) return dict([(enlist[i], chlist[i]) for i in range(d_len)])