当前位置:网站首页>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")
边栏推荐
- 接口自动化测试平台FasterRunner系列(四)- 持续集成、解决多域名
- Ping command details [easy to understand]
- [encryption weekly] has the encryption market recovered? The cold winter has not thawed yet! Check the major events in the encryption market last week!
- Intouch高级报警(报警筛选)
- The difference between PHP equal to = = and identity equal to = = =
- 【小程序开发】你了解小程序开发吗?
- PyQt5单击QTableView垂直表头verticalHeader获取行数据以及单击单元格获取行数据操作
- Hough transform understanding [easy to understand]
- Typescript object proxy use
- MySQL sub query (selected 20 sub query exercises)
猜你喜欢

“未来杯”第二届知识图谱锦标赛正式启动

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

Baklib:制作优秀的产品说明手册

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

基于Mysql-Exporter监控Mysql

Basic mode of music theory
![[open source project] stm32c8t6 + ADC signal acquisition + OLED waveform display](/img/5f/413f1324a8346d7bc4a9490702eef4.png)
[open source project] stm32c8t6 + ADC signal acquisition + OLED waveform display

房企打响“保交战”

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

【阅读笔记】《深度学习》第一章:引言
随机推荐
[919. Complete binary tree inserter]
PyQt5单击QTableView垂直表头verticalHeader获取行数据以及单击单元格获取行数据操作
qt exec和show的区别
ThreadLocal Kills 11 consecutive questions
Youth, oh, youth
小程序毕设作品之微信校园维修报修小程序毕业设计成品(2)小程序功能
接口自动化测试平台FasterRunner系列(二)- 功能模块
A brief history from object detection to image segmentation
房企打响“保交战”
【919. 完全二叉树插入器】
Fearless of high temperature and rainstorm, how can Youfu network protect you from worry?
【加密周报】加密市场有所回温?寒冬仍未解冻!盘点上周加密市场发生的重大事件!
房地产行业大洗牌
How to create an effective help document?
600000 pieces of data are made from March 1 to March 31. Videodate requires starting time from 00:00 to 24:00 on March 1 to 31, which is only for notes
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
Weak network test tool -qnet
Baklib: make excellent product instruction manual
Go代码检查工具
[iniparser] simple use of the project configuration tool iniparser