Select e.DataCol.Name Case "拜访_类型","拜访_人员" If e.DataRow.IsNull("拜访_类型") OrElse e.DataRow.IsNull("拜访_人员") Then e.DataRow("编号") = Nothing Else Dim bfry As String = e.DataRow("拜访_人员") If e.DataRow("拜访_人员") = "汪晓光" Then bfry = "W" ElseIf e.DataRow("拜访_人员") = "张志斌" Then bfry = "B" ElseIf e.DataRow("拜访_人员") = "巩中桂" Then bfry = "G" ElseIf e.DataRow("拜访_人员") = "汪振学" Then bfry = "X" ElseIf e.DataRow("拜访_人员") = "周荣凯" Then bfry = "Z" ElseIf e.DataRow("拜访_人员") = "张良斌" Then bfry = "L" ElseIf e.DataRow("拜访_人员") = "吴小龙" Then bfry = "I" ElseIf e.DataRow("拜访_人员") = "刘杰" Then bfry = "J" Else bfry = "P" End If Dim bflx As String = e.DataRow("拜访_类型") If e.DataRow("拜访_类型") = "电话" Then bflx = "D" Else bflx = "Z" End If Dim bf As String = "BF" Dim d As Date = e.DataRow("拜访_日期") Dim bh As String = bf & Format(d,"yyMM") & bflx & bfry & "-" Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(编号)","编号 like '" & bh & "%'") If len(max) = 14 Then '如果存在最大编号 idx = CInt(max.Substring(bh.Length)) + 1 '获得最大编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("编号") = bh & Format(idx,"000") End If End Select
|