采集端添加opc请求地址模板

iot
DESKTOP-1JS6RSM\Admin 3 months ago
parent 6a82e1fa8b
commit 7c144a33be

@ -21,6 +21,7 @@ class IotEndpoint(db.Model, TimeModelMixin):
description = db.Column(db.Text, nullable=True, comment="采集端描述") description = db.Column(db.Text, nullable=True, comment="采集端描述")
ip = db.Column(db.String(255), nullable=False, comment="采集端IP") ip = db.Column(db.String(255), nullable=False, comment="采集端IP")
port = db.Column(db.String(255), nullable=False, comment="采集端端口") port = db.Column(db.String(255), nullable=False, comment="采集端端口")
opc_url_temp = db.Column(db.String(1024), nullable=False, comment="OPC URL模板")
brand_name = db.Column(db.String(255), nullable=False, comment="品牌名称") brand_name = db.Column(db.String(255), nullable=False, comment="品牌名称")
specification_model = db.Column(db.String(255), nullable=False, comment="规格型号") specification_model = db.Column(db.String(255), nullable=False, comment="规格型号")
is_online = db.Column(db.Integer, nullable=False, default=0, comment="在线状态 0:离线 1:在线") is_online = db.Column(db.Integer, nullable=False, default=0, comment="在线状态 0:离线 1:在线")
@ -40,6 +41,7 @@ class IotEndpointSchema(BaseSchema):
description = String() description = String()
ip = String() ip = String()
port = String() port = String()
opc_url_temp = String()
brand_name = String() brand_name = String()
specification_model = String() specification_model = String()
is_online = Integer() is_online = Integer()

@ -76,11 +76,12 @@ def add_node_alert(json_data: dict):
""" """
添加节点值异常告警日志 添加节点值异常告警日志
""" """
node_id = json_data["node_id"] for node_data in json_data["node_data_list"]:
alert_value = json_data["alert_value"] node_id = node_data["node_id"]
result = add_node_alert_log(node_id, alert_value) alert_value = node_data["alert_value"]
if len(result) > 0: result = add_node_alert_log(node_id, alert_value)
raise BizException(result) if len(result) > 0:
raise BizException(result)
return success(); return success();

@ -121,10 +121,9 @@ class AlertLogUpdateRequest(BaseSchema):
}, },
) )
class NodeCollectData(BaseSchema):
class NodeAlertLogAddRequest(BaseSchema):
""" """
节点值异常告警日志信息添加请求 节点收集数据
""" """
node_id = fields.Integer( node_id = fields.Integer(
required=True, required=True,
@ -140,3 +139,25 @@ class NodeAlertLogAddRequest(BaseSchema):
"description": "告警值", "description": "告警值",
}, },
) )
class NodeAlertLogAddRequest(BaseSchema):
"""
节点值异常告警日志信息添加请求
"""
node_data_list = fields.List(
fields.Nested(NodeCollectData),
required=True,
metadata={
"example": [
{
"node_id": 1,
"alert_value": "-2.1",
},
{
"node_id": 2,
"alert_value": "100",
},
],
"description": "节点收集数据列表",
},
)

@ -38,7 +38,7 @@ class EndpointAddRequest(BaseSchema):
endpoint_name = fields.String( endpoint_name = fields.String(
required=True, required=True,
metadata={"example": "采集端名称", "descriptrion": "采集端名称"}, metadata={"example": "采集端名称", "description": "采集端名称"},
) )
endpoint_number = fields.String( endpoint_number = fields.String(
required=True, required=True,
@ -57,6 +57,10 @@ class EndpointAddRequest(BaseSchema):
required=True, required=True,
metadata={"example": "采集端端口", "description": "采集端端口"}, metadata={"example": "采集端端口", "description": "采集端端口"},
) )
opc_url_temp = fields.String(
required=True,
metadata={"example": "{_ip_}:{_port_}", "description": "OPC URL模板"},
)
brand_name = fields.String( brand_name = fields.String(
required=False, required=False,
metadata={"example": "品牌名称", "description": "品牌名称"}, metadata={"example": "品牌名称", "description": "品牌名称"},
@ -95,6 +99,10 @@ class EndpointUpdateRequest(BaseSchema):
required=True, required=True,
metadata={"example": "采集端端口", "description": "采集端端口"}, metadata={"example": "采集端端口", "description": "采集端端口"},
) )
opc_url_temp = fields.String(
required=True,
metadata={"example": "{_ip_}:{_port_}", "description": "OPC URL模板"},
)
brand_name = fields.String( brand_name = fields.String(
required=False, required=False,
metadata={"example": "品牌名称", "description": "品牌名称"}, metadata={"example": "品牌名称", "description": "品牌名称"},

Loading…
Cancel
Save