以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  图片列批量下载的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=179516)

--  作者:deliangzhaoe
--  发布时间:2022/8/27 16:17:00
--  图片列批量下载的问题
在打印隐患排查报告中设置了两个图片列:

图片点击可在新窗口打开查看此主题相关图片如下:1.jpg
图片点击可在新窗口打开查看
但在打印的时候,会出现图片列未加载上的情况。

图片点击可在新窗口打开查看此主题相关图片如下:2.jpg
图片点击可在新窗口打开查看
加了一个按钮,设置了如下代码:
Dim ftp As new ftpclient
ftp.host= "***"
ftp.Account = "***"
ftp.password = "***"
ftp.Port = "21"
ftp.UTF8 = False
Dim curtable As Table = CurrentTable
\'Dim cr As Row = curtable.Current
For Each dr As DataRow In DataTables("隐患排查整改报告").Select("[选择] = true")
    Dim 默认目录 As String  = "\\" & dr("企业名称") & "\\" & dr("年度") & "\\" & curtable.Name
    \'output.show(默认目录)
    If ftp.DirExists(默认目录) = False Then
        ftp.MakeDir("\\" & dr("企业名称"))
        ftp.MakeDir("\\" & dr("企业名称") & "\\" & dr("年度"))
        If ftp.MakeDir(默认目录) = False Then
            MessageBox.Show("创建目录失败")
            Return
        End If
    End If
    Dim path1 As String = ProjectPath & "RemoteFiles\\" & dr("企业名称") & "\\" & dr("年度") & "\\" & "隐患排查治理台账\\" & FileSys.GetName(dr("隐患照片"))
    ftp.Download(dr("隐患照片"), path1, True)
    Dim path2 As String = ProjectPath & "RemoteFiles\\" & dr("企业名称") & "\\" & dr("年度") & "\\" & "隐患排查治理台账\\" & FileSys.GetName(dr("验证照片"))
    ftp.Download(dr("验证照片"), path2, True)
Next
ftp.Close

现在存在的问题是:
报错:

图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20220827153726.jpg
图片点击可在新窗口打开查看


请老师帮忙看一下,代码如何修改?谢谢了!

--  作者:有点蓝
--  发布时间:2022/8/27 16:30:00
--  
Dim ftp As New ftpclient
ftp.host = "***"
ftp.Account = "***"
ftp.password = "***"
ftp.Port = "21"
ftp.UTF8 = False

Dim 默认目录 As String = ProjectPath & "RemoteFiles\\" & dr("企业名称") & "\\" & dr("年度") & "\\隐患排查治理台账\\"
If FileSys.DirectoryExists(默认目录) = False Then
    If FileSys.CreateDirectory(默认目录) = False;se Then
        MessageBox.Show("创建目录失败")
        Return
    End If 
End If 
For Each dr As DataRow In DataTables("隐患排查整改报告").Select("[选择] = true")
    Dim path1 As String = 默认目录 & FileSys.GetName(dr("隐患照片"))
    ftp.Download(dr("隐患照片"), path1, True)
    Dim path2 As String = 默认目录 & FileSys.GetName(dr("验证照片"))
    ftp.Download(dr("验证照片"), path2, True)
Next
ftp.Close


--  作者:deliangzhaoe
--  发布时间:2022/8/27 20:13:00
--  
报了个错;

图片点击可在新窗口打开查看此主题相关图片如下:微信截图_20220827201216.jpg
图片点击可在新窗口打开查看


--  作者:deliangzhaoe
--  发布时间:2022/8/28 9:36:00
--  
自己改了一下,麻烦蓝老师看一下,有没有问题:
Dim ftp As New ftpclient
ftp.host = "**"
ftp.Account = "***"
ftp.password = "***"
ftp.Port = "21"
ftp.UTF8 = False
For Each dr As DataRow In DataTables("隐患排查整改报告").Select("[选择] = true")
    Dim 默认目录 As String = ProjectPath & "RemoteFiles\\" & dr("企业名称") & "\\" & dr("年度") & "\\隐患排查治理台账\\"
    If FileSys.DirectoryExists(默认目录) = False Then
        FileSys.CreateDirectory(默认目录)
    End If
    If dr.isnull("隐患照片") Then
        MessageBox.Show("    部分行缺少隐患照片,请先上传隐患照片!")
        Return
    Else
        Dim path1 As String = 默认目录 & FileSys.GetName(dr("隐患照片"))
        ftp.Download(dr("隐患照片"), path1, True)
    End If
    If dr.isnull("验证照片") Then
        MessageBox.Show("    部分行缺少验证照片,请先上传验证照片!")
        Return
    Else
        Dim path2 As String = 默认目录 & FileSys.GetName(dr("验证照片"))
        ftp.Download(dr("验证照片"), path2, True)
    End If
Next
ftp.Close

[此贴子已经被作者于2022/8/28 9:38:43编辑过]

--  作者:有点蓝
--  发布时间:2022/8/28 20:21:00
--  
if DataTables("隐患排查整改报告").compute("count(选择)",[选择] = true and (隐患照片 is null or 验证照片 is null)") > 0 then
        MessageBox.Show("    部分行缺少隐患照片或者验证照片,请先上传照片!")
        Return
end if

Dim ftp As New ftpclient
ftp.host = "**"
ftp.Account = "***"
ftp.password = "***"
ftp.Port = "21"
ftp.UTF8 = False
For Each dr As DataRow In DataTables("隐患排查整改报告").Select("[选择] = true")
    Dim 默认目录 As String = ProjectPath & "RemoteFiles\\" & dr("企业名称") & "\\" & dr("年度") & "\\隐患排查治理台账\\"
    If FileSys.DirectoryExists(默认目录) = False Then
        FileSys.CreateDirectory(默认目录)
    End If
        Dim path1 As String = 默认目录 & FileSys.GetName(dr("隐患照片"))
        ftp.Download(dr("隐患照片"), path1, True)
        Dim path2 As String = 默认目录 & FileSys.GetName(dr("验证照片"))
        ftp.Download(dr("验证照片"), path2, True)
Next
ftp.Close