dataUpstreamTransport_msg_f2_page.html 7.11 KB
Newer Older
1 2 3 4 5 6 7
{% extends "messageTools/message/heartBeat_msg_page.html" %}
{% block title %}dataUpstreamTransport_msg{% endblock %}
{% block content_1 %}
<div id="container3" style="width:100%;min-height:750px;float:left;_background:green;margin-top:10px;_border-top: 1px solid #eee;">
    <div style="width:100%;_background:green;padding:5px;padding-top:0px;">
        <h3 style="border-bottom: 1px solid #eee;">设置消息头:</h3>
        <label>消息ID:</label><input id="msgID" type="text" class="form-control" disabled="disabled" value="0900" style="width:80px;">
8
        <label>车机号:</label><input id="phoneNum" type="text" class="form-control" value="13146201119" style="width:150px;">
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
        <label>消息流水号:</label><input id="msgWaterCode" type="text" class="form-control" value="1" style="width:60px;">
        <label>是否加密:</label><select style="width:100px;" id="encryptionType" class="form-control">
            <option value="0">不加密</option>
            <option value="1024">加密</option>
        </select>
        <label>有无分包:</label><select style="width:80px;" id="subPkg" class="form-control" onchange="hasSubPkg()">
            <option value="0"></option>
            <option value="8192"></option>
        </select>
        <label id="subPkg_label" style="color:grey;">分包个数:</label><input disabled="disabled" id="pkgCounts" type="text" class="form-control" value="0" style="width:60px;">
    </div>
    <H3 style="border-bottom: 1px solid #eee;">数据上行透传消息内容:</H3>
    <div style="width:100%;margin-bottom:10px;">
        <label>选择数据类型:</label><select style="width:300px;" id="msgType" class="form-control" onchange="changeMsgType()">
            <option value="F1">驾驶行程数据 (熄火发送)</option>
            <option value="F2" selected="selected">故障码数据 (状态改变发送)</option>
            <option value="F3">休眠进入 (进入休眠模式发送)</option>
            <option value="F4">休眠唤醒 (退出休眠模式发送)</option>
        </select>
    </div>
    <ul class="protocol_content" style="padding:0px;">
        <li><label>时间:</label><input id="infoTime" type="text" class="form-control"></li>
        <li style="width:340px;"><label>维度:</label><input id="latitude" type="text" class="form-control" value="29.40268"><select style="width:80px;" id="latitudeType" class="form-control">
            <option value="0">北纬</option>
            <option value="1">南纬</option>
        </select></li>
        <li style="width:340px;"><label>经度:</label><input id="longitude" type="text" class="form-control" value="106.54041"><select style="width:80px;" id="longitudeType" class="form-control">
            <option value="0">东经</option>
            <option value="1">西经</option>
        </select></li>
        <li><label>故障码个数:</label><input id="troubleCodeNums" type="text" class="form-control" value="3"></li>
40 41 42 43 44 45
        <li><label>故障码类型:</label><select id="systemId" class="form-control">
            <option value="00">发动机故障码</option>
            <option value="01">变速箱故障码</option>
            <option value="02">ABS 故障码</option>
            <option value="03">安全气囊故障码</option>
        </select></li>
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
    </ul>
    <H3 style="border-bottom: 1px solid #eee;">控制:</H3>
    <div style="width:100%;padding:5px;margin-top:10px;">
        <button type="button" class="btn btn-primary" id="sendMsgBtn">发送消息</button>
    </div>
    <H3 style="border-bottom: 1px solid #eee;">返回信息:</H3>
    <div style="width:100%;padding:5px;margin-top:10px;">
        <textarea id="showFeedback" style="width:100%;padding:5px;" rows="8"></textarea>
    </div>
</div>

<script>
//发送GPS数据
$("#sendMsgBtn").click(function(){
    var msgID = $("#msgID").val();
    var phoneNum = $("#phoneNum").val();
    var msgWaterCode = $("#msgWaterCode").val();
    var encryptionType = $("#encryptionType").val();
    var subPkg = $("#subPkg").val();
    var pkgCounts = ""
    if (subPkg != "8192"){
        pkgCounts = "0"
    }else{
        pkgCounts = $("#pkgCounts").val();
    }

    var msgType = $("#msgType").val();
    var infoTime = $("#infoTime").val();
    var latitude = $("#latitude").val();
    var latitudeType = $("#latitudeType").val();
    if(latitudeType == "1"){
        latitude = parseFloat(latitude) + 2147483648 / 1000000
    }
    var longitude = $("#longitude").val();
    var longitudeType = $("#longitudeType").val();
    if(longitudeType == "1"){
        longitude = parseFloat(longitude) + 2147483648 / 1000000
    }
    var troubleCodeNums = $("#troubleCodeNums").val();
85
    var systemId = $("#systemId").val();
86 87 88 89 90 91 92 93 94 95 96 97 98 99

    var data = {};
    data["msgID"] = msgID;
    data["phoneNum"] = phoneNum;
    data["msgWaterCode"] = msgWaterCode;
    data["encryptionType"] = encryptionType;
    data["subPkg"] = subPkg;
    data["pkgCounts"] = pkgCounts;

    data["msgType"] = msgType;
    data["infoTime"] = infoTime;
    data["latitude"] = latitude;
    data["longitude"] = longitude;
    data["troubleCodeNums"] = troubleCodeNums;
100
    data["systemId"] = systemId;
101 102

    var host = window.location.host;
103
    $("#showFeedback").val("")
104 105 106 107 108 109 110 111 112 113
    $.ajax({
        url:"http://" + host + "/messageTools/message_process/porcessDataUpstreamTransportMsg_F2",
        type:"post",
        data:data,
        dataType:"json",
        success:function(data){
            if(data.status == 200){
                //window.location.reload()
                var theShow = "原始数据: " + data.original + "\n";
                theShow = theShow + "收到数据: " + data.result + "\n";
114
                theShow = theShow + "收到数据16进制: " + data.resultH + "\n";
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
                theShow = theShow + "解析数据: " + JSON.stringify(data.parse) + "\n";
                $("#showFeedback").val(theShow)
            }else{
                $("#showFeedback").val(data.message)
                alert(data.message);
            }
        }
    });
});

function hasSubPkg(){
    value = $("#subPkg").val()
    if(value == "8192"){
        $("#subPkg_label").css("color","black")
        $("#pkgCounts").removeAttr("disabled")
    }else{
        $("#subPkg_label").css("color","grey")
        $("#pkgCounts").attr("disabled","disabled")
    }
}

function changeMsgType(){
    var value = $("#msgType").val()
    if(value == "F1"){
        $(location).attr('href', "http://" + window.location.host + "/messageTools/message_view/dataUpstreamTransport_msg_page");
    }else if(value == "F2"){
        $(location).attr('href', "http://" + window.location.host + "/messageTools/message_view/dataUpstreamTransport_msg_f2_page");
    }else if(value == "F3"){
        $(location).attr('href', "http://" + window.location.host + "/messageTools/message_view/dataUpstreamTransport_msg_f3_page");
    }else if(value == "F4"){
        $(location).attr('href', "http://" + window.location.host + "/messageTools/message_view/dataUpstreamTransport_msg_f4_page");
    }
}

//设置当前时间到时间输入框
(function(){
    var curTime = getCurTime();
    $("#infoTime").val(curTime);
})();
</script>
{% endblock %}