Dim dr As Row = Tables("项目管理").Current
Dim Cols1() As String = {"产品系列","产品分类","产品名称","主材工艺" ,"备注"}
Dim Cols2() As String = {"产品系列","产品分类","产品名称","主材工艺" ,"备注"}
For Each dr1 As DataRow In DataTables("项目选型表").Select("[选择] = True ")
Dim dr2 As DataRow = DataTables("项目清单").AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
dr2("区域") = e.Form.Controls("ComboBox2").text
dr2("楼层") = e.Form.Controls("ComboBox1").text
dr2("客户ID") = dr("客户ID")
dr2("报价ID") = dr("报价ID")
dr2("客户") = dr("客户")
dr2("项目名称") = dr("客户") & "/"& dr("客户地址")
dr2("项目组") = dr("项目组")
Dim bh As String = "TQD" & Format(dr2("sys_日期"),"yyyyMMdd") '取得编号的8位前缀
If dr2("清单ID").StartsWith(bh) = False '如果编号的前8位不符
Dim max As String
Dim idx As Integer
max = dr2.Compute("Max(清单ID)","sys_日期 = #" & dr2("sys_日期") & "# And [_Identify] <> " & dr2("_Identify")) '取得该天的最大编号
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(12,5)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
dr2("清单ID") = bh & "-" & Format(idx,"00000")
End If
上面的自动编号功能不能工作,需要怎么调整呢
Next
'