Foxtable(狐表)用户栏目专家坐堂 → 提交条件与提交后隐藏成功提交的相关行


  共有2140人关注过本帖树形打印复制链接

主题:提交条件与提交后隐藏成功提交的相关行

帅哥哟,离线,有人找我吗?
大红袍
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 15:28:00 [显示全部帖子]

Dim Filter1 = "[订单编号] = '" & r("订单编号") & "'"
Dim dr1 As DataRow = DataTables("配载订单").sqlFind(filter1)

Dim Filter2 = "[项目] = '" & r("项目") & "'"
Dim dr2 As DataRow = DataTables("项目信息").sqlFind(filter2)

If dr1 Is Nothing AndAlso dr2 IsNot Nothing Then
    ls.Add(r)
    count += 1
End If


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 16:07:00 [显示全部帖子]

remove掉

 

r.Remove()

 

http://www.foxtable.com/help/topics/2736.htm

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 16:33:00 [显示全部帖子]

写在这里,这里就是所有要新增的行啊。

 

For Each r As Row In ls


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 17:12:00 [显示全部帖子]

这段,不用写,删除

 

For Each key As DataRow In dic.Keys
    Dim r As Row = dic(key)
    Dim dr As DataRow = key
    For i As Integer = 0 To Cols1.Length -1
        If r.IsNull(Cols1(i)) Then
            dr(Cols2(i)) = Nothing
        Else
            dr(Cols2(i)) = r(Cols1(i))
        End If
    Next

Next


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 17:24:00 [显示全部帖子]

上传具体例子

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 17:45:00 [显示全部帖子]

Dim Cols1() As String = {"项目","下单日期","MK号","DO号","城市","客户","送货地址","物料代码","数量","体积","重量","承运商","司机","车牌","车数","车型","出车日期","车辆属性","备注","特殊要求","司机是否报销搬运费","跟车搬运","人数","订单编号"}
Dim Cols2() As String = {"项目","下单日期","MK号","DO号","城市","客户","送货地址","物料代码","数量","体积","重量","承运商","司机","车牌","车数","车型","出车日期","车辆属性","备注","特殊要求","司机是否报销搬运费","跟车搬运","人数","订单编号"}
Dim count As Integer = 0
Dim ls As new List(of Row)
Dim dic As new Dictionary (Of DataRow, Row)
systemready = False
For Each r As Row In Tables("订单").GetCheckedRows
    If r.IsNull("订单编号") = False
        Dim Filter1 = "[订单编号] = '" & r("订单编号") & "'"
        Dim dr1 As DataRow = DataTables("配载订单").sqlFind(filter1)
        Dim Filter2 = "[项目] = '" & r("项目") & "'"
        Dim dr2 As DataRow = DataTables("项目信息").sqlFind(filter2)
        If dr1 Is Nothing AndAlso dr2 IsNot Nothing Then
            ls.Add(r)
            count += 1
        End If
    End If
Next

Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
If ls.count > 0 Then
    p.Visible = True
    p.Maximum =  ls.Count - 1 '设置最大值
    p.Minimum = 0 '设置最小值
    p.Value = 0 '设置当前值
End If
Dim idx As Integer = 0
DataTables("订单").StopRedraw
For Each r As Row In ls
    Dim dr As DataRow = DataTables("配载订单").AddNew
    For i As Integer = 0 To Cols1.Length -1
        If r.IsNull(Cols1(i)) Then
            dr(Cols2(i)) = Nothing
        Else
            dr(Cols2(i)) = r(Cols1(i))
        End If
    Next
    idx += 1
    p.Value = idx
    r.Remove()
Next
DataTables("订单").ResumeRedraw
p.Visible = False
systemready = True
msgbox("共有 "& count &" 条数据提交" )
Tables("订单").save
Tables("订单").ClearCheckedRows


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/12/29 18:15:00 [显示全部帖子]

测试没问题,不会重复导入。或者你最后加一句代码

 

DataTables("配载订单").Save


 回到顶部