def getNewNo(): sql = 'select max(no) from goods' results = DBUtil.select(sql) maxNo = results[0]['max(no)'] if maxNo != None: newNo = 'S' + str(int(maxNo.replace('S', '1')) + 1)[1:] return newNo else: # 没有记录,新创建一个 return 'S0001'
def getNewNo(): sql = 'select max(no) from provider' results = DBUtil.select(sql) maxNo = results[0]['max(no)'] if maxNo != '': newNo = 'G' + str(int(maxNo.replace('G', '1')) + 1)[1:] return newNo else: # 没有记录,新创建一个 return 'G00001'