【调度系统】广东民航医疗快线调度系统源代码
wzp
2025-05-14 a023d5daed320eb4dbf6cfb8c28529d41cf5f9c3
1
2
3
4
5
6
7
8
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
40
41
42
43
44
45
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Setting</title>
    <link href="../../../bootstrap/css/button.css" type="text/css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../../css/labelIcon.css"/>
    <script  type="text/javascript"  src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../../js/public.js"></script>
    <script type="text/javascript">
    $(function(){
        $("#userSettingBtn").click(function(){
            setting();
        });    
    });
    
 
    var isSetting = false;
 
    /**
     * setting
     **/  
    function setting(){
        if (isSetting) {
            alert("setting please wait");
            return ;
        } 
        
        //1、参数配置的html文件放在cmsserver服务器的web服务器的目录下     示例  C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\10\setting.html 
        //        C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\  为固定的目录  表示设备参数配置的目录
        //      10  表示厂家类型,不同厂家类型        TTXNET_SetDeviceInfo(4, 1, "SZ88888", TTX_DISK_TYPE_HDD, TTX_FACTORY_TYPE_18, TTX_FACTORY_TYPE_18, "V2014 0414");
        //        如果 TTXNET_SetDeviceInfo接口传的参数为  TTX_FACTORY_TYPE_18为厂家类型,则为 C:\Program Files (x86)\CMSServerV6\tomcat\webapps\gpsweb\808gps\deviceSetting\18\
        //        setting.html  页面必须配置为  setting.html
        //      手机客户端会根据这个规则去调用不同厂家设备的参数配置界面
        
        //2、会话信息和设备信息,通过url参数获取
        //        jsession和devIdno_会通过url传参进来,如setting.html?DevIDNO=10101&jsession=12341234678
        //        需要将jsession和devIdno_再传给服务器
        var jsession = getUrlParameter("jsession");
        var devIdno_ = getUrlParameter("DevIDNO");
        
        //3、参数配置设备sdk对应接口    
        //        virtual bool DoTransparentConfig(int nType, const LPTTXConfigData_S pInConfig, LPTTXConfigData_S pOutConfig);
        
        //4、界面请求参数传递
        //        type和param参数为上层自定义,param要求必须为json格式的数据,必须为 {}格式的,不能为数组格式[]    示例  var param = {};为对象格式,  var param = []; 为数组格式
        var type = 1;        //与设备DoTransparentConfig的int nType匹配上,这边配置为1,则sdk调用接口时nType=1
        var param = {};        //param 与 pInConfig 匹配上,格式为json格式
        param.request = $('.request').val();    
        //        示例: param.request = "1234567" 则pInConfig->cBuffer值为   {"request":"1234567"}
        //        param.name = "test"; param.value = "12345";   则pInConfig->cBuffer值为   {"name":"test","value":"12345"}
        
        //5、设备回复参数    
        //        设备上回复的数据通过  pOutConfig 返回,格式要求必须为json格式,示例:  {"response":"123456"}        //第一个字符必须为  {  最后 一个字符必须为 }
        //        测试时,建议在设备的DoTransparentConfig接口内直接返回web界面的请求参数,如下示例
        //        memcpy(pOutConfig->cBuffer, pInConfig->cBuffer, pInConfig->nLength);
        //        pOutConfig->nLength = pInConfig->nLength;
        
        //6、服务器回复参数        示例:{"cmsserver":"1","result":"0","request":"1234567"}
        //        "result":"0"  表示执行的结束,此参数一定返回
        //        "cmsserver":"1",  表示是否为c++服务器返回,如果存在并且为1,则为c++服务器返回的,此参数不一定会返回
        //        "request":"1234567"  为设备返回的参数
        //        相当于服务器会在设备回复的参数基础上增加  "result":"0" 和  "cmsserver":"1  "参数
        
        isSetting = true;
        //url: 'http://'+ ip_ +':' + port_+'/2/46/callback=getData?Type=1&jsession=' + jsession + '&DevIDNO=' + devIdno_,
        $.ajax({type: 'post',
            url: 'StandardApiAction_deviceSetting.action?Type=' + type + '&jsession=' + jsession + '&DevIDNO=' + devIdno_,
            data: {json:JSON.stringify(param)},
            cache: false,
            dataType:"json",
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("setting error");
                isSetting = false;
            },
            complete: function(XMLHttpRequest, textStatus) {
                //alert("setting complete");
                isSetting = false; 
            },
            success: function (data) {
                isSetting = false;
                if(data.result == 0){
                    $('.response').val(data.request);
                    alert("setting success");
                } else {
                    if (typeof data.cmsserver != "undefined") {
                        //  result  3参数错误
                        //  result  21表示设备不存在
                        //  result  22表示设备不在线
                        //  result  23表示设备无响应
                    } else {
                        //  result 1表示出现异常
                        //  result 7 表示参数错误
                    }
                    
                    alert("setting failed! result:" + data.result);
                }
            }
        });    
    }
</script>
</head>
<body>
    <div id="operateExample" style="position:absolute;width: 800px;">
    
        <!--  设置开始 -->
        <div class="userLogin">
            <p id="getJsessionTitle">Setting</p>
            <div class="player-params">
                <table class="player-params" style="text-align: right;">
                    <tr>
                        <td>
                            <a class="title" id="requestTitle">Request:</a>
                        </td>
                        <td>
                            <input style="width: 150px;" class="request" value="1234567">
                        </td>
                        <td>
                            <a class="title" id="responseTitle">Response:</a>
                        </td>
                        <td>
                            <input style="width: 150px;" class="response" value="">
                        </td>
                    </tr>
                </table>
                <div class="player-param">
                    <a id="userSettingBtn" class="button button-primary button-rounded button-small" >Setting</a>
                </div>
            </div>
        </div>
        
    </div>
  </body>
</html>