Foxtable(狐表)用户栏目专家坐堂 → 编码?


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

主题:编码?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/10/17 21:01:00 [显示全部帖子]

Select Case e.DataCol.name
    Case "日期", "客户编码"
        If e.DataRow("日期") = Nothing OrElse e.DataRow("客户编码") = Nothing Then
            e.DataRow("出库单序码") = Nothing
        Else
            Dim fdr As DataRow = e.DataTable.find("日期 = #" & e.DataRow("日期") & "# and 客户编码 ='" & e.DataRow("客户编码") & "' and 出库单序码 Is not null")
            If fdr IsNot Nothing Then
                e.DataRow("出库单序码") = fdr("出库单序码")
            Else
                Dim bh As String = Format(e.DataRow("日期"),"yyyyMMdd") & "-" & e.DataRow("客户编码") & "-" '取得编号的8位前缀
                If e.DataRow("出库单序码").StartsWith(bh) = False '如果编号的前8位不符
                    Dim max As String
                    Dim idx As Integer = 0
                    For Each dr As DataRow In e.DataTable.Select("出库单序码 is not null and 日期 = #" & e.DataRow("日期") & "# And [_Identify] <> " & e.DataRow("_Identify"))
                        If right(dr("出库单序码"), 3) > idx Then
                            idx = right(dr("出库单序码"), 3)
                        End If
                    Next
                    idx += 1
                    e.DataRow("出库单序码") = bh & Format(idx,"000")
                End If
            End If
        End If
End Select

 回到顶部