Dim max As String
max = DataTables("机器入库").Compute("Max(批次)", "Year(采购日期)=#" & Year(e.DataRow("采购日期")) & "# And 机器孔数='" & e.DataRow("机器孔数") & "'")
Output.Show(max)
请老师指教
老师提示错误
Se lect e.DataCol.Name
Case "采购日期", "机器孔数"
If e.DataRow.IsNull("采购日期") OrElse e.DataRow.IsNull("机器孔数") Then
e.DataRow("批次") = Nothing
Else
Dim bh As String = Format(e.DataRow("采购日期"), "yyyy") & "-" & e.DataRow("机器孔数") & "-"
If e.DataRow("批次").StartsWith(bh) = False Then
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(批次)", "Year(采购日期)=" & e.DataRow("采购日期").year & " And 机器孔数='" & e.DataRow("机器孔数") & "'And [_Identify] <> " & e.DataRow("_Identify"))
If max > "" Then
idx = CInt(max.Substring(8, 2)) + 1
Else
idx = 1
End If
e.DataRow("批次") = bh & Format(idx, "00")
End If
End If
End Select