If e.DataCol.Name = "订单明细编号" Then Dim r As Row = Tables("订单管理_table1").current If r Is Nothing OrElse r.Isnull("订单编号") = True Then output.show(1) e.DataRow("订单明细编号") = Nothing Else Dim lb As String = r("订单编号") & "-" output.show(2) If e.DataRow("订单明细编号").StartsWith(lb) = False Then '如果单据编号前缀不符 Dim max As String Dim idx As Integer max = e.DataTable.sqlCompute("Max(订单明细编号)","订单明细编号 like '" & r("订单编号") & "%' And [_Identify] <> " & e.DataRow("_Identify")) '取得该类别的最大编号 If max > "" Then '如果存在最大编号 output.show(3) idx = CInt(max.Substring(lb.length,2)) + 1 '获得最大编号的后两位顺序号,并加1 Else output.show(4) idx = 1 '否则顺序号等于1 End If e.DataRow("订单明细编号") = lb & Format(idx,"00") e.DataRow.Save End If End If End If
看看哪里停住了。。。。就找哪里
|