当前位置:网站首页>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")
边栏推荐
- The understanding of domain adaptation in transfer learning and the introduction of three technologies
- 基于FPGA的1080P 60Hz BT1120接口调试过程记录
- 聊聊接口性能优化的11个小技巧
- Interface automation test platform fasterrunner series (IV) - continuous integration and solution of multi domain names
- 【iniparser】项目配置工具iniparser的简单使用
- App test point (mind map)
- Baklib: make excellent product instruction manual
- 【加密周报】加密市场有所回温?寒冬仍未解冻!盘点上周加密市场发生的重大事件!
- Analysis of the internet jam in IM development? Network disconnection?
- 华为交换机系统软件升级和安全漏洞修复教程
猜你喜欢

Huawei switch system software upgrade and security vulnerability repair tutorial

A brief history from object detection to image segmentation

Korean AI team plagiarizes shock academia! One tutor with 51 students, or plagiarism recidivist

Basic music theory -- configuring chords

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

How to create an effective help document?

The degree of interval of basic music theory

基础乐理--配置和弦

聊聊接口性能优化的11个小技巧

SQL Server 2019 installation tutorial
随机推荐
Alibaba cloud technology expert Qin long: reliability assurance is a must - how to carry out chaos engineering on the cloud?
JMeter performance test actual video (what are the common performance test tools)
Basic mode of music theory
【Web技术】1391- 页面可视化搭建工具前生今世
Actual combat of MySQL database design project of online mall system
Baklib:制作优秀的产品说明手册
Pyqt5 click qtableview vertical header to get row data and click cell to get row data
With 8 years of product experience, I have summarized these practical experience of continuous and efficient research and development
MySQL sub query (selected 20 sub query exercises)
Pymoo learning (5): convergence analysis
[applet development] detailed explanation of host environment
SQL 实现 Excel 的10个常用功能,附面试原题
CRM configuration item command notes
Go code checking tool
The understanding of domain adaptation in transfer learning and the introduction of three technologies
“未来杯”第二届知识图谱锦标赛正式启动
阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
2022 IAA industry category development insight series report - phase II
无惧高温暴雨,有孚网络如何保您无忧?
Common development software download addresses