以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  数据量大运行慢  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=115102)

--  作者:huangfanzi
--  发布时间:2018/3/1 9:05:00
--  
你这加载树是自己开发的吧,是不是代码上有问题,加载了所有行,只是分页显示部分行
--  作者:y2287958
--  发布时间:2018/3/1 9:05:00
--  
可以贴出代码的,看看能否优化
--  作者:有点甜
--  发布时间:2018/3/1 9:13:00
--  

你说的是打开窗口的时候慢?如果是,就是你生成目录树的方法不正确,请做个例子发上来说明。


--  作者:狐狸爸爸
--  发布时间:2018/3/1 10:04:00
--  
很可能只是表面上分页了,窗口打开时还是加载了所有数据,生成目录树之后才开始分页加载。
注意
1、SQLTable的初始Select 语句应该不要加载任何数据: Select * fr om {表名} Where [Identify] is null
2、目录树根据后台列生成:
http://www.foxtable.com/webhelp/scr/2692.htm

--  作者:有点甜
--  发布时间:2018/3/1 12:03:00
--  

加入msgbox,测试你上面哪段代码耗时

 

http://www.foxtable.com/webhelp/scr/2226.htm

 

尽量做个例子发上来测试,才能优化你的代码的


--  作者:有点甜
--  发布时间:2018/3/1 12:23:00
--  
以下是引用nuoyan88在2018/3/1 12:17:00的发言:
数据大了,发不出来,我能把给QQ客服吗?谢谢

 

你可以上传到【百度云】那里,然后把链接分享出来。


--  作者:有点甜
--  发布时间:2018/3/1 15:40:00
--  

1、代码改成这样,你按照需要删减你afterload事件的代码

 

If e.Form.Width> 0 AndAlso e.Form.height > 0 Then
    vars("width") = e.Form.width
    vars("height") = e.Form.height
End If
msgbox(1)
Dim cmd As new SQLCommand
cmd.ConnectionName = "条码扫描系统数据库"
cmd.CommandText = " Select year(开始日期) as 年, month(开始日期) as 月,成品描述,count(*) as 毛坯编码 from {工序跟踪表} group by year(开始日期), month(开始日期),成品描述"
Dim dt As DataTable = cmd.ExecuteReader

msgbox(2)
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "年|月|成品描述")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
    Dim Year As Integer = nd.DataRow("年")
    Dim Month As Integer = nd.DataRow("月")
    Dim Product As String = nd.DataRow("成品描述")
    Select Case nd.Level
        Case 0
            nd.Text = nd.text & "年("& dt.Compute("Sum(毛坯编码)","年 = " & Year) & "条)"
        Case 1
            nd.Text = nd.text & "月("& dt.Compute("Sum(毛坯编码)","年 = " & Year & " And 月 = " & Month) & "条)"
        Case 2
            nd.Text = nd.text & "("& nd.DataRow("毛坯编码") & ")"
    End Select
Next
trv.Nodes.Insert("加载所有行","加载所有行("& dt.Compute("Sum(毛坯编码)") & "条)", 0)
trv.ResumeRedraw
msgbox(3)
For Each dr As DataRow In DataTables("权限设置").Select("用户名 = \'" & _username & "\' And 窗口名 =  \'" & e.form.Name & "\'")
    Dim c = e.form.Controls(dr("按钮权限"))
    If typeof c Is winform.Table Then
        c.visible = Not dr("不可见")
        c.Table.allowEdit = Not dr("不可编辑")
    Else
        c.Visible = Not dr("不可见")
        c.Enabled = Not dr("不可编辑")
    End If
Next
msgbox(4)
With DataTables("生产报工查询_生产报工查询表")
    .LoadFilter = "" \'一定要清除加载条件
    .LoadTop = 50
    .LoadPage = 0
    .Load()
    e.Form.Controls("TextBox1").Value = 1 &"/" & .TotalPages
End With
msgbox(5)

 

2、这段代码比较耗时,建议你分别写到各个控件的enter事件。或者是做个按钮获取

 

Dim cmf As WinForm.ComboBox = e.form.Controls("加工工序1")
cmf.ComboList = DataTables("工序跟踪表").SQLGetComboListString("加工工序")
Dim cfm As WinForm.ComboBox = e.form.Controls("使用设备1")
cfm.ComboList = DataTables("工序跟踪表").SQLGetComboListString("使用设备")
Dim cma As WinForm.ComboBox = e.form.Controls("生产批次1")
cma.ComboList = DataTables("工序跟踪表").SQLGetComboListString("生产批次")
Dim cms As WinForm.ComboBox = e.form.Controls("姓名1")
cms.ComboList = DataTables("工序跟踪表").SQLGetComboListString("姓名")
Dim cmd As WinForm.ComboBox = e.form.Controls("班次1")
cmd.ComboList = DataTables("工序跟踪表").SQLGetComboListString("班次")
Dim cmv As WinForm.ComboBox = e.form.Controls("成品编码1")
cmv.ComboList = DataTables("工序跟踪表").SQLGetComboListString("成品编码")
Dim cmw As WinForm.ComboBox = e.form.Controls("毛坯编码1")
cmw.ComboList = DataTables("工序跟踪表").SQLGetComboListString("毛坯编码")
Dim cmg As WinForm.ComboBox = e.form.Controls("批次序号1")
cmg.ComboList = DataTables("工序跟踪表").SQLGetComboListString("批次序号")


--  作者:有点甜
--  发布时间:2018/3/2 8:43:00
--  
以下是引用nuoyan88在2018/3/2 8:35:00的发言:
老师,非常谢谢您!已作优化,这个项目其他地方代码还有问题吗?能请您帮忙看看吗?谢谢!

 

这个得靠自己优化了。或者你具体说明什么问题,别人才能处理。

 

论坛只提供问题的答疑,具体的代码、功能,需要自己去实现。


--  作者:有点甜
--  发布时间:2018/3/2 9:27:00
--  
以下是引用nuoyan88在2018/3/2 9:02:00的发言:
老师,咨询下如果我想把程序用网页的形式那个在帮助哪里呢?谢谢

 

直接部署,参考 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=23&ID=68898&skin=0

 

如果改成移动版,你需要把全部功能重新做一次的。


--  作者:有点甜
--  发布时间:2018/3/5 11:34:00
--  
以下是引用nuoyan88在2018/3/5 11:27:00的发言:
老师,这个系统我优化好的,发布之后登录打开好慢,IE属性那里我设置了,已取消打勾,可以帮忙看看吗?谢谢

 

1、发布前打开用多久?

 

2、发布后打开用多久?

 

3、是在同一台电脑上打开运行的吗?数据库放在哪里?