以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]增加行出现在第一行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=77995)

--  作者:huhu
--  发布时间:2015/11/30 11:38:00
--  [求助]增加行出现在第一行
增加行出现在第一行。
tables(“表A”).addnew()出现在第一行,光标定位到一个单元格怎么弄来着。
之前会做来着,现在忘了,

--  作者:大红袍
--  发布时间:2015/11/30 12:09:00
--  
Dim nr As Row = tables("表A").addnew()
nr.move(0)
nr.Table.Select(nr.Index, nr.Table.cols("第三列").index)

--  作者:huhu
--  发布时间:2015/12/1 11:02:00
--  
假如,输入的序列号SN在配货单存在3行,希望待入库也能自动增加3行。----这个如何能做到自动增加3行,且这3行的序列号都一致。
待入库的datacolchange代码如下
If e.DataCol.Name = "SN" Then
    Dim nms() As String = {"数量","物料编码","产品型号","类别","配货单号","工单号","订单号","预入库单号","生产完成日期","预计入库日期"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim dr As DataRow
        dr = DataTables("配货单").Find("[SN] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing
            If dr("提示") = "扫描完成" Then
                For Each nm As String In nms
                    e.DataRow(nm) = dr(nm)
                Next
                e.DataRow("提示") = "重复扫描"
                dr("提示") = "扫描完成"
            Else
                For Each nm As String In nms
                    e.DataRow(nm) = dr(nm)
                Next
                If e.DataRow("预入库单号") <> e.DataRow("入库单号")  Then
                    e.DataRow("提示") = "非本入库单物料"
                Else
                    e.DataRow("提示") = "扫描完成"
                    dr("提示") = "扫描完成"
                    e.DataRow("收货结束时间") = Date.now
                End If
            End If
        Else
            e.DataRow("提示") = "序列号不存在"
        End If
    End If
End If

--  作者:大红袍
--  发布时间:2015/12/1 11:04:00
--  

Dim drs As List(Of DataRow) = DataTables("配货单").Select("[SN] = \'" & e.NewValue & "\'")

For each dr As DataRow In drs

 

Next


--  作者:huhu
--  发布时间:2015/12/1 11:35:00
--  
If e.DataCol.Name = "SN" Then
    Dim nms() As String = {"数量","物料编码","产品型号","类别","配货单号","工单号","订单号","预入库单号","生产完成日期","预计入库日期"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim drs As List(Of DataRow) = DataTables("配货单").Select("[SN] = \'" & e.NewValue & "\'")
        If drs.Count > 0 Then
            For Each dr As DataRow In drs
                If dr("提示") = "扫描完成" Then
                    For Each nm As String In nms
                        e.DataRow(nm) = dr(nm)
                    Next
                    e.DataRow("提示") = "重复扫描"
                    dr("提示") = "扫描完成"
                Else
                    For Each nm As String In nms
                        e.DataRow(nm) = dr(nm)
                    Next
                    If e.DataRow("预入库单号") <> e.DataRow("入库单号")  Then
                        e.DataRow("提示") = "非本入库单物料"
                    Else
                        e.DataRow("提示") = "扫描完成"
                        dr("提示") = "扫描完成"
                        e.DataRow("收货结束时间") = Date.now
                    End If
                End If
            Next
        Else
            e.DataRow("提示") = "序列号不存在"
        End If
    End If
End If
这样不能实现自动增加3行数据的效果吧

--  作者:大红袍
--  发布时间:2015/12/1 11:38:00
--  

Dim drs As List(Of DataRow) = DataTables("配货单").Select("[SN] = \'" & e.NewValue & "\'")

SystermReady = False

For each dr As DataRow In drs

    Dim ndr As DataRow = e.DataTable.AddNew

   

Next

e.DataRow.Delete

SystemReady = True


--  作者:huhu
--  发布时间:2015/12/1 11:55:00
--  
If e.DataCol.Name = "SN" Then
    Dim nms() As String = {"数量","物料编码","产品型号","类别","配货单号","工单号","订单号","预入库单号","生产完成日期","预计入库日期"}
    If e.NewValue Is Nothing Then
        For Each nm As String In nms
            e.DataRow(nm) = Nothing
        Next
    Else
        Dim drs As List(Of DataRow) = DataTables("配货单").Select("[SN] = \'" & e.NewValue & "\'")
        If drs.Count > 0 Then
            SystemReady = False
            For Each dr As DataRow In drs
                Dim ndr As DataRow = e.DataTable.AddNew
                If dr("提示") = "扫描完成" Then
                    For Each nm As String In nms
                        e.DataRow(nm) = dr(nm)
                    Next
                    e.DataRow("提示") = "重复扫描"
                    dr("提示") = "扫描完成"
                Else
                    For Each nm As String In nms
                        e.DataRow(nm) = dr(nm)
                    Next
                    If e.DataRow("预入库单号") <> e.DataRow("入库单号")  Then
                        e.DataRow("提示") = "非本入库单物料"
                    Else
                        e.DataRow("提示") = "扫描完成"
                        dr("提示") = "扫描完成"
                        e.DataRow("收货结束时间") = Date.now
                    End If
                End If
            Next
            e.DataRow.Delete
            SystemReady = True
        Else
            e.DataRow("提示") = "序列号不存在"
        End If
    End If
End If
还是没有自动增加行

--  作者:大红袍
--  发布时间:2015/12/1 11:58:00
--  

          For Each dr As DataRow In drs

                Dim ndr As DataRow = e.DataTable.AddNew
                If dr("提示") = "扫描完成" Then
                    For Each nm As String In nms
                        ndr(nm) = dr(nm)
                    Next
                    ndr("提示") = "重复扫描"
                    dr("提示") = "扫描完成"
                Else
                    For Each nm As String In nms
                        ndr(nm) = dr(nm)
                    Next
                    If e.DataRow("预入库单号") <> e.DataRow("入库单号")  Then
                        ndr("提示") = "非本入库单物料"
                    Else
                        ndr("提示") = "扫描完成"
                        dr("提示") = "扫描完成"
                        ndr("收货结束时间") = Date.now
                    End If
                End If
            Next

--  作者:huhu
--  发布时间:2015/12/1 12:09:00
--  
要哭了,死活不能自动增加行啊。
--  作者:大红袍
--  发布时间:2015/12/1 12:11:00
--  
不可能啊,加入msgbox看进入了没有啊