以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  FTP自动下载报错  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=175319)

--  作者:cd_tdh
--  发布时间:2022/3/1 9:27:00
--  FTP自动下载报错

老师,我表中有三列是图片列,属性是自动下载,当快速切换不同行时,FTP的图片附件没下载完成就会报错,之前提了类似问题没解决好。

原贴地址:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=162824

[此贴子已经被作者于2022/3/1 9:27:27编辑过]

--  作者:有点蓝
--  发布时间:2022/3/1 9:53:00
--  
我使用阿里云的ftp测试,同样添加了3个图片列,在列窗口,和添加了一个窗口绑定3个图片浏览器控件,测试快速点击切换不同的行,测试没有问题。我把\\RemoteFiles里的图片都删除掉,再测试也没有问题。

您的项目应该还有其它什么代码影响了,做个例子发上来测试

--  作者:cd_tdh
--  发布时间:2022/3/1 10:18:00
--  

我查看了所有代码,有可能出现问题的地方有3个:

1、全局表事件:CurrentChanged

Select Case e.Table.Name
    Case  "主窗口_Table1","主窗口_Table2"
        Tables("主窗口_Table1").Grid.ScrollBars = 0 \'0 无 1 横向 2 纵向 3 横向纵向
        Tables("主窗口_Table2").Grid.ScrollBars = 0 \'0 无 1 横向 2 纵向 3 横向纵向
    Case Else \'其他所有表显示纵横向滚动条
        For Each t As Table In Tables
            t.Grid.ScrollBars = 3 \'0 无 1 横向 2 纵向 3 横向纵向
            t.Grid.ScrollOptions = 1
            \'t.Grid.Styles.EmptyArea.Border.Style = 0        \'去表格边框
            \'t.Grid.Styles.EmptyArea.backcolor = color.white \'空白区白色背景
        Next
End Select

2、项目事件:ystemIdle

Dim str2 As String = "                                                                                                                          屏幕最佳显示分辨率:1920*1080"
StatusBar.Message2 = str2
\'自动计算
Dim str1 As String = ""
Dim t As Table = CurrentTable
If t.Name <> "主窗口_Table1" AndAlso t.Name <> "主窗口_Table2" Then
    Str1 = Str1 & "计数:" & t.Aggregate(AggregateEnum.Count, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & ""
    Str1 = Str1 & "  累计:" & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & ""
    Str1 = Str1 & "  平均:" & t.Aggregate(AggregateEnum.Average, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & ""
    \'Str1 = Str1 & "  最大:" & t.Aggregate(AggregateEnum.Max, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    \'Str1 = Str1 & "  最小:" & t.Aggregate(AggregateEnum.Min, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    \'Str1 = Str1 & "标准差:" & t.Aggregate(AggregateEnum.Std, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    \'Str1 = Str1 & "总体标准差:" & t.Aggregate(AggregateEnum.StdPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    \'Str1 = Str1 & "方差:" & t.Aggregate(AggregateEnum.Var, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
    \'Str1 = Str1 & "总体方差:" & t.Aggregate(AggregateEnum.VarPop, t.TopRow, t.LeftCol, t.BottomRow, t.RightCol) & " "
End If
StatusBar.Message3 = Str1

3、当前表的CellButtonClick事件

e.cancel = True
Select  Case e.Col.Name
    Case  "中标通知书"
        Dim dlg As New openFileDialog \'定义一个新的SaveFileDialog
        dlg.MultiSelect = True
        If dlg.showDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
            Dim ftp1 As new  ftpclient
            ftp1.host="*********"
            ftp1.Account = "*******1"
            ftp1.password = "1*****19"
            Dim r As Row = Tables("业绩管理").Current
            Dim ls = r.DataRow.Lines("中标通知书")
            For Each f As String In dlg.FileNames
                Dim file = "/公司业绩/" & r("项目名称") & "/" & filesys.GetName(f)
                If ftp1.DirExists("/公司业绩/" & r("项目名称")) = False Then
                    ftp1.MakeDir("/公司业绩/" & r("项目名称"))
                End If
                Dim Result As DialogResult
                If ftp1.FileExists(file) Then
                    Result = MessageBox.Show("文件已经存在,是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                End If
                If result = Nothing OrElse result = DialogResult.Yes Then
                    If  ftp1.Upload(f,file,True) = True Then
                        If ls.contains(file) = False Then
                            ls.add(file)
                        End If
                    Else
                        MessageBox.Show( f & "上传失败" ,"提示" ,MessageBoxButtons.OK,MessageBoxIcon.Question)
                    End If
                End If
            Next
            r.DataRow.lines("中标通知书") = ls
            ftp1.Close
            r.save
        End If
End Select
Select  Case e.Col.Name
    Case  "合同协议书"
        Dim dlg As New openFileDialog \'定义一个新的SaveFileDialog
        dlg.MultiSelect = True
        If dlg.showDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
            Dim ftp1 As new  ftpclient
            ftp1.host="*****0"
            ftp1.Account = "ft****"
            ftp1.password = "1*******9"
            Dim r As Row = Tables("业绩管理").Current
            Dim ls = r.DataRow.Lines("合同协议书")
            For Each f As String In dlg.FileNames
                Dim file = "/公司业绩/" & r("项目名称") & "/" & filesys.GetName(f)
                If ftp1.DirExists("/公司业绩/" & r("项目名称")) = False Then
                    ftp1.MakeDir("/公司业绩/" & r("项目名称"))
                End If
                Dim Result As DialogResult
                If ftp1.FileExists(file) Then
                    Result = MessageBox.Show("文件已经存在,是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                End If
                If result = Nothing OrElse result = DialogResult.Yes Then
                    If  ftp1.Upload(f,file,True) = True Then
                        If ls.contains(file) = False Then
                            ls.add(file)
                        End If
                    Else
                        MessageBox.Show( f & "上传失败" ,"提示" ,MessageBoxButtons.OK,MessageBoxIcon.Question)
                    End If
                End If
            Next
            r.DataRow.lines("合同协议书") = ls
            ftp1.Close
            r.save
        End If
End Select
Select  Case e.Col.Name
    Case  "竣工验收报告"
        Dim dlg As New openFileDialog \'定义一个新的SaveFileDialog
        dlg.MultiSelect = True
        If dlg.showDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
            Dim ftp1 As new  ftpclient
            ftp1.host="****0"
            ftp1.Account = "f*1"
            ftp1.password = "19***9"
            Dim r As Row = Tables("业绩管理").Current
            Dim ls = r.DataRow.Lines("竣工验收报告")
            For Each f As String In dlg.FileNames
                Dim file = "/公司业绩/" & r("项目名称") & "/" & filesys.GetName(f)
                If ftp1.DirExists("/公司业绩/" & r("项目名称")) = False Then
                    ftp1.MakeDir("/公司业绩/" & r("项目名称"))
                End If
                Dim Result As DialogResult
                If ftp1.FileExists(file) Then
                    Result = MessageBox.Show("文件已经存在,是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                End If
                If result = Nothing OrElse result = DialogResult.Yes Then
                    If  ftp1.Upload(f,file,True) = True Then
                        If ls.contains(file) = False Then
                            ls.add(file)
                        End If
                    Else
                        MessageBox.Show( f & "上传失败" ,"提示" ,MessageBoxButtons.OK,MessageBoxIcon.Question)
                    End If
                End If
            Next
            r.DataRow.lines("竣工验收报告") = ls
            ftp1.Close
            r.save
        End If
End Select


--  作者:cd_tdh
--  发布时间:2022/3/1 10:24:00
--  
测试,应该是因为问题1 的原因造成的,问题1代码注释后就没问题了
--  作者:有点蓝
--  发布时间:2022/3/1 10:46:00
--  
全局表事件:CurrentChanged为什么要控制其它的表,正常控制触发事件的表就可以了吧。特别是Case Else,任何一个表选择不同的行都要改所有表的设置,有这个必要吗。再说这种设置只需要设置一次可以了吧,每改变不同的行都要设置一次?

Select Case e.Table.Name
    Case  "主窗口_Table1","主窗口_Table2"
        e.Table.Grid.ScrollBars = 0 \'0 无 1 横向 2 纵向 3 横向纵向
    Case Else \'其他所有表显示纵横向滚动条
            e.Table.Grid.ScrollBars = 3 \'0 无 1 横向 2 纵向 3 横向纵向
            e.Table.Grid.ScrollOptions = 1
End Select

--  作者:cd_tdh
--  发布时间:2022/3/1 11:01:00
--  

以上3个问题代码都注释掉,快速换行还是有问题,调试加上msgbox有个关闭弹窗的时间问题,就不会出问题。

所有表都测试,就这个表用鼠标点击不同的行,明显比其他表反应慢,找不到问题了。

[此贴子已经被作者于2022/3/1 11:01:40编辑过]

--  作者:cd_tdh
--  发布时间:2022/3/1 11:47:00
--  
我把文件发给客服测试了一下,也说没问题,估计电脑配置也有影响
--  作者:有点蓝
--  发布时间:2022/3/1 11:52:00
--  
估计是项目里某些用法有问题