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
狐狸爸爸 这个代码会针对这样几种情况时行判断 首先是 N值--N值、〈N值、〉N值、≥N值、≤N值 这是现在的对N值的判断。
还有一种判断就是只针对N值 厂标里面只有数字,没有大于、小于等等的符号,当实测里面的数大于或小于厂标里面的数时用正负数体现,代码如何加进去