Foxtable(狐表)用户栏目专家坐堂 → [求助]自动编号问题


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

主题:[求助]自动编号问题

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/3/7 14:13:00 [显示全部帖子]

Select e.DataCol.Name
    Case "面试室"
        If e.DataRow.IsNull("面试室") Then
            e.DataRow("抽签序号") = Nothing
        Else
            Dim mss() As String = {"面试室1","面试室2","面试室3"}
            Dim dms() As String = {"a","b","c"}
            Dim lb As String
            For i As Integer = 0  To mss.Length - 1
                If mss(i) = e.NewValue Then
                    lb = dms(i)
                    Exit For
                End If
            Next
            If lb > "" AndAlso e.DataRow("抽签序号").StartsWith(lb) = False '如果单据编号前缀不符
                Dim max As String
                Dim idx As Integer
                max = e.DataTable.Compute("Max(抽签序号)","面试室 = '" & e.NewValue & "'") '取得该类别的最大编号
                If max > "" Then '如果存在最大编号
                    idx = CInt(max.Substring(1,2)) + 1 '获得最大编号的后2位顺序号,并加1
                Else
                    idx = 1 '否则顺序号等于1
                End If
                e.DataRow("抽签序号") = lb & Format(idx,"00")
            End If
        End If
End Select


 回到顶部