当前位置:网站首页>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")
边栏推荐
- 软件测试(思维导图)
- QT compiled successfully, but the program could not run
- 浅析IM即时通讯开发出现上网卡顿?网络掉线?
- Cross Site Request Forgery in PHP
- [encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
- Software testing (mind mapping)
- Youth, oh, youth
- 如何创建一个有效的帮助文档?
- Fearless of high temperature and rainstorm, how can Youfu network protect you from worry?
- 【阅读笔记】《深度学习》第一章:引言
猜你喜欢

Deng Qinglin, a technical expert of Alibaba cloud: Best Practices for disaster recovery and remote multi activity across availability zones on cloud

高并发下如何保证数据库和缓存双写一致性?

2022 IAA industry category development insight series report - phase II

【919. 完全二叉树插入器】

Pymoo学习 (5):收敛性分析

Ultimate doll 2.0 | cloud native delivery package

SQL realizes 10 common functions of Excel, with original interview questions attached

阿里云技术专家郝晨栋:云上可观测能力——问题的发现与定位实践

Huawei switch system software upgrade and security vulnerability repair tutorial

Huawei recruited "talented teenagers" twice this year; 5.4 million twitter account information was leaked, with a selling price of $30000; Google fired engineers who believed in AI consciousness | gee
随机推荐
有孚原力超算,为客户提供定制化高性能计算服务
C 调的满级和玄
How to create an effective help document?
telnet安装以及telnet(密码正确)无法登录!
[applet development] do you know about applet development?
阿里云技术专家郝晨栋:云上可观测能力——问题的发现与定位实践
Care for front-line epidemic prevention workers, Haocheng JIAYE and Gaomidian sub district office jointly build the great wall of public welfare
弱网测试工具-QNET
歌曲转调之后和弦如何转换
【小程序开发】宿主环境详解
Software testing (mind mapping)
Actual combat of MySQL database design project of online mall system
Yyds dry inventory interview must brush top101: reverse linked list
阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
With 8 years of product experience, I have summarized these practical experience of continuous and efficient research and development
JMeter performance test actual video (what are the common performance test tools)
Share six practical applet plug-ins
Alibaba cloud free SSL certificate application detailed process
Interface automation test platform fasterrunner series (I) - introduction, installation and deployment, startup service, access address, configuration supplement
SQL 实现 Excel 的10个常用功能,附面试原题