fixed issues 199 -2

pull/127/head
tianlinzhong 2022-02-21 23:38:49 +08:00
parent 51b9e43a04
commit 25a9713e23
1 changed files with 11 additions and 10 deletions

View File

@ -939,18 +939,19 @@ class MeterPointCollection:
" WHERE meter_id = %s") " WHERE meter_id = %s")
cursor.execute(query, (id_,)) cursor.execute(query, (id_,))
rows = cursor.fetchall() rows = cursor.fetchall()
cursor.execute(" SELECT id "
" FROM tbl_points "
" WHERE object_type = %s ", ('ENERGY_VALUE',))
ponit_ids = cursor.fetchall()
if rows is not None: if rows is not None:
for row1 in rows: for row1 in rows:
cursor.execute(" SELECT object_type " if row1 in ponit_ids:
" FROM tbl_points " cursor.close()
" WHERE id = %s ", (row1[0],)) cnx.disconnect()
row = cursor.fetchone() raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
if row is not None: description='API.POINT_OBJECT_TYPE_IS_ALREADY_IN_USE')
if row[0] == 'ENERGY_VALUE':
cursor.close()
cnx.disconnect()
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
description='API.POINT_OBJECT_TYPE_IS_ALREADY_IN_USE')
query = (" SELECT id " query = (" SELECT id "
" FROM tbl_meters_points " " FROM tbl_meters_points "