If e.DataCol.Name = "产品名称" Then If e.DataRow.IsNull("产品名称") Then e.DataRow("产品编码") = Nothing Else e.DataRow("产品编码") = GetPinyin(e.DataRow("产品名称"), 1) End If Dim bh As String = e.DataRow("产品编码") & Format(e.DataRow("订货日期"),"yyyyMMdd") If e.DataRow("订单编码").StartsWith(bh) = True Dim max As String Dim idx As Integer max = e.DataTable.Compute("Max(订单编码)","产品名称 = '" & e.DataRow("产品名称") & "' and 订货日期= #" & e.DataRow("订货日期") & "# And [_Identify] <> " & e.DataRow("_Identify")) If max > "" Then idx = CInt(max.Substring(bh.length+1,3)) + 1 Else idx = 1 e.DataRow("订单编码") = bh & "-" & Format(idx,"000") End If End If End If
|