Foxtable(狐表)用户栏目专家坐堂 → [求助]经过一系列代码之后代码把打印指向了datatable的行,如何让其指向当前table的当前行?


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

主题:[求助]经过一系列代码之后代码把打印指向了datatable的行,如何让其指向当前table的当前行?

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


加好友 发短信
等级:幼狐 帖子:178 积分:1228 威望:0 精华:0 注册:2014/1/23 0:48:00
[求助]经过一系列代码之后代码把打印指向了datatable的行,如何让其指向当前table的当前行?  发帖心情 Post By:2014/3/12 20:09:00 [只看该作者]

如题。。打印出来是datatable的当前行。不是table的当前行。困惑中~ 各位大侠帮帮忙,小弟拜谢~ 通常是什么原因导致这样? 难道因为用datatable的find之行之后的结果?但是后来又把table的position修正过来呢。

 完整代码,各位老师帮忙看看。。到底为什么打印到了datatable去了。。困惑呢。

 

Dim txt As String = e.Form.controls("cxtextbox").text '查询
Dim dr As DataRow
dr = DataTables("小包发货单").Find(" [订单子编号] = '" & txt & "'" )

If e.Form.controls("cxtextbox").text = "" OrElse dr Is Nothing Then '没结果,窗口所有空间都锁定
    Tables("查询_Table1").Filter = " 1 = 2 "
    e.Form.controls("cxtextbox").Select()
Else If dr IsNot Nothing Then '如果找到该行
    Tables("查询_Table1").Filter = ""
    Dim wz As Integer = Tables("查询_Table1").FindRow(dr) '查找该行在table中的行号
    If wz >= 0 Then
        Tables("查询_Table1").Position = wz
        Tables("查询_Table1").Filter = " 订单编号 = '" & e.Form.Controls("ddbhTextBox").Text & "'"
        Dim r As Integer
        r = Tables("查询_Table1").FindRow("[订单子编号] ='" & txt & "'" ) '从第一行开始查找
        If r >= 0 Then '如果找到的话
            Tables("查询_Table1").Position = r '定位到找到的行
           
            Dim sl As String = e.Form.controls("sltextbox").text '子单商品数量.
            If e.Form.controls("cjdsltextbox").text = "" Then
                If sl = "1" Then
                    Tables("查询_Table1").Current("采集到数量") = sl
                    Dim cjdsl As String = e.Form.controls("cjdsltextbox").text
                    Tables("查询_Table1").Current("缺货数量") = val(sl) - val(cjdsl)
                    Tables("查询_Table1").Current("退货数量") = "0"
                    Tables("查询_Table1").Current("入库数量") = sl
                    Tables("查询_Table1").Current("拣货状态") = "已入库"
                   
                    Dim Sum As Integer
                    Dim sum1 As Integer
                    Sum = Tables("查询_Table1").Compute("Sum(数量)")
                    Sum1 = Tables("查询_Table1").Compute("Sum(入库数量)",  " 拣货状态 = '已入库' or 拣货状态 = '数量不够'")
                    If sum1 = sum Then
                        Dim Result As DialogResult
                        Result = messagebox.show("货已经全齐,请打印地址标签/快递单并发货?","发货信息提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                        If Result = DialogResult.OK Then                                                       
                            Dim Book As New XLS.Book(ProjectPath & "Attachments\小包发货单.xls")
                            Dim fl As String = ProjectPath & "Reports\小包发货单.xls"
                            Book.Build()
                            Book.Save(fl)
                            Dim Proc As New Process
                            Proc.File = fl
                            'Proc.Verb = "Print" '指定动作
                            Proc.Start()
                            For Each r1 As Row In Tables("查询_Table1").Rows
                                r1("地址标签") = True
                                r1("拣货状态") = "待发货"
                                r1("仓位信息") = "已出库"
                            Next
                        End If
                    Else If sum1 <> sum Then
                        Dim ddbh As String = e.Form.controls("ddbhtextbox").text '订单编号
                        Dim dr2 As DataRow
                        dr2 = DataTables("小包发货单").Find(" [订单编号] = '" & ddbh & "' And  [拣货状态] = '采集中'" )
                       
                        If dr2 Is Nothing Then
                            Dim n As Integer = sum - sum1
                            messagebox.show("该订单采集完毕!缺" & n & "件! 请更在网站更改订单状态通知客户!")
                        Else If dr2 IsNot Nothing Then
                            Return
                        End If
                    End If
                   
                   
                Else If sl > "1" Then
                    Dim Result1 As DialogResult
                    Result1 = messagebox.show("是否" & "'" & sl & "'" & "件都齐了?", "入库提示",MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    If Result1 = DialogResult.Yes Then
                        Tables("查询_Table1").Current("采集到数量") = sl
                        Dim cjdsl As String = e.Form.controls("cjdsltextbox").text
                        Tables("查询_Table1").Current("缺货数量") = val(sl) - val(cjdsl)
                        Tables("查询_Table1").Current("退货数量") = "0"
                        Tables("查询_Table1").Current("入库数量") = sl
                        Tables("查询_Table1").Current("拣货状态") = "已入库"
                        Dim Sum As Integer
                        Dim sum1 As Integer
                        Sum = Tables("查询_Table1").Compute("Sum(数量)")
                        Sum1 = Tables("查询_Table1").Compute("Sum(入库数量)",  " 拣货状态 = '已入库' or 拣货状态 = '数量不够'")
                        If sum1 = sum Then
                            Dim Result As DialogResult
                            Result = messagebox.show("货已经全齐,请打印地址标签/快递单并发货?","发货信息提示", MessageBoxButtons.OK, MessageBoxIcon.Question)
                            If Result = DialogResult.OK Then
                                Dim Book As New XLS.Book(ProjectPath & "Attachments\小包发货单.xls")
                                Dim fl As String = ProjectPath & "Reports\小包发货单.xls"
                                Book.Build()
                                Book.Save(fl)
                                Dim Proc As New Process
                                Proc.File = fl
                                'Proc.Verb = "Print" '指定动作
                                Proc.Start()
                                For Each r1 As Row In Tables("查询_Table1").Rows
                                    r1("地址标签") = True
                                    r1("拣货状态") = "待发货"
                                    r1("仓位信息") = "已出库"
                                Next
                               
                            End If
                        Else If sum1 <> sum Then
                            Dim ddbh As String = e.Form.controls("ddbhtextbox").text '订单编号
                            Dim dr2 As DataRow
                            dr2 = DataTables("小包发货单").Find(" [订单编号] = '" & ddbh & "' And  [拣货状态] = '采集中'" )                           
                            If dr2 Is Nothing Then
                                Dim n As Integer = sum - sum1
                                messagebox.show("该订单采集完毕!缺" & n & "件! 请更在网站更改订单状态通知客户!")
                            Else If dr2 IsNot Nothing Then
                                Return
                            End If
                        End If
                       
                       
                    Else If Result1 = DialogResult.No Then
                        e.Form.controls("cjdsltextbox").Select()
                        Messagebox.show("请输入采集到实际数量!")
                    End If
                End If
            Else If e.Form.controls("cjdsltextbox").text <> ""  Then
                Return
            End If
           
        End If
    End If
End If

[此贴子已经被作者于2014-3-12 20:23:12编辑过]

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


加好友 发短信
等级:版主 帖子:5246 积分:33163 威望:0 精华:8 注册:2013/1/17 21:28:00
  发帖心情 Post By:2014/3/12 21:02:00 [只看该作者]

代码多,又没例子,没法测试。

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


加好友 发短信
等级:幼狐 帖子:178 积分:1228 威望:0 精华:0 注册:2014/1/23 0:48:00
  发帖心情 Post By:2014/3/12 22:32:00 [只看该作者]

代码虽多,层次分明啊。应该是最初的寻找dr的时候把打印指向datatable。因为print进程是在条件里面,我只是不知道如何指定要打印的行。

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


加好友 发短信
等级:幼狐 帖子:178 积分:1228 威望:0 精华:0 注册:2014/1/23 0:48:00
  发帖心情 Post By:2014/3/12 23:49:00 [只看该作者]

原来原因不在于有没有绑定table,而是用position定位之后没有生效,要点击table里的当前行才能打印当前行的内容。。请问如何选中position所在的行啊?

[此贴子已经被作者于2014-3-13 0:52:49编辑过]

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


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2014/3/13 8:43:00 [只看该作者]

代码多,又没例子,没法测试分析.

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2014/3/13 17:56:00 [只看该作者]

楼主,DataTable怎么会存在当前行呢? 只有Table才有当前行之说。

也许你定义细节区的时候,并非是根据“查询_Table1"定义的。

修改模版的定义,或者看看:

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

 


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


加好友 发短信
等级:幼狐 帖子:178 积分:1228 威望:0 精华:0 注册:2014/1/23 0:48:00
  发帖心情 Post By:2014/3/13 18:31:00 [只看该作者]

狐爸,谢谢你~ 结症就在这里了。解决了~


 回到顶部