当前位置:网站首页>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")
边栏推荐
- Pymoo学习 (5):收敛性分析
- Process communication (Systemv communication mode: shared memory, message queue, semaphore)
- How to change the chords after the tune of the song is changed
- srec_ Use of common cat parameters
- Pymoo学习 (7):并行化Parallelization
- A free image download warehouse website
- JMeter performance test actual video (what are the common performance test tools)
- The difference between PHP equal to = = and identity equal to = = =
- srec_cat 常用参数的使用
- Real estate enterprises have launched a "war of guarantee"
猜你喜欢

Excellent test / development programmers should make breakthroughs and never forget their original intentions, so that they can always

2022 IAA industry category development insight series report - phase II

Actual combat of MySQL database design project of online mall system

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

Talk about 15 tips of SQL optimization

基础乐理--配置和弦

Alibaba cloud technology expert haochendong: cloud observability - problem discovery and positioning practice

基础乐理之音程的度数

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

“未来杯”第二届知识图谱锦标赛正式启动
随机推荐
FPGA based 1080p 60Hz bt1120 interface debugging process record
【919. 完全二叉树插入器】
Yyds dry inventory interview must brush top101: reverse linked list
Ping command details [easy to understand]
Gan, why ".Length! == 3??
接口自动化测试平台FasterRunner系列(四)- 持续集成、解决多域名
【iniparser】项目配置工具iniparser的简单使用
A free image download warehouse website
With 8 years of product experience, I have summarized these practical experience of continuous and efficient research and development
How to prohibit the use of 360 browser (how to disable the built-in browser)
GDB help
[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
JMeter performance test actual video (what are the common performance test tools)
There are several browser cores. How to upgrade if the browser version is too low
阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
Fearless of high temperature and rainstorm, how can Youfu network protect you from worry?
Analysis of the internet jam in IM development? Network disconnection?
PHP等于==和恒等于===的区别
The difference between PHP equal to = = and identity equal to = = =
弱网测试工具-QNET