Commit 283ac935 authored by liyuanhong's avatar liyuanhong

添加怠速市场过长解除报警功能

parent 8d9e57c3
......@@ -152,6 +152,7 @@
<label style="padding: 0px 10px;"><input type="checkbox" id="overSpeed_check" onclick="eventSelect(this)" checked />超速报警 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="tiredDriving_check" onclick="eventSelect(this)" checked />疲劳驾驶 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="idlingOverTime_check" onclick="eventSelect(this)" checked />怠速过长 </label>
<label style="padding: 0px 10px;"><input type="checkbox" id="idlingOverTimeOver_check" onclick="eventSelect(this)" checked />怠速过长(解除) </label>
</div>
<div style="padding:10px;">
<span id="insertAlarm_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendInsertAlarmEvent(this)">终端插入报警</button></label></span>
......@@ -169,7 +170,8 @@
<span id="surplusOil_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendSurplusOilAlarmEvent(this)">剩余油量异常</button></label></span>
<span id="overSpeed_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendOverSpeedEvent(this)">超速报警</button></label></span>
<span id="tiredDriving_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendTiredDrivingAlarmEvent(this)">疲劳驾驶</button></label></span>
<span id="idlingOverTime_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendIdlingOverTimeEvent(this)">怠速过长</button></label></span>
<span id="idlingOverTime_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendIdlingOverTimeEvent(this)" title="300秒,300毫升">怠速过长</button></label></span>
<span id="idlingOverTimeOver_button" style="display:inline;"><button type="button" class="btn btn-primary" onclick="sendIdlingOverTimeOverEvent(this)" title="500秒,500毫升">怠速过长(解除)</button></label></span>
</div>
</div>
</div>
......@@ -767,6 +769,8 @@ function eventSelect(e){
$("#tiredDriving_button").css("display","inline")
}else if($(e).attr("id") == "idlingOverTime_check"){
$("#idlingOverTime_button").css("display","inline")
}else if($(e).attr("id") == "idlingOverTimeOver_check"){
$("#idlingOverTimeOver_button").css("display","inline")
}
}else{
if($(e).attr("id") == "insertAlarm_check"){
......@@ -801,6 +805,8 @@ function eventSelect(e){
$("#tiredDriving_button").css("display","none")
}else if($(e).attr("id") == "idlingOverTime_check"){
$("#idlingOverTime_button").css("display","none")
}else if($(e).attr("id") == "idlingOverTimeOver_check"){
$("#idlingOverTimeOver_button").css("display","none")
}
}
}
......@@ -900,6 +906,12 @@ function sendIdlingOverTimeEvent(){
url = "/protocolTools/M_carSimulater_process/sendIdlingOverTimeEvent";
sendjson(data,url);
}
//怠速过长报警(解除)
function sendIdlingOverTimeOverEvent(){
var data = getPageData()
url = "/protocolTools/M_carSimulater_process/sendIdlingOverTimeOverEvent";
sendjson(data,url);
}
// -------------------------------- 实时控制js代码-------------------------------------------
//设置隐藏或显示实时控制区域
......
......@@ -1179,7 +1179,7 @@ def sendIdlingOverTimeEvent():
"totalTime": "2020002", "GPSTimestamp": "1588229973"},
"securityData": {"securityStatus": 107, "doorStatus": 0, "lockStatus": 0, "windowStatus": 0,
"lightStatus": 0, "onoffStatusA": 0, "onoffStatusB": 112, "dataByte": 249}, "event": {
"0032": {"alarmType": "1", "durationTime": "1100","oilExpend":"300"}}}
"0032": {"alarmType": "1", "durationTime": "300","oilExpend":"300"}}}
jdata["DEV_ID"] = params["carId"]
obj = EventReport_protocol(data=jdata)
gpsData = service.genGPSData2()
......@@ -1197,6 +1197,53 @@ def sendIdlingOverTimeEvent():
data["message"] = "Error: 发送怠速时间过长告警事件失败!"
return Response(json.dumps(data), mimetype='application/json')
##########################################
# 【接口类型】发送怠速时间过长报警事件(解除报警)
##########################################
@M_carSimulater_process.route("/sendIdlingOverTimeOverEvent",methods=['POST'])
def sendIdlingOverTimeOverEvent():
params = request.get_data()
params = json.loads(params.decode("utf-8"))
sessionId = params["session"]["sessionId"]
data = {}
if not sessionId in connects.keys():
data["status"] = "4003"
data["message"] = "Error: 未启动服务,不可发送怠速解除告警事件!"
return Response(json.dumps(data), mimetype='application/json')
service = connects[sessionId]["service"]
travelStatus = service.getTravelStatus() #获取汽车行驶状态
if travelStatus == 0 or travelStatus == 2:
data["status"] = "4003"
data["message"] = "Error: 汽车还未行驶,不可发送怠速解除告警事件!"
elif travelStatus == 1:
try:
jdata = {"WATER_CODE": "0003", "DEV_ID": "M121501010001",
"gpsInfo": {"UTCTime": "2020-04-30 14:59:33", "latitude": "40.22077", "longitude": "116.23128",
"speed": "80.8", "directionAngle": "80.8", "elevation": "2999.9", "positionStar": "3",
"Pdop": "0.3", "Hdop": "0.4", "Vdop": "0.5", "statusBit": 162, "valtage": "36.9",
"OBDSpeed": "60.9", "engineSpeed": "3000", "GPSTotalMileage": "12800", "totalOil": "100000",
"totalTime": "2020002", "GPSTimestamp": "1588229973"},
"securityData": {"securityStatus": 107, "doorStatus": 0, "lockStatus": 0, "windowStatus": 0,
"lightStatus": 0, "onoffStatusA": 0, "onoffStatusB": 112, "dataByte": 249}, "event": {
"0032": {"alarmType": "0", "durationTime": "500","oilExpend":"500"}}}
jdata["DEV_ID"] = params["carId"]
obj = EventReport_protocol(data=jdata)
gpsData = service.genGPSData2()
obj.setGPSPkg(gpsData)
obj.setEventType("0032")
msg = obj.generateEventMsg()
service.serviceSendMsg(msg, "怠速解除告警事件")
service.setSn(service.getSn() + 1)
data["status"] = "200"
data["message"] = "发送怠速解除告警事件成功!"
except BaseException as e:
# 打印异常信息
traceback.print_exc()
data["status"] = "4003"
data["message"] = "Error: 发送怠速解除告警事件失败!"
return Response(json.dumps(data), mimetype='application/json')
#--------------------------------------- 实时控制逻辑 ---------------------------------------
##########################################
# 【接口类型】改变车速
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment