Ejemplo n.º 1
0
 def getUpdateInfo(self):
     '''
         对比数据库与xls文件,获得需要更新的软件版本
         对比逻辑:取各自(client, version, author),若三者一致视为同版本,否则视为待添加的新版本
         注意table_name和sheet_name必须对应, 比如t_V05对应V05!
         :returns 成功打开xls文件并进行对比后,返回格式为
         [
             (client, version, date, base, record, reason, remark, author),
             (client, version, date, base, record, reason, remark, author),
             ...
         ]
         如果没有更新返回空list
         如果因为无法xls等失败则返回None
     '''
     if self.running_update:
         return 0
     if not os.path.isfile(self.version_xls_path):
         print('xls文件路径有误!!!')
         self.vers_ready_to_append = None
         return -1
     try:
         workbook = xlrd.open_workbook(self.version_xls_path)
         sheet = workbook.sheet_by_name(self.sheet_name)
     except (FileNotFoundError, xlrd.biffh.XLRDError) as e:
         print(e)
         self.vers_ready_to_append = None
         return -1
     t_soft = TableManager(self.table_name, self.version_db_path)
     ids = t_soft.getAllId()
     softs_existed = []
     for id in ids:
         # 3重验证,防止版本号重复的版本无法录入
         client, version, author = t_soft.displayBriefData(id, 'client', 'version', 'author')
         softs_existed.append((client, version, author))
     self.vers_ready_to_append = []
     for i in range(1, sheet.nrows):
         temp = sheet.row_values(i)
         client = temp[0]
         version = temp[1]
         author = temp[7]
         if version and (client, version, author) not in softs_existed:
             self.vers_ready_to_append.append(sheet.row_values(i)[:8])
     return self.vers_ready_to_append
Ejemplo n.º 2
0
def getOutputItems():
    t_func_list = TableManager('FuncOutput_List', IO_INFO_DB_PATH)
    ret_data = []
    for each_id in t_func_list.getAllId():
        ret_data.append(t_func_list.displayBriefData(each_id, 'CName')[0])
    return jsonify(ret_data)