Merge branch 'develop'
commit
7ec8671cf6
|
@ -852,6 +852,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
@ -1851,6 +1852,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
@ -2848,6 +2850,7 @@ function config($translateProvider) {
|
||||||
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
METER_NAME_IS_ALREADY_IN_USE: 'Meter Name Is Already In Use',
|
||||||
METER_NOT_FOUND: 'Meter Not Found',
|
METER_NOT_FOUND: 'Meter Not Found',
|
||||||
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
METER_OF_VARIABLE_NOT_FOUND: 'Meter Of Variable Not Found',
|
||||||
|
METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS: 'Meter Cannot Have More Than One ENERGY_VALUE Points',
|
||||||
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
METER_POINT_RELATION_EXISTS: 'Meter Point Relation Exists',
|
||||||
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
METER_POINT_RELATION_NOT_FOUND: 'Meter Point Relation Not Found',
|
||||||
NOT_FOUND: 'Not Found',
|
NOT_FOUND: 'Not Found',
|
||||||
|
|
|
@ -913,7 +913,6 @@ class MeterPointCollection:
|
||||||
description='API.INVALID_METER_ID')
|
description='API.INVALID_METER_ID')
|
||||||
|
|
||||||
new_values = json.loads(raw_json)
|
new_values = json.loads(raw_json)
|
||||||
|
|
||||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||||
cursor = cnx.cursor()
|
cursor = cnx.cursor()
|
||||||
|
|
||||||
|
@ -925,15 +924,26 @@ class MeterPointCollection:
|
||||||
cnx.disconnect()
|
cnx.disconnect()
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.METER_NOT_FOUND')
|
description='API.METER_NOT_FOUND')
|
||||||
|
cursor.execute(" SELECT name, object_type "
|
||||||
cursor.execute(" SELECT name "
|
|
||||||
" FROM tbl_points "
|
" FROM tbl_points "
|
||||||
" WHERE id = %s ", (new_values['data']['point_id'],))
|
" WHERE id = %s ", (new_values['data']['point_id'],))
|
||||||
if cursor.fetchone() is None:
|
row = cursor.fetchone()
|
||||||
|
if row is None:
|
||||||
cursor.close()
|
cursor.close()
|
||||||
cnx.disconnect()
|
cnx.disconnect()
|
||||||
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND',
|
||||||
description='API.POINT_NOT_FOUND')
|
description='API.POINT_NOT_FOUND')
|
||||||
|
elif row[1] == 'ENERGY_VALUE':
|
||||||
|
query = (" SELECT p.id "
|
||||||
|
" FROM tbl_meters_points mp, tbl_points p "
|
||||||
|
" WHERE mp.meter_id = %s AND mp.point_id = p.id AND p.object_type = 'ENERGY_VALUE' ")
|
||||||
|
cursor.execute(query, (id_,))
|
||||||
|
rows_points = cursor.fetchall()
|
||||||
|
if rows_points is not None and len(rows_points) > 0:
|
||||||
|
cursor.close()
|
||||||
|
cnx.disconnect()
|
||||||
|
raise falcon.HTTPError(falcon.HTTP_404, title='API.BAD_REQUEST',
|
||||||
|
description='API.METER_CANNOT_HAVE_MORE_THAN_ONE_ENERGY_VALUE_POINTS')
|
||||||
|
|
||||||
query = (" SELECT id "
|
query = (" SELECT id "
|
||||||
" FROM tbl_meters_points "
|
" FROM tbl_meters_points "
|
||||||
|
|
Loading…
Reference in New Issue