commit
1a2f274f1f
|
|
@ -244,6 +244,7 @@ app.controller('ModalAddPointCtrl', function($scope, $uibModalInstance) {
|
|||
$scope.point = {};
|
||||
$scope.point.object_type = "ENERGY_VALUE";
|
||||
$scope.point.is_trend = true;
|
||||
$scope.point.is_virtual = false;
|
||||
$scope.ok = function() {
|
||||
$uibModalInstance.close($scope.point);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -449,6 +449,7 @@ function config($translateProvider) {
|
|||
LOW_LIMIT: 'Low Limit',
|
||||
RATIO: 'Ratio',
|
||||
IS_TREND: 'Is Trend',
|
||||
IS_VIRTUAL: 'Is Virtual',
|
||||
ADDRESS: 'Address(JSON)',
|
||||
DESCRIPTION: 'Description(Optionnal)',
|
||||
INPUT_HIGH_LIMIT: 'Please Input High Limit',
|
||||
|
|
@ -1488,6 +1489,7 @@ function config($translateProvider) {
|
|||
LOW_LIMIT: '低限',
|
||||
RATIO: '比例系数',
|
||||
IS_TREND: '保存趋势',
|
||||
IS_VIRTUAL: '虚拟点',
|
||||
ADDRESS: '地址(JSON)',
|
||||
DESCRIPTION: '描述',
|
||||
INPUT_HIGH_LIMIT: '请输入高限',
|
||||
|
|
@ -2539,6 +2541,7 @@ function config($translateProvider) {
|
|||
LOW_LIMIT: 'Untergrenze',
|
||||
RATIO: 'Skalierungsfaktor',
|
||||
IS_TREND: 'Trend speichern',
|
||||
IS_VIRTUAL: 'Virtueller Punkt',
|
||||
ADDRESS: 'Adresse (JSON)',
|
||||
DESCRIPTION: 'Beschreibung',
|
||||
INPUT_HIGH_LIMIT: 'Bitte geben Sie das obere Limit ein',
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
<th class="text-center">{{'POINT.LOW_LIMIT' | translate}}</th>
|
||||
<th class="text-center">{{'POINT.RATIO' | translate}}</th>
|
||||
<th class="text-center">{{'POINT.IS_TREND' | translate}}</th>
|
||||
<th class="text-center">{{'POINT.IS_VIRTUAL' | translate}}</th>
|
||||
<th class="text-center">{{'POINT.ADDRESS' | translate}}</th>
|
||||
<th class="text-center">{{'POINT.DESCRIPTION' | translate}} ({{'SETTING.OPTIONAL' | translate}})</th>
|
||||
<th class="text-center">{{'SETTING.ACTION' | translate}}</th>
|
||||
|
|
@ -86,8 +87,8 @@
|
|||
<td class="text-center">{{ point.high_limit }}</td>
|
||||
<td class="text-center">{{ point.low_limit }}</td>
|
||||
<td class="text-center">{{ point.ratio }}</td>
|
||||
<td class="text-center">
|
||||
{{ point.is_trend==false?'SETTING.NO':'SETTING.YES' | translate }}</td>
|
||||
<td class="text-center">{{ point.is_trend==false?'SETTING.NO':'SETTING.YES' | translate }}</td>
|
||||
<td class="text-center">{{ point.is_virtual==false?'SETTING.NO':'SETTING.YES' | translate }}</td>
|
||||
<td class="text-center md">{{ point.address }}</td>
|
||||
<td class="text-center md">{{ point.description }}</td>
|
||||
<td class="text-center">
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@
|
|||
</div>
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-4 control-label">{{'POINT.IS_TREND' | translate}}</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox checkbox-success">
|
||||
<input id="chk_point_istrend" type="checkbox" ng-model="point.is_trend" ng-checked="point.is_trend">
|
||||
|
|
@ -73,6 +72,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-4 control-label">{{'POINT.IS_VIRTUAL' | translate}}</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox checkbox-success">
|
||||
<input id="chk_point_isvirtual" type="checkbox" ng-model="point.is_virtual" ng-checked="point.is_virtual">
|
||||
<label for="chk_point_isvirtual">{{'POINT.IS_VIRTUAL' | translate}}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
<div class="form-group"><label class="col-sm-4 control-label">{{'POINT.ADDRESS' | translate}}</label>
|
||||
|
||||
|
|
|
|||
|
|
@ -3400,7 +3400,7 @@
|
|||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"ModbusPoint2\", \"data_source_id\":1, \"object_type\": \"ENERGY_VALUE\", \"units\":\"kWh\", \"high_limit\":999999999, \"low_limit\":0, \"ratio\":1,\"is_trend\":true, \"address\":\"{\\\"slave_id\\\":1, \\\"function_code\\\":3, \\\"offset\\\":1, \\\"number_of_registers\\\":2, \\\"data_format\\\":\\\"float\\\"}\", \"description\":null}}"
|
||||
"raw": "{\"data\":{\"name\":\"ModbusPoint2\", \"data_source_id\":1, \"object_type\": \"ENERGY_VALUE\", \"units\":\"kWh\", \"high_limit\":999999999, \"low_limit\":0, \"ratio\":1,\"is_trend\":true, \"is_virtual\":false, \"address\":\"{\\\"slave_id\\\":1, \\\"function_code\\\":3, \\\"offset\\\":1, \\\"number_of_registers\\\":2, \\\"data_format\\\":\\\"float\\\"}\", \"description\":null}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/points",
|
||||
|
|
@ -3439,7 +3439,7 @@
|
|||
"header": [],
|
||||
"body": {
|
||||
"mode": "raw",
|
||||
"raw": "{\"data\":{\"name\":\"ModbusPoint1\", \"data_source_id\":1, \"object_type\": \"ENERGY_VALUE\", \"units\":\"kWh\", \"high_limit\":999999999, \"low_limit\":0, \"ratio\":100, \"is_trend\":true, \"address\":\"{\\\"slave_id\\\":1, \\\"function_code\\\":3, \\\"offset\\\":1, \\\"number_of_registers\\\":2, \\\"data_format\\\":\\\"float\\\"}\", \"description\":null}}"
|
||||
"raw": "{\"data\":{\"name\":\"ModbusPoint1\", \"data_source_id\":1, \"object_type\": \"ENERGY_VALUE\", \"units\":\"kWh\", \"high_limit\":999999999, \"low_limit\":0, \"ratio\":100, \"is_trend\":true, \"is_virtual\":false, \"address\":\"{\\\"slave_id\\\":1, \\\"function_code\\\":3, \\\"offset\\\":1, \\\"number_of_registers\\\":2, \\\"data_format\\\":\\\"float\\\"}\", \"description\":null}}"
|
||||
},
|
||||
"url": {
|
||||
"raw": "{{base_url}}/points/1",
|
||||
|
|
@ -7079,6 +7079,98 @@
|
|||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET Combined Equipment Efficiency Report",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/reports/combinedequipmentefficiency?combinedequipmentid=1000001&periodtype=daily&baseperiodstartdatetime=2020-08-01T00:00:00&baseperiodenddatetime=2020-09-01T00:00:00&reportingperiodstartdatetime=2020-09-01T00:00:00&reportingperiodenddatetime=2020-10-01T00:00:00",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"reports",
|
||||
"combinedequipmentefficiency"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "combinedequipmentid",
|
||||
"value": "1000001"
|
||||
},
|
||||
{
|
||||
"key": "periodtype",
|
||||
"value": "daily"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodstartdatetime",
|
||||
"value": "2020-08-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodenddatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodstartdatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodenddatetime",
|
||||
"value": "2020-10-01T00:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET Combined Equipment Efficiency Report (Quick Mode)",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/reports/combinedequipmentefficiency?combinedequipmentid=1000001&periodtype=daily&baseperiodstartdatetime=2020-08-01T00:00:00&baseperiodenddatetime=2020-09-01T00:00:00&reportingperiodstartdatetime=2020-09-01T00:00:00&reportingperiodenddatetime=2020-10-01T00:00:00&quickmode=true",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"reports",
|
||||
"combinedequipmentefficiency"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "combinedequipmentid",
|
||||
"value": "1000001"
|
||||
},
|
||||
{
|
||||
"key": "periodtype",
|
||||
"value": "daily"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodstartdatetime",
|
||||
"value": "2020-08-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodenddatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodstartdatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodenddatetime",
|
||||
"value": "2020-10-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "quickmode",
|
||||
"value": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET Dashboard",
|
||||
"request": {
|
||||
|
|
@ -7749,6 +7841,47 @@
|
|||
{
|
||||
"key": "reportingperiodenddatetime",
|
||||
"value": "2020-09-11T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "",
|
||||
"value": null,
|
||||
"disabled": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET Meter Trend Report (Quick Mode)",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/reports/metertrend?meterid=6&reportingperiodstartdatetime=2020-09-10T00:00:00&reportingperiodenddatetime=2020-09-11T00:00:00&quickmode=true",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"reports",
|
||||
"metertrend"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "meterid",
|
||||
"value": "6"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodstartdatetime",
|
||||
"value": "2020-09-10T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodenddatetime",
|
||||
"value": "2020-09-11T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "quickmode",
|
||||
"value": "true"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -8646,6 +8779,50 @@
|
|||
}
|
||||
},
|
||||
"response": []
|
||||
},
|
||||
{
|
||||
"name": "GET Equipment Efficiency Report Copy",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{base_url}}/reports/equipmentefficiency?equipmentid=1&periodtype=daily&baseperiodstartdatetime=2020-08-01T00:00:00&baseperiodenddatetime=2020-09-01T00:00:00&reportingperiodstartdatetime=2020-09-01T00:00:00&reportingperiodenddatetime=2020-10-01T00:00:00",
|
||||
"host": [
|
||||
"{{base_url}}"
|
||||
],
|
||||
"path": [
|
||||
"reports",
|
||||
"equipmentefficiency"
|
||||
],
|
||||
"query": [
|
||||
{
|
||||
"key": "equipmentid",
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"key": "periodtype",
|
||||
"value": "daily"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodstartdatetime",
|
||||
"value": "2020-08-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "baseperiodenddatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodstartdatetime",
|
||||
"value": "2020-09-01T00:00:00"
|
||||
},
|
||||
{
|
||||
"key": "reportingperiodenddatetime",
|
||||
"value": "2020-10-01T00:00:00"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"response": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ class DataSourcePointCollection:
|
|||
description='API.INVALID_DATA_SOURCE_ID')
|
||||
|
||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||
cursor = cnx.cursor()
|
||||
cursor = cnx.cursor(dictionary=True)
|
||||
|
||||
cursor.execute(" SELECT name "
|
||||
" FROM tbl_data_sources "
|
||||
|
|
@ -338,7 +338,7 @@ class DataSourcePointCollection:
|
|||
# Get points of the data source
|
||||
# NOTE: there is no uuid in tbl_points
|
||||
query_point = (" SELECT id, name, object_type, "
|
||||
" units, high_limit, low_limit, ratio, is_trend, address, description "
|
||||
" units, high_limit, low_limit, ratio, is_trend, is_virtual, address, description "
|
||||
" FROM tbl_points "
|
||||
" WHERE data_source_id = %s "
|
||||
" ORDER BY name ")
|
||||
|
|
@ -347,16 +347,17 @@ class DataSourcePointCollection:
|
|||
|
||||
if rows_point is not None and len(rows_point) > 0:
|
||||
for row in rows_point:
|
||||
meta_result = {"id": row[0],
|
||||
"name": row[1],
|
||||
"object_type": row[2],
|
||||
"units": row[3],
|
||||
"high_limit": row[4],
|
||||
"low_limit": row[5],
|
||||
"ratio": float(row[6]),
|
||||
"is_trend": True if row[7] else False,
|
||||
"address": row[8],
|
||||
"description": row[9]}
|
||||
meta_result = {"id": row['id'],
|
||||
"name": row['name'],
|
||||
"object_type": row['object_type'],
|
||||
"units": row['units'],
|
||||
"high_limit": row['high_limit'],
|
||||
"low_limit": row['low_limit'],
|
||||
"ratio": float(row['ratio']),
|
||||
"is_trend": bool(row['is_trend']),
|
||||
"is_virtual": bool(row['is_virtual']),
|
||||
"address": row['address'],
|
||||
"description": row['description']}
|
||||
result.append(meta_result)
|
||||
|
||||
cursor.close()
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class PointCollection:
|
|||
"uuid": row['uuid']}
|
||||
|
||||
query = (" SELECT id, name, data_source_id, object_type, units, "
|
||||
" high_limit, low_limit, ratio, is_trend, address, description "
|
||||
" high_limit, low_limit, ratio, is_trend, is_virtual, address, description "
|
||||
" FROM tbl_points ")
|
||||
cursor.execute(query)
|
||||
rows = cursor.fetchall()
|
||||
|
|
@ -50,7 +50,8 @@ class PointCollection:
|
|||
"high_limit": row['high_limit'],
|
||||
"low_limit": row['low_limit'],
|
||||
"ratio": float(row['ratio']),
|
||||
"is_trend": row['is_trend'],
|
||||
"is_trend": bool(row['is_trend']),
|
||||
"is_virtual": bool(row['is_virtual']),
|
||||
"address": row['address'],
|
||||
"description": row['description']}
|
||||
result.append(meta_result)
|
||||
|
|
@ -122,6 +123,12 @@ class PointCollection:
|
|||
description='API.INVALID_IS_TREND_VALUE')
|
||||
is_trend = new_values['data']['is_trend']
|
||||
|
||||
if 'is_virtual' not in new_values['data'].keys() or \
|
||||
not isinstance(new_values['data']['is_virtual'], bool):
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_IS_VIRTUAL_VALUE')
|
||||
is_virtual = new_values['data']['is_virtual']
|
||||
|
||||
if 'address' not in new_values['data'].keys() or \
|
||||
not isinstance(new_values['data']['address'], str) or \
|
||||
len(str.strip(new_values['data']['address'])) == 0:
|
||||
|
|
@ -159,8 +166,8 @@ class PointCollection:
|
|||
|
||||
add_value = (" INSERT INTO tbl_points (name, data_source_id, "
|
||||
" object_type, units, high_limit, low_limit, ratio, "
|
||||
" is_trend, address, description) "
|
||||
" VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ")
|
||||
" is_trend, is_virtual, address, description) "
|
||||
" VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ")
|
||||
cursor.execute(add_value, (name,
|
||||
data_source_id,
|
||||
object_type,
|
||||
|
|
@ -169,6 +176,7 @@ class PointCollection:
|
|||
low_limit,
|
||||
ratio,
|
||||
is_trend,
|
||||
is_virtual,
|
||||
address,
|
||||
description))
|
||||
new_id = cursor.lastrowid
|
||||
|
|
@ -211,7 +219,7 @@ class PointItem:
|
|||
"uuid": row['uuid']}
|
||||
|
||||
query = (" SELECT id, name, data_source_id, object_type, units, "
|
||||
" high_limit, low_limit, ratio, is_trend, address, description "
|
||||
" high_limit, low_limit, ratio, is_trend, is_virtual, address, description "
|
||||
" FROM tbl_points "
|
||||
" WHERE id = %s ")
|
||||
cursor.execute(query, (id_,))
|
||||
|
|
@ -232,6 +240,7 @@ class PointItem:
|
|||
"low_limit": row['low_limit'],
|
||||
"ratio": float(row['ratio']),
|
||||
"is_trend": bool(row['is_trend']),
|
||||
"is_virtual": bool(row['is_virtual']),
|
||||
"address": row['address'],
|
||||
"description": row['description']}
|
||||
resp.body = json.dumps(result)
|
||||
|
|
@ -443,6 +452,12 @@ class PointItem:
|
|||
description='API.INVALID_IS_TREND_VALUE')
|
||||
is_trend = new_values['data']['is_trend']
|
||||
|
||||
if 'is_virtual' not in new_values['data'].keys() or \
|
||||
not isinstance(new_values['data']['is_virtual'], bool):
|
||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||
description='API.INVALID_IS_VIRTUAL_VALUE')
|
||||
is_virtual = new_values['data']['is_virtual']
|
||||
|
||||
if 'address' not in new_values['data'].keys() or \
|
||||
not isinstance(new_values['data']['address'], str) or \
|
||||
len(str.strip(new_values['data']['address'])) == 0:
|
||||
|
|
@ -491,7 +506,7 @@ class PointItem:
|
|||
" SET name = %s, data_source_id = %s, "
|
||||
" object_type = %s, units = %s, "
|
||||
" high_limit = %s, low_limit = %s, ratio = %s, "
|
||||
" is_trend = %s, address = %s, description = %s "
|
||||
" is_trend = %s, is_virtual = %s, address = %s, description = %s "
|
||||
" WHERE id = %s ")
|
||||
cursor.execute(update_row, (name,
|
||||
data_source_id,
|
||||
|
|
@ -501,6 +516,7 @@ class PointItem:
|
|||
low_limit,
|
||||
ratio,
|
||||
is_trend,
|
||||
is_virtual,
|
||||
address,
|
||||
description,
|
||||
id_,))
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ def process(logger, ):
|
|||
try:
|
||||
query = (" SELECT id, name, object_type, is_trend, ratio, address "
|
||||
" FROM tbl_points "
|
||||
" WHERE data_source_id = %s "
|
||||
" WHERE data_source_id = %s AND is_virtual = FALSE "
|
||||
" ORDER BY id ")
|
||||
cursor_system_db.execute(query, (data_source_id,))
|
||||
rows_points = cursor_system_db.fetchall()
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ def process(logger, data_source_id, host, port):
|
|||
try:
|
||||
query = (" SELECT id, name, object_type, is_trend, ratio, address "
|
||||
" FROM tbl_points "
|
||||
" WHERE data_source_id = %s "
|
||||
" WHERE data_source_id = %s AND is_virtual = FALSE "
|
||||
" ORDER BY id ")
|
||||
cursor_system_db.execute(query, (data_source_id, ))
|
||||
rows_point = cursor_system_db.fetchall()
|
||||
|
|
|
|||
Loading…
Reference in New Issue