Select e.DataCol.Name
Case "人员归属"
If e.DataRow.IsNull("人员归属") Then
e.DataRow("人员归属") = Nothing
Else
Dim lb As String = e.DataRow("人员归属")
If lb = "编制人员" Then
lb = "1"
ElseIf lb = "退休职工" Then
lb = "2"
ElseIf lb = "临聘员工" Then
lb = "3"
ElseIf lb = "亡故人员" Then
lb = "4"
End If
If e.DataRow("档案号").StartsWith(lb) = False Then'如果单据编号前缀不符
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(档案号)", "档案号 like '" & lb & "%' And [_Identify] <> " & e.DataRow("_Identify")) '取得该类别的最大编号
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(lb.length)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("档案号") = lb & Format(idx, "0000")
End If
End If
End Select
要求增加:查重、补漏