Select Case e.DataCol.name
Case "牌号"
Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.NewVAlue & "'")
If dr IsNot Nothing Then
e.DataRow("原料指标_MgO镁_厂标") = dr("原料指标_MgO镁")
e.DataRow("原料指标_SiO2硅_厂标") = dr("原料指标_SiO2硅")
' e.DataRow("硅_厂标") = dr("硅")
' e.DataRow("钙_厂标") = dr("钙")
Else
e.DataRow("原料指标_MgO镁_厂标") = Nothing
e.DataRow("原料指标_SiO2硅_厂标") = Nothing
' e.DataRow("硅_厂标") = Nothing
' e.DataRow("钙_厂标") = Nothing
End If
Case "原料指标_MgO镁_实测","原料指标_SiO2硅_实测"
Dim dr As DataRow = DataTables("理化厂标").Find("牌号 = '" & e.DataRow("牌号") & "'")
If dr IsNot Nothing AndAlso e.newvalue Then
Dim nm As String = e.DataCol.Name
nm = nm.SubString(0,nm.LastIndexOf("_"))
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
[此贴子已经被作者于2011-10-29 19:51:49编辑过]