当前位置:网站首页>Intouch高级报警(报警筛选)
Intouch高级报警(报警筛选)
2022-07-25 19:07:00 【卡哇伊大喵】
报警存储SqlServer
打开Alarm DB Logger Manager软件

点击开始按钮,让intouch把报警记录存储的SqlServer里面

SqlServer开启Sql登录

SqlServer创建一个新用户

开启所有授权
开启远程登录
查看数据库端口号,一般都是1433端口号
如果是远程,需要防火墙开启端口号
SqlServer远程登录测试
使用软件

新建连接sqlserver服务器

打开sqlserver数据库视图可以看到所有报警数据

前端页面编写

后端服务器编写
import pymssql
import base64
from flask import request, Flask, jsonify
app = Flask(__name__)
## 链接sqlserver
db = pymssql.connect(host='127.0.0.1',user='TEST',password='[email protected]',database='WWALMDB',charset='utf8')
cursor = db.cursor()
db.autocommit(True)
## 获取所有报警信息(分页查询)
@app.route('/police/get/<searchType>/<like>/<pageIndex>/<size>')
def getRoad(searchType,like,pageIndex,size):
like = base64.b64decode(like)
like = str(like, 'utf-8')
print(like)
sql = ""
sqlLike = ""
searchType = int(searchType)
if searchType == 1:
sqlLike = like+"%"
elif searchType == 2:
sqlLike = "%液位%"
elif searchType == 3:
sqlLike = "%电流%"
elif searchType == 4:
sqlLike = "%电压%"
elif searchType == 5:
sqlLike = "%1#泵%"
elif searchType == 6:
sqlLike = "%2#泵%"
elif searchType == 7:
sqlLike = "%风机%"
if(searchType == 0):
sql = "SELECT TOP "+ size +" * FROM ( SELECT ROW_NUMBER ( ) OVER ( ORDER BY EventStamp DESC ) AS ROWS,* FROM v_AlarmHistory) A WHERE ROWS >"+pageIndex
else:
sql = "SELECT TOP "+ size +" * FROM ( SELECT ROW_NUMBER ( ) OVER ( ORDER BY EventStamp DESC ) AS ROWS,* FROM v_AlarmHistory WHERE v_AlarmHistory.Description LIKE '"+sqlLike+"') A WHERE ROWS >"+pageIndex
print("-----------")
print(sql)
cursor.execute(sql)
msg = cursor.fetchall()
return {"msg": "error","data":msg}
## 时间查询(分页查询)
@app.route('/police/getbyDate/<start>/<end>/<pageIndex>/<size>')
def getbyDate(start,end,pageIndex,size):
start = base64.b64decode(start)
start = str(start, 'utf-8')+" 00:00:00"
end = base64.b64decode(end)
end = str(end, 'utf-8')+" 00:00:00"
sql = "select top "+size+" * from (SELECT ROW_NUMBER() over(order by EventStamp desc) as rows,*FROM v_AlarmHistory WHERE v_AlarmHistory.EventStamp BETWEEN '"+start+"' AND '"+end+"' ) A where rows > "+pageIndex
print(sql)
cursor.execute(sql)
msg = cursor.fetchall()
return {"msg": "error","data":msg}
try:
app.run(port=8066)
except BaseException:
print("服务启动失败,端口:8066")
边栏推荐
- [encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
- The bank's wealth management subsidiary accumulates power to distribute a shares; The rectification of cash management financial products was accelerated
- Deng Qinglin, a technical expert of Alibaba cloud: Best Practices for disaster recovery and remote multi activity across availability zones on cloud
- 基于Mysql-Exporter监控Mysql
- Alibaba cloud free SSL certificate application detailed process
- 2022 IAA industry category development insight series report - phase II
- 怎样设计产品帮助中心?以下几点不可忽视
- 阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
- 房企打响“保交战”
- Fruit chain "siege": it's a journey of sweetness and bitterness next to apples
猜你喜欢

Based on easycv to reproduce Detr and dab-detr, the correct opening method of object query

Talk about 15 tips of SQL optimization

There are several browser cores. How to upgrade if the browser version is too low

Huawei switch system software upgrade and security vulnerability repair tutorial

浅析IM即时通讯开发出现上网卡顿?网络掉线?

ThreadLocal夺命11连问

Everyone can participate in the official launch of open source activities. We sincerely invite you to experience!

Ultimate doll 2.0 | cloud native delivery package

MySQL sub query (selected 20 sub query exercises)

常用的开发软件下载地址
随机推荐
Based on easycv to reproduce Detr and dab-detr, the correct opening method of object query
Pymoo学习 (8):Gradients
PHP等于==和恒等于===的区别
The bank's wealth management subsidiary accumulates power to distribute a shares; The rectification of cash management financial products was accelerated
What is the application value of MES management system
房企打响“保交战”
Is Cinda securities a state-owned enterprise? Is it safe to open an account in Cinda securities?
Full scale and Xuan of C key
华为交换机系统软件升级和安全漏洞修复教程
Deng Qinglin, a technical expert of Alibaba cloud: Best Practices for disaster recovery and remote multi activity across availability zones on cloud
How to prohibit the use of 360 browser (how to disable the built-in browser)
李宏毅《机器学习》丨1. Introduction of this course(机器学习介绍)
[web technology] 1391 page visualization building tool, previous life and present life
软件测试(思维导图)
"Wdsr-3" Penglai pharmaceutical Bureau solution
有孚网络受邀参加2022全国CIO大会并荣获“CIO信赖品牌”称号
阿里云技术专家郝晨栋:云上可观测能力——问题的发现与定位实践
弱网测试工具-QNET
i3-status 配置
[cloud native kubernetes] management of secret storage objects under kubernetes cluster