【调度系统】广东民航医疗快线调度系统源代码
wanglizhong
2025-04-22 72c0df785d4838d35dc694071c61e3f9a54e7e81
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
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Session.CodePage=65001%>  
<% Response.charset = "utf-8" %>
<!--#include virtual="/inc/odbc.asp"-->
<!--#include file="JsonPost.gds"-->
<%
GPSDate=Request("GPSDate")
OldData=0
Set rs = Server.CreateObject("ADODB.Recordset")
If GPSDate="" Then
    GPSDate=Date()
    sql="select count(id) from CarGPS_Milestat where GPS_datetime=convert(char(10),dateadd(dd,-1,getdate()),120)"
    rs.open Sql,objConn,1,1
    OldData=rs(0)
    rs.close()
Else
    GPSDate=CDate(GPSDate)+1
End If
If OldData<5 And OldData>0 Then
    sql="delete from CarGPS_Milestat where GPS_datetime='"&CDate(GPSDate)+1&"'"
    objConn.Execute sql
    OldData=0
End If
If OldData=0 And DatePart("h",now())>=6 And DatePart("h",now())<=22 Then
    '获取设备里程统计
    appUrl="http://api.gpsoo.net/1/tool/runstatus"
 
    args1="method=milestat&access_token="&access_token
    args1=args1&"&beginTime="&ToUnixTime(CDate(GPSDate)-1,8)&"&endTime="&ToUnixTime(CDate(GPSDate),8)-1        '自动上一天
    'args1=args1&"&beginTime="&ToUnixTime("2020-1-19 00:00:00",8)&"&endTime="&ToUnixTime("2020-1-19 23:59:59",8)    '手动日期
    'args1=args1&"&beginTime=1538323200&endTime=1538841599"                                    '手动时间
    args1=args1&"&timezone=8"        '用户所在时区(-12,+12)
 
    sql="select CarID,CarLicense,GPS_IMEI from CarData where GPS_IMEI<>''"
    rs.open Sql,objConn,1,1
    do while not rs.Eof
        args2=args1&"&imei="&rs("GPS_IMEI")
        'Response.Write args2&"<br><br>"
        HTMLCODE= GetBody(appUrl,args2)
        'Response.Write HTMLCODE &"<br>"
    'Response.end
        json    = HTMLCODE
 
        str=json
        str=right(str,len(str)-instr(str,"{")+1)
        str=left(str,InstrRev(str,"}"))
        dim obj
        set obj = getjson(str)
        str0=""
        ret        = obj.ret        '是否返回成功
        If ret=0 then
            for i=0 to obj.data.length-1
                data        = obj.data.get(i)
                If data<>"" Then
                    GPSData        = split(data,",")
                    If ubound(GPSData)=5 then
                        GPS_imei    = GPSData(0)
                        GPS_datetime= GPSData(1)
                        GPS_milestat= GPSData(2)
                        GPS_outspeed= GPSData(3)
                        GPS_outspeedlimit= GPSData(4)
                        GPS_stop= GPSData(5)
                        sql="insert into CarGPS_Milestat (imei,GPS_datetime,GPS_milestat,GPS_outspeed,GPS_outspeedlimit,GPS_stop) values ('"&GPS_imei&"','"&GPS_datetime&"',"&GPS_milestat&","&GPS_outspeed&","&GPS_outspeedlimit&","&GPS_stop&")"
                        'Response.Write sql &"<br>"
                        objConn.Execute sql
                    End If
                End If
            Next
        End If
    rs.movenext
    Loop
    rs.close()
    Response.Write "OK"
    If Request("GPSDate")<>"" Then
        Response.Write "&nbsp;<a href=""?GPSDate="&CDate(GPSDate)&""">"&CDate(GPSDate)&"</a>"
    End If
    %>
    <script language="JScript" runat="Server"> 
    function toObject(json) { 
        eval("var o=" + json); 
        return o; 
    } 
    function toArray(s){
        var dic = Server.CreateObject("Scripting.Dictionary")
        eval("var a=" + json);
        for(var i=0;i<a.length;i++){
            var obj = Server.CreateObject("Scripting.Dictionary")
            for(x in a[i]) obj.Add(x,a[i][x])
            dic.Add(i, obj);
        }
        return dic
    }
    </script> 
 
    <script language="jscript" runat="server">
    Array.prototype.get = function(i)
    {
     return this[i]; 
    };
    function getjson(str){
     try{
      eval("var jsonStr = (" + str + ")");
     }catch(ex){
      var jsonStr = null;
     }
     return jsonStr;
    }
    </script>
<%Else
    'Response.Write "OK1"
End If%>