Select e.DataCol.Name Case "部门名称" If e.DataRow.IsNull("部门名称") Then e.DataRow("员工编号") = Nothing Else Dim dr As DataRow = DataTables("部门单位").find("部门='" & e.DataRow("部门名称") & "'") If dr IsNot Nothing Then Dim bh As String = dr("编号") 'If e.DataRow("员工编号").StartsWith(bh) = False '如果单据地块编号前缀不符 Dim max As String Dim idx As Integer max = e.DataTable.SQLCompute("Max(员工编号)","部门名称 = '" & bh & "' And [_Identify] <> " & e.DataRow("_Identify")) '取得该所属园区的最大地块编号 If max > "" Then '如果存在最大地块编号 idx = CInt(max.Substring(bh.Length,2)) + 1 '获得最大地块编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("员工编号") = bh & Format(idx,"00") e.DataRow.Save 'End If End If End If End Select
|