Else e.DataRow.save Dim bh As String = "RWSQ" & Format(e.DataRow("下达日期"),"yyMMdd") ' 取得编号的8位前缀 If e.DataRow("任务编码").StartsWith(bh) = False '如果编号的前8位不符 Dim dt2 As DataTable = DataTables("总任务库") Dim max As String Dim idx As Integer max = Tables("总任务库").DataTable.SQLCompute("Max(任务编码)","下达日期 = '" & e.DataRow("下达日期") & "' And [_Identify] <> " & e.DataRow("_Identify") & "
and 任务编码 like 'RWSQ%'") '取得该天的最大编号 If max > "" Then '如果存在最大编号 idx = CInt(max.Substring(10,3)) + 1 '获得最大编号的后三位顺序号,并加1 Else idx = 1 '否则顺序号等于1 End If e.DataRow("任务编码") = bh & Format(idx,"000") e.DataRow.save End If End If
|