以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  下载进度显示  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=119383)

--  作者:yifan3429
--  发布时间:2018/5/23 21:48:00
--  下载进度显示

StatusBar.Message1= "正在下载"
StatusBar.ProgressBar.Visible =
true
StatusBar.ProgressBar.Value =
50
StatusBar.Message2=
"50%"



End If

Next


[此贴子已经被作者于2018/5/24 10:47:53编辑过]

--  作者:有点甜
--  发布时间:2018/5/23 22:10:00
--  

循环之前

 

StatusBar.Message1= "正在下载"
StatusBar.ProgressBar.Visible =True
StatusBar.ProgressBar.Maximum = ja.Count
StatusBar.ProgressBar.Minimum = 0

 

循环中,赋值,如

 

StatusBar.ProgressBar.value = i+1

Application.DoEvents

[此贴子已经被作者于2018/5/23 22:10:08编辑过]

--  作者:yifan3429
--  发布时间:2018/5/23 22:15:00
--  

 Dim dr As DataRow

    dr = DataTables("木作报价申请").SQLFind("审批编号= \'" & ja(i)("sp_num").ToString() & "\'")


     如果已经全部下载提示  已经是最新数据  这个提示怎么做呢


    If dr Is Nothing Then

        If  ja(i)("spname").ToString() ="木作报价申请" Then

            Dim r As Row =Tables("木作报价申请").AddNew()


--  作者:yifan3429
--  发布时间:2018/5/23 22:19:00
--  

图片点击可在新窗口打开查看

[此贴子已经被作者于2018/5/23 22:23:05编辑过]

--  作者:有点甜
--  发布时间:2018/5/23 22:23:00
--  

单独判断,如

 

Dim bhs As String = "\'\',"
For i As Integer = 0 To ja.Count - 1
    bhs &= "\'" & ja(i)("sp_num").ToString() & "\',"
Next

Dim fdr = DataTables("木作报价申请").SQLFind("审批编号 in (" & bhs.trim(",") & ")")
If fdr Is Nothing Then
    msgbox("全部编号都有了")
End If

 


--  作者:yifan3429
--  发布时间:2018/5/23 22:31:00
--  
怎么结合呢  变量前后出错
--  作者:有点甜
--  发布时间:2018/5/23 22:41:00
--  

5楼的代码写在 Dim ja As JArray = Jarray.Parse(json) 后面


--  作者:yifan3429
--  发布时间:2018/5/23 22:53:00
--  
貌似达不到理想的效果



StatusBar.Message1= "正在从服务器下载数据请稍后:"
StatusBar.ProgressBar.Visible =True
Dim st As New Date(1970,1,1,8,0,0)
Dim t1 As Integer = CInt((Date.Today.AddDays(-30)  - st).TotalSeconds()) \'时间戳
Dim t2 As Integer = CInt((Date.Now - st).TotalSeconds()) \'时间戳

Di
        End If
    End If
Next
StatusBar.Reset()
[此贴子已经被作者于2018/5/24 10:48:17编辑过]

--  作者:有点甜
--  发布时间:2018/5/23 23:05:00
--  

StatusBar.Message1= "正在从服务器下载数据请稍后:"
StatusBar.ProgressBar.Visible =True
Dim st As New Date(1970,1,1,8,0,0)
Dim t1 As Integer = CInt((Date.Today.AddDays(-30)  - st).TotalSeconds()) \'时间戳
Dim t2 As Integer = CInt((Date.Now - st).TotalSeconds()) \'时间戳


Dim ur As String = "https://qyapi.weixin.qq.com/cgi-bin/corp/getapprovaldata?access_token={0}"
Dim hc As new HttpClient(Cexp(ur,Functions.Execute("GetQYAccessToken2")))
Dim jo As New JObject
jo("starttime") = t1 \'\' "1492617600"
jo("endtime") = t2 \'\'"1539392688"
hc.Content = jo.Tostring()
jo = JObject.Parse(hc.GetData)

Dim json As String = jo("data").ToString()
Dim ja As JArray = Jarray.Parse(json)
StatusBar.ProgressBar.Maximum = ja.Count + 30
StatusBar.ProgressBar.Minimum = 30
Dim bhs As String = "\'\',"
For i As Integer = 0 To ja.Count - 1
    bhs &= "\'" & ja(i)("sp_num").ToString() & "\',"
Next
Dim fdr = DataTables("报价申请").SQLFind("审批编号 in (" & bhs.trim(",") & ")")
If fdr Is Nothing Then
    msgbox("全部编号都有了")
End If
For i As Integer = 0 To ja.Count - 1
    StatusBar.ProgressBar.value += 1
    Dim dr As DataRow
    dr = DataTables("报价申请").SQLFind("审批编号= \'" & ja(i)("sp_num").ToString() & "\'")
    If dr Is Nothing Then
        If  ja(i)("spname").ToString() ="木作报价申请" Then
            Dim r As Row =Tables("报价申请").AddNew()
            r("单据类型") =ja(i)("spname").ToString()
            r("审批状态") = ja(i)("sp_status").ToString()
            r("审批人") = ja(i)("approval_name").ToString().Replace("""","").Replace("[","").Replace("]","")
            r("抄送人") = ja(i)("notify_name").ToString().Replace("""","").Replace("[","").Replace("]","")
           
            r("审批编号") = ja(i)("sp_num").ToString()
            r("申请部门")  = ja(i)("apply_org").ToString() \'申请部门
            r("申请人") = ja(i)("apply_name").ToString()  \'申请人
            \'r("单元房号") = ja(i)("单元房号").ToString()
            \'r("客户电话") = ja(i)("客户电话").ToString()
           
           
           
            \'  r("sh") = 1
            Dim d = st.AddSeconds(ja(i)("apply_time").ToString())
            r("申请时间") = d  \'\'\'\'\'ja(i)("apply_time").ToString() 时间戳 申请时间
            Dim jsona As String = ja(i)("comm")("apply_data").ToString()
            Dim joa As JObject = JObject.Parse(jsona)
            For Each it As object In joa
                If it.value("value") IsNot Nothing  Then
                   
                    \'r(it.value("title").ToString()) =  CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    \'MessageBox.Show(CompressJSon(it.value("value")).Trim("[","]").Replace("""",""))
                    If it.value("title").ToString() = "客户名称" Then
                        r("客户名称") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="客户电话" Then
                        r("客户电话") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="楼盘" Then
                        r("楼盘") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="单元房号" Then
                        r("单元房号") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                       
                    ElseIf  it.value("title").ToString() ="推荐系列" Then
                        r("推荐系列") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="预算金额" Then
                        r("预算价格") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="漆面要求" Then
                        r("漆面要求") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="基材要求" Then
                        r("基材要求") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="已收资料" Then
                        r("已收资料") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="客户来源" Then
                        r("客户来源") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    ElseIf  it.value("title").ToString() ="计划时间" Then
                        r("计划时间") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                        \'ElseIf  it.value("title").ToString() ="基材要求" Then
                        \'r("基材要求") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                        \'ElseIf  it.value("title").ToString() ="计划时间" Then
                        \'If CompressJSon(it.value("value")).Trim("[","]").Replace("""","") IsNot Nothing Then
                        \'r("计划时间") = Format(st.AddSeconds( CompressJSon(it.value("value")).Trim("[","]").Replace("""","")/1000 ),"yyyyMMddhhmmss")
                        \'End If
                        \'    ElseIf  it.value("title").ToString() ="出车用途" Then
                        \'   r("ccyt") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                        \'  ElseIf  it.value("title").ToString() ="接送方式" Then
                        \'   r("jsfs") = CompressJSon(it.value("value")).Trim("[","]").Replace("""","")
                    End If
                   
                    Application.DoEvents
                End If
            Next
            \'\'\'
            r.save
        End If
    End If
Next
StatusBar.Reset()