当前位置:网站首页>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")
边栏推荐
- [applet development] do you know about applet development?
- Real estate enterprises have launched a "war of guarantee"
- Software testing process (mind map)
- Cross Site Request Forgery in PHP
- srec_cat 常用参数的使用
- Interface automation test platform fasterrunner series (IV) - continuous integration and solution of multi domain names
- In the first half of the year, the shipment volume has exceeded that of the whole year of last year, and centritec millimeter wave radar has "captured" the international giant
- Interface automation test platform fasterrunner series (I) - introduction, installation and deployment, startup service, access address, configuration supplement
- 这种动态规划你见过吗——状态机动态规划之股票问题(上)
- ThreadLocal Kills 11 consecutive questions
猜你喜欢

Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?

The understanding of domain adaptation in transfer learning and the introduction of three technologies

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

小程序毕设作品之微信校园维修报修小程序毕业设计成品(3)后台功能

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

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

聊聊sql优化的15个小技巧

常用的开发软件下载地址

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

Share six practical applet plug-ins
随机推荐
Basic mode of music theory
Typescript object proxy use
Deng Qinglin, a technical expert of Alibaba cloud: Best Practices for disaster recovery and remote multi activity across availability zones on cloud
In the first half of the year, the shipment volume has exceeded that of the whole year of last year, and centritec millimeter wave radar has "captured" the international giant
Is Cinda securities a state-owned enterprise? Is it safe to open an account in Cinda securities?
Based on easycv to reproduce Detr and dab-detr, the correct opening method of object query
鸿蒙-大喵计算画板-视频
[open source project] stm32c8t6 + ADC signal acquisition + OLED waveform display
ThreadLocal Kills 11 consecutive questions
qt exec和show的区别
Yarn installation and use tutorial [easy to understand]
How to design product help center? The following points cannot be ignored
JMeter performance test actual video (what are the common performance test tools)
Share six practical applet plug-ins
2022 IAA industry category development insight series report - phase II
HTTP cache tongtianpian, there may be something you want
GDB help
Cross Site Request Forgery in PHP
srec_cat 常用参数的使用
接口自动化测试平台FasterRunner系列(二)- 功能模块