Select Case e.DataCol.name
Case "材质"
Dim dr As DataRow = DataTables("厂标").Find("材质 = '" & e.NewVAlue & "'")
If dr IsNot Nothing Then
e.DataRow("镁_厂标") = dr("镁")
e.DataRow("铁_厂标") = dr("铁")
e.DataRow("硅_厂标") = dr("硅")
e.DataRow("钙_厂标") = dr("钙")
Else
e.DataRow("镁_厂标") = Nothing
e.DataRow("铁_厂标") = Nothing
e.DataRow("硅_厂标") = Nothing
e.DataRow("钙_厂标") = Nothing
End If
Case "镁_实测","硅_实测","钙_实测","铁_实测"
Dim dr As DataRow = DataTables("厂标").Find("材质 = '" & e.DataRow("材质") & "'")
If dr IsNot Nothing AndAlso e.newvalue Then
Dim nm As String = e.DataCol.Name.SubString(0,1)
Dim ov As String = dr(nm)
If ov.IndexOf("-") > 0 Then
Dim vls() As String = ov.split("-")
Dim v1 As Double = vls(0)
Dim v2 As Double = vls(1)
If e.newvalue >= v1 AndAlso e.newvalue <= v2 Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
ElseIf e.newvalue < v1 Then
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v1
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v2
End If
Else
Dim o As String = ov.SubString(0,1)
Dim v As Double = val(ov.SubString(1))
If o = ">" Then
If e.NewValue > v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
End If
ElseIf o = "<"
If e.NewValue < v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v
End If
ElseIf o = "≥" Then
If e.NewValue >= v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = v - e.newvalue
End If
ElseIf o = "≤"
If e.NewValue <= v Then
e.DataRow(nm & "_" & "厂标" ) = "合格"
Else
e.DataRow(nm & "_" & "厂标" ) = e.newvalue - v
End If
End If
End If
End If
End Select