Select e.DataCol.Name Case "监造流水号" If e.DataRow.IsNull("监造流水号") Then e.DataRow("周报编号") = Nothing Else Dim lb As String = e.DataRow("监造流水号") '生成编号的前缀 Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(周报编号)","监造流水号 = '" & lb & "' And [_Identify] <> " & e.DataRow("_Identify")) '取得该类别的最大编号 If max > "" Then '如果存在最大编号 idx = CInt(max.Substring(lb.Length+1,3)) + 1 '获得最大编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("周报编号") = lb & "-" & Format(idx,"000") End If End Select
|