当前位置:网站首页>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")
边栏推荐
- 有孚网络受邀参加2022全国CIO大会并荣获“CIO信赖品牌”称号
- How to change the chords after the tune of the song is changed
- The difference between PHP equal to = = and identity equal to = = =
- 高并发下如何保证数据库和缓存双写一致性?
- Ultimate doll 2.0 | cloud native delivery package
- kubernetes RBAC
- 果链“围城”:傍上苹果,是一场甜蜜与苦楚交错的旅途
- 软件测试流程(思维导图)
- Interface automation test platform fasterrunner series (I) - introduction, installation and deployment, startup service, access address, configuration supplement
- 7/24 training log
猜你喜欢

Modelsim and quartus jointly simulate PLL FIFO and other IP cores

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

怎样设计产品帮助中心?以下几点不可忽视

2022 IAA industry category development insight series report - phase II
![[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!](/img/6d/b037208996ce52016d014062deaa1f.jpg)
[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!

房企打响“保交战”

HTTP cache tongtianpian, there may be something you want

ThreadLocal Kills 11 consecutive questions

Basic music theory -- configuring chords

What is the application value of MES management system
随机推荐
接口自动化测试平台FasterRunner系列(二)- 功能模块
C 调的满级和玄
房地产行业大洗牌
Yarn 安装与使用教程[通俗易懂]
接口自动化测试平台FasterRunner系列(四)- 持续集成、解决多域名
Cross Site Request Forgery in PHP
软件测试流程(思维导图)
Ping command details [easy to understand]
有孚原力超算,为客户提供定制化高性能计算服务
The Yellow Crane Tower has a super shocking perspective. You've never seen such a VR panorama!
Modelsim and quartus jointly simulate PLL FIFO and other IP cores
Software testing (mind mapping)
Full scale and Xuan of C key
Korean AI team plagiarizes shock academia! One tutor with 51 students, or plagiarism recidivist
GDB help
ThreadLocal Kills 11 consecutive questions
Youfu network was invited to attend the 2022 national CIO conference and won the title of "CIO trusted brand"
Yyds dry inventory interview must brush top101: reverse linked list
7/24 training log
CRM configuration item command notes