当前位置:网站首页>InTouch advanced alarm (alarm filtering)
InTouch advanced alarm (alarm filtering)
2022-07-25 19:09:00 【Kawaii big meow】
Alarm storage SqlServer
open Alarm DB Logger Manager Software

Click the start button , Give Way intouch Store the alarm record SqlServer Inside

SqlServer Turn on Sql Sign in

SqlServer Create a new user

Turn on all authorizations 
Turn on remote login 
Check the database port number , It's usually 1433 Port number 
If it's remote , The firewall opening port number is required
SqlServer Remote login test
Use software

make new connection sqlserver The server

open sqlserver All alarm data can be seen in the database view

Front end page writing

The backend server is written
import pymssql
import base64
from flask import request, Flask, jsonify
app = Flask(__name__)
## link sqlserver
db = pymssql.connect(host='127.0.0.1',user='TEST',password='[email protected]',database='WWALMDB',charset='utf8')
cursor = db.cursor()
db.autocommit(True)
## Get all alarm information ( Paging query )
@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 = "% level %"
elif searchType == 3:
sqlLike = "% electric current %"
elif searchType == 4:
sqlLike = "% voltage %"
elif searchType == 5:
sqlLike = "%1# pump %"
elif searchType == 6:
sqlLike = "%2# pump %"
elif searchType == 7:
sqlLike = "% Fan %"
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}
## The query time ( Paging query )
@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(" Service startup failed , port :8066")
边栏推荐
- Pymoo学习 (5):收敛性分析
- 【Web技术】1391- 页面可视化搭建工具前生今世
- [encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
- APP测试点(思维导图)
- ES6 implements the observer mode through proxy and reflection
- Pymoo学习 (8):Gradients
- [applet development] detailed explanation of host environment
- JMeter performance test actual video (what are the common performance test tools)
- Software testing (mind mapping)
- 基于FPGA的1080P 60Hz BT1120接口调试过程记录
猜你喜欢

乐理基础 调式

阿里云技术专家秦隆:可靠性保障必备——云上如何进行混沌工程?

MySQL sub query (selected 20 sub query exercises)

小程序毕设作品之微信校园维修报修小程序毕业设计成品(8)毕业设计论文模板

JS basic type reference type deep / shallow clone copy

MES管理系统有什么应用价值

Full scale and Xuan of C key

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

C 调的满级和玄

Alibaba cloud free SSL certificate application detailed process
随机推荐
聊聊接口性能优化的11个小技巧
7/24 training log
SQL 实现 Excel 的10个常用功能,附面试原题
GDB help
Interface automation test platform fasterrunner series (I) - introduction, installation and deployment, startup service, access address, configuration supplement
[encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
无惧高温暴雨,有孚网络如何保您无忧?
基于FPGA的1080P 60Hz BT1120接口调试过程记录
Microsoft azure and Analysys jointly released the report "Enterprise Cloud native platform driven digital transformation"
李宏毅《机器学习》丨1. Introduction of this course(机器学习介绍)
[web technology] 1391 page visualization building tool, previous life and present life
MySQL sub query (selected 20 sub query exercises)
i3-status 配置
Introduction of this course (Introduction to machine learning)
How to change the chords after the tune of the song is changed
Pymoo学习 (6):终止条件
MES管理系统有什么应用价值
Pymoo学习 (5):收敛性分析
Cross Site Request Forgery in PHP
Pyqt5 click qtableview vertical header to get row data and click cell to get row data